[PATCH v2] staging: comedi: ni_*: Fix style warnings.

From: Aniruddha Shastri
Date: Thu Dec 14 2017 - 01:28:52 EST


Three of these warnings are now line-too-long warnings. I think these
warnings are preferable to the ones listed below. The longest line
is only 87 chars wide, which is reasonable.

Warnings fixed:
ni_670x.c:212: WARNING: struct comedi_lrange should normally be const
ni_atmio.c:239: WARNING: Avoid multiple line dereference
- prefer 'ni_boards[i].isapnp_id'
ni_labpc_common.c:573: WARNING: Avoid multiple line dereference
- prefer 'cmd->scan_begin_arg'
ni_mio_common.c:736: WARNING: Avoid multiple line dereference
- prefer 'devpriv->counter_dev->counters[gpct_index]'
ni_mio_common.c:1977: WARNING: Prefer using '"%s...", __func__'
to using 'ni_cmd_set_mite_transfer', this function's name, in a string
ni_mio_common.c:1990: WARNING: Prefer using '"%s...", __func__'
to using 'ni_cmd_set_mite_transfer', this function's name, in a string
ni_mio_common.c:4302: WARNING: function definition argument
'int' should also have an identifier name
ni_mio_common.c:4302: WARNING: function definition argument
'int' should also have an identifier name
ni_mio_common.c:4302: WARNING: function definition argument
'int *' should also have an identifier name
ni_mio_common.c:4699: WARNING: Prefer using '"%s...", __func__'
to using 'cs5529_do_conversion', this function's name, in a string
ni_stc.h:21: WARNING: Block comments should align the * on each line

Signed-off-by: Aniruddha Shastri <aniruddha.shastri@xxxxxxxxx>
---
Changes in v2:
No longer go out of our way to fix minor line-length violations at the expense
of code quality.

drivers/staging/comedi/drivers/ni_670x.c | 2 +-
drivers/staging/comedi/drivers/ni_atmio.c | 6 +++---
drivers/staging/comedi/drivers/ni_labpc_common.c | 3 +--
drivers/staging/comedi/drivers/ni_mio_common.c | 14 ++++++++------
drivers/staging/comedi/drivers/ni_stc.h | 2 +-
5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c
index 1d3ff60..ecf663355 100644
--- a/drivers/staging/comedi/drivers/ni_670x.c
+++ b/drivers/staging/comedi/drivers/ni_670x.c
@@ -209,7 +209,7 @@ static int ni_670x_auto_attach(struct comedi_device *dev,
const struct comedi_lrange **range_table_list;

range_table_list = kmalloc_array(32,
- sizeof(struct comedi_lrange *),
+ sizeof(const struct comedi_lrange *),
GFP_KERNEL);
if (!range_table_list)
return -ENOMEM;
diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c
index ae6ed96..f9a8638 100644
--- a/drivers/staging/comedi/drivers/ni_atmio.c
+++ b/drivers/staging/comedi/drivers/ni_atmio.c
@@ -234,9 +234,9 @@ static int ni_isapnp_find_board(struct pnp_dev **dev)

for (i = 0; i < ARRAY_SIZE(ni_boards); i++) {
isapnp_dev = pnp_find_dev(NULL,
- ISAPNP_VENDOR('N', 'I', 'C'),
- ISAPNP_FUNCTION(ni_boards[i].
- isapnp_id), NULL);
+ ISAPNP_VENDOR('N', 'I', 'C'),
+ ISAPNP_FUNCTION(ni_boards[i].isapnp_id),
+ NULL);

if (!isapnp_dev || !isapnp_dev->card)
continue;
diff --git a/drivers/staging/comedi/drivers/ni_labpc_common.c b/drivers/staging/comedi/drivers/ni_labpc_common.c
index b0dfb8e..a38910e 100644
--- a/drivers/staging/comedi/drivers/ni_labpc_common.c
+++ b/drivers/staging/comedi/drivers/ni_labpc_common.c
@@ -569,8 +569,7 @@ static int labpc_ai_cmdtest(struct comedi_device *dev,
/* make sure scan timing is not too fast */
if (cmd->scan_begin_src == TRIG_TIMER) {
if (cmd->convert_src == TRIG_TIMER) {
- err |= comedi_check_trigger_arg_min(&cmd->
- scan_begin_arg,
+ err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
cmd->convert_arg *
cmd->chanlist_len);
}
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 398347f..c4a4f5c 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -732,8 +732,7 @@ static void ni_release_gpct_mite_channel(struct comedi_device *dev,

ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG,
NI_E_DMA_G0_G1_SEL_MASK(gpct_index), 0);
- ni_tio_set_mite_channel(&devpriv->
- counter_dev->counters[gpct_index],
+ ni_tio_set_mite_channel(&devpriv->counter_dev->counters[gpct_index],
NULL);
mite_release_channel(mite_chan);
}
@@ -1974,7 +1973,8 @@ static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
if (nbytes > sdev->async->prealloc_bufsz) {
if (cmd->stop_arg > 0)
dev_err(sdev->device->class_dev,
- "ni_cmd_set_mite_transfer: tried exact data transfer limits greater than buffer size\n");
+ "%s: tried exact data transfer limits greater than buffer size\n",
+ __func__);

/*
* we can only transfer up to the size of the buffer. In this
@@ -1987,7 +1987,8 @@ static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
mite_init_ring_descriptors(ring, sdev, nbytes);
#else
dev_err(sdev->device->class_dev,
- "ni_cmd_set_mite_transfer: exact data transfer limits not implemented yet without DMA\n");
+ "%s: exact data transfer limits not implemented yet without DMA\n",
+ __func__);
#endif
}

@@ -4299,7 +4300,7 @@ static int pack_ad8842(int addr, int val, int *bitstring)
struct caldac_struct {
int n_chans;
int n_bits;
- int (*packbits)(int, int, int *);
+ int (*packbits)(int addr, int val, int *bitstring);
};

static struct caldac_struct caldacs[] = {
@@ -4696,7 +4697,8 @@ static int cs5529_do_conversion(struct comedi_device *dev,
retval = cs5529_wait_for_idle(dev);
if (retval) {
dev_err(dev->class_dev,
- "timeout or signal in cs5529_do_conversion()\n");
+ "timeout or signal in %s()\n",
+ __func__);
return -ETIME;
}
status = ni_ao_win_inw(dev, NI67XX_CAL_STATUS_REG);
diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index 61138e8..03099a7 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -18,7 +18,7 @@
/*
* References:
* DAQ-STC Technical Reference Manual
-*/
+ */

#ifndef _COMEDI_NI_STC_H
#define _COMEDI_NI_STC_H
--
2.7.4