Re: [PATCH v2] staging: rtl8723au: fix potential leak in update_bcn_wps_ie()
Christian Engelmayer writes: > Fix a potential leak in the error path of function update_bcn_wps_ie(). > Move the affected input verification to the beginning of the function so > that it may return directly without leaking already allocated memory. > Detected by Coverity - CID 1077718. > > Signed-off-by: Christian Engelmayer > --- > v2: Added change suggested by Mateusz Guzik: > > Move the check before allocating the memory instead of freeing the > resource afterwards in the error path. > > Compile tested and applies against branch staging-next of tree > git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > --- > drivers/staging/rtl8723au/core/rtw_ap.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) Added to the 8723au tree Thanks! Jes ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Fixing coding style issues in android alarm-dev.c
On Wed, Apr 30, 2014 at 10:05:53PM +0100, Karim Raslan wrote: > fixing "Missing a blank line after declarations" found by checkpatch.pl script > Use a subject prefix. Also the subject is too vague. [PATCH] staging: android: alarm-dev: add a blank line regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/22] staging: comedi: remove redundant pointer dereference in comedi_poll()
`s->async->subdevice` in `comedi_poll()` points to the same `struct comedi_subdevice` as `s`, so the double pointer reference is redundant. Just use `s`. (`s->async->subdevice` is initialized by `__comedi_device_postconfig_async()` in "drivers/staging/comedi/drivers.c" and doesn't change.) Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 70545e6..90ea380 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2034,7 +2034,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) s = comedi_write_subdevice(dev, minor); if (s && s->async) { - unsigned int bps = bytes_per_sample(s->async->subdevice); + unsigned int bps = bytes_per_sample(s); poll_wait(file, &s->async->wait_head, wait); comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz); -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/22] staging: comedi: pass subdevice around instead of async
For comedi subdevices that support asynchronous commands, the `async` member of `struct comedi_subdevice` points to a `struct comedi_async` allocated to manage asynchronous commands on that subdevice. The pointer to this "async" structure is passed around by various functions and some of those functions need to get back to the "subdevice" structure from this pointer, so the "async" structure has a `subdevice` member pointing back to the `struct comedi_subdevice`. Since we can always get to the "async" structure from the "subdevice" structure, we can just pass around the pointer to the subdevice instead of the pointer to the async structure. Then the `subdevice` member of `struct comedi_async` is no longer required and can be removed. 01) staging: comedi: remove redundant pointer dereference in comedi_poll() 02) staging: comedi: remove async parameter from resize_async_buffer() 03) staging: comedi: pass subdevice to comedi_buf_put() 04) staging: comedi: pass subdevice to comedi_buf_get() 05) staging: comedi: pass subdevice to comedi_buf_memcpy_to() 06) staging: comedi: pass subdevice to comedi_buf_memcpy_from() 07) staging: comedi: ni_tiocmd: pass subdevice to command setup functions 08) staging: comedi: pass subdevice to comedi_buf_write_alloc() 09) staging: comedi: pass subdevice to comedi_buf_write_free() 10) staging: comedi: pass subdevice to comedi_buf_write_n_allocated() 11) staging: comedi: pass subdevice to comedi_buf_read_alloc() 12) staging: comedi: pass subdevice to comedi_buf_read_free() 13) staging: comedi: pass subdevice to comedi_buf_read_n_available() 14) staging: comedi: pass subdevice to comedi_buf_reset() 15) staging: comedi: pass subdevice to comedi_buf_is_mmapped() 16) staging: comedi: pass subdevice to comedi_buf_munge() 17) staging: comedi: pass subdevice to __comedi_buf_write_alloc() 18) staging: comedi: pass subdevice to comedi_buf_write_n_available() 19) staging: comedi: mite: pass subdevice to mite_buf_change() 20) staging: comedi: mite: pass subdevice to mite_sync_input_dma() 21) staging: comedi: mite: pass subdevice to mite_sync_output_dma() 22) staging: comedi: remove subdevice member of struct comedi_async drivers/staging/comedi/comedi_buf.c| 66 +- drivers/staging/comedi/comedi_fops.c | 48 drivers/staging/comedi/comedi_internal.h | 6 +- drivers/staging/comedi/comedidev.h | 20 +++ drivers/staging/comedi/drivers.c | 1 - drivers/staging/comedi/drivers/8255.c | 2 +- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 2 +- .../comedi/drivers/addi-data/hwdrv_apci3200.c | 7 +-- drivers/staging/comedi/drivers/addi_apci_1032.c| 2 +- drivers/staging/comedi/drivers/addi_apci_2032.c| 2 +- drivers/staging/comedi/drivers/addi_apci_3xxx.c| 2 +- drivers/staging/comedi/drivers/adv_pci1710.c | 10 ++-- .../staging/comedi/drivers/amplc_dio200_common.c | 2 +- drivers/staging/comedi/drivers/amplc_pc236.c | 2 +- drivers/staging/comedi/drivers/amplc_pci224.c | 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 8 +-- drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +- drivers/staging/comedi/drivers/comedi_fc.c | 16 +++--- drivers/staging/comedi/drivers/comedi_parport.c| 2 +- drivers/staging/comedi/drivers/dmm32at.c | 8 +-- drivers/staging/comedi/drivers/dt282x.c| 2 +- drivers/staging/comedi/drivers/dt3000.c| 2 +- drivers/staging/comedi/drivers/me4000.c| 4 +- drivers/staging/comedi/drivers/mite.c | 26 - drivers/staging/comedi/drivers/mite.h | 6 +- drivers/staging/comedi/drivers/ni_6527.c | 2 +- drivers/staging/comedi/drivers/ni_65xx.c | 2 +- drivers/staging/comedi/drivers/ni_660x.c | 6 +- drivers/staging/comedi/drivers/ni_atmio16d.c | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c | 20 +++ drivers/staging/comedi/drivers/ni_pcidio.c | 12 ++-- drivers/staging/comedi/drivers/ni_pcimio.c | 10 ++-- drivers/staging/comedi/drivers/ni_tiocmd.c | 24 drivers/staging/comedi/drivers/pcl711.c| 2 +- drivers/staging/comedi/drivers/pcl726.c| 2 +- drivers/staging/comedi/drivers/pcl812.c| 4 +- drivers/staging/comedi/drivers/pcl816.c| 2 +- drivers/staging/comedi/drivers/pcl818.c| 6 +- drivers/staging/comedi/drivers/pcmmio.c| 4 +- drivers/staging/comedi/drivers/pcmuio.c| 4 +- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- drivers/staging/comedi/drivers/rtd520.c| 4 +- drivers/staging/comedi/drivers/s626.c | 1 - drivers/staging/comedi/drivers/usbdux.c| 4 +- drivers/staging/comedi/drivers/usbduxsigma.c | 2 +- 45 files changed, 184 insertions(+), 181 de
[PATCH 04/22] staging: comedi: pass subdevice to comedi_buf_get()
Change the parameters of `comedi_buf_get()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The function gets a sample value from the comedi buffer, but currently only deals with 16-bit sample types. A future version could deal with 16 or 32-bit sample types depending on the value of the SDF_LSAMPL subdevice flag. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c| 3 ++- drivers/staging/comedi/comedidev.h | 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 4 ++-- drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++-- drivers/staging/comedi/drivers/usbdux.c| 2 +- drivers/staging/comedi/drivers/usbduxsigma.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index f127bf9..acb042c 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -431,8 +431,9 @@ int comedi_buf_put(struct comedi_subdevice *s, unsigned short x) } EXPORT_SYMBOL_GPL(comedi_buf_put); -int comedi_buf_get(struct comedi_async *async, unsigned short *x) +int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x) { + struct comedi_async *async = s->async; unsigned int n = comedi_buf_read_n_available(async); if (n < sizeof(short)) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index a874c1c..d19a20c 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -344,7 +344,7 @@ unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int); unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int); int comedi_buf_put(struct comedi_subdevice *s, unsigned short x); -int comedi_buf_get(struct comedi_async *, unsigned short *); +int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x); void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, const void *source, unsigned int num_bytes); diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 627282c..d3b35ff 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -1172,7 +1172,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev, return; for (i = 0; i < cmd->chanlist_len; i++) { /* Read sample from Comedi's circular buffer. */ - ret = comedi_buf_get(s->async, &data); + ret = comedi_buf_get(s, &data); if (ret == 0) { s->async->events |= COMEDI_CB_OVERFLOW; pci230_ao_stop(dev, s); @@ -1258,7 +1258,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, for (i = 0; i < cmd->chanlist_len; i++) { unsigned short datum; - comedi_buf_get(async, &datum); + comedi_buf_get(s, &datum); pci230_ao_write_fifo(dev, datum, CR_CHAN(cmd->chanlist[i])); } diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 087b533..d4e99af 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1149,7 +1149,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev, chan = async->cur_chan; for (i = 0; i < n; i++) { - err &= comedi_buf_get(async, &d); + err &= comedi_buf_get(s, &d); if (err == 0) break; @@ -1159,7 +1159,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev, packed_data = d & 0x; /* 6711 only has 16 bit wide ao fifo */ if (board->reg_type != ni_reg_6711) { - err &= comedi_buf_get(async, &d); + err &= comedi_buf_get(s, &d); if (err == 0) break; chan++; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 011fede..143f632 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -484,7 +484,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) unsigned int chan = devpriv->ao_chanlist[i]; unsigned short val; - ret = comedi_bu
[PATCH 03/22] staging: comedi: pass subdevice to comedi_buf_put()
Change the parameters of `comedi_buf_put()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The function puts a sample value in the comedi buffer, but currently only deals with 16-bit sample types. A future version could deal with 16 or 32-bit sample types depending on the value of the SDF_LSAMPL subdevice flag. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 3 ++- drivers/staging/comedi/comedidev.h| 2 +- drivers/staging/comedi/drivers/8255.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 2 +- drivers/staging/comedi/drivers/addi_apci_1032.c | 2 +- drivers/staging/comedi/drivers/addi_apci_2032.c | 2 +- drivers/staging/comedi/drivers/addi_apci_3xxx.c | 2 +- drivers/staging/comedi/drivers/adv_pci1710.c | 10 -- drivers/staging/comedi/drivers/amplc_dio200_common.c | 2 +- drivers/staging/comedi/drivers/amplc_pc236.c | 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 2 +- drivers/staging/comedi/drivers/comedi_parport.c | 2 +- drivers/staging/comedi/drivers/dmm32at.c | 8 +--- drivers/staging/comedi/drivers/dt282x.c | 2 +- drivers/staging/comedi/drivers/dt3000.c | 2 +- drivers/staging/comedi/drivers/me4000.c | 4 ++-- drivers/staging/comedi/drivers/ni_6527.c | 2 +- drivers/staging/comedi/drivers/ni_65xx.c | 2 +- drivers/staging/comedi/drivers/ni_atmio16d.c | 2 +- drivers/staging/comedi/drivers/ni_pcidio.c| 4 ++-- drivers/staging/comedi/drivers/pcl711.c | 2 +- drivers/staging/comedi/drivers/pcl726.c | 2 +- drivers/staging/comedi/drivers/pcl812.c | 4 ++-- drivers/staging/comedi/drivers/pcl816.c | 2 +- drivers/staging/comedi/drivers/pcl818.c | 6 +++--- drivers/staging/comedi/drivers/pcmmio.c | 4 ++-- drivers/staging/comedi/drivers/pcmuio.c | 4 ++-- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- drivers/staging/comedi/drivers/rtd520.c | 4 ++-- drivers/staging/comedi/drivers/s626.c | 1 - drivers/staging/comedi/drivers/usbdux.c | 2 +- 31 files changed, 42 insertions(+), 50 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 2575950..f127bf9 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -416,8 +416,9 @@ unsigned int comedi_buf_read_free(struct comedi_async *async, } EXPORT_SYMBOL_GPL(comedi_buf_read_free); -int comedi_buf_put(struct comedi_async *async, unsigned short x) +int comedi_buf_put(struct comedi_subdevice *s, unsigned short x) { + struct comedi_async *async = s->async; unsigned int n = __comedi_buf_write_alloc(async, sizeof(short), 1); if (n < sizeof(short)) { diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index d46123a..a874c1c 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -343,7 +343,7 @@ unsigned int comedi_buf_read_n_available(struct comedi_async *); unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int); unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int); -int comedi_buf_put(struct comedi_async *, unsigned short); +int comedi_buf_put(struct comedi_subdevice *s, unsigned short x); int comedi_buf_get(struct comedi_async *, unsigned short *); void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 1d53e24..46113a3 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -117,7 +117,7 @@ void subdev_8255_interrupt(struct comedi_device *dev, d = spriv->io(0, _8255_DATA, 0, iobase); d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); - comedi_buf_put(s->async, d); + comedi_buf_put(s, d); s->async->events |= COMEDI_CB_EOS; comedi_event(dev, s); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 7ead23e..511559c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1570,7 +1570,7 @@ static int apci3120_interrupt_handle_eos(struct comedi_device *dev) n_chan = devpri
[PATCH 06/22] staging: comedi: pass subdevice to comedi_buf_memcpy_from()
Change the parameters of `comedi_buf_memcpy_from()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c| 3 ++- drivers/staging/comedi/comedidev.h | 2 +- drivers/staging/comedi/drivers/comedi_fc.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index de850f3..199ebb4 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -472,10 +472,11 @@ void comedi_buf_memcpy_to(struct comedi_subdevice *s, unsigned int offset, } EXPORT_SYMBOL_GPL(comedi_buf_memcpy_to); -void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, +void comedi_buf_memcpy_from(struct comedi_subdevice *s, unsigned int offset, void *dest, unsigned int nbytes) { void *src; + struct comedi_async *async = s->async; unsigned int read_ptr = async->buf_read_ptr + offset; if (read_ptr >= async->prealloc_bufsz) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 221db71..0a68006 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -348,7 +348,7 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x); void comedi_buf_memcpy_to(struct comedi_subdevice *s, unsigned int offset, const void *source, unsigned int num_bytes); -void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, +void comedi_buf_memcpy_from(struct comedi_subdevice *s, unsigned int offset, void *destination, unsigned int num_bytes); /* drivers.c - general comedi driver functions */ diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c index 81749a7..5eff9d1 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.c +++ b/drivers/staging/comedi/drivers/comedi_fc.c @@ -92,7 +92,7 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *s, return 0; num_bytes = comedi_buf_read_alloc(async, num_bytes); - comedi_buf_memcpy_from(async, 0, data, num_bytes); + comedi_buf_memcpy_from(s, 0, data, num_bytes); comedi_buf_read_free(async, num_bytes); cfc_inc_scan_progress(s, num_bytes); async->events |= COMEDI_CB_BLOCK; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/22] staging: comedi: pass subdevice to comedi_buf_memcpy_to()
Change the parameters of `comedi_buf_memcpy_to()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 3 ++- drivers/staging/comedi/comedidev.h| 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c | 2 +- drivers/staging/comedi/drivers/comedi_fc.c| 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index acb042c..de850f3 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -445,9 +445,10 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x) } EXPORT_SYMBOL_GPL(comedi_buf_get); -void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, +void comedi_buf_memcpy_to(struct comedi_subdevice *s, unsigned int offset, const void *data, unsigned int num_bytes) { + struct comedi_async *async = s->async; unsigned int write_ptr = async->buf_write_ptr + offset; if (write_ptr >= async->prealloc_bufsz) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index d19a20c..221db71 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -346,7 +346,7 @@ unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int); int comedi_buf_put(struct comedi_subdevice *s, unsigned short x); int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x); -void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, +void comedi_buf_memcpy_to(struct comedi_subdevice *s, unsigned int offset, const void *source, unsigned int num_bytes); void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, void *destination, unsigned int num_bytes); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index 9b8851c..51095be 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -2712,7 +2712,7 @@ static int i_APCI3200_InterruptHandleEos(struct comedi_device *dev) s->async->events |= COMEDI_CB_ERROR; } /* Write all 7 scan values in the comedi buffer */ - comedi_buf_memcpy_to(s->async, 0, + comedi_buf_memcpy_to(s, 0, (unsigned int *) s_BoardInfos[dev->minor]. ui_ScanValueArray, (7 + 12) * sizeof(unsigned int)); diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c index 9d9b146..81749a7 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.c +++ b/drivers/staging/comedi/drivers/comedi_fc.c @@ -74,7 +74,7 @@ unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *s, return 0; } - comedi_buf_memcpy_to(async, 0, data, num_bytes); + comedi_buf_memcpy_to(s, 0, data, num_bytes); comedi_buf_write_free(async, num_bytes); cfc_inc_scan_progress(s, num_bytes); async->events |= COMEDI_CB_BLOCK; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/22] staging: comedi: remove async parameter from resize_async_buffer()
The `struct comedi_async *async` parameter of `resize_async_buffer()` is redundant as its value can be easily derived from the `struct comedi_subdevice *s` parameter as `s->async`. Remove the parameter. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_fops.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 90ea380..9ce1574 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -238,9 +238,9 @@ comedi_write_subdevice(const struct comedi_device *dev, unsigned int minor) } static int resize_async_buffer(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_async *async, unsigned new_size) + struct comedi_subdevice *s, unsigned new_size) { + struct comedi_async *async = s->async; int retval; if (new_size > async->max_bufsize) @@ -380,7 +380,7 @@ static ssize_t read_buffer_kb_store(struct device *csdev, mutex_lock(&dev->mutex); s = comedi_read_subdevice(dev, minor); if (s && (s->subdev_flags & SDF_CMD_READ) && s->async) - err = resize_async_buffer(dev, s, s->async, size); + err = resize_async_buffer(dev, s, size); else err = -EINVAL; mutex_unlock(&dev->mutex); @@ -493,7 +493,7 @@ static ssize_t write_buffer_kb_store(struct device *csdev, mutex_lock(&dev->mutex); s = comedi_write_subdevice(dev, minor); if (s && (s->subdev_flags & SDF_CMD_WRITE) && s->async) - err = resize_async_buffer(dev, s, s->async, size); + err = resize_async_buffer(dev, s, size); else err = -EINVAL; mutex_unlock(&dev->mutex); @@ -740,7 +740,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, } if (bc.size) { - retval = resize_async_buffer(dev, s, async, bc.size); + retval = resize_async_buffer(dev, s, bc.size); if (retval < 0) return retval; } -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/22] staging: comedi: pass subdevice to comedi_buf_write_alloc()
Change the parameters of `comedi_buf_write_alloc()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 4 ++-- drivers/staging/comedi/comedi_fops.c | 6 +++--- drivers/staging/comedi/comedidev.h| 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c | 3 +-- drivers/staging/comedi/drivers/comedi_fc.c| 2 +- drivers/staging/comedi/drivers/mite.c | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c| 2 +- drivers/staging/comedi/drivers/ni_pcidio.c| 2 +- drivers/staging/comedi/drivers/ni_tiocmd.c| 2 +- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 199ebb4..6a65500 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -269,10 +269,10 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_async *async, } /* allocates chunk for the writer from free buffer space */ -unsigned int comedi_buf_write_alloc(struct comedi_async *async, +unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int nbytes) { - return __comedi_buf_write_alloc(async, nbytes, 0); + return __comedi_buf_write_alloc(s->async, nbytes, 0); } EXPORT_SYMBOL_GPL(comedi_buf_write_alloc); diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 9ce1574..65135c1 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1003,7 +1003,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, if (bi.bytes_written && (s->subdev_flags & SDF_CMD_WRITE)) { bi.bytes_written = - comedi_buf_write_alloc(async, bi.bytes_written); + comedi_buf_write_alloc(s, bi.bytes_written); comedi_buf_write_free(async, bi.bytes_written); } @@ -2037,7 +2037,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) unsigned int bps = bytes_per_sample(s); poll_wait(file, &s->async->wait_head, wait); - comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz); + comedi_buf_write_alloc(s, s->async->prealloc_bufsz); if (!s->busy || !comedi_is_subdevice_running(s) || comedi_buf_write_n_allocated(s->async) >= bps) mask |= POLLOUT | POLLWRNORM; @@ -2135,7 +2135,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, m = n; if (async->buf_write_ptr + m > async->prealloc_bufsz) m = async->prealloc_bufsz - async->buf_write_ptr; - comedi_buf_write_alloc(async, async->prealloc_bufsz); + comedi_buf_write_alloc(s, async->prealloc_bufsz); if (m > comedi_buf_write_n_allocated(async)) m = comedi_buf_write_n_allocated(async); if (m < n) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 0a68006..b47cc96 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -336,7 +336,7 @@ static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd) */ int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev); -unsigned int comedi_buf_write_alloc(struct comedi_async *, unsigned int); +unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_write_free(struct comedi_async *, unsigned int); unsigned int comedi_buf_read_n_available(struct comedi_async *); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index 51095be..246220a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -2702,8 +2702,7 @@ static int i_APCI3200_InterruptHandleEos(struct comedi_device *dev) s->async->events |= COMEDI_CB_EOS; /* Test if enougth memory is available and allocate it for 7 values */ - /* n = comedi_buf_write_alloc(s->async, 7*sizeof(unsigned int)); */ - n = comedi_buf_write_alloc(s->async, + n = comedi_buf_write_alloc(s, (7 + 12) * sizeof(unsigned int)); /* If not enough memory available, event is set to
[PATCH 17/22] staging: comedi: pass subdevice to __comedi_buf_write_alloc()
Local function `__comedi_buf_write_alloc()` is called by `comedi_buf_write_alloc()` and `comedi_buf_put()`. It currently takes a pointer to a `struct comedi_async`. Change it to take a pointer to a `struct comedi_subdevice` and use the `async` member for consistency with other comedi buffer handling functions. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index b5e329e..5be91cd 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -250,10 +250,11 @@ static unsigned int comedi_buf_write_n_available(struct comedi_async *async) return free_end - async->buf_write_alloc_count; } -static unsigned int __comedi_buf_write_alloc(struct comedi_async *async, +static unsigned int __comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int nbytes, int strict) { + struct comedi_async *async = s->async; unsigned int available = comedi_buf_write_n_available(async); if (nbytes > available) @@ -274,7 +275,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_async *async, unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int nbytes) { - return __comedi_buf_write_alloc(s->async, nbytes, 0); + return __comedi_buf_write_alloc(s, nbytes, 0); } EXPORT_SYMBOL_GPL(comedi_buf_write_alloc); @@ -427,7 +428,7 @@ EXPORT_SYMBOL_GPL(comedi_buf_read_free); int comedi_buf_put(struct comedi_subdevice *s, unsigned short x) { struct comedi_async *async = s->async; - unsigned int n = __comedi_buf_write_alloc(async, sizeof(short), 1); + unsigned int n = __comedi_buf_write_alloc(s, sizeof(short), 1); if (n < sizeof(short)) { async->events |= COMEDI_CB_ERROR; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/22] staging: comedi: pass subdevice to comedi_buf_read_free()
Change the parameters of `comedi_buf_read_free()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c| 5 +++-- drivers/staging/comedi/comedi_fops.c | 4 ++-- drivers/staging/comedi/comedidev.h | 2 +- drivers/staging/comedi/drivers/comedi_fc.c | 6 ++ drivers/staging/comedi/drivers/mite.c | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 07e0b3a..a3c3f21 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -398,9 +398,10 @@ static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async) } /* transfers control of a chunk from reader to free buffer space */ -unsigned int comedi_buf_read_free(struct comedi_async *async, +unsigned int comedi_buf_read_free(struct comedi_subdevice *s, unsigned int nbytes) { + struct comedi_async *async = s->async; unsigned int allocated; /* @@ -444,7 +445,7 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x) return 0; comedi_buf_read_alloc(s, sizeof(short)); *x = *(unsigned short *)(async->prealloc_buf + async->buf_read_ptr); - comedi_buf_read_free(async, sizeof(short)); + comedi_buf_read_free(s, sizeof(short)); return 1; } EXPORT_SYMBOL_GPL(comedi_buf_get); diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 5d1480e..ab2afab 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -993,7 +993,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, if (bi.bytes_read && (s->subdev_flags & SDF_CMD_READ)) { bi.bytes_read = comedi_buf_read_alloc(s, bi.bytes_read); - comedi_buf_read_free(async, bi.bytes_read); + comedi_buf_read_free(s, bi.bytes_read); if (comedi_is_subdevice_idle(s) && async->buf_write_count == async->buf_read_count) { @@ -2272,7 +2272,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, } comedi_buf_read_alloc(s, n); - comedi_buf_read_free(async, n); + comedi_buf_read_free(s, n); count += n; nbytes -= n; diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index d2131f2..c481620 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -341,7 +341,7 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_read_n_available(struct comedi_async *); unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n); -unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int); +unsigned int comedi_buf_read_free(struct comedi_subdevice *s, unsigned int n); int comedi_buf_put(struct comedi_subdevice *s, unsigned short x); int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x); diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c index 836eb1a..cf3da2c 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.c +++ b/drivers/staging/comedi/drivers/comedi_fc.c @@ -86,16 +86,14 @@ EXPORT_SYMBOL_GPL(cfc_write_array_to_buffer); unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *s, void *data, unsigned int num_bytes) { - struct comedi_async *async = s->async; - if (num_bytes == 0) return 0; num_bytes = comedi_buf_read_alloc(s, num_bytes); comedi_buf_memcpy_from(s, 0, data, num_bytes); - comedi_buf_read_free(async, num_bytes); + comedi_buf_read_free(s, num_bytes); cfc_inc_scan_progress(s, num_bytes); - async->events |= COMEDI_CB_BLOCK; + s->async->events |= COMEDI_CB_BLOCK; return num_bytes; } diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index d1423ca..6c8bd7c 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -588,7 +588,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, return 0; if (count) { - comedi_buf_read_free(async, count); + comedi_buf_read_free(s, count); async->events |= COMEDI_CB_BLOCK; } return 0; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverpr
[PATCH 13/22] staging: comedi: pass subdevice to comedi_buf_read_n_available()
Change the parameters of `comedi_buf_read_n_available()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c| 5 +++-- drivers/staging/comedi/comedi_fops.c | 4 ++-- drivers/staging/comedi/comedidev.h | 2 +- drivers/staging/comedi/drivers/amplc_pci224.c | 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 2 +- drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +- drivers/staging/comedi/drivers/ni_660x.c | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++-- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index a3c3f21..f295285 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -350,8 +350,9 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice *s, } EXPORT_SYMBOL_GPL(comedi_buf_write_free); -unsigned int comedi_buf_read_n_available(struct comedi_async *async) +unsigned int comedi_buf_read_n_available(struct comedi_subdevice *s) { + struct comedi_async *async = s->async; unsigned num_bytes; if (!async) @@ -439,7 +440,7 @@ EXPORT_SYMBOL_GPL(comedi_buf_put); int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x) { struct comedi_async *async = s->async; - unsigned int n = comedi_buf_read_n_available(async); + unsigned int n = comedi_buf_read_n_available(s); if (n < sizeof(short)) return 0; diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index ab2afab..997be8f 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2028,7 +2028,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) if (s && s->async) { poll_wait(file, &s->async->wait_head, wait); if (!s->busy || !comedi_is_subdevice_running(s) || - comedi_buf_read_n_available(s->async) > 0) + comedi_buf_read_n_available(s) > 0) mask |= POLLIN | POLLRDNORM; } @@ -2228,7 +2228,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, n = nbytes; - m = comedi_buf_read_n_available(async); + m = comedi_buf_read_n_available(s); /* printk("%d available\n",m); */ if (async->buf_read_ptr + m > async->prealloc_bufsz) m = async->prealloc_bufsz - async->buf_read_ptr; diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index c481620..a5d479c 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -339,7 +339,7 @@ int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev); unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n); -unsigned int comedi_buf_read_n_available(struct comedi_async *); +unsigned int comedi_buf_read_n_available(struct comedi_subdevice *s); unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_read_free(struct comedi_subdevice *s, unsigned int n); diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index f0b04ca..48c3570 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -559,7 +559,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, bytes_per_scan = sizeof(short); } /* Determine number of scans available in buffer. */ - num_scans = comedi_buf_read_n_available(s->async) / bytes_per_scan; + num_scans = comedi_buf_read_n_available(s) / bytes_per_scan; if (!devpriv->ao_stop_continuous) { /* Fixed number of scans. */ if (num_scans > devpriv->ao_stop_count) diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index d3b35ff..f532a39 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -1213,7 +1213,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, dacstat = inw(dev->iobase + PCI230_DACCON); /* Determine number of scans available in buffer. */ bytes_per_scan = cmd->chanlist_len * sizeof(short); - num_scans = comedi_buf_read_n_available(async) / bytes_per_scan; + num_scans = comedi_buf_read_n_available(s) / bytes_per_scan; if (!
[PATCH 10/22] staging: comedi: pass subdevice to comedi_buf_write_n_allocated()
Change the parameters of `comedi_buf_write_n_allocated()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 6 -- drivers/staging/comedi/comedi_fops.c | 6 +++--- drivers/staging/comedi/comedi_internal.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 2208168..ac498e0 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -323,8 +323,10 @@ static unsigned int comedi_buf_munge(struct comedi_async *async, return count; } -unsigned int comedi_buf_write_n_allocated(struct comedi_async *async) +unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s) { + struct comedi_async *async = s->async; + return async->buf_write_alloc_count - async->buf_write_count; } @@ -333,7 +335,7 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int nbytes) { struct comedi_async *async = s->async; - unsigned int allocated = comedi_buf_write_n_allocated(async); + unsigned int allocated = comedi_buf_write_n_allocated(s); if (nbytes > allocated) nbytes = allocated; diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 5262543..ba6949e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2039,7 +2039,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) poll_wait(file, &s->async->wait_head, wait); comedi_buf_write_alloc(s, s->async->prealloc_bufsz); if (!s->busy || !comedi_is_subdevice_running(s) || - comedi_buf_write_n_allocated(s->async) >= bps) + comedi_buf_write_n_allocated(s) >= bps) mask |= POLLOUT | POLLWRNORM; } @@ -2136,8 +2136,8 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, if (async->buf_write_ptr + m > async->prealloc_bufsz) m = async->prealloc_bufsz - async->buf_write_ptr; comedi_buf_write_alloc(s, async->prealloc_bufsz); - if (m > comedi_buf_write_n_allocated(async)) - m = comedi_buf_write_n_allocated(async); + if (m > comedi_buf_write_n_allocated(s)) + m = comedi_buf_write_n_allocated(s); if (m < n) n = m; diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index a492f2d..36e7a99 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -21,7 +21,7 @@ void comedi_buf_map_get(struct comedi_buf_map *bm); int comedi_buf_map_put(struct comedi_buf_map *bm); struct comedi_buf_map *comedi_buf_map_from_subdev_get( struct comedi_subdevice *s); -unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); +unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s); void comedi_device_cancel_all(struct comedi_device *dev); extern unsigned int comedi_default_buf_size_kb; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/22] staging: comedi: ni_tiocmd: pass subdevice to command setup functions
The `ni_tio_input_cmd()`, `ni_tio_output_cmd()` and `ni_tio_cmd_setup()` functions are called from `ni_tio_cmd()` to set up a comedi command. They currently get passed two parameters, a pointer to a `struct ni_gpct` and a pointer to a `struct comedi_async`, but both of those come from members of a `struct comedi_subdevice` (the former from the `private` member). Replace the parameters with a pointer to the `struct comedi_subdevice`. The main motive is to make the comedi subdevice more easily available to the functions for the use of subsequent patches to remove the `struct comedi_async *` parameters from the comedi buffer handling functions. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/ni_tiocmd.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index b9d23db..7a163fc 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -115,10 +115,12 @@ static int ni_tio_input_inttrig(struct comedi_device *dev, return retval; } -static int ni_tio_input_cmd(struct ni_gpct *counter, struct comedi_async *async) +static int ni_tio_input_cmd(struct comedi_subdevice *s) { + struct ni_gpct *counter = s->private; struct ni_gpct_device *counter_dev = counter->counter_dev; unsigned cidx = counter->counter_index; + struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; int retval = 0; @@ -164,9 +166,10 @@ static int ni_tio_input_cmd(struct ni_gpct *counter, struct comedi_async *async) return retval; } -static int ni_tio_output_cmd(struct ni_gpct *counter, -struct comedi_async *async) +static int ni_tio_output_cmd(struct comedi_subdevice *s) { + struct ni_gpct *counter = s->private; + dev_err(counter->counter_dev->dev->class_dev, "output commands not yet implemented.\n"); return -ENOTSUPP; @@ -178,9 +181,10 @@ static int ni_tio_output_cmd(struct ni_gpct *counter, return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE); } -static int ni_tio_cmd_setup(struct ni_gpct *counter, struct comedi_async *async) +static int ni_tio_cmd_setup(struct comedi_subdevice *s) { - struct comedi_cmd *cmd = &async->cmd; + struct comedi_cmd *cmd = &s->async->cmd; + struct ni_gpct *counter = s->private; unsigned cidx = counter->counter_index; int set_gate_source = 0; unsigned gate_source; @@ -219,12 +223,12 @@ int ni_tio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) "Interrupt-driven commands not yet implemented.\n"); retval = -EIO; } else { - retval = ni_tio_cmd_setup(counter, async); + retval = ni_tio_cmd_setup(s); if (retval == 0) { if (cmd->flags & CMDF_WRITE) - retval = ni_tio_output_cmd(counter, async); + retval = ni_tio_output_cmd(s); else - retval = ni_tio_input_cmd(counter, async); + retval = ni_tio_input_cmd(s); } } spin_unlock_irqrestore(&counter->lock, flags); -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/22] staging: comedi: pass subdevice to comedi_buf_reset()
Change the parameters of `comedi_buf_reset()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 4 +++- drivers/staging/comedi/comedi_fops.c | 4 ++-- drivers/staging/comedi/comedi_internal.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index f295285..fa5d6d4 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -222,8 +222,10 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } -void comedi_buf_reset(struct comedi_async *async) +void comedi_buf_reset(struct comedi_subdevice *s) { + struct comedi_async *async = s->async; + async->buf_write_alloc_count = 0; async->buf_write_count = 0; async->buf_read_alloc_count = 0; diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 997be8f..a7aef8a 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -583,7 +583,7 @@ static void do_become_nonbusy(struct comedi_device *dev, comedi_set_subdevice_runflags(s, SRF_RUNNING, 0); if (async) { - comedi_buf_reset(async); + comedi_buf_reset(s); async->inttrig = NULL; kfree(async->cmd.chanlist); async->cmd.chanlist = NULL; @@ -1556,7 +1556,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, goto cleanup; } - comedi_buf_reset(async); + comedi_buf_reset(s); async->cb_mask = COMEDI_CB_EOA | COMEDI_CB_BLOCK | COMEDI_CB_ERROR | diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index 36e7a99..3cc81de 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -15,7 +15,7 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s); int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long new_size); -void comedi_buf_reset(struct comedi_async *async); +void comedi_buf_reset(struct comedi_subdevice *s); bool comedi_buf_is_mmapped(struct comedi_async *async); void comedi_buf_map_get(struct comedi_buf_map *bm); int comedi_buf_map_put(struct comedi_buf_map *bm); -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/22] staging: comedi: pass subdevice to comedi_buf_write_free()
Change the parameters of `comedi_buf_write_free()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 5 +++-- drivers/staging/comedi/comedi_fops.c | 4 ++-- drivers/staging/comedi/comedidev.h| 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c | 2 +- drivers/staging/comedi/drivers/comedi_fc.c| 2 +- drivers/staging/comedi/drivers/mite.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 6a65500..2208168 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -329,9 +329,10 @@ unsigned int comedi_buf_write_n_allocated(struct comedi_async *async) } /* transfers a chunk from writer to filled buffer space */ -unsigned int comedi_buf_write_free(struct comedi_async *async, +unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int nbytes) { + struct comedi_async *async = s->async; unsigned int allocated = comedi_buf_write_n_allocated(async); if (nbytes > allocated) @@ -426,7 +427,7 @@ int comedi_buf_put(struct comedi_subdevice *s, unsigned short x) return 0; } *(unsigned short *)(async->prealloc_buf + async->buf_write_ptr) = x; - comedi_buf_write_free(async, sizeof(short)); + comedi_buf_write_free(s, sizeof(short)); return 1; } EXPORT_SYMBOL_GPL(comedi_buf_put); diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 65135c1..5262543 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1004,7 +1004,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, if (bi.bytes_written && (s->subdev_flags & SDF_CMD_WRITE)) { bi.bytes_written = comedi_buf_write_alloc(s, bi.bytes_written); - comedi_buf_write_free(async, bi.bytes_written); + comedi_buf_write_free(s, bi.bytes_written); } copyback_position: @@ -2166,7 +2166,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, n -= m; retval = -EFAULT; } - comedi_buf_write_free(async, n); + comedi_buf_write_free(s, n); count += n; nbytes -= n; diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index b47cc96..4a795e0 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -337,7 +337,7 @@ static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd) int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev); unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n); -unsigned int comedi_buf_write_free(struct comedi_async *, unsigned int); +unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_read_n_available(struct comedi_async *); unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index 246220a..f540394 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -2716,7 +2716,7 @@ static int i_APCI3200_InterruptHandleEos(struct comedi_device *dev) ui_ScanValueArray, (7 + 12) * sizeof(unsigned int)); /* Update comedi buffer pinters indexes */ - comedi_buf_write_free(s->async, + comedi_buf_write_free(s, (7 + 12) * sizeof(unsigned int)); /* Send events */ diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c index 21cf34e..a7860a4 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.c +++ b/drivers/staging/comedi/drivers/comedi_fc.c @@ -75,7 +75,7 @@ unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *s, } comedi_buf_memcpy_to(s, 0, data, num_bytes); - comedi_buf_write_free(async, num_bytes); + comedi_buf_write_free(s, num_bytes); cfc_inc_scan_progress(s, num_bytes); async->events |= COMEDI_CB_BLOCK; diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index a5999f5..e33c03d 100
[PATCH 19/22] staging: comedi: mite: pass subdevice to mite_buf_change()
`mite_buf_change()` in the "mite" module currently takes a pointer to a `struct comedi_async` and gets a pointer to the owning `struct comedi_subdevice` from the `subdevice` member. Change it to take a pointer to a `struct comedi_subdevice` and use the `async` member. The motivation for this is to eliminate the `subdevice` member of `struct comedi_async`. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/mite.c | 5 +++-- drivers/staging/comedi/drivers/mite.h | 2 +- drivers/staging/comedi/drivers/ni_660x.c | 2 +- drivers/staging/comedi/drivers/ni_pcidio.c | 2 +- drivers/staging/comedi/drivers/ni_pcimio.c | 10 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 6c8bd7c..2d224cf 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -307,8 +307,9 @@ EXPORT_SYMBOL_GPL(mite_dma_arm); /**/ int mite_buf_change(struct mite_dma_descriptor_ring *ring, - struct comedi_async *async) + struct comedi_subdevice *s) { + struct comedi_async *async = s->async; unsigned int n_links; int i; @@ -333,7 +334,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, n_links * sizeof(struct mite_dma_descriptor), &ring->descriptors_dma_addr, GFP_KERNEL); if (!ring->descriptors) { - dev_err(async->subdevice->device->class_dev, + dev_err(s->device->class_dev, "mite: ring buffer allocation failed\n"); return -ENOMEM; } diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 78f2357..929b9bb 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -120,7 +120,7 @@ int mite_done(struct mite_channel *mite_chan); void mite_prep_dma(struct mite_channel *mite_chan, unsigned int num_device_bits, unsigned int num_memory_bits); int mite_buf_change(struct mite_dma_descriptor_ring *ring, - struct comedi_async *async); + struct comedi_subdevice *s); static inline int CHAN_OFFSET(int channel) { diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 2858b3d..3901e3b 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -836,7 +836,7 @@ static int ni_660x_buf_change(struct comedi_device *dev, struct ni_gpct *counter = s->private; int ret; - ret = mite_buf_change(mite_ring(devpriv, counter), s->async); + ret = mite_buf_change(mite_ring(devpriv, counter), s); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index d0ad82a..1f84235 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -806,7 +806,7 @@ static int ni_pcidio_change(struct comedi_device *dev, struct nidio96_private *devpriv = dev->private; int ret; - ret = mite_buf_change(devpriv->di_mite_ring, s->async); + ret = mite_buf_change(devpriv->di_mite_ring, s); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index d40df07..89300dc 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -1560,7 +1560,7 @@ static int pcimio_ai_change(struct comedi_device *dev, struct ni_private *devpriv = dev->private; int ret; - ret = mite_buf_change(devpriv->ai_mite_ring, s->async); + ret = mite_buf_change(devpriv->ai_mite_ring, s); if (ret < 0) return ret; @@ -1573,7 +1573,7 @@ static int pcimio_ao_change(struct comedi_device *dev, struct ni_private *devpriv = dev->private; int ret; - ret = mite_buf_change(devpriv->ao_mite_ring, s->async); + ret = mite_buf_change(devpriv->ao_mite_ring, s); if (ret < 0) return ret; @@ -1587,7 +1587,7 @@ static int pcimio_gpct0_change(struct comedi_device *dev, struct ni_private *devpriv = dev->private; int ret; - ret = mite_buf_change(devpriv->gpct_mite_ring[0], s->async); + ret = mite_buf_change(devpriv->gpct_mite_ring[0], s); if (ret < 0) return ret; @@ -1601,7 +1601,7 @@ static int pcimio_gpct1_change(struct comedi_device *dev, struct ni_private *devpriv = dev->private; int ret; - ret = mite_buf_change(devpriv->gpct_mite_ring[1], s->async); + ret = mite_buf_change(devpriv->gpct_mite_ring[1], s); if (ret < 0) return ret;
[PATCH 22/22] staging: comedi: remove subdevice member of struct comedi_async
The `async` member of `struct comedi_subdevice` may point to a `struct comedi_async` or may be NULL. The `subdevice` member of `struct comedi_async` points back to the `struct comedi_subdevice` associated with it in a one-to-one relationship. All uses of the `subdevice` member of `struct comedi_async` apart from its initialization have now been removed (by passing around a pointer to the subdevice instead of to the "async" structure), so get rid of it. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedidev.h | 2 -- drivers/staging/comedi/drivers.c | 1 - 2 files changed, 3 deletions(-) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index a5d479c..d07d47f 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -108,8 +108,6 @@ struct comedi_buf_map { }; struct comedi_async { - struct comedi_subdevice *subdevice; - void *prealloc_buf; /* pre-allocated buffer */ unsigned int prealloc_bufsz;/* buffer size, in bytes */ struct comedi_buf_map *buf_map; /* map of buffer pages */ diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index cb5d214..299726f 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -307,7 +307,6 @@ static int __comedi_device_postconfig_async(struct comedi_device *dev, return -ENOMEM; init_waitqueue_head(&async->wait_head); - async->subdevice = s; s->async = async; async->max_bufsize = comedi_default_buf_maxsize_kb * 1024; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/22] staging: comedi: pass subdevice to comedi_buf_munge()
Local function `comedi_buf_munge()` is called by `comedi_buf_write_free()` to modify (or "munge") the data copied from a device into the buffer. Currently, the function takes a pointer to a `struct comedi_async` and gets a pointer to the comedi subdevice from the `subdevice` member. Change it to take a pointer to a `struct comedi_subdevice` and get a pointer to the "async" structure from the `async` member. The main motivation for this is to elimate the `subdevice` member of `struct comedi_async`. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 46de933..b5e329e 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -282,10 +282,10 @@ EXPORT_SYMBOL_GPL(comedi_buf_write_alloc); * munging is applied to data by core as it passes between user * and kernel space */ -static unsigned int comedi_buf_munge(struct comedi_async *async, +static unsigned int comedi_buf_munge(struct comedi_subdevice *s, unsigned int num_bytes) { - struct comedi_subdevice *s = async->subdevice; + struct comedi_async *async = s->async; unsigned int count = 0; const unsigned num_sample_bytes = bytes_per_sample(s); @@ -344,7 +344,7 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice *s, async->buf_write_count += nbytes; async->buf_write_ptr += nbytes; - comedi_buf_munge(async, async->buf_write_count - async->munge_count); + comedi_buf_munge(s, async->buf_write_count - async->munge_count); if (async->buf_write_ptr >= async->prealloc_bufsz) async->buf_write_ptr %= async->prealloc_bufsz; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/22] staging: comedi: pass subdevice to comedi_buf_write_n_available()
Local function `comedi_buf_write_n_available()` currently takes a pointer to a `struct comedi_async`. Change it to take a pointer to a `struct comedi_subdevice` and use the `async` member for consistency with the other comedi buffer handling functions. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 5be91cd..df4a9c4 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -243,8 +243,9 @@ void comedi_buf_reset(struct comedi_subdevice *s) async->events = 0; } -static unsigned int comedi_buf_write_n_available(struct comedi_async *async) +static unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s) { + struct comedi_async *async = s->async; unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; return free_end - async->buf_write_alloc_count; @@ -255,7 +256,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_subdevice *s, int strict) { struct comedi_async *async = s->async; - unsigned int available = comedi_buf_write_n_available(async); + unsigned int available = comedi_buf_write_n_available(s); if (nbytes > available) nbytes = strict ? 0 : available; -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/22] staging: comedi: pass subdevice to comedi_buf_read_alloc()
Change the parameters of `comedi_buf_read_alloc()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c| 5 +++-- drivers/staging/comedi/comedi_fops.c | 4 ++-- drivers/staging/comedi/comedidev.h | 2 +- drivers/staging/comedi/drivers/comedi_fc.c | 2 +- drivers/staging/comedi/drivers/mite.c | 6 +++--- drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index ac498e0..07e0b3a 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -370,9 +370,10 @@ unsigned int comedi_buf_read_n_available(struct comedi_async *async) EXPORT_SYMBOL_GPL(comedi_buf_read_n_available); /* allocates a chunk for the reader from filled (and munged) buffer space */ -unsigned int comedi_buf_read_alloc(struct comedi_async *async, +unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int nbytes) { + struct comedi_async *async = s->async; unsigned int available; available = async->munge_count - async->buf_read_alloc_count; @@ -441,7 +442,7 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x) if (n < sizeof(short)) return 0; - comedi_buf_read_alloc(async, sizeof(short)); + comedi_buf_read_alloc(s, sizeof(short)); *x = *(unsigned short *)(async->prealloc_buf + async->buf_read_ptr); comedi_buf_read_free(async, sizeof(short)); return 1; diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index ba6949e..5d1480e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -992,7 +992,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev, return -EACCES; if (bi.bytes_read && (s->subdev_flags & SDF_CMD_READ)) { - bi.bytes_read = comedi_buf_read_alloc(async, bi.bytes_read); + bi.bytes_read = comedi_buf_read_alloc(s, bi.bytes_read); comedi_buf_read_free(async, bi.bytes_read); if (comedi_is_subdevice_idle(s) && @@ -2271,7 +2271,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, retval = -EFAULT; } - comedi_buf_read_alloc(async, n); + comedi_buf_read_alloc(s, n); comedi_buf_read_free(async, n); count += n; diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 4a795e0..d2131f2 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -340,7 +340,7 @@ unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_read_n_available(struct comedi_async *); -unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int); +unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n); unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int); int comedi_buf_put(struct comedi_subdevice *s, unsigned short x); diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c index a7860a4..836eb1a 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.c +++ b/drivers/staging/comedi/drivers/comedi_fc.c @@ -91,7 +91,7 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *s, if (num_bytes == 0) return 0; - num_bytes = comedi_buf_read_alloc(async, num_bytes); + num_bytes = comedi_buf_read_alloc(s, num_bytes); comedi_buf_memcpy_from(s, 0, data, num_bytes); comedi_buf_read_free(async, num_bytes); cfc_inc_scan_progress(s, num_bytes); diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index e33c03d..d1423ca 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -560,15 +560,15 @@ EXPORT_SYMBOL_GPL(mite_sync_input_dma); int mite_sync_output_dma(struct mite_channel *mite_chan, struct comedi_async *async) { + struct comedi_subdevice *s = async->subdevice; int count; u32 nbytes_ub, nbytes_lb; unsigned int old_alloc_count; - u32 stop_count = - async->cmd.stop_arg * cfc_bytes_per_scan(async->subdevice); + u32 stop_count = async->cmd.stop_arg * cfc_bytes_per_scan(s); old_alloc_count = async
[PATCH 21/22] staging: comedi: mite: pass subdevice to mite_sync_output_dma()
`mite_sync_output_dma()` in the "mite" module currently takes a pointer to a `struct comedi_async` and gets a pointer to the owning `struct comedi_subdevice` from the `subdevice` member. Change it to take a pointer to a `struct comedi_subdevice` and use the `async` member. The motivation for this is to eliminate the `subdevice` member of `struct comedi_async`. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/mite.c | 7 +++ drivers/staging/comedi/drivers/mite.h | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index f473841..c12806e 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -559,9 +559,9 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, EXPORT_SYMBOL_GPL(mite_sync_input_dma); int mite_sync_output_dma(struct mite_channel *mite_chan, -struct comedi_async *async) +struct comedi_subdevice *s) { - struct comedi_subdevice *s = async->subdevice; + struct comedi_async *async = s->async; int count; u32 nbytes_ub, nbytes_lb; unsigned int old_alloc_count; @@ -579,8 +579,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, (int)(nbytes_ub - stop_count) > 0) nbytes_ub = stop_count; if ((int)(nbytes_ub - old_alloc_count) > 0) { - dev_warn(async->subdevice->device->class_dev, -"mite: DMA underrun\n"); + dev_warn(s->device->class_dev, "mite: DMA underrun\n"); async->events |= COMEDI_CB_OVERFLOW; return -1; } diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index ba3ad0c..e6e58e9 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -108,7 +108,7 @@ void mite_dma_disarm(struct mite_channel *mite_chan); int mite_sync_input_dma(struct mite_channel *mite_chan, struct comedi_subdevice *s); int mite_sync_output_dma(struct mite_channel *mite_chan, -struct comedi_async *async); +struct comedi_subdevice *s); u32 mite_bytes_written_to_memory_lb(struct mite_channel *mite_chan); u32 mite_bytes_written_to_memory_ub(struct mite_channel *mite_chan); u32 mite_bytes_read_from_memory_lb(struct mite_channel *mite_chan); diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 953130b..9afe76f 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -877,7 +877,7 @@ static void mite_handle_b_linkc(struct mite_struct *mite, spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->ao_mite_chan) - mite_sync_output_dma(devpriv->ao_mite_chan, s->async); + mite_sync_output_dma(devpriv->ao_mite_chan, s); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); } @@ -3640,7 +3640,7 @@ static void handle_cdio_interrupt(struct comedi_device *dev) devpriv->mite->mite_io_addr + MITE_CHOR(devpriv->cdo_mite_chan->channel)); } - mite_sync_output_dma(devpriv->cdo_mite_chan, s->async); + mite_sync_output_dma(devpriv->cdo_mite_chan, s); } spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); #endif -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/22] staging: comedi: pass subdevice to comedi_buf_is_mmapped()
Change the parameters of `comedi_buf_is_mmapped()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott --- drivers/staging/comedi/comedi_buf.c | 4 ++-- drivers/staging/comedi/comedi_fops.c | 4 ++-- drivers/staging/comedi/comedi_internal.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index fa5d6d4..46de933 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -183,9 +183,9 @@ comedi_buf_map_from_subdev_get(struct comedi_subdevice *s) return bm; } -bool comedi_buf_is_mmapped(struct comedi_async *async) +bool comedi_buf_is_mmapped(struct comedi_subdevice *s) { - struct comedi_buf_map *bm = async->buf_map; + struct comedi_buf_map *bm = s->async->buf_map; return bm && (atomic_read(&bm->refcount.refcount) > 1); } diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index a7aef8a..8fbe995 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -251,7 +251,7 @@ static int resize_async_buffer(struct comedi_device *dev, "subdevice is busy, cannot resize buffer\n"); return -EBUSY; } - if (comedi_buf_is_mmapped(async)) { + if (comedi_buf_is_mmapped(s)) { dev_dbg(dev->class_dev, "subdevice is mmapped, cannot resize buffer\n"); return -EBUSY; @@ -635,7 +635,7 @@ static int is_device_busy(struct comedi_device *dev) s = &dev->subdevices[i]; if (s->busy) return 1; - if (s->async && comedi_buf_is_mmapped(s->async)) + if (s->async && comedi_buf_is_mmapped(s)) return 1; } diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index 3cc81de..e978c22 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -16,7 +16,7 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s); int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long new_size); void comedi_buf_reset(struct comedi_subdevice *s); -bool comedi_buf_is_mmapped(struct comedi_async *async); +bool comedi_buf_is_mmapped(struct comedi_subdevice *s); void comedi_buf_map_get(struct comedi_buf_map *bm); int comedi_buf_map_put(struct comedi_buf_map *bm); struct comedi_buf_map *comedi_buf_map_from_subdev_get( -- 1.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/22] staging: comedi: mite: pass subdevice to mite_sync_input_dma()
`mite_sync_input_dma()` in the "mite" module currently takes a pointer to a `struct comedi_async` and gets a pointer to the owning `struct comedi_subdevice` from the `subdevice` member. Change it to take a pointer to a `struct comedi_subdevice` and use the `async` member. The motivation for this is to eliminate the `subdevice` member of `struct comedi_async`. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/mite.c | 4 ++-- drivers/staging/comedi/drivers/mite.h | 2 +- drivers/staging/comedi/drivers/ni_660x.c | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- drivers/staging/comedi/drivers/ni_pcidio.c | 4 ++-- drivers/staging/comedi/drivers/ni_tiocmd.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 2d224cf..f473841 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -526,9 +526,9 @@ void mite_dma_disarm(struct mite_channel *mite_chan) EXPORT_SYMBOL_GPL(mite_dma_disarm); int mite_sync_input_dma(struct mite_channel *mite_chan, - struct comedi_async *async) + struct comedi_subdevice *s) { - struct comedi_subdevice *s = async->subdevice; + struct comedi_async *async = s->async; int count; unsigned int nbytes, old_alloc_count; diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 929b9bb..ba3ad0c 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -106,7 +106,7 @@ unsigned mite_dma_tcr(struct mite_channel *mite_chan); void mite_dma_arm(struct mite_channel *mite_chan); void mite_dma_disarm(struct mite_channel *mite_chan); int mite_sync_input_dma(struct mite_channel *mite_chan, - struct comedi_async *async); + struct comedi_subdevice *s); int mite_sync_output_dma(struct mite_channel *mite_chan, struct comedi_async *async); u32 mite_bytes_written_to_memory_lb(struct mite_channel *mite_chan); diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 3901e3b..634cde8 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -823,7 +823,7 @@ static int ni_660x_input_poll(struct comedi_device *dev, /* lock to avoid race with comedi_poll */ spin_lock_irqsave(&devpriv->interrupt_lock, flags); - mite_sync_input_dma(counter->mite_chan, s->async); + mite_sync_input_dma(counter->mite_chan, s); spin_unlock_irqrestore(&devpriv->interrupt_lock, flags); return comedi_buf_read_n_available(s); } diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index e54488c..953130b 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -864,7 +864,7 @@ static void ni_sync_ai_dma(struct comedi_device *dev) spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->ai_mite_chan) - mite_sync_input_dma(devpriv->ai_mite_chan, s->async); + mite_sync_input_dma(devpriv->ai_mite_chan, s); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); } diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 1f84235..14aaa58 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -359,7 +359,7 @@ static int ni_pcidio_poll(struct comedi_device *dev, struct comedi_subdevice *s) spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock(&devpriv->mite_channel_lock); if (devpriv->di_mite_chan) - mite_sync_input_dma(devpriv->di_mite_chan, s->async); + mite_sync_input_dma(devpriv->di_mite_chan, s); spin_unlock(&devpriv->mite_channel_lock); count = s->async->buf_write_count - s->async->buf_read_count; spin_unlock_irqrestore(&dev->spinlock, irq_flags); @@ -405,7 +405,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d) writel(CHOR_CLRLC, mite->mite_io_addr + MITE_CHOR(devpriv->di_mite_chan->channel)); - mite_sync_input_dma(devpriv->di_mite_chan, s->async); + mite_sync_input_dma(devpriv->di_mite_chan, s); /* XXX need to byteswap */ } if (m_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_DRDY | diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index 9cc77c0..2557ab4 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -464,7
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
> -Original Message- > From: Haiyang Zhang > Sent: Friday, May 2, 2014 7:42 AM > To: Jim Davis; Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; > de...@linuxdriverproject.org; netdev > Subject: RE: randconfig build error with next-20140502, in > drivers/net/hyperv/netvsc_drv.c > > > > > -Original Message- > > From: Jim Davis [mailto:jim.ep...@gmail.com] > > Sent: Friday, May 2, 2014 9:56 AM > > To: Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; Haiyang > > Zhang; de...@linuxdriverproject.org; netdev > > Subject: randconfig build error with next-20140502, in > > drivers/net/hyperv/netvsc_drv.c > > > > Building with the attached random configuration file, > > > > drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_recv_callback’: > > drivers/net/hyperv/netvsc_drv.c:648:11: error: ‘struct net_device’ has > > no member named ‘real_num_rx_queues’ > > net->real_num_rx_queues); > >^ > > In file included from drivers/net/hyperv/netvsc_drv.c:26:0: > > drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_probe’: > > drivers/net/hyperv/netvsc_drv.c:832:32: error: ‘struct net_device’ has > > no member named ‘real_num_rx_queues’ > > net->real_num_tx_queues, net->real_num_rx_queues); > > ^ > > include/linux/device.h:1080:58: note: in definition of macro ‘dev_info’ > > #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) > > ^ > > make[3]: *** [drivers/net/hyperv/netvsc_drv.o] Error 1 > > real_num_rx_queues is defined in "include/linux/netdevice.h": > It requires CONFIG_SYSFS flag, which is enabled by default, but not set in > your config file. > > Could you use default config and add hyperv drivers, then try again? Haiyang, That is the point - the code must compile correctly for all possible configurations. You will want to protect the dependencies appropriately. K. Y > > Thanks, > - Haiyang > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
> -Original Message- > From: Jim Davis [mailto:jim.ep...@gmail.com] > Sent: Friday, May 2, 2014 9:56 AM > To: Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; Haiyang > Zhang; de...@linuxdriverproject.org; netdev > Subject: randconfig build error with next-20140502, in > drivers/net/hyperv/netvsc_drv.c > > Building with the attached random configuration file, > > drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_recv_callback’: > drivers/net/hyperv/netvsc_drv.c:648:11: error: ‘struct net_device’ has > no member > named ‘real_num_rx_queues’ > net->real_num_rx_queues); >^ > In file included from drivers/net/hyperv/netvsc_drv.c:26:0: > drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_probe’: > drivers/net/hyperv/netvsc_drv.c:832:32: error: ‘struct net_device’ has > no member named ‘real_num_rx_queues’ > net->real_num_tx_queues, net->real_num_rx_queues); > ^ > include/linux/device.h:1080:58: note: in definition of macro ‘dev_info’ > #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) > ^ > make[3]: *** [drivers/net/hyperv/netvsc_drv.o] Error 1 real_num_rx_queues is defined in "include/linux/netdevice.h": It requires CONFIG_SYSFS flag, which is enabled by default, but not set in your config file. Could you use default config and add hyperv drivers, then try again? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: vt6656: fix potential leak in vt6656_hostap_ioctl()
Commit fb841d67 (staging: vt6656: don't leak 'param' in vt6656_hostap_ioctl() when returning -EOPNOTSUPP) cleaned up direct returns in the ioctl switch statement that leaked already allocated memory. Fix the same issue for VIAWGET_HOSTAPD_SCAN_REQ and VIAWGET_HOSTAPD_MLME that are also not supported by this driver. Detected by Coverity - CID 144381. Signed-off-by: Christian Engelmayer --- Compile tested and applies against branch staging-next of tree git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git --- drivers/staging/vt6656/hostap.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 67ba48b..a0d9fff 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -742,7 +742,8 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) case VIAWGET_HOSTAPD_MLME: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n"); - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; + goto out; case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n"); @@ -751,7 +752,8 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) case VIAWGET_HOSTAPD_SCAN_REQ: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n"); - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; + goto out; case VIAWGET_HOSTAPD_STA_CLEAR_STATS: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n"); -- 1.9.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
> -Original Message- > From: KY Srinivasan > Sent: Friday, May 2, 2014 11:00 AM > To: Haiyang Zhang; Jim Davis; Stephen Rothwell; linux-next; linux-kernel; > de...@linuxdriverproject.org; netdev > Subject: RE: randconfig build error with next-20140502, in > drivers/net/hyperv/netvsc_drv.c > > > > > -Original Message- > > From: Haiyang Zhang > > Sent: Friday, May 2, 2014 7:42 AM > > To: Jim Davis; Stephen Rothwell; linux-next; linux-kernel; KY > Srinivasan; > > de...@linuxdriverproject.org; netdev > > Subject: RE: randconfig build error with next-20140502, in > > drivers/net/hyperv/netvsc_drv.c > > > > > > > > > -Original Message- > > > From: Jim Davis [mailto:jim.ep...@gmail.com] > > > Sent: Friday, May 2, 2014 9:56 AM > > > To: Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; > Haiyang > > > Zhang; de...@linuxdriverproject.org; netdev > > > Subject: randconfig build error with next-20140502, in > > > drivers/net/hyperv/netvsc_drv.c > > > > > > Building with the attached random configuration file, > > > > > > drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_recv_callback’: > > > drivers/net/hyperv/netvsc_drv.c:648:11: error: ‘struct net_device’ > has > > > no member named ‘real_num_rx_queues’ > > > net->real_num_rx_queues); > > >^ > > > In file included from drivers/net/hyperv/netvsc_drv.c:26:0: > > > drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_probe’: > > > drivers/net/hyperv/netvsc_drv.c:832:32: error: ‘struct net_device’ > has > > > no member named ‘real_num_rx_queues’ > > > net->real_num_tx_queues, net->real_num_rx_queues); > > > ^ > > > include/linux/device.h:1080:58: note: in definition of macro > ‘dev_info’ > > > #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) > > > ^ > > > make[3]: *** [drivers/net/hyperv/netvsc_drv.o] Error 1 > > > > real_num_rx_queues is defined in "include/linux/netdevice.h": > > It requires CONFIG_SYSFS flag, which is enabled by default, but not > set in > > your config file. > > > > Could you use default config and add hyperv drivers, then try again? > > Haiyang, > > That is the point - the code must compile correctly for all possible > configurations. > You will want to protect the dependencies appropriately. > OK, I'll look into this. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: lustre: Use %zd to format ssize_t
drivers/staging/lustre/lustre/llite/rw26.c: In function 'll_direct_IO_26': drivers/staging/lustre/lustre/llite/rw26.c:383:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'ssize_t' [-Wformat] drivers/staging/lustre/lustre/llite/rw26.c:383:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 10 has type 'ssize_t' [-Wformat] Join the quoted string split across lines to fix a checkpatch warning while we're at it. Signed-off-by: Geert Uytterhoeven --- drivers/staging/lustre/lustre/llite/rw26.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index c3fd544b78dc..af84c1aaa5f8 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -380,8 +380,8 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, if ((file_offset & ~CFS_PAGE_MASK) || (count & ~CFS_PAGE_MASK)) return -EINVAL; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size=%lu (max %lu), " - "offset=%lld=%llx, pages %lu (max %lu)\n", + CDEBUG(D_VFSTRACE, + "VFS Op:inode=%lu/%u(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n", inode->i_ino, inode->i_generation, inode, count, MAX_DIO_SIZE, file_offset, file_offset, count >> PAGE_CACHE_SHIFT, MAX_DIO_SIZE >> PAGE_CACHE_SHIFT); -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging/lustre/llite: Fix unused variable warning if !CONFIG_FS_POSIX_ACL
If CONFIG_FS_POSIX_ACL=n: drivers/staging/lustre/lustre/llite/xattr.c: In function 'll_setxattr_common': drivers/staging/lustre/lustre/llite/xattr.c:115:27: warning: unused variable 'rce' [-Wunused-variable] Signed-off-by: Geert Uytterhoeven --- drivers/staging/lustre/lustre/llite/xattr.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 67a1de41c5b2..c6c27bbb43b4 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -112,8 +112,8 @@ int ll_setxattr_common(struct inode *inode, const char *name, struct ptlrpc_request *req = NULL; int xattr_type, rc; struct obd_capa *oc; - struct rmtacl_ctl_entry *rce = NULL; #ifdef CONFIG_FS_POSIX_ACL + struct rmtacl_ctl_entry *rce = NULL; posix_acl_xattr_header *new_value = NULL; ext_acl_xattr_header *acl = NULL; #endif -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging/lustre/libcfs: Fix build errors for !CONFIG_SMP
When CONFIG_SMP=n: drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h:58:31: fatal error: libcfs/libcfs_cpu.h: No such file or directory drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c:78:1: error: redefinition of 'cfs_cpt_table_print' drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h:109:1: note: previous definition of 'cfs_cpt_table_print' was here Signed-off-by: Geert Uytterhoeven --- http://kisskb.ellerman.id.au/kisskb/buildresult/11054360/ --- .../lustre/include/linux/libcfs/linux/linux-mem.h |2 +- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c |2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h index 72c76ad96ce9..ccee5c3e4142 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h @@ -55,7 +55,7 @@ #ifndef HAVE_LIBCFS_CPT /* Need this for cfs_cpt_table */ -#include +#include #endif #define CFS_PAGE_MASK (~((__u64)PAGE_CACHE_SIZE-1)) diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c index d985e83ba2c3..a1a7bf44cccf 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c @@ -74,6 +74,7 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab) } EXPORT_SYMBOL(cfs_cpt_table_free); +#ifdef CONFIG_SMP int cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) { @@ -87,6 +88,7 @@ cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) return rc; } EXPORT_SYMBOL(cfs_cpt_table_print); +#endif /* CONFIG_SMP */ int cfs_cpt_number(struct cfs_cpt_table *cptab) -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 00/22] staging: comedi: pass subdevice around instead of async
On Friday, May 02, 2014 5:50 AM, Ian Abbott wrote: > For comedi subdevices that support asynchronous commands, the `async` > member of `struct comedi_subdevice` points to a `struct comedi_async` > allocated to manage asynchronous commands on that subdevice. The > pointer to this "async" structure is passed around by various functions > and some of those functions need to get back to the "subdevice" > structure from this pointer, so the "async" structure has a `subdevice` > member pointing back to the `struct comedi_subdevice`. > > Since we can always get to the "async" structure from the "subdevice" > structure, we can just pass around the pointer to the subdevice instead > of the pointer to the async structure. Then the `subdevice` member of > `struct comedi_async` is no longer required and can be removed. > > 01) staging: comedi: remove redundant pointer dereference in comedi_poll() > 02) staging: comedi: remove async parameter from resize_async_buffer() > 03) staging: comedi: pass subdevice to comedi_buf_put() > 04) staging: comedi: pass subdevice to comedi_buf_get() > 05) staging: comedi: pass subdevice to comedi_buf_memcpy_to() > 06) staging: comedi: pass subdevice to comedi_buf_memcpy_from() > 07) staging: comedi: ni_tiocmd: pass subdevice to command setup functions > 08) staging: comedi: pass subdevice to comedi_buf_write_alloc() > 09) staging: comedi: pass subdevice to comedi_buf_write_free() > 10) staging: comedi: pass subdevice to comedi_buf_write_n_allocated() > 11) staging: comedi: pass subdevice to comedi_buf_read_alloc() > 12) staging: comedi: pass subdevice to comedi_buf_read_free() > 13) staging: comedi: pass subdevice to comedi_buf_read_n_available() > 14) staging: comedi: pass subdevice to comedi_buf_reset() > 15) staging: comedi: pass subdevice to comedi_buf_is_mmapped() > 16) staging: comedi: pass subdevice to comedi_buf_munge() > 17) staging: comedi: pass subdevice to __comedi_buf_write_alloc() > 18) staging: comedi: pass subdevice to comedi_buf_write_n_available() > 19) staging: comedi: mite: pass subdevice to mite_buf_change() > 20) staging: comedi: mite: pass subdevice to mite_sync_input_dma() > 21) staging: comedi: mite: pass subdevice to mite_sync_output_dma() > 22) staging: comedi: remove subdevice member of struct comedi_async Reviewed-by: H Hartley Sweeten Ian, There are merge conflicts if this series is applied after the one I have posted that you have already tagged Reviewed-by. [PATCH v2 00/12] staging: comedi: adv_pci1710: more async command cleanup [PATCH 00/32] staging: comedi: continue async command cleanup Note: the second series is really [PATCH v2 00/32] but I forgot to add the v2... Regards, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
From: Haiyang Zhang Date: Fri, 2 May 2014 14:42:06 + > real_num_rx_queues is defined in "include/linux/netdevice.h": > It requires CONFIG_SYSFS flag, which is enabled by default, but not set in > your config file. > > Could you use default config and add hyperv drivers, then try again? You must fix your driver to compile successfully under all possible configuration combinations, not just the ones which are convenient for you to support. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
> -Original Message- > From: David Miller [mailto:da...@davemloft.net] > Sent: Friday, May 2, 2014 3:19 PM > To: Haiyang Zhang > Cc: jim.ep...@gmail.com; s...@canb.auug.org.au; linux- > n...@vger.kernel.org; linux-ker...@vger.kernel.org; KY Srinivasan; > de...@linuxdriverproject.org; net...@vger.kernel.org > Subject: Re: randconfig build error with next-20140502, in > drivers/net/hyperv/netvsc_drv.c > > From: Haiyang Zhang > Date: Fri, 2 May 2014 14:42:06 + > > > real_num_rx_queues is defined in "include/linux/netdevice.h": > > It requires CONFIG_SYSFS flag, which is enabled by default, but not > set in > > your config file. > > > > Could you use default config and add hyperv drivers, then try again? > > You must fix your driver to compile successfully under all possible > configuration combinations, not just the ones which are convenient > for you to support. OK, I'll look into this. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/22] staging: comedi: pass subdevice around instead of async
On 02/05/14 18:40, Hartley Sweeten wrote: On Friday, May 02, 2014 5:50 AM, Ian Abbott wrote: For comedi subdevices that support asynchronous commands, the `async` member of `struct comedi_subdevice` points to a `struct comedi_async` allocated to manage asynchronous commands on that subdevice. The pointer to this "async" structure is passed around by various functions and some of those functions need to get back to the "subdevice" structure from this pointer, so the "async" structure has a `subdevice` member pointing back to the `struct comedi_subdevice`. Since we can always get to the "async" structure from the "subdevice" structure, we can just pass around the pointer to the subdevice instead of the pointer to the async structure. Then the `subdevice` member of `struct comedi_async` is no longer required and can be removed. 01) staging: comedi: remove redundant pointer dereference in comedi_poll() 02) staging: comedi: remove async parameter from resize_async_buffer() 03) staging: comedi: pass subdevice to comedi_buf_put() 04) staging: comedi: pass subdevice to comedi_buf_get() 05) staging: comedi: pass subdevice to comedi_buf_memcpy_to() 06) staging: comedi: pass subdevice to comedi_buf_memcpy_from() 07) staging: comedi: ni_tiocmd: pass subdevice to command setup functions 08) staging: comedi: pass subdevice to comedi_buf_write_alloc() 09) staging: comedi: pass subdevice to comedi_buf_write_free() 10) staging: comedi: pass subdevice to comedi_buf_write_n_allocated() 11) staging: comedi: pass subdevice to comedi_buf_read_alloc() 12) staging: comedi: pass subdevice to comedi_buf_read_free() 13) staging: comedi: pass subdevice to comedi_buf_read_n_available() 14) staging: comedi: pass subdevice to comedi_buf_reset() 15) staging: comedi: pass subdevice to comedi_buf_is_mmapped() 16) staging: comedi: pass subdevice to comedi_buf_munge() 17) staging: comedi: pass subdevice to __comedi_buf_write_alloc() 18) staging: comedi: pass subdevice to comedi_buf_write_n_available() 19) staging: comedi: mite: pass subdevice to mite_buf_change() 20) staging: comedi: mite: pass subdevice to mite_sync_input_dma() 21) staging: comedi: mite: pass subdevice to mite_sync_output_dma() 22) staging: comedi: remove subdevice member of struct comedi_async Reviewed-by: H Hartley Sweeten Ian, There are merge conflicts if this series is applied after the one I have posted that you have already tagged Reviewed-by. [PATCH v2 00/12] staging: comedi: adv_pci1710: more async command cleanup [PATCH 00/32] staging: comedi: continue async command cleanup Note: the second series is really [PATCH v2 00/32] but I forgot to add the v2... Sorry. I knew some of your patches conflicted and did a rebase before posting and got some 3-way auto-merges, so I assumed the conflicting patches had already been committed. I'll rebase and repost once your remaining patches are committed. -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: bcm: fix lines over 80 characters
Signed-off-by: Greg DeAngelis --- drivers/staging/bcm/Transmit.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/staging/bcm/Transmit.c b/drivers/staging/bcm/Transmit.c index 2ed4836..4976746 100644 --- a/drivers/staging/bcm/Transmit.c +++ b/drivers/staging/bcm/Transmit.c @@ -46,12 +46,14 @@ int SendControlPacket(struct bcm_mini_adapter *Adapter, char *pControlPacket) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Tx"); if (!pControlPacket || !Adapter) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Got NULL Control Packet or Adapter"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, + "Got NULL Control Packet or Adapter"); return STATUS_FAILURE; } if ((atomic_read(&Adapter->CurrNumFreeTxDesc) < ((PLeader->PLength-1)/MAX_DEVICE_DESC_SIZE)+1)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "NO FREE DESCRIPTORS TO SEND CONTROL PACKET"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, + "NO FREE DESCRIPTORS TO SEND CONTROL PACKET"); return STATUS_FAILURE; } @@ -109,7 +111,8 @@ int SetupNextSend(struct bcm_mini_adapter *Adapter, struct sk_buff *Packet, USH (UINT *)&Packet->len, Adapter->PackInfo[QueueIndex].bEthCSSupport); if (status != STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "PHS Transmit failed..\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, + "PHS Transmit failed..\n"); goto errExit; } @@ -217,12 +220,15 @@ int tx_pkt_handler(struct bcm_mini_adapter *Adapter /**< pointer to adapter obje Adapter->LinkStatus == SYNC_UP_REQUEST && !Adapter->bSyncUpRequestSent) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Calling LinkMessage"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, + DBG_LVL_ALL, "Calling LinkMessage"); LinkMessage(Adapter); } if ((Adapter->IdleMode || Adapter->bShutStatus) && atomic_read(&Adapter->TotalPacketCount)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Device in Low Power mode...waking up"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, + TX_PACKETS, DBG_LVL_ALL, + "Device in Low Power mode...waking up"); Adapter->usIdleModePattern = ABORT_IDLE_MODE; Adapter->bWakeUpDevice = TRUE; wake_up(&Adapter->process_rx_cntrlpkt); @@ -232,7 +238,8 @@ int tx_pkt_handler(struct bcm_mini_adapter *Adapter /**< pointer to adapter obje atomic_set(&Adapter->TxPktAvail, 0); } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Exiting the tx thread..\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, + "Exiting the tx thread..\n"); Adapter->transmit_packet_thread = NULL; return 0; } -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel