Re: [PATCH] staging: comedi: das1800: remove unused variable

2016-04-06 Thread Ian Abbott

On 06/04/16 02:21, Hartley Sweeten wrote:

On Tuesday, April 05, 2016 7:23 AM, Sudip Mukherjee wrote:

The variable unipolar was never used.

Signed-off-by: Sudip Mukherjee 
---

There may be a chance that reading from DAS1800_CONTROL_C is necessary
before reading from DAS1800_STATUS. If that is true then please discard
this patch.


Actually the driver has a bug here.

The analog input samples should  be munged if the inputs are configured for
bipolar mode.

I have a series almost ready that cleans up this driver and fixes the bug.


Hi Hartley, can the bug fix be placed at the top of your patch series? 
Thanks.


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


Re: [PATCH] staging: comedi: das1800: remove unused variable

2016-04-06 Thread Ian Abbott

On 06/04/16 10:41, Ian Abbott wrote:

On 06/04/16 02:21, Hartley Sweeten wrote:

On Tuesday, April 05, 2016 7:23 AM, Sudip Mukherjee wrote:

The variable unipolar was never used.

Signed-off-by: Sudip Mukherjee 
---

There may be a chance that reading from DAS1800_CONTROL_C is necessary
before reading from DAS1800_STATUS. If that is true then please discard
this patch.


Actually the driver has a bug here.

The analog input samples should  be munged if the inputs are
configured for
bipolar mode.

I have a series almost ready that cleans up this driver and fixes the
bug.


Hi Hartley, can the bug fix be placed at the top of your patch series?
Thanks.



The bug has been there forever (even in the "out-of-tree" version from 
comedi.org, where I have just fixed it). There have been patches applied 
to reformat and remove the incorrect bits of code, including 
a142785d7c9d ("Staging: comedi: das1800: fixed multiple brace coding 
style issues and pointer declaration style errors") and 82d28561b7e0 
("staging: comedi: Remove if condition.").  The latter patch, 
82d28561b7e0, mainly served to hide the bug further!


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


[PATCH] Fixes some checkpatch.pl warnings

2016-04-06 Thread Manav Batra
CHECK: Alignment should match open parenthesis
WARNING: line over 80 characters

Signed-off-by: Manav Batra 
---
 drivers/staging/rts5208/ms.c | 66 ++--
 1 file changed, 39 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 3e75db7..1314303 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -48,8 +48,8 @@ static int ms_parse_err_code(struct rtsx_chip *chip)
return STATUS_FAIL;
 }
 
-static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode,
-   u8 tpc, u8 cnt, u8 cfg)
+static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode, u8 tpc,
+  u8 cnt, u8 cfg)
 {
struct ms_info *ms_card = &chip->ms_card;
int retval;
@@ -63,12 +63,12 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 
trans_mode,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER,
-   0xFF, MS_TRANSFER_START | trans_mode);
+0xFF, MS_TRANSFER_START | trans_mode);
rtsx_add_cmd(chip, CHECK_REG_CMD, MS_TRANSFER,
-   MS_TRANSFER_END, MS_TRANSFER_END);
+MS_TRANSFER_END, MS_TRANSFER_END);
 
rtsx_add_cmd(chip, READ_REG_CMD, MS_TRANS_CFG, 0, 0);
 
@@ -109,8 +109,8 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 
trans_mode,
 }
 
 static int ms_transfer_data(struct rtsx_chip *chip, u8 trans_mode,
-   u8 tpc, u16 sec_cnt, u8 cfg, bool mode_2k,
-   int use_sg, void *buf, int buf_len)
+   u8 tpc, u16 sec_cnt, u8 cfg, bool mode_2k,
+   int use_sg, void *buf, int buf_len)
 {
int retval;
u8 val, err_code = 0;
@@ -206,7 +206,7 @@ static int ms_write_bytes(struct rtsx_chip *chip,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD,
 MS_TRANSFER, 0xFF, MS_TRANSFER_START | MS_TM_WRITE_BYTES);
@@ -253,7 +253,7 @@ static int ms_write_bytes(struct rtsx_chip *chip,
 }
 
 static int ms_read_bytes(struct rtsx_chip *chip,
-   u8 tpc, u8 cnt, u8 cfg, u8 *data, int data_len)
+u8 tpc, u8 cnt, u8 cfg, u8 *data, int data_len)
 {
struct ms_info *ms_card = &chip->ms_card;
int retval, i;
@@ -270,12 +270,12 @@ static int ms_read_bytes(struct rtsx_chip *chip,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER, 0xFF,
-   MS_TRANSFER_START | MS_TM_READ_BYTES);
+MS_TRANSFER_START | MS_TM_READ_BYTES);
rtsx_add_cmd(chip, CHECK_REG_CMD, MS_TRANSFER,
-   MS_TRANSFER_END, MS_TRANSFER_END);
+MS_TRANSFER_END, MS_TRANSFER_END);
 
for (i = 0; i < data_len - 1; i++)
rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + i, 0, 0);
@@ -284,7 +284,7 @@ static int ms_read_bytes(struct rtsx_chip *chip,
rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + data_len, 0, 0);
else
rtsx_add_cmd(chip, READ_REG_CMD, PPBUF_BASE2 + data_len - 1,
-   0, 0);
+0, 0);
 
retval = rtsx_send_cmd(chip, MS_CARD, 5000);
if (retval < 0) {
@@ -335,7 +335,8 @@ static int ms_read_bytes(struct rtsx_chip *chip,
 }
 
 static int ms_set_rw_reg_addr(struct rtsx_chip *chip,
-   u8 read_start, u8 read_cnt, u8 write_start, u8 write_cnt)
+ u8 read_start, u8 read_cnt, u8 write_start,
+ u8 write_cnt)
 {
int retval, i;
u8 data[4];
@@ -432,31 +433,36 @@ static int ms_pull_ctl_disable(struct rtsx_chip *chip)
 
if (CHECK_PID(chip, 0x5208)) {
retval = rtsx_write_register(chip, CARD_PULL_CTL1, 0xFF,
-MS_D1_PD | MS_D2_PD | MS_CLK_PD | 
MS_D6_PD);
+MS_D1_PD | MS_D2_PD | MS_CLK_PD |
+MS_D6_PD);
if (retval) {
rtsx_trace(chip);
return retval;
}

Re: [PATCH] staging: rts5208: ensure braces on all arms of if stmt

2016-04-06 Thread Dan Carpenter
On Tue, Apr 05, 2016 at 05:29:17PM +0100, Nicholas Sim wrote:
> Added braces on if arm of if statement where else arm already needs braces
> as suggested for clarity in Documentation/CodingStyle
> 
> Signed-off-by: Nicholas Sim 
> ---
>  drivers/staging/rts5208/ms.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
> index 3e75db7..2ad4ea0 100644
> --- a/drivers/staging/rts5208/ms.c
> +++ b/drivers/staging/rts5208/ms.c
> @@ -794,8 +794,9 @@ static int ms_confirm_cpu_startup(struct rtsx_chip *chip)
>   }
>  
>   if (val & INT_REG_ERR) {
> - if (val & INT_REG_CMDNK)
> + if (val & INT_REG_CMDNK) {
>   chip->card_wp |= (MS_CARD);
> + }
>   else {

It should be } else { on one line.

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


[PATCH] staging: unisys: removed unused 'visor_device.respond_to_device_create'

2016-04-06 Thread David Kershner
From: Alexander Curtin 

The respond_to_device_create flag was used previously when we used to
delay responses to create requests until the drivers were finished
loading. This behaviour was removed some time ago, yet the field still
existed, while never being referenced or even initialized.

Signed-off-by: Alexander Curtin 
Signed-off-by: David Kershner 
---
 drivers/staging/unisys/include/visorbus.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 3788d16..db59d97 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -134,7 +134,6 @@ struct visor_device {
struct list_head list_all;
struct periodic_work *periodic_work;
bool being_removed;
-   bool responded_to_device_create;
/* the code will detect and behave appropriately) */
struct semaphore visordriver_callback_lock;
bool pausing;
-- 
1.9.1

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


RE: [PATCH] staging: comedi: das1800: remove unused variable

2016-04-06 Thread Hartley Sweeten
On Wednesday, April 06, 2016 2:41 AM, Ian Abbott wrote:
> On 06/04/16 02:21, Hartley Sweeten wrote:
>> On Tuesday, April 05, 2016 7:23 AM, Sudip Mukherjee wrote:
>>> The variable unipolar was never used.
>>>
>>> Signed-off-by: Sudip Mukherjee 
>>> ---
>>>
>>> There may be a chance that reading from DAS1800_CONTROL_C is necessary
>>> before reading from DAS1800_STATUS. If that is true then please discard
>>> this patch.
>>
>> Actually the driver has a bug here.
>>
>> The analog input samples should  be munged if the inputs are configured for
>> bipolar mode.
>>
>> I have a series almost ready that cleans up this driver and fixes the bug.
>
> Hi Hartley, can the bug fix be placed at the top of your patch series? 

I'll split it out as a separate patch and post it shortly.

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


[PATCH] staging: comedi: das1800: fix analog input sample munging

2016-04-06 Thread H Hartley Sweeten
The analog input samples are 2's complement when the inputs are configured
for bipolar ranges and offset binary when they are unipolar ranges. For
bipolar ranges the samples need to be munged to the offset binary format
that comedi uses.

The (*insn_read) does the munging correctly but the async command support
incorrectly munges the data for both bipolar and unipolar ranges when
reading the remaining samples from the fifo in das1800_handle_fifo_not_empty().

Add a (*munge) function to the analog input subdevice so that the samples
are correctly munged when they are added to the async buffer by
comedi_buf_write_samples(). Add a flag to the private data and set it in
the (*do_cmd) so that the munging is only done for bipolar ranges.

Clarify the code by using the core helper functions to check the range and
do the munging.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 94078118..b93a8e7 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -107,7 +107,6 @@ TODO:
 /* misc. defines */
 #define DAS1800_SIZE   16  /* uses 16 io addresses */
 #define FIFO_SIZE  1024/*  1024 sample fifo */
-#define UNIPOLAR   0x4 /*  bit that determines whether input 
range is uni/bipolar */
 #define DMA_BUF_SIZE   0x1ff00 /*  size in bytes of dma buffers */
 
 /* Registers for the das1800 */
@@ -429,6 +428,7 @@ struct das1800_private {
unsigned long iobase2;  /* secondary io address used for analog out on 
'ao' boards */
unsigned short ao_update_bits;  /* remembers the last write to the
 * 'update' dac */
+   bool ai_is_unipolar;
 };
 
 /* analog out range for 'ao' boards */
@@ -441,29 +441,21 @@ static const struct comedi_lrange range_ao_2 = {
 };
 */
 
-static inline uint16_t munge_bipolar_sample(const struct comedi_device *dev,
-   uint16_t sample)
-{
-   const struct das1800_board *board = dev->board_ptr;
-
-   sample += 1 << (board->resolution - 1);
-   return sample;
-}
-
-static void munge_data(struct comedi_device *dev, uint16_t *array,
-  unsigned int num_elements)
+static void das1800_ai_munge(struct comedi_device *dev,
+struct comedi_subdevice *s,
+void *data, unsigned int num_bytes,
+unsigned int start_chan_index)
 {
+   struct das1800_private *devpriv = dev->private;
+   unsigned short *array = data;
+   unsigned int num_samples = comedi_bytes_to_samples(s, num_bytes);
unsigned int i;
-   int unipolar;
 
-   /* see if card is using a unipolar or bipolar range so we can munge 
data correctly */
-   unipolar = inb(dev->iobase + DAS1800_CONTROL_C) & UB;
+   if (devpriv->ai_is_unipolar)
+   return;
 
-   /* convert to unsigned type if we are in a bipolar mode */
-   if (!unipolar) {
-   for (i = 0; i < num_elements; i++)
-   array[i] = munge_bipolar_sample(dev, array[i]);
-   }
+   for (i = 0; i < num_samples; i++)
+   array[i] = comedi_offset_munge(s, array[i]);
 }
 
 static void das1800_handle_fifo_half_full(struct comedi_device *dev,
@@ -473,7 +465,6 @@ static void das1800_handle_fifo_half_full(struct 
comedi_device *dev,
unsigned int nsamples = comedi_nsamples_left(s, FIFO_SIZE / 2);
 
insw(dev->iobase + DAS1800_FIFO, devpriv->fifo_buf, nsamples);
-   munge_data(dev, devpriv->fifo_buf, nsamples);
comedi_buf_write_samples(s, devpriv->fifo_buf, nsamples);
 }
 
@@ -482,14 +473,9 @@ static void das1800_handle_fifo_not_empty(struct 
comedi_device *dev,
 {
struct comedi_cmd *cmd = &s->async->cmd;
unsigned short dpnt;
-   int unipolar;
-
-   unipolar = inb(dev->iobase + DAS1800_CONTROL_C) & UB;
 
while (inb(dev->iobase + DAS1800_STATUS) & FNE) {
dpnt = inw(dev->iobase + DAS1800_FIFO);
-   /* convert to unsigned type */
-   dpnt = munge_bipolar_sample(dev, dpnt);
comedi_buf_write_samples(s, &dpnt, 1);
 
if (cmd->stop_src == TRIG_COUNT &&
@@ -511,7 +497,6 @@ static void das1800_flush_dma_channel(struct comedi_device 
*dev,
nsamples = comedi_bytes_to_samples(s, nbytes);
nsamples = comedi_nsamples_left(s, nsamples);
 
-   munge_data(dev, desc->virt_addr, nsamples);
comedi_buf_write_samples(s, desc->virt_addr, nsamples);
 }
 
@@ -704,13 +689,14 @@ static int das1800_ai_check_chanlist(struct comedi_device 
*dev,
 struct comedi_subdevice *s,
   

[PATCH] staging: comedi: das1800: fix analog input number of channels

2016-04-06 Thread H Hartley Sweeten
The "hc" type boards have 64 analog input channels with a 64 entry queue.
All the others have 16 channels and a 256 entry queue.

Currently the boardinfo 'qram_len' is used to initialize the subdevice
'n_chan' and 'len_chanlist'. This works for the 64 channel boards but
sets the 'n_chan' wrong for the 16 channel boards.

Replace the 'qram_len' member of the boardinfo with a bit-field flag,
'has_64_ai_chan' and use that to properly initialize the subdevice.
Remove the unnecessary initialization for the boards that have 16
channels.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index b93a8e7..f80a579 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -205,12 +205,12 @@ struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
int resolution; /* bits of ai resolution */
-   int qram_len;   /* length of card's channel / gain queue */
int common; /* supports AREF_COMMON flag */
int do_n_chan;  /* number of digital output channels */
int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 
== waveform analog out */
int ao_n_chan;  /* number of analog out channels */
const struct comedi_lrange *range_ai;   /* available input ranges */
+   unsigned int has_64_ai_chan:1;
 };
 
 /* Warning: the maximum conversion speeds listed below are
@@ -222,7 +222,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1701st",
 .ai_speed = 6250,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 0,
@@ -233,7 +232,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1701st-da",
 .ai_speed = 6250,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 1,
@@ -244,7 +242,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1702st",
 .ai_speed = 6250,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 0,
@@ -255,7 +252,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1702st-da",
 .ai_speed = 6250,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 1,
@@ -266,7 +262,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1702hr",
 .ai_speed = 2,
 .resolution = 16,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 0,
@@ -277,7 +272,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1702hr-da",
 .ai_speed = 2,
 .resolution = 16,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 1,
@@ -288,7 +282,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1701ao",
 .ai_speed = 6250,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 2,
@@ -299,7 +292,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1702ao",
 .ai_speed = 6250,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 2,
@@ -310,7 +302,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1801st",
 .ai_speed = 3000,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 0,
@@ -321,7 +312,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1801st-da",
 .ai_speed = 3000,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 0,
@@ -332,7 +322,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1802st",
 .ai_speed = 3000,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 0,
@@ -343,7 +332,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1802st-da",
 .ai_speed = 3000,
 .resolution = 12,
-.qram_len = 256,
 .common = 1,
 .do_n_chan = 4,
 .ao_ability = 1,
@@ -354,7 +342,6 @@ static const struct das1800_board das1800_boards[] = {
 .name = "das-1802hr",
 .ai_speed = 1,
  

Re: [PATCH] staging: iio: ad7606: use iio_device_{claim|release}_direct_mode()

2016-04-06 Thread Lars-Peter Clausen
On 04/03/2016 11:09 AM, Jonathan Cameron wrote:
> On 01/04/16 17:53, Alison Schofield wrote:
>> Two instances are moved to the new claim/release API:
>>
>> In the first instance, the driver was using mlock followed by
>> iio_buffer_enabled(). Replace that code with the new API to guarantee
>> the device stays in direct mode. There is no change in driver behavior.
>>
>> In the second instance, the driver was not using mlock to hold the
>> device in direct mode, but should have been.  Here we introduce the
>> new API to guarantee direct mode. This is a change in driver behavior.
>>
>> Signed-off-by: Alison Schofield 
>> ---
>>  drivers/staging/iio/adc/ad7606_core.c | 15 ---
>>  1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/iio/adc/ad7606_core.c
b/drivers/staging/iio/adc/ad7606_core.c
>> index 6dbc811..f914b8d 100644
>> --- a/drivers/staging/iio/adc/ad7606_core.c
>> +++ b/drivers/staging/iio/adc/ad7606_core.c
>> @@ -88,12 +88,12 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
>>
>>  switch (m) {
>>  case IIO_CHAN_INFO_RAW:
>> -mutex_lock(&indio_dev->mlock);
>> -if (iio_buffer_enabled(indio_dev))
>> -ret = -EBUSY;
>> -else
>> -ret = ad7606_scan_direct(indio_dev, chan->address);
>> -mutex_unlock(&indio_dev->mlock);
>> +ret = iio_device_claim_direct_mode(indio_dev);
>> +if (ret)
>> +return ret;
>> +
>> +ret = ad7606_scan_direct(indio_dev, chan->address);
>> +iio_device_release_direct_mode(indio_dev);
>>
>>  if (ret < 0)
>>  return ret;
>> @@ -411,8 +411,9 @@ static irqreturn_t ad7606_interrupt(int irq, void
*dev_id)
>>  struct iio_dev *indio_dev = dev_id;
>>  struct ad7606_state *st = iio_priv(indio_dev);
>>
>> -if (iio_buffer_enabled(indio_dev)) {
>> +if (!iio_device_claim_direct_mode(indio_dev))  {
>>  schedule_work(&st->poll_work);
>> +iio_device_release_direct_mode(indio_dev);
> Unfortunately this won't work.  That interrupt is still in traditional non
> threaded form.  This will take a mutex in a top half interrupt handler
> where a sleep cannot occur.
>
> I'm just wondering how expensive it would be to fix this by moving that over
> to a threaded handler.  In the poll_work case (buffer) it would be cleaner
to do
> so. I'm really confused what the intended interrupt handler
> is in here.  I 'think' the sequence is:
>
> Trigger fires the convst pin whether in top half or the bottom half of
> a threaded interrupt, but not both - I guess this works, if it is rather
> 'unusual'.
>
> We then get a interrupt to indicate that it has finished conversion and that
> filters through to actually fill the buffer via a traditional top half /
> bottom half interrupt handler.
>
> So if we were to convert that to a threaded interrupt (with no top half / non
> threaded part), we could drop the schedule_work and just call
> ad7606_poll_bh_to_ring from the thread handler.
>
> In the direct read case I doubt we care about the delay in dropping to a
> thread prior to signalling the data is ready.
>
> Can't think why this driver is still in staging :)

Yeah, we should leave this driver out from the conversion for now. The whole
convst pin handling need a major rework. It shouldn't really be in the
driver and usually you wouldn't want to use to use a GPIO and software timer
since that gives you way to much jitter for good results. You'd probably use
something like a PWM.

>
> Lars, any interest from Analog in getting this one cleaned up?  Also
> do you have any test hardware, if we mess around with this interrupt handling?

I have the hardware somewhere in some storage bay, but just converting this
over to threaded interrupt handling is not really a solution. So, if you
want to get rid of the iio_buffer_enabled() in the interrupt handler a
simple solution is to register preenable and postdisable callbacks where you
set a flag in the driver struct to indicate that it is in buffered mode or not.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] staging: comedi: das1800: remove unused variable

2016-04-06 Thread Hartley Sweeten
On Wednesday, April 06, 2016 3:41 AM, Ian Abbott wrote:
> On 06/04/16 10:41, Ian Abbott wrote:
>> On 06/04/16 02:21, Hartley Sweeten wrote:
>>> On Tuesday, April 05, 2016 7:23 AM, Sudip Mukherjee wrote:
 The variable unipolar was never used.

 Signed-off-by: Sudip Mukherjee 
 ---

 There may be a chance that reading from DAS1800_CONTROL_C is necessary
 before reading from DAS1800_STATUS. If that is true then please discard
 this patch.
>>>
>>> Actually the driver has a bug here.
>>>
>>> The analog input samples should  be munged if the inputs are
>>> configured for bipolar mode.
>>>
>>> I have a series almost ready that cleans up this driver and fixes the
>>> bug.
>>
>> Hi Hartley, can the bug fix be placed at the top of your patch series?
>> Thanks.
>>

 Just posted the patch. It's a bit more involved than your fix in the comedi.org
code but I think it's more complete.

> The bug has been there forever (even in the "out-of-tree" version from 
> comedi.org, where I have just fixed it). There have been patches applied 
> to reformat and remove the incorrect bits of code, including 
> a142785d7c9d ("Staging: comedi: das1800: fixed multiple brace coding 
> style issues and pointer declaration style errors") and 82d28561b7e0 
> ("staging: comedi: Remove if condition.").  The latter patch, 
> 82d28561b7e0, mainly served to hide the bug further!

Looks like both of those patches might have originated from one of the
outreachy programs that Greg deals with.

If you think this needs to be fixed in any of the stable trees, I can split it 
to
match your comedi.org fix (to fix the stable trees) and a second patch for
the additional cleanup. This is an old legacy ISA board and, as you stated,
the bug has been there forever so I'm not sure if the backport is worth it.

Regards,
Hartley

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


[PATCH] staging: comedi: das1800: fix das-1801st-da boardinfo

2016-04-06 Thread H Hartley Sweeten
The "da" type boards all have 4 analog inputs. Fix the boardinfo
for the das-1801st-da.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index f80a579..ff73da91 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -314,7 +314,7 @@ static const struct das1800_board das1800_boards[] = {
 .resolution = 12,
 .common = 1,
 .do_n_chan = 4,
-.ao_ability = 0,
+.ao_ability = 1,
 .ao_n_chan = 4,
 .range_ai = &range_ai_das1801,
 },
-- 
2.6.3

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


re: android,lowmemorykiller: Don't abuse TIF_MEMDIE.

2016-04-06 Thread Dan Carpenter
Hello Tetsuo Handa,

This is a semi-automatic email about new static checker warnings.

The patch 77ed2c5745d9: "android,lowmemorykiller: Don't abuse 
TIF_MEMDIE." from Mar 8, 2016, leads to the following Smatch 
complaint:

drivers/staging/android/lowmemorykiller.c:145 lowmem_scan()
 error: we previously assumed 'p->mm' could be null (see line 134)

drivers/staging/android/lowmemorykiller.c
   133  
   134  if (task_lmk_waiting(p) && p->mm &&
   ^
Patch adds a new check.

   135  time_before_eq(jiffies, 
lowmem_deathpending_timeout)) {
   136  task_unlock(p);
   137  rcu_read_unlock();
   138  return 0;
   139  }
   140  oom_score_adj = p->signal->oom_score_adj;
   141  if (oom_score_adj < min_score_adj) {
   142  task_unlock(p);
   143  continue;
   144  }
   145  tasksize = get_mm_rss(p->mm);
  ^
Old unchecked dereference inside function call.

   146  task_unlock(p);
   147  if (tasksize <= 0)

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


Re: [1/2] rtlwifi: rtl8723be: Add antenna select module parameter

2016-04-06 Thread Kalle Valo

> A number of new laptops have been delivered with only a single antenna.
> In principle, this is OK; however, a problem arises when the on-board
> EEPROM is programmed to use the other antenna connection. The option
> of opening the computer and moving the connector is not always possible
> as it will void the warranty in some cases. In addition, this solution
> breaks the Windows driver when the box dual boots Linux and Windows.
> 
> A fix involving a new module parameter has been developed.  This commit
> adds the new parameter and implements the changes needed for the driver.
> 
> Signed-off-by: Larry Finger 
> Cc: Stable  [V4.0+]

Thanks, 2 patches applied to wireless-drivers-next.git:

c18d8f509571 rtlwifi: rtl8723be: Add antenna select module parameter
baa170229095 rtlwifi: btcoexist: Implement antenna selection

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


Re: [1/9] rtlwifi: Fix Smatch warnings

2016-04-06 Thread Kalle Valo

> Smatch reports the following:
> 
>   CHECK   drivers/net/wireless/realtek/rtlwifi/pci.c
> drivers/net/wireless/realtek/rtlwifi/pci.c:366 rtl_pci_check_buddy_priv() 
> error: we previously assumed 'tpriv' could be null (see line 368)
> drivers/net/wireless/realtek/rtlwifi/pci.c:1216 _rtl_pci_init_struct() warn: 
> inconsistent indenting
> 
> Signed-off-by: Larry Finger 

Thanks, 9 patches applied to wireless-drivers-next.git:

37c52934c668 rtlwifi: Fix Smatch warnings
2e074fab347e rtlwifi: btcoexist: Fix Smatch warning
844026f609fc rtlwifi: rtl8188ee: Fix Smatch warnings
de8a9a6eeb57 rtlwifi: rtl8192c-common: Fix Smatch warning
05d9e1bba43b rtlwifi: rtl8192ee: Fix Smatch warning
c42ceccec170 rtlwifi: rtl8192se: Fix Smatch warning
154fb486df3d rtlwifi: rtl8723ae: Fix Smatch warning
b3c4201bce5e rtlwifi: rtl8723be: Fix Smatch warnings
1e812458206e rtlwifi: rtl8821ae: Fix Smatch warnings

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


Re: [lustre-devel] [PATCH] staging/lustre/obdclass: fix build warning

2016-04-06 Thread James Simmons

> While building with W=1 we were getting the warning:
> 
> drivers/staging/lustre/lustre/obdclass/cl_object.c:1056:16:
>   warning: old-style function definition
>  struct lu_env *cl_env_percpu_get()
> ^
> 
> Signed-off-by: Sudip Mukherjee 

Acked-by: James Simmons 

> ---
>  drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c 
> b/drivers/staging/lustre/lustre/obdclass/cl_object.c
> index 395b92c..d84ec00 100644
> --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
> +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
> @@ -1053,7 +1053,7 @@ void cl_env_percpu_put(struct lu_env *env)
>  }
>  EXPORT_SYMBOL(cl_env_percpu_put);
>  
> -struct lu_env *cl_env_percpu_get()
> +struct lu_env *cl_env_percpu_get(void)
>  {
>   struct cl_env *cle;
>  
> -- 
> 1.9.1
> 
> ___
> lustre-devel mailing list
> lustre-de...@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/24] staging: lustre: selftest: remove typedefs

2016-04-06 Thread James Simmons
The lnet selftest code is littered with typedefs. Convert these
typedefs into their proper data types.

James Simmons (24):
  staging: lustre: selftest: convert srpc_event_type to proper enum
  staging: lustre: selftest: convert srpc_event_t to proper struct
  staging: lustre: selftest: convert srpc_bulk_t to proper struct
  staging: lustre: selftest: convert srpc_buffer_t to proper struct
  staging: lustre: selftest: convert swi_workitem_t to proper struct
  staging: lustre: selftest: convert srpc_client_rpc_t to proper struct
  staging: lustre: selftest: convert srpc_service_t to proper struct
  staging: lustre: selftest: convert sfw_session_t to proper struct
  staging: lustre: selftest: convert sfw_batch_t to proper struct
  staging: lustre: selftest: convert sfw_test_client_ops_t to proper struct
  staging: lustre: selftest: convert sfw_test_instance_t to proper struct
  staging: lustre: selftest: convert sfw_test_unit_t to proper struct
  staging: lustre: selftest: convert sfw_test_case_t to proper struct
  staging: lustre: selftest: convert lstcon_rpc_t to proper struct
  staging: lustre: selftest: convert lstcon_rpc_trans_t to proper struct
  staging: lustre: selftest: convert lstcon_node_t to proper struct
  staging: lustre: selftest: convert lstcon_ndlink_t to proper struct
  staging: lustre: selftest: convert lstcon_group_t to proper struct
  staging: lustre: selftest: convert lstcon_tsb_hdr_t to proper struct
  staging: lustre: selftest: convert lstcon_batch_t to proper struct
  staging: lustre: selftest: convert lstcon_test_t to proper struct
  staging: lustre: selftest: convert srpc_msg_t to proper struct
  staging: lustre: selftest: convert wire protocol to use struct
  staging: lustre: selftest: change srpc_state_t to proper enum

 drivers/staging/lustre/lnet/selftest/brw_test.c  |   76 +++---
 drivers/staging/lustre/lnet/selftest/conctl.c|2 +-
 drivers/staging/lustre/lnet/selftest/conrpc.c|  196 
 drivers/staging/lustre/lnet/selftest/conrpc.h|   40 ++--
 drivers/staging/lustre/lnet/selftest/console.c   |  271 +++---
 drivers/staging/lustre/lnet/selftest/console.h   |   47 ++--
 drivers/staging/lustre/lnet/selftest/framework.c |  256 ++--
 drivers/staging/lustre/lnet/selftest/ping_test.c |   42 ++--
 drivers/staging/lustre/lnet/selftest/rpc.c   |  123 +-
 drivers/staging/lustre/lnet/selftest/rpc.h   |  156 +++--
 drivers/staging/lustre/lnet/selftest/selftest.h  |  200 
 11 files changed, 714 insertions(+), 695 deletions(-)

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


[PATCH 07/24] staging: lustre: selftest: convert srpc_service_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef srpc_service_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |3 +-
 drivers/staging/lustre/lnet/selftest/console.c   |3 +-
 drivers/staging/lustre/lnet/selftest/framework.c |8 +++---
 drivers/staging/lustre/lnet/selftest/ping_test.c |3 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |   10 
 drivers/staging/lustre/lnet/selftest/selftest.h  |   26 +++---
 6 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 442f431..d2a8379 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -497,7 +497,8 @@ void brw_init_test_client(void)
brw_test_client.tso_done_rpc = brw_client_done_rpc;
 };
 
-srpc_service_t brw_test_service;
+struct srpc_service brw_test_service;
+
 void brw_init_test_service(void)
 {
brw_test_service.sv_id = SRPC_SERVICE_BRW;
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index dcfc83d..1352310 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -1986,7 +1986,8 @@ out:
return rc;
 }
 
-static srpc_service_t lstcon_acceptor_service;
+static struct srpc_service lstcon_acceptor_service;
+
 static void lstcon_init_acceptor_service(void)
 {
/* initialize selftest console acceptor service table */
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 6c0af58..0eb275f 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -135,7 +135,7 @@ sfw_find_test_case(int id)
 }
 
 static int
-sfw_register_test(srpc_service_t *service, sfw_test_client_ops_t *cliops)
+sfw_register_test(struct srpc_service *service, sfw_test_client_ops_t *cliops)
 {
sfw_test_case_t *tsc;
 
@@ -1584,7 +1584,7 @@ sfw_post_rpc(struct srpc_client_rpc *rpc)
spin_unlock(&rpc->crpc_lock);
 }
 
-static srpc_service_t sfw_services[] = {
+static struct srpc_service sfw_services[] = {
{
/* sv_id */SRPC_SERVICE_DEBUG,
/* sv_name */  "debug",
@@ -1628,7 +1628,7 @@ sfw_startup(void)
int i;
int rc;
int error;
-   srpc_service_t *sv;
+   struct srpc_service *sv;
sfw_test_case_t *tsc;
 
if (session_timeout < 0) {
@@ -1721,7 +1721,7 @@ sfw_startup(void)
 void
 sfw_shutdown(void)
 {
-   srpc_service_t *sv;
+   struct srpc_service *sv;
sfw_test_case_t *tsc;
int i;
 
diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c 
b/drivers/staging/lustre/lnet/selftest/ping_test.c
index 1f2ddf6..c09b599 100644
--- a/drivers/staging/lustre/lnet/selftest/ping_test.c
+++ b/drivers/staging/lustre/lnet/selftest/ping_test.c
@@ -219,7 +219,8 @@ void ping_init_test_client(void)
ping_test_client.tso_done_rpc = ping_client_done_rpc;
 }
 
-srpc_service_t ping_test_service;
+struct srpc_service ping_test_service;
+
 void ping_init_test_service(void)
 {
ping_test_service.sv_id = SRPC_SERVICE_PING;
diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c 
b/drivers/staging/lustre/lnet/selftest/rpc.c
index e711571..1e2fd8a 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -56,7 +56,7 @@ typedef enum {
 
 static struct smoketest_rpc {
spinlock_t   rpc_glock; /* global lock */
-   srpc_service_t  *rpc_services[SRPC_SERVICE_MAX_ID + 1];
+   struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1];
lnet_handle_eq_t rpc_lnet_eq;   /* _the_ LNet event queue */
srpc_state_t rpc_state;
srpc_counters_t  rpc_counters;
@@ -338,7 +338,7 @@ srpc_add_service(struct srpc_service *sv)
 }
 
 int
-srpc_remove_service(srpc_service_t *sv)
+srpc_remove_service(struct srpc_service *sv)
 {
int id = sv->sv_id;
 
@@ -755,7 +755,7 @@ srpc_abort_service(struct srpc_service *sv)
 }
 
 void
-srpc_shutdown_service(srpc_service_t *sv)
+srpc_shutdown_service(struct srpc_service *sv)
 {
struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc;
@@ -1414,7 +1414,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev)
struct srpc_client_rpc *crpc;
struct srpc_server_rpc *srpc;
struct srpc_buffer *buffer;
-   srpc_service_t *sv;
+   struct srpc_service *sv;
srpc_msg_t *msg;
srpc_msg_type_t type;
 
@@ -1663,7 +1663,7 @@ srpc_shutdown(void)
spin_lock(&srpc_data.rpc_glock);
 
for (i = 0; i <= SRPC_SERVICE_MAX_ID; i++) {
-   srpc_service_t *sv = srpc_data.rpc_services[i];
+   struct srpc_service *sv = srpc_data.rpc_services[i];
 
   

[PATCH 01/24] staging: lustre: selftest: convert srpc_event_type to proper enum

2016-04-06 Thread James Simmons
Turn tyepdef srpc_event_type to proper enum

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/selftest.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h 
b/drivers/staging/lustre/lnet/selftest/selftest.h
index f50580e..00d73a1 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -134,7 +134,7 @@ srpc_service2reply(int service)
return srpc_service2request(service) + 1;
 }
 
-typedef enum {
+enum srpc_event_type {
SRPC_BULK_REQ_RCVD   = 1, /* passive bulk request(PUT sink/GET source)
   * received */
SRPC_BULK_PUT_SENT   = 2, /* active bulk PUT sent (source) */
@@ -143,11 +143,11 @@ typedef enum {
SRPC_REPLY_SENT  = 5, /* outgoing reply sent */
SRPC_REQUEST_RCVD= 6, /* incoming request received */
SRPC_REQUEST_SENT= 7, /* outgoing request sent */
-} srpc_event_type_t;
+};
 
 /* RPC event */
 typedef struct {
-   srpc_event_type_t ev_type;   /* what's up */
+   enum srpc_event_typeev_type;/* what's up */
lnet_event_kind_t ev_lnet;   /* LNet event type */
int   ev_fired;  /* LNet event fired? */
int   ev_status; /* LNet event status */
-- 
1.7.1

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


[PATCH 08/24] staging: lustre: selftest: convert sfw_session_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef sfw_session_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |6 ++--
 drivers/staging/lustre/lnet/selftest/framework.c |   40 +++---
 drivers/staging/lustre/lnet/selftest/ping_test.c |8 ++--
 drivers/staging/lustre/lnet/selftest/selftest.h  |6 ++--
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index d2a8379..8e789ba 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -69,7 +69,7 @@ brw_client_fini(sfw_test_instance_t *tsi)
 static int
 brw_client_init(sfw_test_instance_t *tsi)
 {
-   sfw_session_t *sn = tsi->tsi_batch->bat_session;
+   struct sfw_session *sn = tsi->tsi_batch->bat_session;
int flags;
int npg;
int len;
@@ -259,7 +259,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
 {
struct srpc_bulk *bulk = tsu->tsu_private;
sfw_test_instance_t *tsi = tsu->tsu_instance;
-   sfw_session_t *sn = tsi->tsi_batch->bat_session;
+   struct sfw_session *sn = tsi->tsi_batch->bat_session;
struct srpc_client_rpc *rpc;
srpc_brw_reqst_t *req;
int flags;
@@ -317,7 +317,7 @@ brw_client_done_rpc(sfw_test_unit_t *tsu, struct 
srpc_client_rpc *rpc)
 {
__u64 magic = BRW_MAGIC;
sfw_test_instance_t *tsi = tsu->tsu_instance;
-   sfw_session_t *sn = tsi->tsi_batch->bat_session;
+   struct sfw_session *sn = tsi->tsi_batch->bat_session;
srpc_msg_t *msg = &rpc->crpc_replymsg;
srpc_brw_reply_t *reply = &msg->msg_body.brw_reply;
srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 0eb275f..3a20598 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -109,14 +109,14 @@ static struct smoketest_framework {
struct list_head  fw_tests;   /* registered test cases */
atomic_t  fw_nzombies;/* # zombie sessions */
spinlock_tfw_lock;/* serialise */
-   sfw_session_t *fw_session;/* _the_ session */
+   struct sfw_session*fw_session;/* _the_ session */
int   fw_shuttingdown;/* shutdown in progress */
struct srpc_server_rpc *fw_active_srpc;/* running RPC */
 } sfw_data;
 
 /* forward ref's */
 int sfw_stop_batch(sfw_batch_t *tsb, int force);
-void sfw_destroy_session(sfw_session_t *sn);
+void sfw_destroy_session(struct sfw_session *sn);
 
 static inline sfw_test_case_t *
 sfw_find_test_case(int id)
@@ -159,7 +159,7 @@ sfw_register_test(struct srpc_service *service, 
sfw_test_client_ops_t *cliops)
 static void
 sfw_add_session_timer(void)
 {
-   sfw_session_t *sn = sfw_data.fw_session;
+   struct sfw_session *sn = sfw_data.fw_session;
struct stt_timer *timer = &sn->sn_timer;
 
LASSERT(!sfw_data.fw_shuttingdown);
@@ -177,7 +177,7 @@ sfw_add_session_timer(void)
 static int
 sfw_del_session_timer(void)
 {
-   sfw_session_t *sn = sfw_data.fw_session;
+   struct sfw_session *sn = sfw_data.fw_session;
 
if (!sn || !sn->sn_timer_active)
return 0;
@@ -196,7 +196,7 @@ static void
 sfw_deactivate_session(void)
 __must_hold(&sfw_data.fw_lock)
 {
-   sfw_session_t *sn = sfw_data.fw_session;
+   struct sfw_session *sn = sfw_data.fw_session;
int nactive = 0;
sfw_batch_t *tsb;
sfw_test_case_t *tsc;
@@ -239,7 +239,7 @@ __must_hold(&sfw_data.fw_lock)
 static void
 sfw_session_expired(void *data)
 {
-   sfw_session_t *sn = data;
+   struct sfw_session *sn = data;
 
spin_lock(&sfw_data.fw_lock);
 
@@ -257,12 +257,12 @@ sfw_session_expired(void *data)
 }
 
 static inline void
-sfw_init_session(sfw_session_t *sn, lst_sid_t sid,
+sfw_init_session(struct sfw_session *sn, lst_sid_t sid,
 unsigned features, const char *name)
 {
struct stt_timer *timer = &sn->sn_timer;
 
-   memset(sn, 0, sizeof(sfw_session_t));
+   memset(sn, 0, sizeof(struct sfw_session));
INIT_LIST_HEAD(&sn->sn_list);
INIT_LIST_HEAD(&sn->sn_batches);
atomic_set(&sn->sn_refcount, 1);/* +1 for caller */
@@ -321,7 +321,7 @@ sfw_client_rpc_fini(struct srpc_client_rpc *rpc)
 static sfw_batch_t *
 sfw_find_batch(lst_bid_t bid)
 {
-   sfw_session_t *sn = sfw_data.fw_session;
+   struct sfw_session *sn = sfw_data.fw_session;
sfw_batch_t *bat;
 
LASSERT(sn);
@@ -337,7 +337,7 @@ sfw_find_batch(lst_bid_t bid)
 static sfw_batch_t *
 sfw_bid2batch(lst_bid_t bid)
 {
-   sfw_session_t *sn = sfw_data.fw_session;
+   struct sfw_session *sn = sfw_data.fw_session;
sfw_batch_t *bat;
 
  

[PATCH 09/24] staging: lustre: selftest: convert sfw_batch_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef sfw_batch_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/framework.c |   38 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |6 ++--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 3a20598..0d7c3c5 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -115,7 +115,7 @@ static struct smoketest_framework {
 } sfw_data;
 
 /* forward ref's */
-int sfw_stop_batch(sfw_batch_t *tsb, int force);
+int sfw_stop_batch(struct sfw_batch *tsb, int force);
 void sfw_destroy_session(struct sfw_session *sn);
 
 static inline sfw_test_case_t *
@@ -198,7 +198,7 @@ __must_hold(&sfw_data.fw_lock)
 {
struct sfw_session *sn = sfw_data.fw_session;
int nactive = 0;
-   sfw_batch_t *tsb;
+   struct sfw_batch *tsb;
sfw_test_case_t *tsc;
 
if (!sn)
@@ -318,11 +318,11 @@ sfw_client_rpc_fini(struct srpc_client_rpc *rpc)
spin_unlock(&sfw_data.fw_lock);
 }
 
-static sfw_batch_t *
+static struct sfw_batch *
 sfw_find_batch(lst_bid_t bid)
 {
struct sfw_session *sn = sfw_data.fw_session;
-   sfw_batch_t *bat;
+   struct sfw_batch *bat;
 
LASSERT(sn);
 
@@ -334,11 +334,11 @@ sfw_find_batch(lst_bid_t bid)
return NULL;
 }
 
-static sfw_batch_t *
+static struct sfw_batch *
 sfw_bid2batch(lst_bid_t bid)
 {
struct sfw_session *sn = sfw_data.fw_session;
-   sfw_batch_t *bat;
+   struct sfw_batch *bat;
 
LASSERT(sn);
 
@@ -346,7 +346,7 @@ sfw_bid2batch(lst_bid_t bid)
if (bat)
return bat;
 
-   LIBCFS_ALLOC(bat, sizeof(sfw_batch_t));
+   LIBCFS_ALLOC(bat, sizeof(struct sfw_batch));
if (!bat)
return NULL;
 
@@ -365,7 +365,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t 
*reply)
 {
struct sfw_session *sn = sfw_data.fw_session;
sfw_counters_t *cnt = &reply->str_fw;
-   sfw_batch_t *bat;
+   struct sfw_batch *bat;
 
reply->str_sid = !sn ? LST_INVALID_SID : sn->sn_id;
 
@@ -648,7 +648,7 @@ clean:
 }
 
 static void
-sfw_destroy_batch(sfw_batch_t *tsb)
+sfw_destroy_batch(struct sfw_batch *tsb)
 {
sfw_test_instance_t *tsi;
 
@@ -662,20 +662,20 @@ sfw_destroy_batch(sfw_batch_t *tsb)
sfw_destroy_test_instance(tsi);
}
 
-   LIBCFS_FREE(tsb, sizeof(sfw_batch_t));
+   LIBCFS_FREE(tsb, sizeof(struct sfw_batch));
 }
 
 void
 sfw_destroy_session(struct sfw_session *sn)
 {
-   sfw_batch_t *batch;
+   struct sfw_batch *batch;
 
LASSERT(list_empty(&sn->sn_list));
LASSERT(sn != sfw_data.fw_session);
 
while (!list_empty(&sn->sn_batches)) {
batch = list_entry(sn->sn_batches.next,
-  sfw_batch_t, bat_list);
+  struct sfw_batch, bat_list);
list_del_init(&batch->bat_list);
sfw_destroy_batch(batch);
}
@@ -729,7 +729,7 @@ sfw_unpack_addtest_req(srpc_msg_t *msg)
 }
 
 static int
-sfw_add_test_instance(sfw_batch_t *tsb, struct srpc_server_rpc *rpc)
+sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc)
 {
srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg;
srpc_test_reqst_t *req = &msg->msg_body.tes_reqst;
@@ -827,7 +827,7 @@ static void
 sfw_test_unit_done(sfw_test_unit_t *tsu)
 {
sfw_test_instance_t *tsi = tsu->tsu_instance;
-   sfw_batch_t *tsb = tsi->tsi_batch;
+   struct sfw_batch *tsb = tsi->tsi_batch;
struct sfw_session *sn = tsb->bat_session;
 
LASSERT(sfw_test_active(tsi));
@@ -991,7 +991,7 @@ test_done:
 }
 
 static int
-sfw_run_batch(sfw_batch_t *tsb)
+sfw_run_batch(struct sfw_batch *tsb)
 {
struct swi_workitem *wi;
sfw_test_unit_t *tsu;
@@ -1026,7 +1026,7 @@ sfw_run_batch(sfw_batch_t *tsb)
 }
 
 int
-sfw_stop_batch(sfw_batch_t *tsb, int force)
+sfw_stop_batch(struct sfw_batch *tsb, int force)
 {
sfw_test_instance_t *tsi;
struct srpc_client_rpc *rpc;
@@ -1068,7 +1068,7 @@ sfw_stop_batch(sfw_batch_t *tsb, int force)
 }
 
 static int
-sfw_query_batch(sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply)
+sfw_query_batch(struct sfw_batch *tsb, int testidx, srpc_batch_reply_t *reply)
 {
sfw_test_instance_t *tsi;
 
@@ -1119,7 +1119,7 @@ sfw_add_test(struct srpc_server_rpc *rpc)
srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply;
srpc_test_reqst_t *request;
int rc;
-   sfw_batch_t *bat;
+   struct sfw_batch *bat;
 
request = &rpc->srpc_reqstbuf->buf_msg.msg_body.tes_reqst;
reply->tsr_sid = !sn ? LST_INVALID_SID : sn->sn_id;
@@ -1187,7 +1187,7 @@ sfw_control_batch(srpc_batch_reqst_t *request, 
srpc_batch_reply_t *reply)
 {
struct

[PATCH 05/24] staging: lustre: selftest: convert swi_workitem_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef swi_workitem_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/framework.c |4 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |8 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |   26 +++--
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 40a3da9..b2df184 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -942,7 +942,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t 
peer,
 }
 
 static int
-sfw_run_test(swi_workitem_t *wi)
+sfw_run_test(struct swi_workitem *wi)
 {
sfw_test_unit_t *tsu = wi->swi_workitem.wi_data;
sfw_test_instance_t *tsi = tsu->tsu_instance;
@@ -993,7 +993,7 @@ test_done:
 static int
 sfw_run_batch(sfw_batch_t *tsb)
 {
-   swi_workitem_t *wi;
+   struct swi_workitem *wi;
sfw_test_unit_t *tsu;
sfw_test_instance_t *tsi;
 
diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c 
b/drivers/staging/lustre/lnet/selftest/rpc.c
index 316ccf7..b0d5a89 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -71,7 +71,7 @@ srpc_serv_portal(int svc_id)
 }
 
 /* forward ref's */
-int srpc_handle_rpc(swi_workitem_t *wi);
+int srpc_handle_rpc(struct swi_workitem *wi);
 
 void srpc_get_counters(srpc_counters_t *cnt)
 {
@@ -963,7 +963,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int 
status)
 
 /* handles an incoming RPC */
 int
-srpc_handle_rpc(swi_workitem_t *wi)
+srpc_handle_rpc(struct swi_workitem *wi)
 {
struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data;
struct srpc_service_cd *scd = rpc->srpc_scd;
@@ -1140,7 +1140,7 @@ srpc_del_client_rpc_timer(srpc_client_rpc_t *rpc)
 static void
 srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status)
 {
-   swi_workitem_t *wi = &rpc->crpc_wi;
+   struct swi_workitem *wi = &rpc->crpc_wi;
 
LASSERT(status || wi->swi_state == SWI_STATE_DONE);
 
@@ -1175,7 +1175,7 @@ srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status)
 
 /* sends an outgoing RPC */
 int
-srpc_send_rpc(swi_workitem_t *wi)
+srpc_send_rpc(struct swi_workitem *wi)
 {
int rc = 0;
srpc_client_rpc_t *rpc;
diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h 
b/drivers/staging/lustre/lnet/selftest/selftest.h
index 04e742e..d6799b6 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -175,19 +175,19 @@ struct srpc_buffer {
 struct swi_workitem;
 typedef int (*swi_action_t) (struct swi_workitem *);
 
-typedef struct swi_workitem {
+struct swi_workitem {
struct cfs_wi_sched *swi_sched;
struct cfs_workitem swi_workitem;
swi_action_tswi_action;
int swi_state;
-} swi_workitem_t;
+};
 
 /* server-side state of a RPC */
 struct srpc_server_rpc {
/* chain on srpc_service::*_rpcq */
struct list_head   srpc_list;
struct srpc_service_cd *srpc_scd;
-   swi_workitem_t srpc_wi;
+   struct swi_workitem srpc_wi;
struct srpc_event   srpc_ev;/* bulk/reply event */
lnet_nid_t srpc_self;
lnet_process_id_t  srpc_peer;
@@ -209,7 +209,7 @@ typedef struct srpc_client_rpc {
atomic_t  crpc_refcount;
int   crpc_timeout;   /* # seconds to wait for reply */
struct stt_timer   crpc_timer;
-   swi_workitem_tcrpc_wi;
+   struct swi_workitem crpc_wi;
lnet_process_id_t crpc_dest;
 
void  (*crpc_done)(struct srpc_client_rpc *);
@@ -273,7 +273,7 @@ struct srpc_service_cd {
/** in-flight RPCs */
struct list_headscd_rpc_active;
/** workitem for posting buffer */
-   swi_workitem_t  scd_buf_wi;
+   struct swi_workitem scd_buf_wi;
/** CPT id */
int scd_cpt;
/** error code for scd_buf_wi */
@@ -404,7 +404,7 @@ typedef struct sfw_test_unit {
int tsu_loop;  /* loop count of the test */
sfw_test_instance_t *tsu_instance; /* pointer to test instance */
void*tsu_private;  /* private data */
-   swi_workitem_t  tsu_worker;/* workitem of the test unit */
+   struct swi_workitem tsu_worker; /* workitem of the test unit */
 } sfw_test_unit_t;
 
 typedef struct sfw_test_case {
@@ -440,7 +440,7 @@ void srpc_abort_rpc(srpc_client_rpc_t *rpc, int why);
 void srpc_free_bulk(struct srpc_bulk *bk);
 struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned bulk_npg,
  unsigned bulk_len, int sink);
-int srpc_send_rpc(swi_workitem_t *wi);
+int srpc_send_rpc(struct swi_workitem *wi);
 int srpc_sen

[PATCH 02/24] staging: lustre: selftest: convert srpc_event_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef srpc_event_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/rpc.c  |   20 ++--
 drivers/staging/lustre/lnet/selftest/selftest.h |   14 +++---
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c 
b/drivers/staging/lustre/lnet/selftest/rpc.c
index 5d8908d..ba75b34 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -357,7 +357,7 @@ srpc_remove_service(srpc_service_t *sv)
 static int
 srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf,
   int len, int options, lnet_process_id_t peer,
-  lnet_handle_md_t *mdh, srpc_event_t *ev)
+  lnet_handle_md_t *mdh, struct srpc_event *ev)
 {
int rc;
lnet_md_t md;
@@ -396,7 +396,7 @@ srpc_post_passive_rdma(int portal, int local, __u64 
matchbits, void *buf,
 static int
 srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
  int options, lnet_process_id_t peer, lnet_nid_t self,
- lnet_handle_md_t *mdh, srpc_event_t *ev)
+ lnet_handle_md_t *mdh, struct srpc_event *ev)
 {
int rc;
lnet_md_t md;
@@ -449,7 +449,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void 
*buf, int len,
 
 static int
 srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
-lnet_handle_md_t *mdh, srpc_event_t *ev)
+lnet_handle_md_t *mdh, struct srpc_event *ev)
 {
lnet_process_id_t any = { 0 };
 
@@ -794,7 +794,7 @@ srpc_shutdown_service(srpc_service_t *sv)
 static int
 srpc_send_request(srpc_client_rpc_t *rpc)
 {
-   srpc_event_t *ev = &rpc->crpc_reqstev;
+   struct srpc_event *ev = &rpc->crpc_reqstev;
int rc;
 
ev->ev_fired = 0;
@@ -816,7 +816,7 @@ srpc_send_request(srpc_client_rpc_t *rpc)
 static int
 srpc_prepare_reply(srpc_client_rpc_t *rpc)
 {
-   srpc_event_t *ev = &rpc->crpc_replyev;
+   struct srpc_event *ev = &rpc->crpc_replyev;
__u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid;
int rc;
 
@@ -841,7 +841,7 @@ static int
 srpc_prepare_bulk(srpc_client_rpc_t *rpc)
 {
srpc_bulk_t *bk = &rpc->crpc_bulk;
-   srpc_event_t *ev = &rpc->crpc_bulkev;
+   struct srpc_event *ev = &rpc->crpc_bulkev;
__u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid;
int rc;
int opt;
@@ -873,7 +873,7 @@ srpc_prepare_bulk(srpc_client_rpc_t *rpc)
 static int
 srpc_do_bulk(struct srpc_server_rpc *rpc)
 {
-   srpc_event_t *ev = &rpc->srpc_ev;
+   struct srpc_event *ev = &rpc->srpc_ev;
srpc_bulk_t *bk = rpc->srpc_bulk;
__u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid;
int rc;
@@ -968,7 +968,7 @@ srpc_handle_rpc(swi_workitem_t *wi)
struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data;
struct srpc_service_cd *scd = rpc->srpc_scd;
struct srpc_service *sv = scd->scd_svc;
-   srpc_event_t *ev = &rpc->srpc_ev;
+   struct srpc_event *ev = &rpc->srpc_ev;
int rc = 0;
 
LASSERT(wi == &rpc->srpc_wi);
@@ -1363,7 +1363,7 @@ srpc_post_rpc(srpc_client_rpc_t *rpc)
 int
 srpc_send_reply(struct srpc_server_rpc *rpc)
 {
-   srpc_event_t *ev = &rpc->srpc_ev;
+   struct srpc_event *ev = &rpc->srpc_ev;
struct srpc_msg *msg = &rpc->srpc_replymsg;
struct srpc_buffer *buffer = rpc->srpc_reqstbuf;
struct srpc_service_cd *scd = rpc->srpc_scd;
@@ -1410,7 +1410,7 @@ static void
 srpc_lnet_ev_handler(lnet_event_t *ev)
 {
struct srpc_service_cd *scd;
-   srpc_event_t *rpcev = ev->md.user_ptr;
+   struct srpc_event *rpcev = ev->md.user_ptr;
srpc_client_rpc_t *crpc;
struct srpc_server_rpc *srpc;
srpc_buffer_t *buffer;
diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h 
b/drivers/staging/lustre/lnet/selftest/selftest.h
index 00d73a1..43972eb 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -146,13 +146,13 @@ enum srpc_event_type {
 };
 
 /* RPC event */
-typedef struct {
+struct srpc_event {
enum srpc_event_typeev_type;/* what's up */
lnet_event_kind_t ev_lnet;   /* LNet event type */
int   ev_fired;  /* LNet event fired? */
int   ev_status; /* LNet event status */
void  *ev_data;  /* owning server/client RPC */
-} srpc_event_t;
+};
 
 typedef struct {
int  bk_len; /* len of bulk data */
@@ -187,7 +187,7 @@ struct srpc_server_rpc {
struct list_head   srpc_list;
struct srpc_service_cd *srpc_scd;
swi_workitem_t srpc_wi;
-   srpc_event_t   srpc_ev;  /* bulk/reply event */
+   struct srpc_event   srpc_ev;  

[PATCH 04/24] staging: lustre: selftest: convert srpc_buffer_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef srpc_buffer_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/rpc.c  |   12 ++--
 drivers/staging/lustre/lnet/selftest/selftest.h |6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c 
b/drivers/staging/lustre/lnet/selftest/rpc.c
index 387c306..316ccf7 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -697,7 +697,7 @@ srpc_finish_service(struct srpc_service *sv)
 
 /* called with sv->sv_lock held */
 static void
-srpc_service_recycle_buffer(struct srpc_service_cd *scd, srpc_buffer_t *buf)
+srpc_service_recycle_buffer(struct srpc_service_cd *scd, struct srpc_buffer 
*buf)
 __must_hold(&scd->scd_lock)
 {
if (!scd->scd_svc->sv_shuttingdown && scd->scd_buf_adjust >= 0) {
@@ -759,7 +759,7 @@ srpc_shutdown_service(srpc_service_t *sv)
 {
struct srpc_service_cd *scd;
struct srpc_server_rpc *rpc;
-   srpc_buffer_t *buf;
+   struct srpc_buffer *buf;
int i;
 
CDEBUG(D_NET, "Shutting down service: id %d, name %s\n",
@@ -903,7 +903,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int 
status)
 {
struct srpc_service_cd *scd = rpc->srpc_scd;
struct srpc_service *sv = scd->scd_svc;
-   srpc_buffer_t *buffer;
+   struct srpc_buffer *buffer;
 
LASSERT(status || rpc->srpc_wi.swi_state == SWI_STATE_DONE);
 
@@ -948,7 +948,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int 
status)
 
if (!sv->sv_shuttingdown && !list_empty(&scd->scd_buf_blocked)) {
buffer = list_entry(scd->scd_buf_blocked.next,
-   srpc_buffer_t, buf_list);
+   struct srpc_buffer, buf_list);
list_del(&buffer->buf_list);
 
srpc_init_server_rpc(rpc, scd, buffer);
@@ -1413,7 +1413,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev)
struct srpc_event *rpcev = ev->md.user_ptr;
srpc_client_rpc_t *crpc;
struct srpc_server_rpc *srpc;
-   srpc_buffer_t *buffer;
+   struct srpc_buffer *buffer;
srpc_service_t *sv;
srpc_msg_t *msg;
srpc_msg_type_t type;
@@ -1486,7 +1486,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev)
LASSERT(ev->type != LNET_EVENT_UNLINK ||
sv->sv_shuttingdown);
 
-   buffer = container_of(ev->md.start, srpc_buffer_t, buf_msg);
+   buffer = container_of(ev->md.start, struct srpc_buffer, 
buf_msg);
buffer->buf_peer = ev->initiator;
buffer->buf_self = ev->target.nid;
 
diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h 
b/drivers/staging/lustre/lnet/selftest/selftest.h
index fdf62cc..04e742e 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -164,13 +164,13 @@ struct srpc_bulk {
 };
 
 /* message buffer descriptor */
-typedef struct srpc_buffer {
+struct srpc_buffer {
struct list_head  buf_list; /* chain on srpc_service::*_msgq */
srpc_msg_tbuf_msg;
lnet_handle_md_t  buf_mdh;
lnet_nid_tbuf_self;
lnet_process_id_t buf_peer;
-} srpc_buffer_t;
+};
 
 struct swi_workitem;
 typedef int (*swi_action_t) (struct swi_workitem *);
@@ -193,7 +193,7 @@ struct srpc_server_rpc {
lnet_process_id_t  srpc_peer;
srpc_msg_t srpc_replymsg;
lnet_handle_md_t   srpc_replymdh;
-   srpc_buffer_t  *srpc_reqstbuf;
+   struct srpc_buffer  *srpc_reqstbuf;
struct srpc_bulk*srpc_bulk;
 
unsigned int   srpc_aborted; /* being given up */
-- 
1.7.1

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


[PATCH 13/24] staging: lustre: selftest: convert sfw_test_case_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef sfw_test_case_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/framework.c |   16 
 drivers/staging/lustre/lnet/selftest/selftest.h  |4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 8d364b0..56bcc8c 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -118,10 +118,10 @@ static struct smoketest_framework {
 int sfw_stop_batch(struct sfw_batch *tsb, int force);
 void sfw_destroy_session(struct sfw_session *sn);
 
-static inline sfw_test_case_t *
+static inline struct sfw_test_case *
 sfw_find_test_case(int id)
 {
-   sfw_test_case_t *tsc;
+   struct sfw_test_case *tsc;
 
LASSERT(id <= SRPC_SERVICE_MAX_ID);
LASSERT(id > SRPC_FRAMEWORK_SERVICE_MAX_ID);
@@ -137,7 +137,7 @@ sfw_find_test_case(int id)
 static int
 sfw_register_test(struct srpc_service *service, struct sfw_test_client_ops 
*cliops)
 {
-   sfw_test_case_t *tsc;
+   struct sfw_test_case *tsc;
 
if (sfw_find_test_case(service->sv_id)) {
CERROR("Failed to register test %s (%d)\n",
@@ -145,7 +145,7 @@ sfw_register_test(struct srpc_service *service, struct 
sfw_test_client_ops *clio
return -EEXIST;
}
 
-   LIBCFS_ALLOC(tsc, sizeof(sfw_test_case_t));
+   LIBCFS_ALLOC(tsc, sizeof(struct sfw_test_case));
if (!tsc)
return -ENOMEM;
 
@@ -199,7 +199,7 @@ __must_hold(&sfw_data.fw_lock)
struct sfw_session *sn = sfw_data.fw_session;
int nactive = 0;
struct sfw_batch *tsb;
-   sfw_test_case_t *tsc;
+   struct sfw_test_case *tsc;
 
if (!sn)
return;
@@ -1629,7 +1629,7 @@ sfw_startup(void)
int rc;
int error;
struct srpc_service *sv;
-   sfw_test_case_t *tsc;
+   struct sfw_test_case *tsc;
 
if (session_timeout < 0) {
CERROR("Session timeout must be non-negative: %d\n",
@@ -1722,7 +1722,7 @@ void
 sfw_shutdown(void)
 {
struct srpc_service *sv;
-   sfw_test_case_t *tsc;
+   struct sfw_test_case*tsc;
int i;
 
spin_lock(&sfw_data.fw_lock);
@@ -1778,7 +1778,7 @@ sfw_shutdown(void)
 
while (!list_empty(&sfw_data.fw_tests)) {
tsc = list_entry(sfw_data.fw_tests.next,
-sfw_test_case_t, tsc_list);
+struct sfw_test_case, tsc_list);
 
srpc_wait_service_shutdown(tsc->tsc_srv_service);
 
diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h 
b/drivers/staging/lustre/lnet/selftest/selftest.h
index f08bc70..1a47772 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -407,11 +407,11 @@ struct sfw_test_unit {
struct swi_workitem tsu_worker; /* workitem of the test unit */
 };
 
-typedef struct sfw_test_case {
+struct sfw_test_case {
struct list_head  tsc_list; /* chain on fw_tests */
struct srpc_service *tsc_srv_service;   /* test service 
*/
struct sfw_test_client_ops  *tsc_cli_ops;   /* ops of test client */
-} sfw_test_case_t;
+};
 
 struct srpc_client_rpc *
 sfw_create_rpc(lnet_process_id_t peer, int service,
-- 
1.7.1

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


[PATCH 03/24] staging: lustre: selftest: convert srpc_bulk_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef srpc_bulk_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |   14 +++---
 drivers/staging/lustre/lnet/selftest/conrpc.c|4 ++--
 drivers/staging/lustre/lnet/selftest/framework.c |2 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |   18 +-
 drivers/staging/lustre/lnet/selftest/selftest.h  |   17 +
 5 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 1988cee..a3dec89 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -51,7 +51,7 @@ MODULE_PARM_DESC(brw_inject_errors, "# data errors to inject 
randomly, zero by d
 static void
 brw_client_fini(sfw_test_instance_t *tsi)
 {
-   srpc_bulk_t *bulk;
+   struct srpc_bulk *bulk;
sfw_test_unit_t *tsu;
 
LASSERT(tsi->tsi_is_client);
@@ -74,7 +74,7 @@ brw_client_init(sfw_test_instance_t *tsi)
int npg;
int len;
int opc;
-   srpc_bulk_t *bulk;
+   struct srpc_bulk *bulk;
sfw_test_unit_t *tsu;
 
LASSERT(sn);
@@ -224,7 +224,7 @@ bad_data:
 }
 
 static void
-brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)
+brw_fill_bulk(struct srpc_bulk *bk, int pattern, __u64 magic)
 {
int i;
struct page *pg;
@@ -236,7 +236,7 @@ brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)
 }
 
 static int
-brw_check_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)
+brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 magic)
 {
int i;
struct page *pg;
@@ -257,7 +257,7 @@ static int
 brw_client_prep_rpc(sfw_test_unit_t *tsu,
lnet_process_id_t dest, srpc_client_rpc_t **rpcpp)
 {
-   srpc_bulk_t *bulk = tsu->tsu_private;
+   struct srpc_bulk *bulk = tsu->tsu_private;
sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session;
srpc_client_rpc_t *rpc;
@@ -297,7 +297,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
if (rc)
return rc;
 
-   memcpy(&rpc->crpc_bulk, bulk, offsetof(srpc_bulk_t, bk_iovs[npg]));
+   memcpy(&rpc->crpc_bulk, bulk, offsetof(struct srpc_bulk, bk_iovs[npg]));
if (opc == LST_BRW_WRITE)
brw_fill_bulk(&rpc->crpc_bulk, flags, BRW_MAGIC);
else
@@ -361,7 +361,7 @@ brw_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t 
*rpc)
 static void
 brw_server_rpc_done(struct srpc_server_rpc *rpc)
 {
-   srpc_bulk_t *blk = rpc->srpc_bulk;
+   struct srpc_bulk *blk = rpc->srpc_bulk;
 
if (!blk)
return;
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 3908c10..53da5cb 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -150,7 +150,7 @@ lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned 
feats,
 void
 lstcon_rpc_put(lstcon_rpc_t *crpc)
 {
-   srpc_bulk_t *bulk = &crpc->crp_rpc->crpc_bulk;
+   struct srpc_bulk *bulk = &crpc->crp_rpc->crpc_bulk;
int i;
 
LASSERT(list_empty(&crpc->crp_link));
@@ -812,7 +812,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, 
unsigned feats,
lstcon_group_t *sgrp = test->tes_src_grp;
lstcon_group_t *dgrp = test->tes_dst_grp;
srpc_test_reqst_t *trq;
-   srpc_bulk_t *bulk;
+   struct srpc_bulk *bulk;
int i;
int npg = 0;
int nob = 0;
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index aa646a7..40a3da9 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -733,7 +733,7 @@ sfw_add_test_instance(sfw_batch_t *tsb, struct 
srpc_server_rpc *rpc)
 {
srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg;
srpc_test_reqst_t *req = &msg->msg_body.tes_reqst;
-   srpc_bulk_t *bk = rpc->srpc_bulk;
+   struct srpc_bulk *bk = rpc->srpc_bulk;
int ndest = req->tsr_ndest;
sfw_test_unit_t *tsu;
sfw_test_instance_t *tsi;
diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c 
b/drivers/staging/lustre/lnet/selftest/rpc.c
index ba75b34..387c306 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -88,7 +88,7 @@ void srpc_set_counters(const srpc_counters_t *cnt)
 }
 
 static int
-srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob)
+srpc_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i, int nob)
 {
nob = min_t(int, nob, PAGE_CACHE_SIZE);
 
@@ -102,7 +102,7 @@ srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, 
int nob)
 }
 
 void
-srpc_free_bulk(srpc_bulk_t *bk)
+srpc_free_bulk(struct srpc_bulk *bk)
 {
i

[PATCH 12/24] staging: lustre: selftest: convert sfw_test_unit_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef sfw_test_unit_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |8 
 drivers/staging/lustre/lnet/selftest/framework.c |   20 ++--
 drivers/staging/lustre/lnet/selftest/ping_test.c |4 ++--
 drivers/staging/lustre/lnet/selftest/selftest.h  |6 +++---
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 90fabd0..3455990 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -52,7 +52,7 @@ static void
 brw_client_fini(struct sfw_test_instance *tsi)
 {
struct srpc_bulk *bulk;
-   sfw_test_unit_t *tsu;
+   struct sfw_test_unit*tsu;
 
LASSERT(tsi->tsi_is_client);
 
@@ -75,7 +75,7 @@ brw_client_init(struct sfw_test_instance *tsi)
int len;
int opc;
struct srpc_bulk *bulk;
-   sfw_test_unit_t *tsu;
+   struct sfw_test_unit *tsu;
 
LASSERT(sn);
LASSERT(tsi->tsi_is_client);
@@ -254,7 +254,7 @@ brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 
magic)
 }
 
 static int
-brw_client_prep_rpc(sfw_test_unit_t *tsu,
+brw_client_prep_rpc(struct sfw_test_unit *tsu,
lnet_process_id_t dest, struct srpc_client_rpc **rpcpp)
 {
struct srpc_bulk *bulk = tsu->tsu_private;
@@ -313,7 +313,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
 }
 
 static void
-brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc)
+brw_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc)
 {
__u64 magic = BRW_MAGIC;
struct sfw_test_instance *tsi = tsu->tsu_instance;
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 5cc4807..8d364b0 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -528,7 +528,7 @@ sfw_debug_session(srpc_debug_reqst_t *request, 
srpc_debug_reply_t *reply)
 static void
 sfw_test_rpc_fini(struct srpc_client_rpc *rpc)
 {
-   sfw_test_unit_t *tsu = rpc->crpc_priv;
+   struct sfw_test_unit *tsu = rpc->crpc_priv;
struct sfw_test_instance *tsi = tsu->tsu_instance;
 
/* Called with hold of tsi->tsi_lock */
@@ -617,7 +617,7 @@ static void
 sfw_destroy_test_instance(struct sfw_test_instance *tsi)
 {
struct srpc_client_rpc *rpc;
-   sfw_test_unit_t *tsu;
+   struct sfw_test_unit *tsu;
 
if (!tsi->tsi_is_client)
goto clean;
@@ -630,7 +630,7 @@ sfw_destroy_test_instance(struct sfw_test_instance *tsi)
 
while (!list_empty(&tsi->tsi_units)) {
tsu = list_entry(tsi->tsi_units.next,
-sfw_test_unit_t, tsu_list);
+struct sfw_test_unit, tsu_list);
list_del(&tsu->tsu_list);
LIBCFS_FREE(tsu, sizeof(*tsu));
}
@@ -735,7 +735,7 @@ sfw_add_test_instance(struct sfw_batch *tsb, struct 
srpc_server_rpc *rpc)
srpc_test_reqst_t *req = &msg->msg_body.tes_reqst;
struct srpc_bulk *bk = rpc->srpc_bulk;
int ndest = req->tsr_ndest;
-   sfw_test_unit_t *tsu;
+   struct sfw_test_unit *tsu;
struct sfw_test_instance *tsi;
int i;
int rc;
@@ -795,7 +795,7 @@ sfw_add_test_instance(struct sfw_batch *tsb, struct 
srpc_server_rpc *rpc)
sfw_unpack_id(id);
 
for (j = 0; j < tsi->tsi_concur; j++) {
-   LIBCFS_ALLOC(tsu, sizeof(sfw_test_unit_t));
+   LIBCFS_ALLOC(tsu, sizeof(struct sfw_test_unit));
if (!tsu) {
rc = -ENOMEM;
CERROR("Can't allocate tsu for %d\n",
@@ -824,7 +824,7 @@ error:
 }
 
 static void
-sfw_test_unit_done(sfw_test_unit_t *tsu)
+sfw_test_unit_done(struct sfw_test_unit *tsu)
 {
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_batch *tsb = tsi->tsi_batch;
@@ -868,7 +868,7 @@ sfw_test_unit_done(sfw_test_unit_t *tsu)
 static void
 sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 {
-   sfw_test_unit_t *tsu = rpc->crpc_priv;
+   struct sfw_test_unit *tsu = rpc->crpc_priv;
struct sfw_test_instance *tsi = tsu->tsu_instance;
int done = 0;
 
@@ -900,7 +900,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 }
 
 int
-sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer,
+sfw_create_test_rpc(struct sfw_test_unit *tsu, lnet_process_id_t peer,
unsigned features, int nblk, int blklen,
struct srpc_client_rpc **rpcpp)
 {
@@ -944,7 +944,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t 
peer,
 static int
 sfw_run_test(struct swi_workitem *wi)
 {
-   sfw_test_unit_t *tsu = wi->swi_workitem

[PATCH 06/24] staging: lustre: selftest: convert srpc_client_rpc_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef srpc_client_rpc_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |6 ++--
 drivers/staging/lustre/lnet/selftest/conrpc.c|8 ++--
 drivers/staging/lustre/lnet/selftest/conrpc.h|2 +-
 drivers/staging/lustre/lnet/selftest/framework.c |   36 +-
 drivers/staging/lustre/lnet/selftest/ping_test.c |4 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |   32 
 drivers/staging/lustre/lnet/selftest/selftest.h  |   42 +++---
 7 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index a3dec89..442f431 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -255,12 +255,12 @@ brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 
magic)
 
 static int
 brw_client_prep_rpc(sfw_test_unit_t *tsu,
-   lnet_process_id_t dest, srpc_client_rpc_t **rpcpp)
+   lnet_process_id_t dest, struct srpc_client_rpc **rpcpp)
 {
struct srpc_bulk *bulk = tsu->tsu_private;
sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session;
-   srpc_client_rpc_t *rpc;
+   struct srpc_client_rpc *rpc;
srpc_brw_reqst_t *req;
int flags;
int npg;
@@ -313,7 +313,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
 }
 
 static void
-brw_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
+brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc)
 {
__u64 magic = BRW_MAGIC;
sfw_test_instance_t *tsi = tsu->tsu_instance;
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 53da5cb..0032457 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -50,7 +50,7 @@ void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *,
   lstcon_node_t *, lstcon_trans_stat_t *);
 
 static void
-lstcon_rpc_done(srpc_client_rpc_t *rpc)
+lstcon_rpc_done(struct srpc_client_rpc *rpc)
 {
lstcon_rpc_t *crpc = (lstcon_rpc_t *)rpc->crpc_priv;
 
@@ -287,7 +287,7 @@ lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, 
lstcon_rpc_t *crpc)
 void
 lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error)
 {
-   srpc_client_rpc_t *rpc;
+   struct srpc_client_rpc *rpc;
lstcon_rpc_t *crpc;
lstcon_node_t *nd;
 
@@ -389,7 +389,7 @@ static int
 lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
 {
lstcon_node_t *nd = crpc->crp_node;
-   srpc_client_rpc_t *rpc = crpc->crp_rpc;
+   struct srpc_client_rpc *rpc = crpc->crp_rpc;
srpc_generic_reply_t *rep;
 
LASSERT(nd && rpc);
@@ -541,7 +541,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 void
 lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)
 {
-   srpc_client_rpc_t *rpc;
+   struct srpc_client_rpc *rpc;
lstcon_rpc_t *crpc;
lstcon_rpc_t *tmp;
int count = 0;
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h 
b/drivers/staging/lustre/lnet/selftest/conrpc.h
index 3e7839d..6ddf088 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.h
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.h
@@ -65,7 +65,7 @@ struct lstcon_node;
 
 typedef struct lstcon_rpc {
struct list_head crp_link;  /* chain on rpc transaction */
-   srpc_client_rpc_t   *crp_rpc;   /* client rpc */
+   struct srpc_client_rpc  *crp_rpc;   /* client rpc */
struct lstcon_node  *crp_node;  /* destination node */
struct lstcon_rpc_trans *crp_trans; /* conrpc transaction */
 
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index b2df184..6c0af58 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -298,7 +298,7 @@ sfw_server_rpc_done(struct srpc_server_rpc *rpc)
 }
 
 static void
-sfw_client_rpc_fini(srpc_client_rpc_t *rpc)
+sfw_client_rpc_fini(struct srpc_client_rpc *rpc)
 {
LASSERT(!rpc->crpc_bulk.bk_niov);
LASSERT(list_empty(&rpc->crpc_list));
@@ -526,7 +526,7 @@ sfw_debug_session(srpc_debug_reqst_t *request, 
srpc_debug_reply_t *reply)
 }
 
 static void
-sfw_test_rpc_fini(srpc_client_rpc_t *rpc)
+sfw_test_rpc_fini(struct srpc_client_rpc *rpc)
 {
sfw_test_unit_t *tsu = rpc->crpc_priv;
sfw_test_instance_t *tsi = tsu->tsu_instance;
@@ -616,7 +616,7 @@ sfw_unload_test(struct sfw_test_instance *tsi)
 static void
 sfw_destroy_test_instance(sfw_test_instance_t *tsi)
 {
-   srpc_client_rpc_t *rpc;
+   struct srpc_client_rpc *rpc;
sfw_test_unit_t *tsu;
 
if (!tsi->tsi_is_client)
@@ -637,7 +637,7 @@ sfw_de

[PATCH 14/24] staging: lustre: selftest: convert lstcon_rpc_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_rpc_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |   50 
 drivers/staging/lustre/lnet/selftest/conrpc.h  |   18 
 drivers/staging/lustre/lnet/selftest/console.c |2 +-
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 0032457..edef693 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -52,7 +52,7 @@ void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *,
 static void
 lstcon_rpc_done(struct srpc_client_rpc *rpc)
 {
-   lstcon_rpc_t *crpc = (lstcon_rpc_t *)rpc->crpc_priv;
+   struct lstcon_rpc *crpc = (struct lstcon_rpc *)rpc->crpc_priv;
 
LASSERT(crpc && rpc == crpc->crp_rpc);
LASSERT(crpc->crp_posted && !crpc->crp_finished);
@@ -91,7 +91,7 @@ lstcon_rpc_done(struct srpc_client_rpc *rpc)
 
 static int
 lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats,
-   int bulk_npg, int bulk_len, int embedded, lstcon_rpc_t *crpc)
+   int bulk_npg, int bulk_len, int embedded, struct lstcon_rpc 
*crpc)
 {
crpc->crp_rpc = sfw_create_rpc(nd->nd_id, service,
   feats, bulk_npg, bulk_len,
@@ -116,15 +116,15 @@ lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned 
feats,
 
 static int
 lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats,
-   int bulk_npg, int bulk_len, lstcon_rpc_t **crpcpp)
+   int bulk_npg, int bulk_len, struct lstcon_rpc **crpcpp)
 {
-   lstcon_rpc_t *crpc = NULL;
+   struct lstcon_rpc *crpc = NULL;
int rc;
 
spin_lock(&console_session.ses_rpc_lock);
 
crpc = list_first_entry_or_null(&console_session.ses_rpc_freelist,
-   lstcon_rpc_t, crp_link);
+   struct lstcon_rpc, crp_link);
if (crpc)
list_del_init(&crpc->crp_link);
 
@@ -148,7 +148,7 @@ lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned 
feats,
 }
 
 void
-lstcon_rpc_put(lstcon_rpc_t *crpc)
+lstcon_rpc_put(struct lstcon_rpc *crpc)
 {
struct srpc_bulk *bulk = &crpc->crp_rpc->crpc_bulk;
int i;
@@ -183,7 +183,7 @@ lstcon_rpc_put(lstcon_rpc_t *crpc)
 }
 
 static void
-lstcon_rpc_post(lstcon_rpc_t *crpc)
+lstcon_rpc_post(struct lstcon_rpc *crpc)
 {
lstcon_rpc_trans_t *trans = crpc->crp_trans;
 
@@ -278,7 +278,7 @@ lstcon_rpc_trans_prep(struct list_head *translist, int 
transop,
 }
 
 void
-lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, lstcon_rpc_t *crpc)
+lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, struct lstcon_rpc *crpc)
 {
list_add_tail(&crpc->crp_link, &trans->tas_rpcs_list);
crpc->crp_trans = trans;
@@ -288,7 +288,7 @@ void
 lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error)
 {
struct srpc_client_rpc *rpc;
-   lstcon_rpc_t *crpc;
+   struct lstcon_rpc *crpc;
lstcon_node_t *nd;
 
list_for_each_entry(crpc, &trans->tas_rpcs_list, crp_link) {
@@ -338,7 +338,7 @@ lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans)
 int
 lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
 {
-   lstcon_rpc_t *crpc;
+   struct lstcon_rpc *crpc;
int rc;
 
if (list_empty(&trans->tas_rpcs_list))
@@ -386,7 +386,7 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int 
timeout)
 }
 
 static int
-lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
+lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp)
 {
lstcon_node_t *nd = crpc->crp_node;
struct srpc_client_rpc *rpc = crpc->crp_rpc;
@@ -425,7 +425,7 @@ lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
 void
 lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)
 {
-   lstcon_rpc_t *crpc;
+   struct lstcon_rpc *crpc;
srpc_msg_t *rep;
int error;
 
@@ -474,7 +474,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
struct list_head __user *next;
lstcon_rpc_ent_t *ent;
srpc_generic_reply_t *rep;
-   lstcon_rpc_t *crpc;
+   struct lstcon_rpc *crpc;
srpc_msg_t *msg;
lstcon_node_t *nd;
long dur;
@@ -542,8 +542,8 @@ void
 lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)
 {
struct srpc_client_rpc *rpc;
-   lstcon_rpc_t *crpc;
-   lstcon_rpc_t *tmp;
+   struct lstcon_rpc *crpc;
+   struct lstcon_rpc *tmp;
int count = 0;
 
list_for_each_entry_safe(crpc, tmp, &trans->tas_rpcs_list, crp_link) {
@@ -593,7 +593,7 @@ lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)
 
 int
 lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
-  unsigned feats, lstcon_rpc_t **crpc)
+  unsigned feats, struct lstcon_rpc **crpc)
 {
  

[PATCH 11/24] staging: lustre: selftest: convert sfw_test_instance_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef sfw_test_instance_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |8 +++---
 drivers/staging/lustre/lnet/selftest/framework.c |   26 +++---
 drivers/staging/lustre/lnet/selftest/ping_test.c |8 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |6 ++--
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 5cba2c3..90fabd0 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -49,7 +49,7 @@ module_param(brw_inject_errors, int, 0644);
 MODULE_PARM_DESC(brw_inject_errors, "# data errors to inject randomly, zero by 
default");
 
 static void
-brw_client_fini(sfw_test_instance_t *tsi)
+brw_client_fini(struct sfw_test_instance *tsi)
 {
struct srpc_bulk *bulk;
sfw_test_unit_t *tsu;
@@ -67,7 +67,7 @@ brw_client_fini(sfw_test_instance_t *tsi)
 }
 
 static int
-brw_client_init(sfw_test_instance_t *tsi)
+brw_client_init(struct sfw_test_instance *tsi)
 {
struct sfw_session *sn = tsi->tsi_batch->bat_session;
int flags;
@@ -258,7 +258,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,
lnet_process_id_t dest, struct srpc_client_rpc **rpcpp)
 {
struct srpc_bulk *bulk = tsu->tsu_private;
-   sfw_test_instance_t *tsi = tsu->tsu_instance;
+   struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
struct srpc_client_rpc *rpc;
srpc_brw_reqst_t *req;
@@ -316,7 +316,7 @@ static void
 brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc)
 {
__u64 magic = BRW_MAGIC;
-   sfw_test_instance_t *tsi = tsu->tsu_instance;
+   struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
srpc_msg_t *msg = &rpc->crpc_replymsg;
srpc_brw_reply_t *reply = &msg->msg_body.brw_reply;
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index d42ee18..5cc4807 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -529,7 +529,7 @@ static void
 sfw_test_rpc_fini(struct srpc_client_rpc *rpc)
 {
sfw_test_unit_t *tsu = rpc->crpc_priv;
-   sfw_test_instance_t *tsi = tsu->tsu_instance;
+   struct sfw_test_instance *tsi = tsu->tsu_instance;
 
/* Called with hold of tsi->tsi_lock */
LASSERT(list_empty(&rpc->crpc_list));
@@ -537,7 +537,7 @@ sfw_test_rpc_fini(struct srpc_client_rpc *rpc)
 }
 
 static inline int
-sfw_test_buffers(sfw_test_instance_t *tsi)
+sfw_test_buffers(struct sfw_test_instance *tsi)
 {
struct sfw_test_case *tsc;
struct srpc_service *svc;
@@ -614,7 +614,7 @@ sfw_unload_test(struct sfw_test_instance *tsi)
 }
 
 static void
-sfw_destroy_test_instance(sfw_test_instance_t *tsi)
+sfw_destroy_test_instance(struct sfw_test_instance *tsi)
 {
struct srpc_client_rpc *rpc;
sfw_test_unit_t *tsu;
@@ -650,14 +650,14 @@ clean:
 static void
 sfw_destroy_batch(struct sfw_batch *tsb)
 {
-   sfw_test_instance_t *tsi;
+   struct sfw_test_instance *tsi;
 
LASSERT(!sfw_batch_active(tsb));
LASSERT(list_empty(&tsb->bat_list));
 
while (!list_empty(&tsb->bat_tests)) {
tsi = list_entry(tsb->bat_tests.next,
-sfw_test_instance_t, tsi_list);
+struct sfw_test_instance, tsi_list);
list_del_init(&tsi->tsi_list);
sfw_destroy_test_instance(tsi);
}
@@ -736,7 +736,7 @@ sfw_add_test_instance(struct sfw_batch *tsb, struct 
srpc_server_rpc *rpc)
struct srpc_bulk *bk = rpc->srpc_bulk;
int ndest = req->tsr_ndest;
sfw_test_unit_t *tsu;
-   sfw_test_instance_t *tsi;
+   struct sfw_test_instance *tsi;
int i;
int rc;
 
@@ -826,7 +826,7 @@ error:
 static void
 sfw_test_unit_done(sfw_test_unit_t *tsu)
 {
-   sfw_test_instance_t *tsi = tsu->tsu_instance;
+   struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_batch *tsb = tsi->tsi_batch;
struct sfw_session *sn = tsb->bat_session;
 
@@ -869,7 +869,7 @@ static void
 sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 {
sfw_test_unit_t *tsu = rpc->crpc_priv;
-   sfw_test_instance_t *tsi = tsu->tsu_instance;
+   struct sfw_test_instance *tsi = tsu->tsu_instance;
int done = 0;
 
tsi->tsi_ops->tso_done_rpc(tsu, rpc);
@@ -905,7 +905,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t 
peer,
struct srpc_client_rpc **rpcpp)
 {
struct srpc_client_rpc *rpc = NULL;
-   sfw_test_instance_t *tsi = tsu->tsu_instance;
+   struct sfw_test_instance

[PATCH 19/24] staging: lustre: selftest: convert lstcon_tsb_hdr_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_tsb_hdr_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |5 +++--
 drivers/staging/lustre/lnet/selftest/console.c |2 +-
 drivers/staging/lustre/lnet/selftest/console.h |8 
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 3aae59b..be94b9c 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -650,7 +650,7 @@ lstcon_dbgrpc_prep(struct lstcon_node *nd, unsigned feats, 
struct lstcon_rpc **c
 
 int
 lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
-  lstcon_tsb_hdr_t *tsb, struct lstcon_rpc **crpc)
+  struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc)
 {
lstcon_batch_t *batch;
srpc_batch_reqst_t *brq;
@@ -1135,7 +1135,8 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
case LST_TRANS_TSBCLIQRY:
case LST_TRANS_TSBSRVQRY:
rc = lstcon_batrpc_prep(nd, transop, feats,
-   (lstcon_tsb_hdr_t *)arg, &rpc);
+   (struct lstcon_tsb_hdr *)arg,
+   &rpc);
break;
case LST_TRANS_STATQRY:
rc = lstcon_statrpc_prep(nd, feats, &rpc);
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index 47338f5..41f732b 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -1406,7 +1406,7 @@ lstcon_test_batch_query(char *name, int testidx, int 
client,
struct lstcon_rpc_trans *trans;
struct list_head *translist;
struct list_head *ndlist;
-   lstcon_tsb_hdr_t *hdr;
+   struct lstcon_tsb_hdr *hdr;
lstcon_batch_t *batch;
lstcon_test_t *test = NULL;
int transop;
diff --git a/drivers/staging/lustre/lnet/selftest/console.h 
b/drivers/staging/lustre/lnet/selftest/console.h
index 74bfcd8..427bc9b 100644
--- a/drivers/staging/lustre/lnet/selftest/console.h
+++ b/drivers/staging/lustre/lnet/selftest/console.h
@@ -84,13 +84,13 @@ struct lstcon_group {
 #define LST_BATCH_IDLE   0xB0  /* idle batch */
 #define LST_BATCH_RUNNING 0xB1 /* running batch */
 
-typedef struct lstcon_tsb_hdr {
+struct lstcon_tsb_hdr {
lst_bid_ttsb_id; /* batch ID */
int  tsb_index;  /* test index */
-} lstcon_tsb_hdr_t;
+};
 
 typedef struct {
-   lstcon_tsb_hdr_t bat_hdr; /* test_batch header */
+   struct lstcon_tsb_hdr   bat_hdr;/* test_batch header */
struct list_head bat_link;/* chain on session's batches list */
int  bat_ntest;   /* # of test */
int  bat_state;   /* state of the batch */
@@ -109,7 +109,7 @@ typedef struct {
 } lstcon_batch_t; /* (tests ) batch descriptor */
 
 typedef struct lstcon_test {
-   lstcon_tsb_hdr_t tes_hdr;/* test batch header */
+   struct lstcon_tsb_hdr   tes_hdr;/* test batch header */
struct list_head tes_link;   /* chain on batch's tests list */
lstcon_batch_t   *tes_batch; /* pointer to batch */
 
-- 
1.7.1

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


[PATCH 15/24] staging: lustre: selftest: convert lstcon_rpc_trans_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_rpc_trans_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |   36 
 drivers/staging/lustre/lnet/selftest/conrpc.h  |   20 ++--
 drivers/staging/lustre/lnet/selftest/console.c |   20 ++--
 drivers/staging/lustre/lnet/selftest/console.h |2 +-
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index edef693..aab4be6 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -46,7 +46,7 @@
 #include "conrpc.h"
 #include "console.h"
 
-void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *,
+void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, srpc_msg_t *,
   lstcon_node_t *, lstcon_trans_stat_t *);
 
 static void
@@ -185,7 +185,7 @@ lstcon_rpc_put(struct lstcon_rpc *crpc)
 static void
 lstcon_rpc_post(struct lstcon_rpc *crpc)
 {
-   lstcon_rpc_trans_t *trans = crpc->crp_trans;
+   struct lstcon_rpc_trans *trans = crpc->crp_trans;
 
LASSERT(trans);
 
@@ -236,9 +236,9 @@ lstcon_rpc_trans_name(int transop)
 
 int
 lstcon_rpc_trans_prep(struct list_head *translist, int transop,
- lstcon_rpc_trans_t **transpp)
+ struct lstcon_rpc_trans **transpp)
 {
-   lstcon_rpc_trans_t *trans;
+   struct lstcon_rpc_trans *trans;
 
if (translist) {
list_for_each_entry(trans, translist, tas_link) {
@@ -278,14 +278,14 @@ lstcon_rpc_trans_prep(struct list_head *translist, int 
transop,
 }
 
 void
-lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, struct lstcon_rpc *crpc)
+lstcon_rpc_trans_addreq(struct lstcon_rpc_trans *trans, struct lstcon_rpc 
*crpc)
 {
list_add_tail(&crpc->crp_link, &trans->tas_rpcs_list);
crpc->crp_trans = trans;
 }
 
 void
-lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error)
+lstcon_rpc_trans_abort(struct lstcon_rpc_trans *trans, int error)
 {
struct srpc_client_rpc *rpc;
struct lstcon_rpc *crpc;
@@ -326,7 +326,7 @@ lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error)
 }
 
 static int
-lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans)
+lstcon_rpc_trans_check(struct lstcon_rpc_trans *trans)
 {
if (console_session.ses_shutdown &&
!list_empty(&trans->tas_olink)) /* Not an end session RPC */
@@ -336,7 +336,7 @@ lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans)
 }
 
 int
-lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
+lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, int timeout)
 {
struct lstcon_rpc *crpc;
int rc;
@@ -423,7 +423,7 @@ lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t 
**msgpp)
 }
 
 void
-lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)
+lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, lstcon_trans_stat_t 
*stat)
 {
struct lstcon_rpc *crpc;
srpc_msg_t *rep;
@@ -466,7 +466,7 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, 
lstcon_trans_stat_t *stat)
 }
 
 int
-lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
+lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
 struct list_head __user *head_up,
 lstcon_rpc_readent_func_t readent)
 {
@@ -539,7 +539,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 }
 
 void
-lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)
+lstcon_rpc_trans_destroy(struct lstcon_rpc_trans *trans)
 {
struct srpc_client_rpc *rpc;
struct lstcon_rpc *crpc;
@@ -915,7 +915,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, 
unsigned feats,
 }
 
 static int
-lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans,
+lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans,
 lstcon_node_t *nd, srpc_msg_t *reply)
 {
srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply;
@@ -962,7 +962,7 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans,
 }
 
 void
-lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
+lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, srpc_msg_t *msg,
  lstcon_node_t *nd, lstcon_trans_stat_t *stat)
 {
srpc_rmsn_reply_t *rmsn_rep;
@@ -1083,9 +1083,9 @@ int
 lstcon_rpc_trans_ndlist(struct list_head *ndlist,
struct list_head *translist, int transop,
void *arg, lstcon_rpc_cond_func_t condition,
-   lstcon_rpc_trans_t **transpp)
+   struct lstcon_rpc_trans **transpp)
 {
-   lstcon_rpc_trans_t *trans;
+   struct lstcon_rpc_trans *trans;
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
struct lstcon_rpc *rpc;
@@ -1168,7 +1168,7 @@ static void
 lstcon_rpc_pinger(void *arg)
 {
struct stt_timer *ptimer = (struct stt_ti

[PATCH 24/24] staging: lustre: selftest: change srpc_state_t to proper enum

2016-04-06 Thread James Simmons
Turn typedef srpc_state_t to proper enum

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/rpc.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c 
b/drivers/staging/lustre/lnet/selftest/rpc.c
index 812b9a5..4a45904 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -46,19 +46,19 @@
 
 #include "selftest.h"
 
-typedef enum {
+enum srpc_state {
SRPC_STATE_NONE,
SRPC_STATE_NI_INIT,
SRPC_STATE_EQ_INIT,
SRPC_STATE_RUNNING,
SRPC_STATE_STOPPING,
-} srpc_state_t;
+};
 
 static struct smoketest_rpc {
spinlock_t   rpc_glock; /* global lock */
struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1];
lnet_handle_eq_t rpc_lnet_eq;   /* _the_ LNet event queue */
-   srpc_state_t rpc_state;
+   enum srpc_state  rpc_state;
srpc_counters_t  rpc_counters;
__u64rpc_matchbits; /* matchbits counter */
 } srpc_data;
-- 
1.7.1

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


[PATCH 18/24] staging: lustre: selftest: convert lstcon_group_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_group_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |6 +-
 drivers/staging/lustre/lnet/selftest/console.c |   80 
 drivers/staging/lustre/lnet/selftest/console.h |9 ++-
 3 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 5cbd631..3aae59b 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -715,7 +715,7 @@ lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov)
 }
 
 static int
-lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
+lstcon_dstnodes_prep(struct lstcon_group *grp, int idx,
 int dist, int span, int nkiov, lnet_kiov_t *kiov)
 {
lnet_process_id_packed_t *pid;
@@ -809,8 +809,8 @@ int
 lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
lstcon_test_t *test, struct lstcon_rpc **crpc)
 {
-   lstcon_group_t *sgrp = test->tes_src_grp;
-   lstcon_group_t *dgrp = test->tes_dst_grp;
+   struct lstcon_group *sgrp = test->tes_src_grp;
+   struct lstcon_group *dgrp = test->tes_dst_grp;
srpc_test_reqst_t *trq;
struct srpc_bulk *bulk;
int i;
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index e068c13..47338f5 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -196,12 +196,12 @@ lstcon_ndlink_release(struct lstcon_ndlink *ndl)
 }
 
 static int
-lstcon_group_alloc(char *name, lstcon_group_t **grpp)
+lstcon_group_alloc(char *name, struct lstcon_group **grpp)
 {
-   lstcon_group_t *grp;
+   struct lstcon_group *grp;
int i;
 
-   LIBCFS_ALLOC(grp, offsetof(lstcon_group_t,
+   LIBCFS_ALLOC(grp, offsetof(struct lstcon_group,
   grp_ndl_hash[LST_NODE_HASHSIZE]));
if (!grp)
return -ENOMEM;
@@ -209,7 +209,7 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp)
grp->grp_ref = 1;
if (name) {
if (strlen(name) > sizeof(grp->grp_name) - 1) {
-   LIBCFS_FREE(grp, offsetof(lstcon_group_t,
+   LIBCFS_FREE(grp, offsetof(struct lstcon_group,
grp_ndl_hash[LST_NODE_HASHSIZE]));
return -E2BIG;
}
@@ -229,15 +229,15 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp)
 }
 
 static void
-lstcon_group_addref(lstcon_group_t *grp)
+lstcon_group_addref(struct lstcon_group *grp)
 {
grp->grp_ref++;
 }
 
-static void lstcon_group_ndlink_release(lstcon_group_t *, struct lstcon_ndlink 
*);
+static void lstcon_group_ndlink_release(struct lstcon_group *, struct 
lstcon_ndlink *);
 
 static void
-lstcon_group_drain(lstcon_group_t *grp, int keep)
+lstcon_group_drain(struct lstcon_group *grp, int keep)
 {
struct lstcon_ndlink *ndl;
struct lstcon_ndlink *tmp;
@@ -249,7 +249,7 @@ lstcon_group_drain(lstcon_group_t *grp, int keep)
 }
 
 static void
-lstcon_group_decref(lstcon_group_t *grp)
+lstcon_group_decref(struct lstcon_group *grp)
 {
int i;
 
@@ -264,14 +264,14 @@ lstcon_group_decref(lstcon_group_t *grp)
for (i = 0; i < LST_NODE_HASHSIZE; i++)
LASSERT(list_empty(&grp->grp_ndl_hash[i]));
 
-   LIBCFS_FREE(grp, offsetof(lstcon_group_t,
+   LIBCFS_FREE(grp, offsetof(struct lstcon_group,
  grp_ndl_hash[LST_NODE_HASHSIZE]));
 }
 
 static int
-lstcon_group_find(const char *name, lstcon_group_t **grpp)
+lstcon_group_find(const char *name, struct lstcon_group **grpp)
 {
-   lstcon_group_t *grp;
+   struct lstcon_group *grp;
 
list_for_each_entry(grp, &console_session.ses_grp_list, grp_link) {
if (strncmp(grp->grp_name, name, LST_NAME_SIZE))
@@ -286,7 +286,7 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp)
 }
 
 static int
-lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
+lstcon_group_ndlink_find(struct lstcon_group *grp, lnet_process_id_t id,
 struct lstcon_ndlink **ndlpp, int create)
 {
int rc;
@@ -305,7 +305,7 @@ lstcon_group_ndlink_find(lstcon_group_t *grp, 
lnet_process_id_t id,
 }
 
 static void
-lstcon_group_ndlink_release(lstcon_group_t *grp, struct lstcon_ndlink *ndl)
+lstcon_group_ndlink_release(struct lstcon_group *grp, struct lstcon_ndlink 
*ndl)
 {
list_del_init(&ndl->ndl_link);
lstcon_ndlink_release(ndl);
@@ -313,8 +313,8 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, struct 
lstcon_ndlink *ndl)
 }
 
 static void
-lstcon_group_ndlink_move(lstcon_group_t *old,
-lstcon_group_t *new, struct lstcon_ndlink *ndl)
+lstcon_group_ndlink_move(struct lstcon_group *old,
+

[PATCH 16/24] staging: lustre: selftest: convert lstcon_node_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_node_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |   32 
 drivers/staging/lustre/lnet/selftest/console.c |   20 +++---
 drivers/staging/lustre/lnet/selftest/console.h |9 +++---
 3 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index aab4be6..194b6dc 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -47,7 +47,7 @@
 #include "console.h"
 
 void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, srpc_msg_t *,
-  lstcon_node_t *, lstcon_trans_stat_t *);
+  struct lstcon_node *, lstcon_trans_stat_t *);
 
 static void
 lstcon_rpc_done(struct srpc_client_rpc *rpc)
@@ -90,7 +90,7 @@ lstcon_rpc_done(struct srpc_client_rpc *rpc)
 }
 
 static int
-lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats,
+lstcon_rpc_init(struct lstcon_node *nd, int service, unsigned feats,
int bulk_npg, int bulk_len, int embedded, struct lstcon_rpc 
*crpc)
 {
crpc->crp_rpc = sfw_create_rpc(nd->nd_id, service,
@@ -115,7 +115,7 @@ lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned 
feats,
 }
 
 static int
-lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats,
+lstcon_rpc_prep(struct lstcon_node *nd, int service, unsigned feats,
int bulk_npg, int bulk_len, struct lstcon_rpc **crpcpp)
 {
struct lstcon_rpc *crpc = NULL;
@@ -289,7 +289,7 @@ lstcon_rpc_trans_abort(struct lstcon_rpc_trans *trans, int 
error)
 {
struct srpc_client_rpc *rpc;
struct lstcon_rpc *crpc;
-   lstcon_node_t *nd;
+   struct lstcon_node *nd;
 
list_for_each_entry(crpc, &trans->tas_rpcs_list, crp_link) {
rpc = crpc->crp_rpc;
@@ -388,7 +388,7 @@ lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, 
int timeout)
 static int
 lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp)
 {
-   lstcon_node_t *nd = crpc->crp_node;
+   struct lstcon_node *nd = crpc->crp_node;
struct srpc_client_rpc *rpc = crpc->crp_rpc;
srpc_generic_reply_t *rep;
 
@@ -476,7 +476,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
srpc_generic_reply_t *rep;
struct lstcon_rpc *crpc;
srpc_msg_t *msg;
-   lstcon_node_t *nd;
+   struct lstcon_node *nd;
long dur;
struct timeval tv;
int error;
@@ -592,7 +592,7 @@ lstcon_rpc_trans_destroy(struct lstcon_rpc_trans *trans)
 }
 
 int
-lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
+lstcon_sesrpc_prep(struct lstcon_node *nd, int transop,
   unsigned feats, struct lstcon_rpc **crpc)
 {
srpc_mksn_reqst_t *msrq;
@@ -631,7 +631,7 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
 }
 
 int
-lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc **crpc)
+lstcon_dbgrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc 
**crpc)
 {
srpc_debug_reqst_t *drq;
int rc;
@@ -649,7 +649,7 @@ lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, 
struct lstcon_rpc **crpc)
 }
 
 int
-lstcon_batrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
+lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
   lstcon_tsb_hdr_t *tsb, struct lstcon_rpc **crpc)
 {
lstcon_batch_t *batch;
@@ -682,7 +682,7 @@ lstcon_batrpc_prep(lstcon_node_t *nd, int transop, unsigned 
feats,
 }
 
 int
-lstcon_statrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc 
**crpc)
+lstcon_statrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc 
**crpc)
 {
srpc_stat_reqst_t *srq;
int rc;
@@ -720,7 +720,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
 {
lnet_process_id_packed_t *pid;
lstcon_ndlink_t *ndl;
-   lstcon_node_t *nd;
+   struct lstcon_node *nd;
int start;
int end;
int i = 0;
@@ -806,7 +806,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, 
srpc_test_reqst_t *req)
 }
 
 int
-lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
+lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
lstcon_test_t *test, struct lstcon_rpc **crpc)
 {
lstcon_group_t *sgrp = test->tes_src_grp;
@@ -916,7 +916,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, 
unsigned feats,
 
 static int
 lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans,
-lstcon_node_t *nd, srpc_msg_t *reply)
+struct lstcon_node *nd, srpc_msg_t *reply)
 {
srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply;
int status = mksn_rep->mksn_status;
@@ -963,7 +963,7 @@ lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans,
 
 void
 lstcon_rpc_stat

[PATCH 20/24] staging: lustre: selftest: convert lstcon_batch_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_batch_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |4 +-
 drivers/staging/lustre/lnet/selftest/console.c |   46 
 drivers/staging/lustre/lnet/selftest/console.h |7 ++--
 3 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index be94b9c..19c9b5c 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -652,7 +652,7 @@ int
 lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
   struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc)
 {
-   lstcon_batch_t *batch;
+   struct lstcon_batch *batch;
srpc_batch_reqst_t *brq;
int rc;
 
@@ -675,7 +675,7 @@ lstcon_batrpc_prep(struct lstcon_node *nd, int transop, 
unsigned feats,
 
LASSERT(!tsb->tsb_index);
 
-   batch = (lstcon_batch_t *)tsb;
+   batch = (struct lstcon_batch *)tsb;
brq->bar_arg = batch->bat_arg;
 
return 0;
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index 41f732b..deb0bc0 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -828,9 +828,9 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user 
*gents_p,
 }
 
 static int
-lstcon_batch_find(const char *name, lstcon_batch_t **batpp)
+lstcon_batch_find(const char *name, struct lstcon_batch **batpp)
 {
-   lstcon_batch_t *bat;
+   struct lstcon_batch *bat;
 
list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) {
if (!strncmp(bat->bat_name, name, LST_NAME_SIZE)) {
@@ -845,7 +845,7 @@ lstcon_batch_find(const char *name, lstcon_batch_t **batpp)
 int
 lstcon_batch_add(char *name)
 {
-   lstcon_batch_t *bat;
+   struct lstcon_batch *bat;
int i;
int rc;
 
@@ -855,7 +855,7 @@ lstcon_batch_add(char *name)
return rc;
}
 
-   LIBCFS_ALLOC(bat, sizeof(lstcon_batch_t));
+   LIBCFS_ALLOC(bat, sizeof(struct lstcon_batch));
if (!bat) {
CERROR("Can't allocate descriptor for batch %s\n", name);
return -ENOMEM;
@@ -865,7 +865,7 @@ lstcon_batch_add(char *name)
 sizeof(struct list_head) * LST_NODE_HASHSIZE);
if (!bat->bat_cli_hash) {
CERROR("Can't allocate hash for batch %s\n", name);
-   LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
+   LIBCFS_FREE(bat, sizeof(struct lstcon_batch));
 
return -ENOMEM;
}
@@ -875,7 +875,7 @@ lstcon_batch_add(char *name)
if (!bat->bat_srv_hash) {
CERROR("Can't allocate hash for batch %s\n", name);
LIBCFS_FREE(bat->bat_cli_hash, LST_NODE_HASHSIZE);
-   LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
+   LIBCFS_FREE(bat, sizeof(struct lstcon_batch));
 
return -ENOMEM;
}
@@ -883,7 +883,7 @@ lstcon_batch_add(char *name)
if (strlen(name) > sizeof(bat->bat_name) - 1) {
LIBCFS_FREE(bat->bat_srv_hash, LST_NODE_HASHSIZE);
LIBCFS_FREE(bat->bat_cli_hash, LST_NODE_HASHSIZE);
-   LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
+   LIBCFS_FREE(bat, sizeof(struct lstcon_batch));
return -E2BIG;
}
strncpy(bat->bat_name, name, sizeof(bat->bat_name));
@@ -911,7 +911,7 @@ lstcon_batch_add(char *name)
 int
 lstcon_batch_list(int index, int len, char __user *name_up)
 {
-   lstcon_batch_t *bat;
+   struct lstcon_batch *bat;
 
LASSERT(name_up);
LASSERT(index >= 0);
@@ -935,7 +935,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t 
__user *ent_up,
struct list_head *clilst;
struct list_head *srvlst;
lstcon_test_t *test = NULL;
-   lstcon_batch_t *bat;
+   struct lstcon_batch *bat;
struct lstcon_ndlink*ndl;
int rc;
 
@@ -1020,7 +1020,7 @@ lstcon_batrpc_condition(int transop, struct lstcon_node 
*nd, void *arg)
 }
 
 static int
-lstcon_batch_op(lstcon_batch_t *bat, int transop,
+lstcon_batch_op(struct lstcon_batch *bat, int transop,
struct list_head __user *result_up)
 {
struct lstcon_rpc_trans *trans;
@@ -1046,7 +1046,7 @@ lstcon_batch_op(lstcon_batch_t *bat, int transop,
 int
 lstcon_batch_run(char *name, int timeout, struct list_head __user *result_up)
 {
-   lstcon_batch_t *bat;
+   struct lstcon_batch *bat;
int rc;
 
if (lstcon_batch_find(name, &bat)) {
@@ -1068,7 +1068,7 @@ lstcon_batch_run(char *name, int timeout, struct 
list_head __user *result_up)
 int
 lstcon_batch_stop(char *name, int force, struct list_head __user *result_up)
 {
-   lstcon_batch_t *bat;
+   struct lstcon_batch *bat;

[PATCH 21/24] staging: lustre: selftest: convert lstcon_test_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_test_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conctl.c  |2 +-
 drivers/staging/lustre/lnet/selftest/conrpc.c  |5 ++-
 drivers/staging/lustre/lnet/selftest/console.c |   26 
 drivers/staging/lustre/lnet/selftest/console.h |7 +++--
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c 
b/drivers/staging/lustre/lnet/selftest/conctl.c
index 6e2a81d..730122f 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -743,7 +743,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args)
if (args->lstio_tes_param &&
(args->lstio_tes_param_len <= 0 ||
 args->lstio_tes_param_len >
-PAGE_CACHE_SIZE - sizeof(lstcon_test_t)))
+PAGE_CACHE_SIZE - sizeof(struct lstcon_test)))
return -EINVAL;
 
LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1);
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 19c9b5c..5cec1c9 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -807,7 +807,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, 
srpc_test_reqst_t *req)
 
 int
 lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
-   lstcon_test_t *test, struct lstcon_rpc **crpc)
+   struct lstcon_test *test, struct lstcon_rpc **crpc)
 {
struct lstcon_group *sgrp = test->tes_src_grp;
struct lstcon_group *dgrp = test->tes_dst_grp;
@@ -1128,7 +1128,8 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
case LST_TRANS_TSBCLIADD:
case LST_TRANS_TSBSRVADD:
rc = lstcon_testrpc_prep(nd, transop, feats,
-(lstcon_test_t *)arg, &rpc);
+(struct lstcon_test *)arg,
+&rpc);
break;
case LST_TRANS_TSBRUN:
case LST_TRANS_TSBSTOP:
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index deb0bc0..cdbcee7 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -934,7 +934,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t 
__user *ent_up,
lstcon_test_batch_ent_t *entp;
struct list_head *clilst;
struct list_head *srvlst;
-   lstcon_test_t *test = NULL;
+   struct lstcon_test *test = NULL;
struct lstcon_batch *bat;
struct lstcon_ndlink*ndl;
int rc;
@@ -1091,14 +1091,14 @@ static void
 lstcon_batch_destroy(struct lstcon_batch *bat)
 {
struct lstcon_ndlink *ndl;
-   lstcon_test_t *test;
+   struct lstcon_test *test;
int i;
 
list_del(&bat->bat_link);
 
while (!list_empty(&bat->bat_test_list)) {
test = list_entry(bat->bat_test_list.next,
- lstcon_test_t, tes_link);
+ struct lstcon_test, tes_link);
LASSERT(list_empty(&test->tes_trans_list));
 
list_del(&test->tes_link);
@@ -1106,7 +1106,7 @@ lstcon_batch_destroy(struct lstcon_batch *bat)
lstcon_group_decref(test->tes_src_grp);
lstcon_group_decref(test->tes_dst_grp);
 
-   LIBCFS_FREE(test, offsetof(lstcon_test_t,
+   LIBCFS_FREE(test, offsetof(struct lstcon_test,
   tes_param[test->tes_paramlen]));
}
 
@@ -1143,13 +1143,13 @@ lstcon_batch_destroy(struct lstcon_batch *bat)
 static int
 lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg)
 {
-   lstcon_test_t *test;
+   struct lstcon_test *test;
struct lstcon_batch *batch;
struct lstcon_ndlink *ndl;
struct list_head *hash;
struct list_head *head;
 
-   test = (lstcon_test_t *)arg;
+   test = (struct lstcon_test *)arg;
LASSERT(test);
 
batch = test->tes_batch;
@@ -1185,7 +1185,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node 
*nd, void *arg)
 }
 
 static int
-lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up)
+lstcon_test_nodes_add(struct lstcon_test *test, struct list_head __user 
*result_up)
 {
struct lstcon_rpc_trans *trans;
struct lstcon_group *grp;
@@ -1283,7 +1283,7 @@ lstcon_test_add(char *batch_name, int type, int loop,
void *param, int paramlen, int *retp,
struct list_head __user *result_up)
 {
-   lstcon_test_t *test = NULL;
+   struct lstcon_test *test = NULL;
int rc;
struct lstcon_

[PATCH 23/24] staging: lustre: selftest: convert wire protocol to use struct

2016-04-06 Thread James Simmons
Change all the wire protocol typedefs to proper structures

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |   22 ++--
 drivers/staging/lustre/lnet/selftest/conrpc.c|   44 +++---
 drivers/staging/lustre/lnet/selftest/console.c   |   10 +-
 drivers/staging/lustre/lnet/selftest/framework.c |   54 
 drivers/staging/lustre/lnet/selftest/ping_test.c |   10 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |6 +-
 drivers/staging/lustre/lnet/selftest/rpc.h   |  150 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |   13 +-
 8 files changed, 156 insertions(+), 153 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 02c8dae..da0443c 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -81,7 +81,7 @@ brw_client_init(struct sfw_test_instance *tsi)
LASSERT(tsi->tsi_is_client);
 
if (!(sn->sn_features & LST_FEAT_BULK_LEN)) {
-   test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0;
+   struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0;
 
opc = breq->blk_opc;
flags = breq->blk_flags;
@@ -92,7 +92,7 @@ brw_client_init(struct sfw_test_instance *tsi)
 */
len = npg * PAGE_CACHE_SIZE;
} else {
-   test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;
+   struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1;
 
/*
 * I should never get this step if it's unknown feature
@@ -261,7 +261,7 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu,
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
struct srpc_client_rpc *rpc;
-   srpc_brw_reqst_t *req;
+   struct srpc_brw_reqst *req;
int flags;
int npg;
int len;
@@ -272,14 +272,14 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu,
LASSERT(bulk);
 
if (!(sn->sn_features & LST_FEAT_BULK_LEN)) {
-   test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0;
+   struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0;
 
opc = breq->blk_opc;
flags = breq->blk_flags;
npg = breq->blk_npg;
len = npg * PAGE_CACHE_SIZE;
} else {
-   test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;
+   struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1;
 
/*
 * I should never get this step if it's unknown feature
@@ -319,8 +319,8 @@ brw_client_done_rpc(struct sfw_test_unit *tsu, struct 
srpc_client_rpc *rpc)
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
struct srpc_msg *msg = &rpc->crpc_replymsg;
-   srpc_brw_reply_t *reply = &msg->msg_body.brw_reply;
-   srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
+   struct srpc_brw_reply *reply = &msg->msg_body.brw_reply;
+   struct srpc_brw_reqst *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
 
LASSERT(sn);
 
@@ -382,8 +382,8 @@ static int
 brw_bulk_ready(struct srpc_server_rpc *rpc, int status)
 {
__u64 magic = BRW_MAGIC;
-   srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply;
-   srpc_brw_reqst_t *reqst;
+   struct srpc_brw_reply *reply = &rpc->srpc_replymsg.msg_body.brw_reply;
+   struct srpc_brw_reqst *reqst;
struct srpc_msg *reqstmsg;
 
LASSERT(rpc->srpc_bulk);
@@ -420,8 +420,8 @@ brw_server_handle(struct srpc_server_rpc *rpc)
struct srpc_service *sv = rpc->srpc_scd->scd_svc;
struct srpc_msg *replymsg = &rpc->srpc_replymsg;
struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;
-   srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply;
-   srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst;
+   struct srpc_brw_reply *reply = &replymsg->msg_body.brw_reply;
+   struct srpc_brw_reqst *reqst = &reqstmsg->msg_body.brw_reqst;
int npg;
int rc;
 
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index caaae8c..065f8fb 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -390,7 +390,7 @@ lstcon_rpc_get_reply(struct lstcon_rpc *crpc, struct 
srpc_msg **msgpp)
 {
struct lstcon_node *nd = crpc->crp_node;
struct srpc_client_rpc *rpc = crpc->crp_rpc;
-   srpc_generic_reply_t *rep;
+   struct srpc_generic_reply *rep;
 
LASSERT(nd && rpc);
LASSERT(crpc->crp_stamp);
@@ -473,7 +473,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
struct list_head tmp;
struct list_head __user *next;
lstcon_rpc_ent_t *ent;
-   srpc_generic_r

[PATCH 10/24] staging: lustre: selftest: convert sfw_test_client_ops_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef sfw_test_client_ops_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |3 ++-
 drivers/staging/lustre/lnet/selftest/framework.c |2 +-
 drivers/staging/lustre/lnet/selftest/ping_test.c |3 ++-
 drivers/staging/lustre/lnet/selftest/selftest.h  |   14 +++---
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 8e789ba..5cba2c3 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -488,7 +488,8 @@ brw_server_handle(struct srpc_server_rpc *rpc)
return 0;
 }
 
-sfw_test_client_ops_t brw_test_client;
+struct sfw_test_client_ops brw_test_client;
+
 void brw_init_test_client(void)
 {
brw_test_client.tso_init = brw_client_init;
diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index 0d7c3c5..d42ee18 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -135,7 +135,7 @@ sfw_find_test_case(int id)
 }
 
 static int
-sfw_register_test(struct srpc_service *service, sfw_test_client_ops_t *cliops)
+sfw_register_test(struct srpc_service *service, struct sfw_test_client_ops 
*cliops)
 {
sfw_test_case_t *tsc;
 
diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c 
b/drivers/staging/lustre/lnet/selftest/ping_test.c
index df33a13..be13004 100644
--- a/drivers/staging/lustre/lnet/selftest/ping_test.c
+++ b/drivers/staging/lustre/lnet/selftest/ping_test.c
@@ -210,7 +210,8 @@ ping_server_handle(struct srpc_server_rpc *rpc)
return 0;
 }
 
-sfw_test_client_ops_t ping_test_client;
+struct sfw_test_client_ops ping_test_client;
+
 void ping_init_test_client(void)
 {
ping_test_client.tso_init = ping_client_init;
diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h 
b/drivers/staging/lustre/lnet/selftest/selftest.h
index 50237bc..b536e98 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -350,7 +350,7 @@ struct sfw_batch {
struct list_head bat_tests; /* test instances */
 };
 
-typedef struct {
+struct sfw_test_client_ops {
int  (*tso_init)(struct sfw_test_instance *tsi); /* initialize test
  * client */
void (*tso_fini)(struct sfw_test_instance *tsi); /* finalize test
@@ -360,13 +360,13 @@ typedef struct {
 struct srpc_client_rpc **rpc); /* prep a tests 
rpc */
void (*tso_done_rpc)(struct sfw_test_unit *tsu,
 struct srpc_client_rpc *rpc);  /* done a test 
rpc */
-} sfw_test_client_ops_t;
+};
 
 typedef struct sfw_test_instance {
struct list_head   tsi_list;/* chain on batch */
inttsi_service; /* test type */
struct sfw_batch*tsi_batch; /* batch */
-   sfw_test_client_ops_t  *tsi_ops;/* test client operation
+   struct sfw_test_client_ops  *tsi_ops;   /* test client operation
 */
 
/* public parameter for all test units */
@@ -409,8 +409,8 @@ typedef struct sfw_test_unit {
 
 typedef struct sfw_test_case {
struct list_head  tsc_list; /* chain on fw_tests */
-   struct srpc_service *tsc_srv_service;   /* test service */
-   sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */
+   struct srpc_service *tsc_srv_service;   /* test service 
*/
+   struct sfw_test_client_ops  *tsc_cli_ops;   /* ops of test client */
 } sfw_test_case_t;
 
 struct srpc_client_rpc *
@@ -610,13 +610,13 @@ srpc_wait_service_shutdown(struct srpc_service *sv)
}
 }
 
-extern sfw_test_client_ops_t brw_test_client;
+extern struct sfw_test_client_ops brw_test_client;
 void brw_init_test_client(void);
 
 extern struct srpc_service brw_test_service;
 void brw_init_test_service(void);
 
-extern sfw_test_client_ops_t ping_test_client;
+extern struct sfw_test_client_ops ping_test_client;
 void ping_init_test_client(void);
 
 extern struct srpc_service ping_test_service;
-- 
1.7.1

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


[PATCH 17/24] staging: lustre: selftest: convert lstcon_ndlink_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef lstcon_ndlink_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |6 +-
 drivers/staging/lustre/lnet/selftest/console.c |   64 
 drivers/staging/lustre/lnet/selftest/console.h |7 ++-
 3 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 194b6dc..5cbd631 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -719,7 +719,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
 int dist, int span, int nkiov, lnet_kiov_t *kiov)
 {
lnet_process_id_packed_t *pid;
-   lstcon_ndlink_t *ndl;
+   struct lstcon_ndlink *ndl;
struct lstcon_node *nd;
int start;
int end;
@@ -1086,7 +1086,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
struct lstcon_rpc_trans **transpp)
 {
struct lstcon_rpc_trans *trans;
-   lstcon_ndlink_t *ndl;
+   struct lstcon_ndlink *ndl;
struct lstcon_node *nd;
struct lstcon_rpc *rpc;
unsigned feats;
@@ -1172,7 +1172,7 @@ lstcon_rpc_pinger(void *arg)
struct lstcon_rpc *crpc;
srpc_msg_t *rep;
srpc_debug_reqst_t *drq;
-   lstcon_ndlink_t *ndl;
+   struct lstcon_ndlink *ndl;
struct lstcon_node *nd;
int intv;
int count = 0;
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index 32364b4..e068c13 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -71,7 +71,7 @@ lstcon_node_get(struct lstcon_node *nd)
 static int
 lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create)
 {
-   lstcon_ndlink_t *ndl;
+   struct lstcon_ndlink*ndl;
unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE;
 
LASSERT(id.nid != LNET_NID_ANY);
@@ -90,11 +90,11 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node 
**ndpp, int create)
if (!create)
return -ENOENT;
 
-   LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + 
sizeof(lstcon_ndlink_t));
+   LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + sizeof(struct 
lstcon_ndlink));
if (!*ndpp)
return -ENOMEM;
 
-   ndl = (lstcon_ndlink_t *)(*ndpp + 1);
+   ndl = (struct lstcon_ndlink *)(*ndpp + 1);
 
ndl->ndl_node = *ndpp;
 
@@ -119,14 +119,14 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node 
**ndpp, int create)
 static void
 lstcon_node_put(struct lstcon_node *nd)
 {
-   lstcon_ndlink_t *ndl;
+   struct lstcon_ndlink *ndl;
 
LASSERT(nd->nd_ref > 0);
 
if (--nd->nd_ref > 0)
return;
 
-   ndl = (lstcon_ndlink_t *)(nd + 1);
+   ndl = (struct lstcon_ndlink *)(nd + 1);
 
LASSERT(!list_empty(&ndl->ndl_link));
LASSERT(!list_empty(&ndl->ndl_hlink));
@@ -135,15 +135,15 @@ lstcon_node_put(struct lstcon_node *nd)
list_del(&ndl->ndl_link);
list_del(&ndl->ndl_hlink);
 
-   LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t));
+   LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(struct 
lstcon_ndlink));
 }
 
 static int
 lstcon_ndlink_find(struct list_head *hash,
-  lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create)
+  lnet_process_id_t id, struct lstcon_ndlink **ndlpp, int 
create)
 {
unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE;
-   lstcon_ndlink_t *ndl;
+   struct lstcon_ndlink *ndl;
struct lstcon_node *nd;
int rc;
 
@@ -168,7 +168,7 @@ lstcon_ndlink_find(struct list_head *hash,
if (rc)
return rc;
 
-   LIBCFS_ALLOC(ndl, sizeof(lstcon_ndlink_t));
+   LIBCFS_ALLOC(ndl, sizeof(struct lstcon_ndlink));
if (!ndl) {
lstcon_node_put(nd);
return -ENOMEM;
@@ -184,7 +184,7 @@ lstcon_ndlink_find(struct list_head *hash,
 }
 
 static void
-lstcon_ndlink_release(lstcon_ndlink_t *ndl)
+lstcon_ndlink_release(struct lstcon_ndlink *ndl)
 {
LASSERT(list_empty(&ndl->ndl_link));
LASSERT(!list_empty(&ndl->ndl_hlink));
@@ -234,13 +234,13 @@ lstcon_group_addref(lstcon_group_t *grp)
grp->grp_ref++;
 }
 
-static void lstcon_group_ndlink_release(lstcon_group_t *, lstcon_ndlink_t *);
+static void lstcon_group_ndlink_release(lstcon_group_t *, struct lstcon_ndlink 
*);
 
 static void
 lstcon_group_drain(lstcon_group_t *grp, int keep)
 {
-   lstcon_ndlink_t *ndl;
-   lstcon_ndlink_t *tmp;
+   struct lstcon_ndlink *ndl;
+   struct lstcon_ndlink *tmp;
 
list_for_each_entry_safe(ndl, tmp, &grp->grp_ndl_list, ndl_link) {
if (!(ndl->ndl_node->nd_state & keep))
@@ -287,7 +287,7 @@ lstcon_group_

[PATCH 22/24] staging: lustre: selftest: convert srpc_msg_t to proper struct

2016-04-06 Thread James Simmons
Turn typedef struct srpc_msg to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |8 
 drivers/staging/lustre/lnet/selftest/conrpc.c|   14 +++---
 drivers/staging/lustre/lnet/selftest/conrpc.h|2 +-
 drivers/staging/lustre/lnet/selftest/console.c   |   10 +-
 drivers/staging/lustre/lnet/selftest/framework.c |   14 +++---
 drivers/staging/lustre/lnet/selftest/ping_test.c |4 ++--
 drivers/staging/lustre/lnet/selftest/rpc.c   |   11 ++-
 drivers/staging/lustre/lnet/selftest/rpc.h   |6 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |   10 +-
 9 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 3455990..02c8dae 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -318,7 +318,7 @@ brw_client_done_rpc(struct sfw_test_unit *tsu, struct 
srpc_client_rpc *rpc)
__u64 magic = BRW_MAGIC;
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
-   srpc_msg_t *msg = &rpc->crpc_replymsg;
+   struct srpc_msg *msg = &rpc->crpc_replymsg;
srpc_brw_reply_t *reply = &msg->msg_body.brw_reply;
srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
 
@@ -384,7 +384,7 @@ brw_bulk_ready(struct srpc_server_rpc *rpc, int status)
__u64 magic = BRW_MAGIC;
srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply;
srpc_brw_reqst_t *reqst;
-   srpc_msg_t *reqstmsg;
+   struct srpc_msg *reqstmsg;
 
LASSERT(rpc->srpc_bulk);
LASSERT(rpc->srpc_reqstbuf);
@@ -418,8 +418,8 @@ static int
 brw_server_handle(struct srpc_server_rpc *rpc)
 {
struct srpc_service *sv = rpc->srpc_scd->scd_svc;
-   srpc_msg_t *replymsg = &rpc->srpc_replymsg;
-   srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;
+   struct srpc_msg *replymsg = &rpc->srpc_replymsg;
+   struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;
srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply;
srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst;
int npg;
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 5cec1c9..caaae8c 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -46,7 +46,7 @@
 #include "conrpc.h"
 #include "console.h"
 
-void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, srpc_msg_t *,
+void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,
   struct lstcon_node *, lstcon_trans_stat_t *);
 
 static void
@@ -386,7 +386,7 @@ lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, 
int timeout)
 }
 
 static int
-lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp)
+lstcon_rpc_get_reply(struct lstcon_rpc *crpc, struct srpc_msg **msgpp)
 {
struct lstcon_node *nd = crpc->crp_node;
struct srpc_client_rpc *rpc = crpc->crp_rpc;
@@ -426,7 +426,7 @@ void
 lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, lstcon_trans_stat_t 
*stat)
 {
struct lstcon_rpc *crpc;
-   srpc_msg_t *rep;
+   struct srpc_msg *rep;
int error;
 
LASSERT(stat);
@@ -475,7 +475,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
lstcon_rpc_ent_t *ent;
srpc_generic_reply_t *rep;
struct lstcon_rpc *crpc;
-   srpc_msg_t *msg;
+   struct srpc_msg *msg;
struct lstcon_node *nd;
long dur;
struct timeval tv;
@@ -916,7 +916,7 @@ lstcon_testrpc_prep(struct lstcon_node *nd, int transop, 
unsigned feats,
 
 static int
 lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans,
-struct lstcon_node *nd, srpc_msg_t *reply)
+struct lstcon_node *nd, struct srpc_msg *reply)
 {
srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply;
int status = mksn_rep->mksn_status;
@@ -962,7 +962,7 @@ lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans,
 }
 
 void
-lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, srpc_msg_t *msg,
+lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, struct srpc_msg *msg,
  struct lstcon_node *nd, lstcon_trans_stat_t *stat)
 {
srpc_rmsn_reply_t *rmsn_rep;
@@ -1172,7 +1172,7 @@ lstcon_rpc_pinger(void *arg)
struct stt_timer *ptimer = (struct stt_timer *)arg;
struct lstcon_rpc_trans *trans;
struct lstcon_rpc *crpc;
-   srpc_msg_t *rep;
+   struct srpc_msg *rep;
srpc_debug_reqst_t *drq;
struct lstcon_ndlink *ndl;
struct lstcon_node *nd;
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h 
b/drivers/staging/lustre/lnet/selft

Re: [PATCH] Fixes some checkpatch.pl warnings

2016-04-06 Thread Greg KH
On Wed, Apr 06, 2016 at 04:38:07AM -0700, Manav Batra wrote:
> CHECK: Alignment should match open parenthesis
> WARNING: line over 80 characters
> 
> Signed-off-by: Manav Batra 
> ---
>  drivers/staging/rts5208/ms.c | 66 
> ++--
>  1 file changed, 39 insertions(+), 27 deletions(-)

Your subject is a bit "odd", please have it match the format that other
patches that have been accepted for this driver follows...

Also only do one thing per patch, you did multiple different things
here.

thanks,

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


Re: [PATCH v2] staging: iio: ad7606: use iio_device_{claim|release}_direct_mode()

2016-04-06 Thread Lars-Peter Clausen
On 04/06/2016 06:11 AM, Alison Schofield wrote:
> Replace the code that guarantees the device stays in direct mode with
> iio_device_{claim|release}_direct_mode() which does same.
> 
> Signed-off-by: Alison Schofield 

Looks good, thanks.

Acked-by: Lars-Peter Clausen 

> ---
> Changed in v2:
>  - removed improper application of claim/release from intr handler
>  - updated changelog
> 
>  drivers/staging/iio/adc/ad7606_core.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7606_core.c 
> b/drivers/staging/iio/adc/ad7606_core.c
> index 6dbc811..f79ee61 100644
> --- a/drivers/staging/iio/adc/ad7606_core.c
> +++ b/drivers/staging/iio/adc/ad7606_core.c
> @@ -88,12 +88,12 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
>  
>   switch (m) {
>   case IIO_CHAN_INFO_RAW:
> - mutex_lock(&indio_dev->mlock);
> - if (iio_buffer_enabled(indio_dev))
> - ret = -EBUSY;
> - else
> - ret = ad7606_scan_direct(indio_dev, chan->address);
> - mutex_unlock(&indio_dev->mlock);
> + ret = iio_device_claim_direct_mode(indio_dev);
> + if (ret)
> + return ret;
> +
> + ret = ad7606_scan_direct(indio_dev, chan->address);
> + iio_device_release_direct_mode(indio_dev);
>  
>   if (ret < 0)
>   return ret;
> 

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


[PATCH] staging: rts5208: alignment to match open paranthesis

2016-04-06 Thread Manav Batra
Fixes CHECK: Alignment should match open parenthesis

Is the subject and patch fine?
Sorry, just getting used to the process, and thanks.

Signed-off-by: Manav Batra 
---
 drivers/staging/rts5208/ms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 3e75db7..0f0cd4a 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -49,7 +49,7 @@ static int ms_parse_err_code(struct rtsx_chip *chip)
 }
 
 static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode,
-   u8 tpc, u8 cnt, u8 cfg)
+  u8 tpc, u8 cnt, u8 cfg)
 {
struct ms_info *ms_card = &chip->ms_card;
int retval;
-- 
1.9.1

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


Re: android,lowmemorykiller: Don't abuse TIF_MEMDIE.

2016-04-06 Thread Tetsuo Handa
Dan Carpenter wrote:
> Hello Tetsuo Handa,

Hello, Dan.

> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 77ed2c5745d9: "android,lowmemorykiller: Don't abuse 
> TIF_MEMDIE." from Mar 8, 2016, leads to the following Smatch 
> complaint:
> 
> drivers/staging/android/lowmemorykiller.c:145 lowmem_scan()
>error: we previously assumed 'p->mm' could be null (see line 134)

This is a false positive. find_lock_task_mm() returns a task_struct
whose mm is not NULL (with alloc_lock spinlock held).

> 
> drivers/staging/android/lowmemorykiller.c
>133
>134if (task_lmk_waiting(p) && p->mm &&
>^
> Patch adds a new check.
> 
>135time_before_eq(jiffies, 
> lowmem_deathpending_timeout)) {
>136task_unlock(p);
>137rcu_read_unlock();
>138return 0;
>139}
>140oom_score_adj = p->signal->oom_score_adj;
>141if (oom_score_adj < min_score_adj) {
>142task_unlock(p);
>143continue;
>144}
>145tasksize = get_mm_rss(p->mm);
>   ^
> Old unchecked dereference inside function call.

At this point alloc_lock spinlock is still held.
Thus, this mm is not NULL.

> 
>146task_unlock(p);
>147if (tasksize <= 0)
> 
> regards,
> dan carpenter
> 

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


[PATCH] staging: android: ion: make locally used functions static

2016-04-06 Thread Markus Böhme
Functions ion_handle_put and ion_handle_get_by_id are only used locally
in ion.c, so they should be made static as they used to be before
9590232b ("staging/android/ion : fix a race condition in the ion driver").

Signed-off-by: Markus Böhme 
---
 drivers/staging/android/ion/ion.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index d4c6207..a2cf93b 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -396,7 +396,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
return ret;
 }
 
-int ion_handle_put(struct ion_handle *handle)
+static int ion_handle_put(struct ion_handle *handle)
 {
struct ion_client *client = handle->client;
int ret;
@@ -438,8 +438,8 @@ static struct ion_handle 
*ion_handle_get_by_id_nolock(struct ion_client *client,
return handle ? handle : ERR_PTR(-EINVAL);
 }
 
-struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
-   int id)
+static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+  int id)
 {
struct ion_handle *handle;
 
-- 
1.7.10.4

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


[PATCH 1/7] staging: wilc1000: change return type of ret variable in handle_get_tx_pwr

2016-04-06 Thread Chaehyun Lim
This patch changes return type of ret variable from s32 to int.
ret has return value from wilc_send_config_pkt that has return type of
int.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index eb86fd4..09e4ca3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2468,7 +2468,7 @@ static void handle_set_tx_pwr(struct wilc_vif *vif, u8 
tx_pwr)
 
 static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr)
 {
-   s32 ret = 0;
+   int ret = 0;
struct wid wid;
 
wid.id = (u16)WID_TX_POWER;
-- 
2.8.0

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


[PATCH 4/7] staging: wilc1000: rename result in handle_set_wfi_drv_handler

2016-04-06 Thread Chaehyun Lim
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() function are used as result,
others are used as ret. It will be changed as ret in all handle_*()
function to match variable name.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 33735fd..4fd429e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -310,7 +310,7 @@ static void handle_set_channel(struct wilc_vif *vif,
 static void handle_set_wfi_drv_handler(struct wilc_vif *vif,
   struct drv_handler *hif_drv_handler)
 {
-   int result = 0;
+   int ret = 0;
struct wid wid;
 
wid.id = (u16)WID_SET_DRV_HANDLER;
@@ -318,13 +318,13 @@ static void handle_set_wfi_drv_handler(struct wilc_vif 
*vif,
wid.val = (s8 *)hif_drv_handler;
wid.size = sizeof(*hif_drv_handler);
 
-   result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- hif_drv_handler->handler);
+   ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+  hif_drv_handler->handler);
 
if (!hif_drv_handler->handler)
complete(&hif_driver_comp);
 
-   if (result)
+   if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
 }
 
-- 
2.8.0

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


[PATCH 2/7] staging: wilc1000: change handle_set_wfi_drv_handler's return type to void

2016-04-06 Thread Chaehyun Lim
When handle_set_wfi_drv_handler is called in hostIFthread that is a
kernel thread, it is not checked return type of this function. This
patch changes return type to void and removes braces if statement due to
have a single statement.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 09e4ca3..ba472d5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -307,8 +307,8 @@ static void handle_set_channel(struct wilc_vif *vif,
netdev_err(vif->ndev, "Failed to set channel\n");
 }
 
-static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
- struct drv_handler *hif_drv_handler)
+static void handle_set_wfi_drv_handler(struct wilc_vif *vif,
+  struct drv_handler *hif_drv_handler)
 {
s32 result = 0;
struct wid wid;
@@ -324,12 +324,8 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
if (!hif_drv_handler->handler)
complete(&hif_driver_comp);
 
-   if (result) {
+   if (result)
netdev_err(vif->ndev, "Failed to set driver handler\n");
-   return -EINVAL;
-   }
-
-   return result;
 }
 
 static s32 handle_set_operation_mode(struct wilc_vif *vif,
-- 
2.8.0

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


[PATCH 3/7] staging: wilc1000: change data type of result in handle_set_wfi_drv_handler

2016-04-06 Thread Chaehyun Lim
This patch changes data type of result variable from s32 to int.
result is used to get return value from wilc_send_config_pkt that has
return type of int.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ba472d5..33735fd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -310,7 +310,7 @@ static void handle_set_channel(struct wilc_vif *vif,
 static void handle_set_wfi_drv_handler(struct wilc_vif *vif,
   struct drv_handler *hif_drv_handler)
 {
-   s32 result = 0;
+   int result = 0;
struct wid wid;
 
wid.id = (u16)WID_SET_DRV_HANDLER;
-- 
2.8.0

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


[PATCH 5/7] staging: wilc1000: change handle_set_operation_mode's return type to void

2016-04-06 Thread Chaehyun Lim
When handle_set_operation_mode is called in hostIFthread that is a
kernel thread, it is not checked return type of this function. This
patch changes return type to void and removes braces if statement due to
have a single statement.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4fd429e..ecf4ddc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -328,8 +328,8 @@ static void handle_set_wfi_drv_handler(struct wilc_vif *vif,
netdev_err(vif->ndev, "Failed to set driver handler\n");
 }
 
-static s32 handle_set_operation_mode(struct wilc_vif *vif,
-struct op_mode *hif_op_mode)
+static void handle_set_operation_mode(struct wilc_vif *vif,
+ struct op_mode *hif_op_mode)
 {
s32 result = 0;
struct wid wid;
@@ -345,12 +345,8 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
if ((hif_op_mode->mode) == IDLE_MODE)
complete(&hif_driver_comp);
 
-   if (result) {
+   if (result)
netdev_err(vif->ndev, "Failed to set driver handler\n");
-   return -EINVAL;
-   }
-
-   return result;
 }
 
 static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
-- 
2.8.0

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


[PATCH 7/7] staging: wilc1000: rename result in handle_set_operation_mode

2016-04-06 Thread Chaehyun Lim
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() functions are used as result,
others are used as ret. It will be changed as ret in all handle_*()
functions to match variable name.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 52eddc4..ac620fb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -331,7 +331,7 @@ static void handle_set_wfi_drv_handler(struct wilc_vif *vif,
 static void handle_set_operation_mode(struct wilc_vif *vif,
  struct op_mode *hif_op_mode)
 {
-   int result = 0;
+   int ret = 0;
struct wid wid;
 
wid.id = (u16)WID_SET_OPERATION_MODE;
@@ -339,13 +339,13 @@ static void handle_set_operation_mode(struct wilc_vif 
*vif,
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);
 
-   result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
+   ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+  wilc_get_vif_idx(vif));
 
if ((hif_op_mode->mode) == IDLE_MODE)
complete(&hif_driver_comp);
 
-   if (result)
+   if (ret)
netdev_err(vif->ndev, "Failed to set driver handler\n");
 }
 
-- 
2.8.0

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


[PATCH 6/7] staging: wilc1000: change data type of result in handle_set_operation_mode

2016-04-06 Thread Chaehyun Lim
This patch changes data type of result variable from s32 to int. result
is used to get return value from wilc_send_config_pkt that has return
type of int.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ecf4ddc..52eddc4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -331,7 +331,7 @@ static void handle_set_wfi_drv_handler(struct wilc_vif *vif,
 static void handle_set_operation_mode(struct wilc_vif *vif,
  struct op_mode *hif_op_mode)
 {
-   s32 result = 0;
+   int result = 0;
struct wid wid;
 
wid.id = (u16)WID_SET_OPERATION_MODE;
-- 
2.8.0

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


Re: [PATCH] staging: rts5208: alignment to match open paranthesis

2016-04-06 Thread Greg KH
On Wed, Apr 06, 2016 at 02:41:01PM -0700, Manav Batra wrote:
> Fixes CHECK: Alignment should match open parenthesis
> 
> Is the subject and patch fine?
> Sorry, just getting used to the process, and thanks.

Yes, this is better, but please resend without these two lines in here,
you don't want them showing up in the kernel changelog, right?  :)

thanks,

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


[PATCH 21/35] staging: comedi: das1800: absorb control_a_bits()

2016-04-06 Thread H Hartley Sweeten
Absorb this helper function into the analog input (*do_cmd).
For aesthetics, convert the switch code into if/else.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 2e1c3ce..8dae3845 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -754,28 +754,6 @@ static int das1800_ai_cmdtest(struct comedi_device *dev,
return 0;
 }
 
-/* returns appropriate bits for control register a, depending on command */
-static int control_a_bits(const struct comedi_cmd *cmd)
-{
-   int control_a;
-
-   control_a = FFEN;   /* enable fifo */
-   if (cmd->stop_src == TRIG_EXT)
-   control_a |= ATEN;
-   switch (cmd->start_src) {
-   case TRIG_EXT:
-   control_a |= TGEN | CGSL;
-   break;
-   case TRIG_NOW:
-   control_a |= CGEN;
-   break;
-   default:
-   break;
-   }
-
-   return control_a;
-}
-
 static unsigned char das1800_ai_chanspec_bits(struct comedi_subdevice *s,
  unsigned int chanspec)
 {
@@ -911,8 +889,13 @@ static int das1800_ai_cmd(struct comedi_device *dev,
 
devpriv->ai_is_unipolar = comedi_range_is_unipolar(s, range0);
 
-   /*  determine proper bits for control registers */
-   control_a = control_a_bits(cmd);
+   control_a = FFEN;
+   if (cmd->stop_src == TRIG_EXT)
+   control_a |= ATEN;
+   if (cmd->start_src == TRIG_EXT)
+   control_a |= TGEN | CGSL;
+   else /* TRIG_NOW */
+   control_a |= CGEN;
 
control_c = das1800_ai_chanspec_bits(s, cmd->chanlist[0]);
/* set clock source to internal or external */
-- 
2.6.3

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


[PATCH 13/35] staging: comedi: das1800: refactor 'range_ai' boardinfo

2016-04-06 Thread H Hartley Sweeten
The boards supported by this driver have analog inputs with gains of
1, 10, 50, and 250 ("01" type) or 1, 2, 4, and 8 ("02" type).

Replace the 'range_ai' member of the boardinfo with a bit-field flag,
'das1801_range' and only set it for the "01" type boards. Remove the
unnecessary initialization for the "02" type boards.

For aesthetics, rename the comedi_lrange arrays and document the gain.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 88ba051..44a5ac1 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -174,39 +174,38 @@ enum {
das1802hr, das1802hr_da, das1801hc, das1802hc, das1801ao, das1802ao
 };
 
-/* analog input ranges */
-static const struct comedi_lrange range_ai_das1801 = {
+static const struct comedi_lrange das1801_ai_range = {
8, {
-   BIP_RANGE(5),
-   BIP_RANGE(1),
-   BIP_RANGE(0.1),
-   BIP_RANGE(0.02),
-   UNI_RANGE(5),
-   UNI_RANGE(1),
-   UNI_RANGE(0.1),
-   UNI_RANGE(0.02)
+   BIP_RANGE(5),   /* bipolar gain = 1 */
+   BIP_RANGE(1),   /* bipolar gain = 10 */
+   BIP_RANGE(0.1), /* bipolar gain = 50 */
+   BIP_RANGE(0.02),/* bipolar gain = 250 */
+   UNI_RANGE(5),   /* unipolar gain = 1 */
+   UNI_RANGE(1),   /* unipolar gain = 10 */
+   UNI_RANGE(0.1), /* unipolar gain = 50 */
+   UNI_RANGE(0.02) /* unipolar gain = 250 */
}
 };
 
-static const struct comedi_lrange range_ai_das1802 = {
+static const struct comedi_lrange das1802_ai_range = {
8, {
-   BIP_RANGE(10),
-   BIP_RANGE(5),
-   BIP_RANGE(2.5),
-   BIP_RANGE(1.25),
-   UNI_RANGE(10),
-   UNI_RANGE(5),
-   UNI_RANGE(2.5),
-   UNI_RANGE(1.25)
+   BIP_RANGE(10),  /* bipolar gain = 1 */
+   BIP_RANGE(5),   /* bipolar gain = 2 */
+   BIP_RANGE(2.5), /* bipolar gain = 4 */
+   BIP_RANGE(1.25),/* bipolar gain = 8 */
+   UNI_RANGE(10),  /* unipolar gain = 1 */
+   UNI_RANGE(5),   /* unipolar gain = 2 */
+   UNI_RANGE(2.5), /* unipolar gain = 4 */
+   UNI_RANGE(1.25) /* unipolar gain = 8 */
}
 };
 
 struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
-   const struct comedi_lrange *range_ai;   /* available input ranges */
unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
+   unsigned int das1801_range:1;
unsigned int has_ao:1;
unsigned int has_wform_ao:1;
unsigned int has_4_ao_chan:1;
@@ -221,98 +220,87 @@ static const struct das1800_board das1800_boards[] = {
{
.name   = "das-1701st",
.ai_speed   = 6250,
-   .range_ai   = &range_ai_das1801,
+   .das1801_range  = 1,
}, {
.name   = "das-1701st-da",
.ai_speed   = 6250,
-   .range_ai   = &range_ai_das1801,
+   .das1801_range  = 1,
.has_ao = 1,
.has_4_ao_chan  = 1,
}, {
.name   = "das-1702st",
.ai_speed   = 6250,
-   .range_ai   = &range_ai_das1802,
}, {
.name   = "das-1702st-da",
.ai_speed   = 6250,
-   .range_ai   = &range_ai_das1802,
.has_ao = 1,
.has_4_ao_chan  = 1,
}, {
.name   = "das-1702hr",
.ai_speed   = 2,
-   .range_ai   = &range_ai_das1802,
.is_16bit   = 1,
}, {
.name   = "das-1702hr-da",
.ai_speed   = 2,
-   .range_ai   = &range_ai_das1802,
.is_16bit   = 1,
.has_ao = 1,
}, {
.name   = "das-1701ao",
.ai_speed   = 6250,
-   .range_ai   = &range_ai_das1801,
+   .das1801_range  = 1,
.has_wform_ao   = 1,
}, {
.name   = "das-1702ao",
.ai_speed   = 6250,
-   .range_ai   = &range_ai_das1802,
.has_wform_ao   = 1,
}, {
.name   = 

[PATCH 09/35] staging: comedi: das1800: refactor 'do_n_chan' boardinfo

2016-04-06 Thread H Hartley Sweeten
The "hc" type boards have 8 digtial outputs. All other board types have 4.

Replace the 'do_n_chan' member of the boardinfo with a bit-field flag,
'has_8_do_chan', and only set it for the "hc" type boards. Remove the
unnecessary initialization for all other board types.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 6067b57..ed58ebb 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -204,12 +204,12 @@ static const struct comedi_lrange range_ai_das1802 = {
 struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
-   int do_n_chan;  /* number of digital output channels */
int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 
== waveform analog out */
int ao_n_chan;  /* number of analog out channels */
const struct comedi_lrange *range_ai;   /* available input ranges */
unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
+   unsigned int has_8_do_chan:1;
 };
 
 /* Warning: the maximum conversion speeds listed below are
@@ -220,37 +220,31 @@ static const struct das1800_board das1800_boards[] = {
{
.name   = "das-1701st",
.ai_speed   = 6250,
-   .do_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1701st-da",
.ai_speed   = 6250,
-   .do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1702st",
.ai_speed   = 6250,
-   .do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1702st-da",
.ai_speed   = 6250,
-   .do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1702hr",
.ai_speed   = 2,
-   .do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
.is_16bit   = 1,
}, {
.name   = "das-1702hr-da",
.ai_speed   = 2,
-   .do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
@@ -258,51 +252,43 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1701ao",
.ai_speed   = 6250,
-   .do_n_chan  = 4,
.ao_ability = 2,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1702ao",
.ai_speed   = 6250,
-   .do_n_chan  = 4,
.ao_ability = 2,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1801st",
.ai_speed   = 3000,
-   .do_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1801st-da",
.ai_speed   = 3000,
-   .do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1802st",
.ai_speed   = 3000,
-   .do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1802st-da",
.ai_speed   = 3000,
-   .do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1802hr",
.ai_speed   = 1,
-   .do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
.is_16bit   = 1,
}, {
.name   = "das-1802hr-da",
.ai_speed   = 1,
-   .do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
@@ -310,30 +296,28 @@ static const struct das1800_board das1800_boards[] = {
}, {

[PATCH 02/35] staging: comedi: das1800: tidy up digital input subdevice init

2016-04-06 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_bits) function.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index db4f847..907cefe 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1110,10 +1110,10 @@ static int das1800_ao_winsn(struct comedi_device *dev,
return 1;
 }
 
-/* reads from digital input channels */
-static int das1800_di_rbits(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
+static int das1800_di_insn_bits(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
data[1] = inb(dev->iobase + DAS1800_DIGITAL) & 0xf;
data[0] = 0;
@@ -1367,14 +1367,14 @@ static int das1800_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED;
}
 
-   /* di */
+   /* Digital Input subdevice */
s = &dev->subdevices[2];
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE;
-   s->n_chan = 4;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = das1800_di_rbits;
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan   = 4;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= das1800_di_insn_bits;
 
/* Digital Output subdevice */
s = &dev->subdevices[3];
-- 
2.6.3

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


[PATCH 14/35] staging: comedi: das1800: change type of 'ai_speed' boardinfo

2016-04-06 Thread H Hartley Sweeten
This value is compared against the unsigned int cmd->convert_arg to
check the minimum value (max speed) for the analog input conversion
timing.

For aesthetics, change the type to match the cmd->convert_arg type.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 44a5ac1..6f40bb8 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -202,7 +202,7 @@ static const struct comedi_lrange das1802_ai_range = {
 
 struct das1800_board {
const char *name;
-   int ai_speed;   /* max conversion period in nanoseconds */
+   unsigned int ai_speed;
unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
unsigned int das1801_range:1;
-- 
2.6.3

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


[PATCH 01/35] staging: comedi: das1800: tidy up digital output subdevice init

2016-04-06 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_bits) function.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index ff73da91..db4f847 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1121,10 +1121,10 @@ static int das1800_di_rbits(struct comedi_device *dev,
return insn->n;
 }
 
-static int das1800_do_wbits(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn,
-   unsigned int *data)
+static int das1800_do_insn_bits(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
if (comedi_dio_update_state(s, data))
outb(s->state, dev->iobase + DAS1800_DIGITAL);
@@ -1376,14 +1376,14 @@ static int das1800_attach(struct comedi_device *dev,
s->range_table = &range_digital;
s->insn_bits = das1800_di_rbits;
 
-   /* do */
+   /* Digital Output subdevice */
s = &dev->subdevices[3];
-   s->type = COMEDI_SUBD_DO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = board->do_n_chan;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = das1800_do_wbits;
+   s->type = COMEDI_SUBD_DO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = board->do_n_chan;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= das1800_do_insn_bits;
 
das1800_cancel(dev, dev->read_subdev);
 
-- 
2.6.3

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


[PATCH 27/35] staging: comedi: das1800: rename burst_convert_arg()

2016-04-06 Thread H Hartley Sweeten
Rename this function so it has namespace associated with the driver.
Remove the unnecessary comment about the function.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index feda499..bdf30f8 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -571,10 +571,8 @@ static irqreturn_t das1800_interrupt(int irq, void *d)
return IRQ_HANDLED;
 }
 
-/* converts requested conversion timing to timing compatible with
- * hardware, used only when card is in 'burst mode'
- */
-static unsigned int burst_convert_arg(unsigned int convert_arg, int flags)
+static unsigned int das1800_check_convert_arg(unsigned int convert_arg,
+ int flags)
 {
unsigned int micro_sec;
 
@@ -696,7 +694,7 @@ static int das1800_ai_cmdtest(struct comedi_device *dev,
err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg);
} else if (cmd->convert_src == TRIG_TIMER) {
/* we are in burst mode */
-   arg = burst_convert_arg(cmd->convert_arg, cmd->flags);
+   arg = das1800_check_convert_arg(cmd->convert_arg, cmd->flags);
err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg);
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-- 
2.6.3

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


[PATCH 16/35] staging: comedi: das1800: add analog output readback

2016-04-06 Thread H Hartley Sweeten
Use the core provided readback support to allow reading back the last
value written to the analog output channels.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index bb99efc..fa1e4bb 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -91,7 +91,6 @@ Unipolar and bipolar ranges cannot be mixed in the 
channel/gain list.
 TODO:
Make it automatically allocate irq and dma channels if they are not 
specified
Add support for analog out on 'ao' cards
-   read insn for analog out
 */
 
 #include 
@@ -371,8 +370,6 @@ struct das1800_private {
int dma_bits;
uint16_t *fifo_buf; /* bounce buffer for analog input FIFO */
unsigned long iobase2;  /* secondary io address used for analog out on 
'ao' boards */
-   unsigned short ao_update_bits;  /* remembers the last write to the
-* 'update' dac */
bool ai_is_unipolar;
 };
 
@@ -1043,7 +1040,6 @@ static int das1800_ao_insn_write(struct comedi_device 
*dev,
 struct comedi_insn *insn,
 unsigned int *data)
 {
-   struct das1800_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int update_chan = s->n_chan - 1;
unsigned long flags;
@@ -1055,9 +1051,9 @@ static int das1800_ao_insn_write(struct comedi_device 
*dev,
for (i = 0; i < insn->n; i++) {
unsigned int val = data[i];
 
+   s->readback[chan] = val;
+
val = comedi_offset_munge(s, val);
-   if (chan == update_chan)
-   devpriv->ao_update_bits = val;
 
/* load this channel (and update if it's the last channel) */
outb(DAC(chan), dev->iobase + DAS1800_SELECT);
@@ -1065,9 +1061,10 @@ static int das1800_ao_insn_write(struct comedi_device 
*dev,
 
/* update all channels */
if (chan != update_chan) {
+   val = comedi_offset_munge(s, s->readback[update_chan]);
+
outb(DAC(update_chan), dev->iobase + DAS1800_SELECT);
-   outw(devpriv->ao_update_bits,
-dev->iobase + DAS1800_DAC);
+   outw(val, dev->iobase + DAS1800_DAC);
}
}
spin_unlock_irqrestore(&dev->spinlock, flags);
@@ -1327,6 +1324,10 @@ static int das1800_attach(struct comedi_device *dev,
s->range_table  = &range_bipolar10;
s->insn_write   = das1800_ao_insn_write;
 
+   ret = comedi_alloc_subdev_readback(s);
+   if (ret)
+   return ret;
+
/* initialize all channels to 0V */
for (i = 0; i < s->n_chan; i++) {
outb(DAC(i), dev->iobase + DAS1800_SELECT);
-- 
2.6.3

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


[PATCH 31/35] staging: comedi: das1800: fix comments in das1800_ai_cmd()

2016-04-06 Thread H Hartley Sweeten
Fix the checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line
WARNING: line over 80 characters

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 4ab7ed9..633fe1f 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -840,8 +840,10 @@ static int das1800_ai_cmd(struct comedi_device *dev,
const struct comedi_cmd *cmd = &async->cmd;
unsigned int range0 = CR_RANGE(cmd->chanlist[0]);
 
-   /* disable dma on CMDF_WAKE_EOS, or CMDF_PRIORITY
-* (because dma in handler is unsafe at hard real-time priority) */
+   /*
+* Disable dma on CMDF_WAKE_EOS, or CMDF_PRIORITY (because dma in
+* handler is unsafe at hard real-time priority).
+*/
if (cmd->flags & (CMDF_WAKE_EOS | CMDF_PRIORITY))
devpriv->irq_dma_bits &= ~DMA_ENABLED;
else
@@ -904,14 +906,15 @@ static int das1800_ai_cmd(struct comedi_device *dev,
outb(control_c, dev->iobase + DAS1800_CONTROL_C);
/*  set conversion rate and length for burst mode */
if (control_c & BMDE) {
-   /*  program conversion period with number of microseconds minus 
1 */
-   outb(cmd->convert_arg / 1000 - 1,
+   outb(cmd->convert_arg / 1000 - 1,   /* microseconds - 1 */
 dev->iobase + DAS1800_BURST_RATE);
outb(cmd->chanlist_len - 1, dev->iobase + DAS1800_BURST_LENGTH);
}
-   outb(devpriv->irq_dma_bits, dev->iobase + DAS1800_CONTROL_B);   /*  
enable irq/dma */
-   outb(control_a, dev->iobase + DAS1800_CONTROL_A);   /* enable fifo 
and triggering */
-   outb(CVEN, dev->iobase + DAS1800_STATUS);   /* enable conversions */
+
+   /* enable and start conversions */
+   outb(devpriv->irq_dma_bits, dev->iobase + DAS1800_CONTROL_B);
+   outb(control_a, dev->iobase + DAS1800_CONTROL_A);
+   outb(CVEN, dev->iobase + DAS1800_STATUS);
 
return 0;
 }
-- 
2.6.3

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


[PATCH 17/35] staging: comedi: das1800: introduce das1800_ai_chanspec_bits()

2016-04-06 Thread H Hartley Sweeten
Introduce a helper function for the common code needed to get the control c
register bits for a channel specification.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index fa1e4bb..2f31ed4 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -776,25 +776,32 @@ static int control_a_bits(const struct comedi_cmd *cmd)
return control_a;
 }
 
-/* returns appropriate bits for control register c, depending on command */
-static int control_c_bits(struct comedi_subdevice *s,
- const struct comedi_cmd *cmd)
+static unsigned char das1800_ai_chanspec_bits(struct comedi_subdevice *s,
+ unsigned int chanspec)
 {
-   unsigned int range = CR_RANGE(cmd->chanlist[0]);
-   unsigned int aref = CR_AREF(cmd->chanlist[0]);
-   int control_c;
+   unsigned int range = CR_RANGE(chanspec);
+   unsigned int aref = CR_AREF(chanspec);
+   unsigned char bits;
 
-   /* set clock source to internal or external, select analog reference,
-* select unipolar / bipolar
-*/
-   control_c = UQEN;   /* enable upper qram addresses */
+   bits = UQEN;/* enable upper qram addresses */
if (aref != AREF_DIFF)
-   control_c |= SD;
+   bits |= SD;
if (aref == AREF_COMMON)
-   control_c |= CMEN;
+   bits |= CMEN;
if (comedi_range_is_unipolar(s, range))
-   control_c |= UB;
+   bits |= UB;
+
+   return bits;
+}
+
+static int control_c_bits(struct comedi_subdevice *s,
+ const struct comedi_cmd *cmd)
+{
+   int control_c;
 
+   control_c = das1800_ai_chanspec_bits(s, cmd->chanlist[0]);
+
+   /* set clock source to internal or external */
switch (cmd->scan_begin_src) {
case TRIG_FOLLOW:   /*  not in burst mode */
switch (cmd->convert_src) {
@@ -981,25 +988,15 @@ static int das1800_ai_insn_read(struct comedi_device *dev,
 {
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
-   unsigned int aref = CR_AREF(insn->chanspec);
bool is_unipolar = comedi_range_is_unipolar(s, range);
int i, n;
int chan_range;
int timeout = 1000;
unsigned short dpnt;
-   int conv_flags = 0;
unsigned long irq_flags;
 
-   /* set up analog reference and unipolar / bipolar mode */
-   conv_flags |= UQEN;
-   if (aref != AREF_DIFF)
-   conv_flags |= SD;
-   if (aref == AREF_COMMON)
-   conv_flags |= CMEN;
-   if (is_unipolar)
-   conv_flags |= UB;
-
-   outb(conv_flags, dev->iobase + DAS1800_CONTROL_C);  /* software 
conversion enabled */
+   outb(das1800_ai_chanspec_bits(s, insn->chanspec),
+dev->iobase + DAS1800_CONTROL_C);  /* software pacer */
outb(CVEN, dev->iobase + DAS1800_STATUS);   /* enable conversions */
outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* reset fifo */
outb(FFEN, dev->iobase + DAS1800_CONTROL_A);
-- 
2.6.3

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


[PATCH 18/35] staging: comedi: das1800: absorb control_c_bits()

2016-04-06 Thread H Hartley Sweeten
Absorb this helper function into the analog input (*do_cmd).
For aesthetics, convert the switch code into if/else.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 2f31ed4..d2aab27 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -794,44 +794,6 @@ static unsigned char das1800_ai_chanspec_bits(struct 
comedi_subdevice *s,
return bits;
 }
 
-static int control_c_bits(struct comedi_subdevice *s,
- const struct comedi_cmd *cmd)
-{
-   int control_c;
-
-   control_c = das1800_ai_chanspec_bits(s, cmd->chanlist[0]);
-
-   /* set clock source to internal or external */
-   switch (cmd->scan_begin_src) {
-   case TRIG_FOLLOW:   /*  not in burst mode */
-   switch (cmd->convert_src) {
-   case TRIG_TIMER:
-   /* trig on cascaded counters */
-   control_c |= IPCLK;
-   break;
-   case TRIG_EXT:
-   /* trig on falling edge of external trigger */
-   control_c |= XPCLK;
-   break;
-   default:
-   break;
-   }
-   break;
-   case TRIG_TIMER:
-   /*  burst mode with internal pacer clock */
-   control_c |= BMDE | IPCLK;
-   break;
-   case TRIG_EXT:
-   /*  burst mode with external trigger */
-   control_c |= BMDE | XPCLK;
-   break;
-   default:
-   break;
-   }
-
-   return control_c;
-}
-
 static unsigned int das1800_ai_transfer_size(struct comedi_device *dev,
 struct comedi_subdevice *s,
 unsigned int maxbytes,
@@ -948,7 +910,25 @@ static int das1800_ai_cmd(struct comedi_device *dev,
 
/*  determine proper bits for control registers */
control_a = control_a_bits(cmd);
-   control_c = control_c_bits(s, cmd);
+
+   control_c = das1800_ai_chanspec_bits(s, cmd->chanlist[0]);
+   /* set clock source to internal or external */
+   if (cmd->scan_begin_src == TRIG_FOLLOW) {
+   /* not in burst mode */
+   if (cmd->convert_src == TRIG_TIMER) {
+   /* trig on cascaded counters */
+   control_c |= IPCLK;
+   } else { /* TRIG_EXT */
+   /* trig on falling edge of external trigger */
+   control_c |= XPCLK;
+   }
+   } else if (cmd->scan_begin_src == TRIG_TIMER) {
+   /* burst mode with internal pacer clock */
+   control_c |= BMDE | IPCLK;
+   } else { /* TRIG_EXT */
+   /* burst mode with external trigger */
+   control_c |= BMDE | XPCLK;
+   }
 
/* setup card and start */
program_chanlist(dev, cmd);
-- 
2.6.3

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


[PATCH 05/35] staging: comedi: das1800: tidy up boardinfo

2016-04-06 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the boardinfo array and
remove the unnecessary '= 0' initializations.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index eca6c05d..1b0eb6f 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -219,187 +219,156 @@ struct das1800_board {
  */
 static const struct das1800_board das1800_boards[] = {
{
-.name = "das-1701st",
-.ai_speed = 6250,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 0,
-.ao_n_chan = 0,
-.range_ai = &range_ai_das1801,
-},
-   {
-.name = "das-1701st-da",
-.ai_speed = 6250,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 1,
-.ao_n_chan = 4,
-.range_ai = &range_ai_das1801,
-},
-   {
-.name = "das-1702st",
-.ai_speed = 6250,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 0,
-.ao_n_chan = 0,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1702st-da",
-.ai_speed = 6250,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 1,
-.ao_n_chan = 4,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1702hr",
-.ai_speed = 2,
-.resolution = 16,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 0,
-.ao_n_chan = 0,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1702hr-da",
-.ai_speed = 2,
-.resolution = 16,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 1,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1701ao",
-.ai_speed = 6250,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 2,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1801,
-},
-   {
-.name = "das-1702ao",
-.ai_speed = 6250,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 2,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1801st",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 0,
-.ao_n_chan = 0,
-.range_ai = &range_ai_das1801,
-},
-   {
-.name = "das-1801st-da",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 1,
-.ao_n_chan = 4,
-.range_ai = &range_ai_das1801,
-},
-   {
-.name = "das-1802st",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 0,
-.ao_n_chan = 0,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1802st-da",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 1,
-.ao_n_chan = 4,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1802hr",
-.ai_speed = 1,
-.resolution = 16,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 0,
-.ao_n_chan = 0,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1802hr-da",
-.ai_speed = 1,
-.resolution = 16,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 1,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1802,
-},
-   {
-.name = "das-1801hc",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 0,
-.do_n_chan = 8,
-.ao_ability = 1,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1801,
-.has_64_ai_chan = 1,
-},
-   {
-.name = "das-1802hc",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 0,
-.do_n_chan = 8,
-.ao_ability = 1,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1802,
-.has_64_ai_chan = 1,
-},
-   {
-.name = "das-1801ao",
-.ai_speed = 3000,
-.resolution = 12,
-.common = 1,
-.do_n_chan = 4,
-.ao_ability = 2,
-.ao_n_chan = 2,
-.range_ai = &range_ai_das1801,
-},
-   {
-.name = "das-1802ao",
-.ai_speed = 3000,
-.resolution = 12,
-   

[PATCH 33/35] staging: comedi: das1800: fix lines over 80 characters

2016-04-06 Thread H Hartley Sweeten
These comments are just extra cruft. Remove them to fix the
checkpatch.pl issues:
WARNING: line over 80 characters

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index a09cf92..e00b55f 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -100,7 +100,7 @@
 #define   DMA_CH5_CH6 0x5
 #define   DMA_CH6_CH7 0x6
 #define   DMA_CH7_CH5 0x7
-#define   DMA_ENABLED 0x3  /* mask used to determine if dma is 
enabled */
+#define   DMA_ENABLED 0x3
 #define   DMA_DUAL0x4
 #define   IRQ30x8
 #define   IRQ50x10
@@ -118,22 +118,21 @@
 #define   SD  0x40
 #define   UB  0x80
 #define DAS1800_STATUS  0x7
-/* bits that prevent interrupt status bits (and CVEN) from being cleared on 
write */
-#define   CLEAR_INTR_MASK (CVEN_MASK | 0x1f)
 #define   INT 0x1
 #define   DMATC   0x2
 #define   CT0TC   0x8
 #define   OVF 0x10
 #define   FHF 0x20
 #define   FNE 0x40
-#define   CVEN_MASK   0x40 /*  masks CVEN on write */
 #define   CVEN0x80
+#define   CVEN_MASK   0x40
+#define   CLEAR_INTR_MASK (CVEN_MASK | 0x1f)
 #define DAS1800_BURST_LENGTH0x8
 #define DAS1800_BURST_RATE  0x9
 #define DAS1800_QRAM_ADDRESS0xa
 #define DAS1800_COUNTER 0xc
 
-#define IOBASE2   0x400/* offset of additional ioports 
used on 'ao' cards */
+#define IOBASE2   0x400
 
 static const struct comedi_lrange das1801_ai_range = {
8, {
-- 
2.6.3

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


[PATCH 08/35] staging: comedi: das1800: refactor 'resolution' boardinfo

2016-04-06 Thread H Hartley Sweeten
The "hr" type boards have 16-bit analog inputs and outputs. All other board
types are 12-bit.

Replace the 'resolution' member of the boardinfo with a bit-field flag,
'is_16bit', and only set it for the 16-bit boards. Remove the unnecessary
initialization for the 12-bit boards.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 324d1cc..6067b57 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -204,11 +204,11 @@ static const struct comedi_lrange range_ai_das1802 = {
 struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
-   int resolution; /* bits of ai resolution */
int do_n_chan;  /* number of digital output channels */
int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 
== waveform analog out */
int ao_n_chan;  /* number of analog out channels */
const struct comedi_lrange *range_ai;   /* available input ranges */
+   unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
 };
 
@@ -220,13 +220,11 @@ static const struct das1800_board das1800_boards[] = {
{
.name   = "das-1701st",
.ai_speed   = 6250,
-   .resolution = 12,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1701st-da",
.ai_speed   = 6250,
-   .resolution = 12,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -234,13 +232,11 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702st",
.ai_speed   = 6250,
-   .resolution = 12,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1702st-da",
.ai_speed   = 6250,
-   .resolution = 12,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -248,21 +244,20 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702hr",
.ai_speed   = 2,
-   .resolution = 16,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
+   .is_16bit   = 1,
}, {
.name   = "das-1702hr-da",
.ai_speed   = 2,
-   .resolution = 16,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
+   .is_16bit   = 1,
}, {
.name   = "das-1701ao",
.ai_speed   = 6250,
-   .resolution = 12,
.do_n_chan  = 4,
.ao_ability = 2,
.ao_n_chan  = 2,
@@ -270,7 +265,6 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702ao",
.ai_speed   = 6250,
-   .resolution = 12,
.do_n_chan  = 4,
.ao_ability = 2,
.ao_n_chan  = 2,
@@ -278,13 +272,11 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1801st",
.ai_speed   = 3000,
-   .resolution = 12,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1801st-da",
.ai_speed   = 3000,
-   .resolution = 12,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -292,13 +284,11 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1802st",
.ai_speed   = 3000,
-   .resolution = 12,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1802st-da",
.ai_speed   = 3000,
-   .resolution = 12,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -306,21 +296,20 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-180

[PATCH 26/35] staging: comedi: das1800: remove the private data member comments

2016-04-06 Thread H Hartley Sweeten
The comments about the members of the private data are not really
necessary and removing them fixes a couple checkpatch.pl issues.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index f197ca5..feda499 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -329,12 +329,10 @@ static const struct das1800_board das1800_boards[] = {
 
 struct das1800_private {
struct comedi_isadma *dma;
-   int irq_dma_bits;   /* bits for control register b */
-   /* dma bits for control register b, stored so that dma can be
-* turned on and off */
+   int irq_dma_bits;
int dma_bits;
unsigned short *fifo_buf;
-   unsigned long iobase2;  /* secondary io address used for analog out on 
'ao' boards */
+   unsigned long iobase2;
bool ai_is_unipolar;
 };
 
-- 
2.6.3

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


[PATCH 28/35] staging: comedi: das1800: fix das1800_ai_cancel()

2016-04-06 Thread H Hartley Sweeten
DMA is optional with this driver. If it was not enabled the devpriv->dma
pointer will be NULL. Fix the possible NULL pointer dereference when trying
to disable the DMA channels.

Also, tidy up the comments to fix the checkpatch.pl issues:
WARNING: line over 80 characters

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index bdf30f8..d8f4e3f 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -458,14 +458,17 @@ static int das1800_ai_cancel(struct comedi_device *dev,
struct comedi_isadma_desc *desc;
int i;
 
-   outb(0x0, dev->iobase + DAS1800_STATUS);/* disable conversions 
*/
-   outb(0x0, dev->iobase + DAS1800_CONTROL_B); /* disable interrupts 
and dma */
-   outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* disable and clear 
fifo and stop triggering */
-
-   for (i = 0; i < 2; i++) {
-   desc = &dma->desc[i];
-   if (desc->chan)
-   comedi_isadma_disable(desc->chan);
+   /* disable and stop conversions */
+   outb(0x0, dev->iobase + DAS1800_STATUS);
+   outb(0x0, dev->iobase + DAS1800_CONTROL_B);
+   outb(0x0, dev->iobase + DAS1800_CONTROL_A);
+
+   if (dma) {
+   for (i = 0; i < 2; i++) {
+   desc = &dma->desc[i];
+   if (desc->chan)
+   comedi_isadma_disable(desc->chan);
+   }
}
 
return 0;
-- 
2.6.3

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


[PATCH 29/35] staging: comedi: das1800: fix NULL pointer dereference in das1800_ai_setup_dma()

2016-04-06 Thread H Hartley Sweeten
DMA is optional with this driver. If it was not enabled the devpriv->dma
pointer will be NULL. It's probably harmless here because the 'desc' pointer
will not be used if DMA is disabled. But, fix the possible NULL pointer
dereference.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index d8f4e3f..ceecfb2 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -783,13 +783,14 @@ static void das1800_ai_setup_dma(struct comedi_device 
*dev,
 {
struct das1800_private *devpriv = dev->private;
struct comedi_isadma *dma = devpriv->dma;
-   struct comedi_isadma_desc *desc = &dma->desc[0];
+   struct comedi_isadma_desc *desc;
unsigned int bytes;
 
if ((devpriv->irq_dma_bits & DMA_ENABLED) == 0)
return;
 
dma->cur_dma = 0;
+   desc = &dma->desc[0];
 
/* determine a dma transfer size to fill buffer in 0.3 sec */
bytes = das1800_ai_transfer_size(dev, s, desc->maxsize, 3);
-- 
2.6.3

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


[PATCH 07/35] staging: comedi: das1800: tidy up das1800_ao_insn_write()

2016-04-06 Thread H Hartley Sweeten
The (*insn_write) functions are supposed to write insn->n values to the
specified channel. Tidy up this function and make it work like the core
expects.

Use the comedi_offset_munge() helper to handle the munging of the data
to 2's complement format.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 69680ea..324d1cc 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1034,31 +1034,36 @@ static int das1800_ao_insn_write(struct comedi_device 
*dev,
 struct comedi_insn *insn,
 unsigned int *data)
 {
-   const struct das1800_board *board = dev->board_ptr;
struct das1800_private *devpriv = dev->private;
-   int chan = CR_CHAN(insn->chanspec);
-/* int range = CR_RANGE(insn->chanspec); */
-   int update_chan = board->ao_n_chan - 1;
-   unsigned short output;
-   unsigned long irq_flags;
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int update_chan = s->n_chan - 1;
+   unsigned long flags;
+   int i;
 
-   /*   card expects two's complement data */
-   output = data[0] - (1 << (board->resolution - 1));
-   /*  if the write is to the 'update' channel, we need to remember its 
value */
-   if (chan == update_chan)
-   devpriv->ao_update_bits = output;
-   /*  write to channel */
-   spin_lock_irqsave(&dev->spinlock, irq_flags);
-   outb(DAC(chan), dev->iobase + DAS1800_SELECT);  /* select dac channel 
for baseAddress + 0x0 */
-   outw(output, dev->iobase + DAS1800_DAC);
-   /*  now we need to write to 'update' channel to update all dac channels 
*/
-   if (chan != update_chan) {
-   outb(DAC(update_chan), dev->iobase + DAS1800_SELECT);   /* 
select 'update' channel for baseAddress + 0x0 */
-   outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC);
+   /* protects the indirect addressing selected by DAS1800_SELECT */
+   spin_lock_irqsave(&dev->spinlock, flags);
+
+   for (i = 0; i < insn->n; i++) {
+   unsigned int val = data[i];
+
+   val = comedi_offset_munge(s, val);
+   if (chan == update_chan)
+   devpriv->ao_update_bits = val;
+
+   /* load this channel (and update if it's the last channel) */
+   outb(DAC(chan), dev->iobase + DAS1800_SELECT);
+   outw(val, dev->iobase + DAS1800_DAC);
+
+   /* update all channels */
+   if (chan != update_chan) {
+   outb(DAC(update_chan), dev->iobase + DAS1800_SELECT);
+   outw(devpriv->ao_update_bits,
+dev->iobase + DAS1800_DAC);
+   }
}
-   spin_unlock_irqrestore(&dev->spinlock, irq_flags);
+   spin_unlock_irqrestore(&dev->spinlock, flags);
 
-   return 1;
+   return insn->n;
 }
 
 static int das1800_di_insn_bits(struct comedi_device *dev,
-- 
2.6.3

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


[PATCH 34/35] staging: comedi: das1800: fix comments about the 'ao' board range

2016-04-06 Thread H Hartley Sweeten
The waveform analog outputs on the 'ao' boards are not currently
supported. Modify the comment about the analog output range on
these boards so that the information is saved but fixes the
checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line

Move the comment so it's grouped with the comedi_lrange info.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index e00b55f..6ce01c0 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -160,6 +160,12 @@ static const struct comedi_lrange das1802_ai_range = {
}
 };
 
+/*
+ * The waveform analog outputs on the 'ao' boards are not currently
+ * supported. They have a comedi_lrange of:
+ * { 2, { BIP_RANGE(10), BIP_RANGE(5) } }
+ */
+
 enum das1800_boardid {
BOARD_DAS1701ST,
BOARD_DAS1701ST_DA,
@@ -335,16 +341,6 @@ struct das1800_private {
bool ai_is_unipolar;
 };
 
-/* analog out range for 'ao' boards */
-/*
-static const struct comedi_lrange range_ao_2 = {
-   2, {
-   BIP_RANGE(10),
-   BIP_RANGE(5)
-   }
-};
-*/
-
 static void das1800_ai_munge(struct comedi_device *dev,
 struct comedi_subdevice *s,
 void *data, unsigned int num_bytes,
-- 
2.6.3

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


[PATCH 32/35] staging: comedi: das1800: fix comments in das1800_ai_handler()

2016-04-06 Thread H Hartley Sweeten
Fix the checkpatch.pl issues:
WARNING: line over 80 characters

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 633fe1f..a09cf92 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -482,15 +482,13 @@ static void das1800_ai_handler(struct comedi_device *dev)
/* select adc register (spinlock is already held) */
outb(ADC, dev->iobase + DAS1800_SELECT);
 
-   /*  dma buffer full */
-   if (devpriv->irq_dma_bits & DMA_ENABLED) {
-   /*  look for data from dma transfer even if dma terminal count 
hasn't happened yet */
+   /* get samples with dma, fifo, or polled as necessary */
+   if (devpriv->irq_dma_bits & DMA_ENABLED)
das1800_handle_dma(dev, s, status);
-   } else if (status & FHF) {  /*  if fifo half full */
+   else if (status & FHF)
das1800_handle_fifo_half_full(dev, s);
-   } else if (status & FNE) {  /*  if fifo not empty */
+   else if (status & FNE)
das1800_handle_fifo_not_empty(dev, s);
-   }
 
/* if the card's fifo has overflowed */
if (status & OVF) {
@@ -506,7 +504,7 @@ static void das1800_ai_handler(struct comedi_device *dev)
if (status & CT0TC) {
/*  clear CT0TC interrupt bit */
outb(CLEAR_INTR_MASK & ~CT0TC, dev->iobase + DAS1800_STATUS);
-   /*  make sure we get all remaining data from board before 
quitting */
+   /* get all remaining samples before quitting */
if (devpriv->irq_dma_bits & DMA_ENABLED)
das1800_flush_dma(dev, s);
else
-- 
2.6.3

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


[PATCH 04/35] staging: comedi: das1800: tidy up analog input subdevice init

2016-04-06 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the subdevice init and rename
the subdevice support functions.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 5d68353..eca6c05d 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -529,7 +529,8 @@ static void das1800_handle_dma(struct comedi_device *dev,
}
 }
 
-static int das1800_cancel(struct comedi_device *dev, struct comedi_subdevice 
*s)
+static int das1800_ai_cancel(struct comedi_device *dev,
+struct comedi_subdevice *s)
 {
struct das1800_private *devpriv = dev->private;
struct comedi_isadma *dma = devpriv->dma;
@@ -690,10 +691,9 @@ static int das1800_ai_check_chanlist(struct comedi_device 
*dev,
return 0;
 }
 
-/* test analog input cmd */
-static int das1800_ai_do_cmdtest(struct comedi_device *dev,
-struct comedi_subdevice *s,
-struct comedi_cmd *cmd)
+static int das1800_ai_cmdtest(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_cmd *cmd)
 {
const struct das1800_board *board = dev->board_ptr;
int err = 0;
@@ -953,9 +953,8 @@ static void program_chanlist(struct comedi_device *dev,
spin_unlock_irqrestore(&dev->spinlock, irq_flags);
 }
 
-/* analog input do_cmd */
-static int das1800_ai_do_cmd(struct comedi_device *dev,
-struct comedi_subdevice *s)
+static int das1800_ai_cmd(struct comedi_device *dev,
+ struct comedi_subdevice *s)
 {
struct das1800_private *devpriv = dev->private;
int control_a, control_c;
@@ -978,7 +977,7 @@ static int das1800_ai_do_cmd(struct comedi_device *dev,
devpriv->irq_dma_bits |= FIMD;
}
 
-   das1800_cancel(dev, s);
+   das1800_ai_cancel(dev, s);
 
devpriv->ai_is_unipolar = comedi_range_is_unipolar(s, range0);
 
@@ -1017,10 +1016,10 @@ static int das1800_ai_do_cmd(struct comedi_device *dev,
return 0;
 }
 
-/* read analog input */
-static int das1800_ai_rinsn(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
+static int das1800_ai_insn_read(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
@@ -1333,25 +1332,25 @@ static int das1800_attach(struct comedi_device *dev,
if (ret)
return ret;
 
-   /* analog input subdevice */
+   /* Analog Input subdevice */
s = &dev->subdevices[0];
-   s->type = COMEDI_SUBD_AI;
-   s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND;
+   s->type = COMEDI_SUBD_AI;
+   s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND;
if (board->common)
-   s->subdev_flags |= SDF_COMMON;
-   s->n_chan = (board->has_64_ai_chan) ? 64 : 16;
-   s->maxdata = (1 << board->resolution) - 1;
-   s->range_table = board->range_ai;
-   s->insn_read = das1800_ai_rinsn;
+   s->subdev_flags |= SDF_COMMON;
+   s->n_chan   = (board->has_64_ai_chan) ? 64 : 16;
+   s->maxdata  = (1 << board->resolution) - 1;
+   s->range_table  = board->range_ai;
+   s->insn_read= das1800_ai_insn_read;
if (dev->irq) {
dev->read_subdev = s;
-   s->subdev_flags |= SDF_CMD_READ;
-   s->len_chanlist = (board->has_64_ai_chan) ? 64 : 256;
-   s->do_cmd = das1800_ai_do_cmd;
-   s->do_cmdtest = das1800_ai_do_cmdtest;
-   s->poll = das1800_ai_poll;
-   s->cancel = das1800_cancel;
-   s->munge = das1800_ai_munge;
+   s->subdev_flags |= SDF_CMD_READ;
+   s->len_chanlist = (board->has_64_ai_chan) ? 64 : 256;
+   s->do_cmd   = das1800_ai_cmd;
+   s->do_cmdtest   = das1800_ai_cmdtest;
+   s->poll = das1800_ai_poll;
+   s->cancel   = das1800_ai_cancel;
+   s->munge= das1800_ai_munge;
}
 
/* Analog Output subdevice */
@@ -1385,7 +1384,7 @@ static int das1800_attach(struct comedi_device *dev,
s->range_table  = &range_digital;
s->insn_bits= das1800_do_insn_bits;
 
-   das1800_cancel(dev, dev->read_subdev);
+   das1800_ai_cancel(dev, dev->read_subdev);
 
/*  init

[PATCH 20/35] staging: comedi: das1800: use comedi_timeout()

2016-04-06 Thread H Hartley Sweeten
Use the helper function to handle the busywaiting for the analog
input conversion to complete.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 4326b39..2e1c3ce 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -963,6 +963,19 @@ static int das1800_ai_cmd(struct comedi_device *dev,
return 0;
 }
 
+static int das1800_ai_eoc(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned long context)
+{
+   unsigned char status;
+
+   status = inb(dev->iobase + DAS1800_STATUS);
+   if (status & FNE)
+   return 0;
+   return -EBUSY;
+}
+
 static int das1800_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -970,8 +983,8 @@ static int das1800_ai_insn_read(struct comedi_device *dev,
 {
unsigned int range = CR_RANGE(insn->chanspec);
bool is_unipolar = comedi_range_is_unipolar(s, range);
-   int i, n;
-   int timeout = 1000;
+   int ret = 0;
+   int n;
unsigned short dpnt;
unsigned long flags;
 
@@ -992,24 +1005,19 @@ static int das1800_ai_insn_read(struct comedi_device 
*dev,
for (n = 0; n < insn->n; n++) {
/* trigger conversion */
outb(0, dev->iobase + DAS1800_FIFO);
-   for (i = 0; i < timeout; i++) {
-   if (inb(dev->iobase + DAS1800_STATUS) & FNE)
-   break;
-   }
-   if (i == timeout) {
-   dev_err(dev->class_dev, "timeout\n");
-   n = -ETIME;
-   goto exit;
-   }
+
+   ret = comedi_timeout(dev, s, insn, das1800_ai_eoc, 0);
+   if (ret)
+   break;
+
dpnt = inw(dev->iobase + DAS1800_FIFO);
if (!is_unipolar)
dpnt = comedi_offset_munge(s, dpnt);
data[n] = dpnt;
}
-exit:
spin_unlock_irqrestore(&dev->spinlock, flags);
 
-   return n;
+   return ret ? ret : insn->n;
 }
 
 static int das1800_ao_insn_write(struct comedi_device *dev,
-- 
2.6.3

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


[PATCH 11/35] staging: comedi: das1800: initialize all analog outputs

2016-04-06 Thread H Hartley Sweeten
The current code used to initialize the analog outputs only sets the
last channel. The other channels will be reloaded with the last value
that was written to them.

Move the initialzation into the subdevice init and properly initialize
all the channels to 0V.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 7a6c31e..6472a36 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1186,6 +1186,7 @@ static int das1800_attach(struct comedi_device *dev,
struct comedi_subdevice *s;
unsigned int irq = it->options[1];
int ret;
+   int i;
 
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
@@ -1290,6 +1291,12 @@ static int das1800_attach(struct comedi_device *dev,
s->maxdata  = (board->is_16bit) ? 0x : 0x0fff;
s->range_table  = &range_bipolar10;
s->insn_write   = das1800_ao_insn_write;
+
+   /* initialize all channels to 0V */
+   for (i = 0; i < s->n_chan; i++) {
+   outb(DAC(i), dev->iobase + DAS1800_SELECT);
+   outw(0, dev->iobase + DAS1800_DAC);
+   }
} else {
s->type = COMEDI_SUBD_UNUSED;
}
@@ -1317,14 +1324,6 @@ static int das1800_attach(struct comedi_device *dev,
/*  initialize digital out channels */
outb(0, dev->iobase + DAS1800_DIGITAL);
 
-   /*  initialize analog out channels */
-   if (board->has_ao) {
-   /*  select 'update' dac channel for baseAddress + 0x0 */
-   outb(DAC(board->ao_n_chan - 1),
-dev->iobase + DAS1800_SELECT);
-   outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC);
-   }
-
return 0;
 };
 
-- 
2.6.3

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


[PATCH 24/35] staging: comedi: das1800: change type of private data 'fifo_buf'

2016-04-06 Thread H Hartley Sweeten
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Change the type to 'unsigned short' as that is more typical in comedi
drivers.

Use sizeof(*p) instead of sizeof(type) when allocation the buffer.
Also fix the checkpatch.pl issue:
WARNING: line over 80 characters

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index f256b05..6b859ee 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -334,7 +334,7 @@ struct das1800_private {
/* dma bits for control register b, stored so that dma can be
 * turned on and off */
int dma_bits;
-   uint16_t *fifo_buf; /* bounce buffer for analog input FIFO */
+   unsigned short *fifo_buf;
unsigned long iobase2;  /* secondary io address used for analog out on 
'ao' boards */
bool ai_is_unipolar;
 };
@@ -1222,7 +1222,9 @@ static int das1800_attach(struct comedi_device *dev,
if (dev->irq & it->options[2])
das1800_init_dma(dev, it);
 
-   devpriv->fifo_buf = kmalloc_array(FIFO_SIZE, sizeof(uint16_t), 
GFP_KERNEL);
+   devpriv->fifo_buf = kmalloc_array(FIFO_SIZE,
+ sizeof(*devpriv->fifo_buf),
+ GFP_KERNEL);
if (!devpriv->fifo_buf)
return -ENOMEM;
 
-- 
2.6.3

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


[PATCH 19/35] staging: comedi: das1800: refactor program_chanlist()

2016-04-06 Thread H Hartley Sweeten
Refactor this function so it can be used to program the chanlist for
the analog input (*do_cmd) and (*insn_read).

Rename the function so it has namespace associated with the driver.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index d2aab27..4326b39 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -854,30 +854,33 @@ static void das1800_ai_setup_dma(struct comedi_device 
*dev,
}
 }
 
-/* programs channel/gain list into card */
-static void program_chanlist(struct comedi_device *dev,
-const struct comedi_cmd *cmd)
+static void das1800_ai_set_chanlist(struct comedi_device *dev,
+   unsigned int *chanlist, unsigned int len)
 {
-   int i, n, chan_range;
-   unsigned long irq_flags;
-   const int range_mask = 0x3; /* masks unipolar/bipolar bit off range 
*/
-   const int range_bitshift = 8;
-
-   n = cmd->chanlist_len;
-   /*  spinlock protects indirect addressing */
-   spin_lock_irqsave(&dev->spinlock, irq_flags);
-   outb(QRAM, dev->iobase + DAS1800_SELECT);   /* select QRAM for 
baseAddress + 0x0 */
-   outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS);/*set QRAM 
address start */
+   unsigned long flags;
+   unsigned int i;
+
+   /* protects the indirect addressing selected by DAS1800_SELECT */
+   spin_lock_irqsave(&dev->spinlock, flags);
+
+   /* select QRAM register and set start address */
+   outb(QRAM, dev->iobase + DAS1800_SELECT);
+   outb(len - 1, dev->iobase + DAS1800_QRAM_ADDRESS);
+
/* make channel / gain list */
-   for (i = 0; i < n; i++) {
-   chan_range =
-   CR_CHAN(cmd->chanlist[i]) |
-   ((CR_RANGE(cmd->chanlist[i]) & range_mask) <<
-range_bitshift);
-   outw(chan_range, dev->iobase + DAS1800_QRAM);
+   for (i = 0; i < len; i++) {
+   unsigned int chan = CR_CHAN(chanlist[i]);
+   unsigned int range = CR_RANGE(chanlist[i]);
+   unsigned short val;
+
+   val = chan | ((range & 0x3) << 8);
+   outw(val, dev->iobase + DAS1800_QRAM);
}
-   outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS);/*finish write 
to QRAM */
-   spin_unlock_irqrestore(&dev->spinlock, irq_flags);
+
+   /* finish write to QRAM */
+   outb(len - 1, dev->iobase + DAS1800_QRAM_ADDRESS);
+
+   spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
 static int das1800_ai_cmd(struct comedi_device *dev,
@@ -930,8 +933,7 @@ static int das1800_ai_cmd(struct comedi_device *dev,
control_c |= BMDE | XPCLK;
}
 
-   /* setup card and start */
-   program_chanlist(dev, cmd);
+   das1800_ai_set_chanlist(dev, cmd->chanlist, cmd->chanlist_len);
 
/* setup cascaded counters for conversion/scan frequency */
if ((cmd->scan_begin_src == TRIG_FOLLOW ||
@@ -966,14 +968,12 @@ static int das1800_ai_insn_read(struct comedi_device *dev,
struct comedi_insn *insn,
unsigned int *data)
 {
-   unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
bool is_unipolar = comedi_range_is_unipolar(s, range);
int i, n;
-   int chan_range;
int timeout = 1000;
unsigned short dpnt;
-   unsigned long irq_flags;
+   unsigned long flags;
 
outb(das1800_ai_chanspec_bits(s, insn->chanspec),
 dev->iobase + DAS1800_CONTROL_C);  /* software pacer */
@@ -981,13 +981,13 @@ static int das1800_ai_insn_read(struct comedi_device *dev,
outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* reset fifo */
outb(FFEN, dev->iobase + DAS1800_CONTROL_A);
 
-   chan_range = chan | ((range & 0x3) << 8);
-   spin_lock_irqsave(&dev->spinlock, irq_flags);
-   outb(QRAM, dev->iobase + DAS1800_SELECT);   /* select QRAM for 
baseAddress + 0x0 */
-   outb(0x0, dev->iobase + DAS1800_QRAM_ADDRESS);  /* set QRAM address 
start */
-   outw(chan_range, dev->iobase + DAS1800_QRAM);
-   outb(0x0, dev->iobase + DAS1800_QRAM_ADDRESS);  /*finish write to QRAM 
*/
-   outb(ADC, dev->iobase + DAS1800_SELECT);/* select ADC for 
baseAddress + 0x0 */
+   das1800_ai_set_chanlist(dev, &insn->chanspec, 1);
+
+   /* protects the indirect addressing selected by DAS1800_SELECT */
+   spin_lock_irqsave(&dev->spinlock, flags);
+
+   /* select ai fifo register */
+   outb(ADC, dev->iobase + DAS1800_SELECT);
 
for (n = 0; n < insn->n; n++) {
/* trigger conv

[PATCH 03/35] staging: comedi: das1800: tidy up analog output subdevice init

2016-04-06 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_write) function.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 907cefe..5d68353 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1078,10 +1078,10 @@ exit:
return n;
 }
 
-/* writes to an analog output channel */
-static int das1800_ao_winsn(struct comedi_device *dev,
-   struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
+static int das1800_ao_insn_write(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned int *data)
 {
const struct das1800_board *board = dev->board_ptr;
struct das1800_private *devpriv = dev->private;
@@ -1354,17 +1354,17 @@ static int das1800_attach(struct comedi_device *dev,
s->munge = das1800_ai_munge;
}
 
-   /* analog out */
+   /* Analog Output subdevice */
s = &dev->subdevices[1];
if (board->ao_ability == 1) {
-   s->type = COMEDI_SUBD_AO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = board->ao_n_chan;
-   s->maxdata = (1 << board->resolution) - 1;
-   s->range_table = &range_bipolar10;
-   s->insn_write = das1800_ao_winsn;
+   s->type = COMEDI_SUBD_AO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = board->ao_n_chan;
+   s->maxdata  = (1 << board->resolution) - 1;
+   s->range_table  = &range_bipolar10;
+   s->insn_write   = das1800_ao_insn_write;
} else {
-   s->type = COMEDI_SUBD_UNUSED;
+   s->type = COMEDI_SUBD_UNUSED;
}
 
/* Digital Input subdevice */
-- 
2.6.3

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


[PATCH 06/35] staging: comedi: das1800: remove 'common' boardinfo member

2016-04-06 Thread H Hartley Sweeten
The 64 channel "hc" type boards do not support common mode analog
inputs all the other boards do.

Remove the unnecessary member from the boardinfo and use the
'has_64_ai_chan' member to determine if the SDF_COMMON flag needs
to be set for the subdevice.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 1b0eb6f..69680ea 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -205,7 +205,6 @@ struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
int resolution; /* bits of ai resolution */
-   int common; /* supports AREF_COMMON flag */
int do_n_chan;  /* number of digital output channels */
int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 
== waveform analog out */
int ao_n_chan;  /* number of analog out channels */
@@ -222,14 +221,12 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1701st",
.ai_speed   = 6250,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1701st-da",
.ai_speed   = 6250,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -238,14 +235,12 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1702st",
.ai_speed   = 6250,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1702st-da",
.ai_speed   = 6250,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -254,14 +249,12 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1702hr",
.ai_speed   = 2,
.resolution = 16,
-   .common = 1,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1702hr-da",
.ai_speed   = 2,
.resolution = 16,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 2,
@@ -270,7 +263,6 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1701ao",
.ai_speed   = 6250,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 2,
.ao_n_chan  = 2,
@@ -279,7 +271,6 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1702ao",
.ai_speed   = 6250,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 2,
.ao_n_chan  = 2,
@@ -288,14 +279,12 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1801st",
.ai_speed   = 3000,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1801,
}, {
.name   = "das-1801st-da",
.ai_speed   = 3000,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -304,14 +293,12 @@ static const struct das1800_board das1800_boards[] = {
.name   = "das-1802st",
.ai_speed   = 3000,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.range_ai   = &range_ai_das1802,
}, {
.name   = "das-1802st-da",
.ai_speed   = 3000,
.resolution = 12,
-   .common = 1,
.do_n_chan  = 4,
.ao_ability = 1,
.ao_n_chan  = 4,
@@ -320,14 

[PATCH 25/35] staging: comedi: das1800: move comment about max conversion speeds

2016-04-06 Thread H Hartley Sweeten
For aesthetics, move this information into the comedi comment block.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 6b859ee..f197ca5 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -51,6 +51,9 @@
  * (convert_arg <= 64000). This limitation does not apply if scan_begin_src
  * is TRIG_FOLLOW.
  *
+ * The maximum conversion speeds are not always achievable depending on the
+ * board setup (see user manual.)
+ *
  * NOTES:
  * Only the DAS-1801ST has been tested by me.
  * Unipolar and bipolar ranges cannot be mixed in the channel/gain list.
@@ -200,10 +203,6 @@ struct das1800_board {
unsigned int has_8_do_chan:1;
 };
 
-/* Warning: the maximum conversion speeds listed below are
- * not always achievable depending on board setup (see
- * user manual.)
- */
 static const struct das1800_board das1800_boards[] = {
[BOARD_DAS1701ST] = {
.name   = "das-1701st",
-- 
2.6.3

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


[PATCH 00/35] staging: comedi: das1800: tidy up driver

2016-04-06 Thread H Hartley Sweeten
Tidy up this driver and fix all the checkpatch.pl issues.

This series applies after the bug fix patches:
  staging: comedi: das1800: fix analog input sample munging
  staging: comedi: das1800: fix analog input number of channels
  staging: comedi: das1800: fix das-1801st-da boardinfo

Patch 28/35 (and possible 29/35) are also bug fixes that I found later.
If neccessary I can rebase this series so that they are first.

H Hartley Sweeten (35):
  staging: comedi: das1800: tidy up digital output subdevice init
  staging: comedi: das1800: tidy up digital input subdevice init
  staging: comedi: das1800: tidy up analog output subdevice init
  staging: comedi: das1800: tidy up analog input subdevice init
  staging: comedi: das1800: tidy up boardinfo
  staging: comedi: das1800: remove 'common' boardinfo member
  staging: comedi: das1800: tidy up das1800_ao_insn_write()
  staging: comedi: das1800: refactor 'resolution' boardinfo
  staging: comedi: das1800: refactor 'do_n_chan' boardinfo
  staging: comedi: das1800: refactor 'ao_ability' boardinfo
  staging: comedi: das1800: initialize all analog outputs
  staging: comedi: das1800: refactor 'ao_n_chan' boardinfo
  staging: comedi: das1800: refactor 'range_ai' boardinfo
  staging: comedi: das1800: change type of 'ai_speed' boardinfo
  staging: comedi: das1800: tidy up das1800_probe()
  staging: comedi: das1800: add analog output readback
  staging: comedi: das1800: introduce das1800_ai_chanspec_bits()
  staging: comedi: das1800: absorb control_c_bits()
  staging: comedi: das1800: refactor program_chanlist()
  staging: comedi: das1800: use comedi_timeout()
  staging: comedi: das1800: absorb control_a_bits()
  staging: comedi: das1800: document the spinlock
  staging: comedi: das1800: cleanup copyright and comedi comment blocks
  staging: comedi: das1800: change type of private data 'fifo_buf'
  staging: comedi: das1800: move comment about max conversion speeds
  staging: comedi: das1800: remove the private data member comments
  staging: comedi: das1800: rename burst_convert_arg()
  staging: comedi: das1800: fix das1800_ai_cancel()
  staging: comedi: das1800: fix NULL pointer dereference in 
das1800_ai_setup_dma()
  staging: comedi: das1800: remove the function comments
  staging: comedi: das1800: fix comments in das1800_ai_cmd()
  staging: comedi: das1800: fix comments in das1800_ai_handler()
  staging: comedi: das1800: fix lines over 80 characters
  staging: comedi: das1800: fix comments about the 'ao' board range
  staging: comedi: das1800: update the MODULE_DESCRIPTION

 drivers/staging/comedi/drivers/das1800.c | 1191 ++
 1 file changed, 545 insertions(+), 646 deletions(-)

-- 
2.6.3

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


[PATCH 22/35] staging: comedi: das1800: document the spinlock

2016-04-06 Thread H Hartley Sweeten
The comedi_device spinlock is used to protect the indirect addressing
selected by the DAS1800_SELECT register. It also prevents races between
the interrupt handler and the analog input (*poll).

Update the comments to make this clear.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 8dae3845..a2108d3 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -517,8 +517,9 @@ static void das1800_ai_handler(struct comedi_device *dev)
struct comedi_cmd *cmd = &async->cmd;
unsigned int status = inb(dev->iobase + DAS1800_STATUS);
 
-   /*  select adc for base address + 0 */
+   /* select adc register (spinlock is already held) */
outb(ADC, dev->iobase + DAS1800_SELECT);
+
/*  dma buffer full */
if (devpriv->irq_dma_bits & DMA_ENABLED) {
/*  look for data from dma transfer even if dma terminal count 
hasn't happened yet */
@@ -562,9 +563,14 @@ static int das1800_ai_poll(struct comedi_device *dev,
 {
unsigned long flags;
 
-   /*  prevent race with interrupt handler */
+   /*
+* Protects the indirect addressing selected by DAS1800_SELECT
+* in das1800_ai_handler() also prevents race with das1800_interrupt().
+*/
spin_lock_irqsave(&dev->spinlock, flags);
+
das1800_ai_handler(dev);
+
spin_unlock_irqrestore(&dev->spinlock, flags);
 
return comedi_buf_n_bytes_ready(s);
@@ -580,9 +586,12 @@ static irqreturn_t das1800_interrupt(int irq, void *d)
return IRQ_HANDLED;
}
 
-   /* Prevent race with das1800_ai_poll() on multi processor systems.
-* Also protects indirect addressing in das1800_ai_handler */
+   /*
+* Protects the indirect addressing selected by DAS1800_SELECT
+* in das1800_ai_handler() also prevents race with das1800_ai_poll().
+*/
spin_lock(&dev->spinlock);
+
status = inb(dev->iobase + DAS1800_STATUS);
 
/* if interrupt was not caused by das-1800 */
@@ -1298,6 +1307,7 @@ static int das1800_attach(struct comedi_device *dev,
 
/* initialize all channels to 0V */
for (i = 0; i < s->n_chan; i++) {
+   /* spinlock is not necessary during the attach */
outb(DAC(i), dev->iobase + DAS1800_SELECT);
outw(0, dev->iobase + DAS1800_DAC);
}
-- 
2.6.3

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


[PATCH 12/35] staging: comedi: das1800: refactor 'ao_n_chan' boardinfo

2016-04-06 Thread H Hartley Sweeten
The "st-da" board types have 4 analog output channels. All other board
types, with analog outputs, only have 2 channels.

Replace the 'ao_n_chan' member of the boardinfo with a bit-field flag,
'has_4_ao_chan' and only set it for the "st-da" boards. Remove the
unnecessary initialization for all other boards.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 6472a36..88ba051 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -204,12 +204,12 @@ static const struct comedi_lrange range_ai_das1802 = {
 struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
-   int ao_n_chan;  /* number of analog out channels */
const struct comedi_lrange *range_ai;   /* available input ranges */
unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
unsigned int has_ao:1;
unsigned int has_wform_ao:1;
+   unsigned int has_4_ao_chan:1;
unsigned int has_8_do_chan:1;
 };
 
@@ -225,9 +225,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1701st-da",
.ai_speed   = 6250,
-   .ao_n_chan  = 4,
.range_ai   = &range_ai_das1801,
.has_ao = 1,
+   .has_4_ao_chan  = 1,
}, {
.name   = "das-1702st",
.ai_speed   = 6250,
@@ -235,9 +235,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702st-da",
.ai_speed   = 6250,
-   .ao_n_chan  = 4,
.range_ai   = &range_ai_das1802,
.has_ao = 1,
+   .has_4_ao_chan  = 1,
}, {
.name   = "das-1702hr",
.ai_speed   = 2,
@@ -246,20 +246,17 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702hr-da",
.ai_speed   = 2,
-   .ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
.is_16bit   = 1,
.has_ao = 1,
}, {
.name   = "das-1701ao",
.ai_speed   = 6250,
-   .ao_n_chan  = 2,
.range_ai   = &range_ai_das1801,
.has_wform_ao   = 1,
}, {
.name   = "das-1702ao",
.ai_speed   = 6250,
-   .ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
.has_wform_ao   = 1,
}, {
@@ -269,9 +266,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1801st-da",
.ai_speed   = 3000,
-   .ao_n_chan  = 4,
.range_ai   = &range_ai_das1801,
.has_ao = 1,
+   .has_4_ao_chan  = 1,
}, {
.name   = "das-1802st",
.ai_speed   = 3000,
@@ -279,9 +276,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1802st-da",
.ai_speed   = 3000,
-   .ao_n_chan  = 4,
.range_ai   = &range_ai_das1802,
.has_ao = 1,
+   .has_4_ao_chan  = 1,
}, {
.name   = "das-1802hr",
.ai_speed   = 1,
@@ -290,14 +287,12 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1802hr-da",
.ai_speed   = 1,
-   .ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
.is_16bit   = 1,
.has_ao = 1,
}, {
.name   = "das-1801hc",
.ai_speed   = 3000,
-   .ao_n_chan  = 2,
.range_ai   = &range_ai_das1801,
.has_64_ai_chan = 1,
.has_ao = 1,
@@ -305,7 +300,6 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1802hc",
.ai_speed   = 3000,
-   .ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
.has_64_ai_chan = 1,
.has_ao = 1,
@@ -313,13 +307,11 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1801ao",
.ai

[PATCH 10/35] staging: comedi: das1800: refactor 'ao_ability' boardinfo

2016-04-06 Thread H Hartley Sweeten
The "da" and "hc" type boards have normal analog outputs. The "ao"
type boards have move advanced analog outputs with waveform generation
capability.

Replace the 'ao_ability' member of the boardinfo with some bit-field
flags, 'has_ao' and 'has_wform_ao', and only set them appropriately
based on the board type.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index ed58ebb..7a6c31e 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -204,11 +204,12 @@ static const struct comedi_lrange range_ai_das1802 = {
 struct das1800_board {
const char *name;
int ai_speed;   /* max conversion period in nanoseconds */
-   int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 
== waveform analog out */
int ao_n_chan;  /* number of analog out channels */
const struct comedi_lrange *range_ai;   /* available input ranges */
unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
+   unsigned int has_ao:1;
+   unsigned int has_wform_ao:1;
unsigned int has_8_do_chan:1;
 };
 
@@ -224,9 +225,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1701st-da",
.ai_speed   = 6250,
-   .ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1801,
+   .has_ao = 1,
}, {
.name   = "das-1702st",
.ai_speed   = 6250,
@@ -234,9 +235,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702st-da",
.ai_speed   = 6250,
-   .ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1802,
+   .has_ao = 1,
}, {
.name   = "das-1702hr",
.ai_speed   = 2,
@@ -245,22 +246,22 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1702hr-da",
.ai_speed   = 2,
-   .ao_ability = 1,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
.is_16bit   = 1,
+   .has_ao = 1,
}, {
.name   = "das-1701ao",
.ai_speed   = 6250,
-   .ao_ability = 2,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1801,
+   .has_wform_ao   = 1,
}, {
.name   = "das-1702ao",
.ai_speed   = 6250,
-   .ao_ability = 2,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
+   .has_wform_ao   = 1,
}, {
.name   = "das-1801st",
.ai_speed   = 3000,
@@ -268,9 +269,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1801st-da",
.ai_speed   = 3000,
-   .ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1801,
+   .has_ao = 1,
}, {
.name   = "das-1802st",
.ai_speed   = 3000,
@@ -278,9 +279,9 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1802st-da",
.ai_speed   = 3000,
-   .ao_ability = 1,
.ao_n_chan  = 4,
.range_ai   = &range_ai_das1802,
+   .has_ao = 1,
}, {
.name   = "das-1802hr",
.ai_speed   = 1,
@@ -289,38 +290,38 @@ static const struct das1800_board das1800_boards[] = {
}, {
.name   = "das-1802hr-da",
.ai_speed   = 1,
-   .ao_ability = 1,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1802,
.is_16bit   = 1,
+   .has_ao = 1,
}, {
.name   = "das-1801hc",
.ai_speed   = 3000,
-   .ao_ability = 1,
.ao_n_chan  = 2,
.range_ai   = &range_ai_das1801,
.has_64_ai_chan = 1,
+   .has_ao = 1,
.has_8_do_chan  = 1,
}, {
.name   = "das-1802hc",
.ai_speed   = 3000,

[PATCH 30/35] staging: comedi: das1800: remove the function comments

2016-04-06 Thread H Hartley Sweeten
These comments are just added cruft. Remove them.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index ceecfb2..4ab7ed9 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -389,7 +389,6 @@ static void das1800_handle_fifo_not_empty(struct 
comedi_device *dev,
}
 }
 
-/* Utility function used by das1800_flush_dma() and das1800_handle_dma() */
 static void das1800_flush_dma_channel(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_isadma_desc *desc)
@@ -405,8 +404,6 @@ static void das1800_flush_dma_channel(struct comedi_device 
*dev,
comedi_buf_write_samples(s, desc->virt_addr, nsamples);
 }
 
-/* flushes remaining data from board when external trigger has stopped 
acquisition
- * and we are using dma transfers */
 static void das1800_flush_dma(struct comedi_device *dev,
  struct comedi_subdevice *s)
 {
@@ -474,7 +471,6 @@ static int das1800_ai_cancel(struct comedi_device *dev,
return 0;
 }
 
-/* the guts of the interrupt handler, that is shared with das1800_ai_poll */
 static void das1800_ai_handler(struct comedi_device *dev)
 {
struct das1800_private *devpriv = dev->private;
-- 
2.6.3

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


[PATCH 15/35] staging: comedi: das1800: tidy up das1800_probe()

2016-04-06 Thread H Hartley Sweeten
Refactor das1800_probe() to return an errno instead of the boardinfo
pointer.

Add the board 'id' to the boardinfo to tidy up this function to clarify
the sanity check when the user provided a board name when trying to
attach to the driver.

Currently when this function probes for a boardinfo based on the board
id it returns the wrong boardinfo for the "st-da" and "hr-da" types.
This causes the analog input subdevice for those boards to not be
available. Fix the probe so that a proper boardinfo is used.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 6f40bb8..bb99efc 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -167,13 +167,6 @@ TODO:
 
 #define IOBASE2   0x400/* offset of additional ioports 
used on 'ao' cards */
 
-enum {
-   das1701st, das1701st_da, das1702st, das1702st_da, das1702hr,
-   das1702hr_da,
-   das1701ao, das1702ao, das1801st, das1801st_da, das1802st, das1802st_da,
-   das1802hr, das1802hr_da, das1801hc, das1802hc, das1801ao, das1802ao
-};
-
 static const struct comedi_lrange das1801_ai_range = {
8, {
BIP_RANGE(5),   /* bipolar gain = 1 */
@@ -200,8 +193,38 @@ static const struct comedi_lrange das1802_ai_range = {
}
 };
 
+enum das1800_boardid {
+   BOARD_DAS1701ST,
+   BOARD_DAS1701ST_DA,
+   BOARD_DAS1702ST,
+   BOARD_DAS1702ST_DA,
+   BOARD_DAS1702HR,
+   BOARD_DAS1702HR_DA,
+   BOARD_DAS1701AO,
+   BOARD_DAS1702AO,
+   BOARD_DAS1801ST,
+   BOARD_DAS1801ST_DA,
+   BOARD_DAS1802ST,
+   BOARD_DAS1802ST_DA,
+   BOARD_DAS1802HR,
+   BOARD_DAS1802HR_DA,
+   BOARD_DAS1801HC,
+   BOARD_DAS1802HC,
+   BOARD_DAS1801AO,
+   BOARD_DAS1802AO
+};
+
+/* board probe id values (hi byte of the digital input register) */
+#define DAS1800_ID_ST_DA   0x3
+#define DAS1800_ID_HR_DA   0x4
+#define DAS1800_ID_AO  0x5
+#define DAS1800_ID_HR  0x6
+#define DAS1800_ID_ST  0x7
+#define DAS1800_ID_HC  0x8
+
 struct das1800_board {
const char *name;
+   unsigned char id;
unsigned int ai_speed;
unsigned int is_16bit:1;
unsigned int has_64_ai_chan:1;
@@ -217,89 +240,124 @@ struct das1800_board {
  * user manual.)
  */
 static const struct das1800_board das1800_boards[] = {
-   {
+   [BOARD_DAS1701ST] = {
.name   = "das-1701st",
+   .id = DAS1800_ID_ST,
.ai_speed   = 6250,
.das1801_range  = 1,
-   }, {
+   },
+   [BOARD_DAS1701ST_DA] = {
.name   = "das-1701st-da",
+   .id = DAS1800_ID_ST_DA,
.ai_speed   = 6250,
.das1801_range  = 1,
.has_ao = 1,
.has_4_ao_chan  = 1,
-   }, {
+   },
+   [BOARD_DAS1702ST] = {
.name   = "das-1702st",
+   .id = DAS1800_ID_ST,
.ai_speed   = 6250,
-   }, {
+   },
+   [BOARD_DAS1702ST_DA] = {
.name   = "das-1702st-da",
+   .id = DAS1800_ID_ST_DA,
.ai_speed   = 6250,
.has_ao = 1,
.has_4_ao_chan  = 1,
-   }, {
+   },
+   [BOARD_DAS1702HR] = {
.name   = "das-1702hr",
+   .id = DAS1800_ID_HR,
.ai_speed   = 2,
.is_16bit   = 1,
-   }, {
+   },
+   [BOARD_DAS1702HR_DA] = {
.name   = "das-1702hr-da",
+   .id = DAS1800_ID_HR_DA,
.ai_speed   = 2,
.is_16bit   = 1,
.has_ao = 1,
-   }, {
+   },
+   [BOARD_DAS1701AO] = {
.name   = "das-1701ao",
+   .id = DAS1800_ID_AO,
.ai_speed   = 6250,
.das1801_range  = 1,
.has_wform_ao   = 1,
-   }, {
+   },
+   [BOARD_DAS1702AO] = {
.name   = "das-1702ao",
+   .id = DAS1800_ID_AO,
.ai_speed   = 6250,
.has_wform_ao   = 1,
-   }, {
+   },
+   [BOARD_DAS1801ST] = {
.name   = "das-1801st",
+   .id = DAS1800_ID_ST,
.ai_speed   = 3000,
.das1801_range  = 1,
-   }, {
+   },
+   [BOARD_DAS1801ST_DA] = {
.name

[PATCH 35/35] staging: comedi: das1800: update the MODULE_DESCRIPTION

2016-04-06 Thread H Hartley Sweeten
Change the MODULE_DESCRIPTION to something more usefull than the
generic "Comedi low-level driver".

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 6ce01c0..e5f47cef 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1325,5 +1325,5 @@ static struct comedi_driver das1800_driver = {
 module_comedi_driver(das1800_driver);
 
 MODULE_AUTHOR("Comedi http://www.comedi.org";);
-MODULE_DESCRIPTION("Comedi low-level driver");
+MODULE_DESCRIPTION("Comedi driver for DAS1800 compatible ISA boards");
 MODULE_LICENSE("GPL");
-- 
2.6.3

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


[PATCH 23/35] staging: comedi: das1800: cleanup copyright and comedi comment blocks

2016-04-06 Thread H Hartley Sweeten
Tidy up these multi-line comments to fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index a2108d3..f256b05 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1,97 +1,63 @@
 /*
-comedi/drivers/das1800.c
-Driver for Keitley das1700/das1800 series boards
-Copyright (C) 2000 Frank Mori Hess 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 2000 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
-/*
-Driver: das1800
-Description: Keithley Metrabyte DAS1800 (& compatibles)
-Author: Frank Mori Hess 
-Devices: [Keithley Metrabyte] DAS-1701ST (das-1701st),
-  DAS-1701ST-DA (das-1701st-da), DAS-1701/AO (das-1701ao),
-  DAS-1702ST (das-1702st), DAS-1702ST-DA (das-1702st-da),
-  DAS-1702HR (das-1702hr), DAS-1702HR-DA (das-1702hr-da),
-  DAS-1702/AO (das-1702ao), DAS-1801ST (das-1801st),
-  DAS-1801ST-DA (das-1801st-da), DAS-1801HC (das-1801hc),
-  DAS-1801AO (das-1801ao), DAS-1802ST (das-1802st),
-  DAS-1802ST-DA (das-1802st-da), DAS-1802HR (das-1802hr),
-  DAS-1802HR-DA (das-1802hr-da), DAS-1802HC (das-1802hc),
-  DAS-1802AO (das-1802ao)
-Status: works
-
-The waveform analog output on the 'ao' cards is not supported.
-If you need it, send me (Frank Hess) an email.
-
-Configuration options:
-  [0] - I/O port base address
-  [1] - IRQ (optional, required for timed or externally triggered conversions)
-  [2] - DMA0 (optional, requires irq)
-  [3] - DMA1 (optional, requires irq and dma0)
-*/
-/*
+ * Comedi driver for Keithley DAS-1700/DAS-1800 series boards
+ * Copyright (C) 2000 Frank Mori Hess 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2000 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
-This driver supports the following Keithley boards:
-
-das-1701st
-das-1701st-da
-das-1701ao
-das-1702st
-das-1702st-da
-das-1702hr
-das-1702hr-da
-das-1702ao
-das-1801st
-das-1801st-da
-das-1801hc
-das-1801ao
-das-1802st
-das-1802st-da
-das-1802hr
-das-1802hr-da
-das-1802hc
-das-1802ao
-
-Options:
-   [0] - base io address
-   [1] - irq (optional, required for timed or externally triggered 
conversions)
-   [2] - dma0 (optional, requires irq)
-   [3] - dma1 (optional, requires irq and dma0)
-
-irq can be omitted, although the cmd interface will not work without it.
-
-analog input cmd triggers supported:
-   start_src:  TRIG_NOW | TRIG_EXT
-   scan_begin_src: TRIG_FOLLOW | TRIG_TIMER | TRIG_EXT
-   scan_end_src:   TRIG_COUNT
-   convert_src:TRIG_TIMER | TRIG_EXT (TRIG_EXT requires scan_begin_src 
== TRIG_FOLLOW)
-   stop_src:   TRIG_COUNT | TRIG_EXT | TRIG_NONE
-
-scan_begin_src triggers TRIG_TIMER and TRIG_EXT use the card's
-'burst mode' which limits the valid conversion time to 64 microseconds
-(convert_arg <= 64000).  This limitation does not apply if scan_begin_src
-is TRIG_FOLLOW.
-
-NOTES:
-Only the DAS-1801ST has been tested by me.
-Unipolar and bipolar ranges cannot be mixed in the channel/gain list.
-
-TODO:
-   Make it automatically allocate irq and dma channels if they are not 
specified
-   Add support for analog out on 'ao' cards
-*/
+/*
+ * Driver: das1800
+ * Description: Keithley Metrabyte DAS1800 (& compatibles)
+ * Author: Frank Mori Hess 
+ * Devices: [Keithley Metrabyte] DAS-1701ST (das-1701st),
+ *   DAS-1701ST-DA (das-1701st-da), DAS-1701/AO (das-1701ao),
+ *   DAS-1702ST (das-1702st), DAS-1702ST-DA (das-1702st-da),
+ *   DAS-1702HR (das-1702hr), DAS-1702HR-DA (das-1702hr-da),
+ *   DAS-1702/AO (das-1702ao), DAS-1801ST (das-1801st),
+ *   DAS-1801ST-DA (das-1801st-da), DAS-1801HC (das-1801hc

[PATCH] staging: rts5208: alignment to match open paranthesis

2016-04-06 Thread Manav Batra
Fixes CHECK: Alignment should match open parenthesis

Signed-off-by: Manav Batra 
---
 drivers/staging/rts5208/ms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 3e75db7..0f0cd4a 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -49,7 +49,7 @@ static int ms_parse_err_code(struct rtsx_chip *chip)
 }
 
 static int ms_transfer_tpc(struct rtsx_chip *chip, u8 trans_mode,
-   u8 tpc, u8 cnt, u8 cfg)
+  u8 tpc, u8 cnt, u8 cfg)
 {
struct ms_info *ms_card = &chip->ms_card;
int retval;
-- 
1.9.1

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