[PATCH 1/2] staging: rtl8188eu: Remove duplicate incusion in drv_types.h
wlan_bssdef.h was included twice. Signed-off-by: Sachin Kamat Cc: Larry Finger --- drivers/staging/rtl8188eu/include/drv_types.h |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/drv_types.h b/drivers/staging/rtl8188eu/include/drv_types.h index 6e49359..ad073c8 100644 --- a/drivers/staging/rtl8188eu/include/drv_types.h +++ b/drivers/staging/rtl8188eu/include/drv_types.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/3] staging: dgnc: driver.c and tty.c: replaces dgnc_driver_kzmalloc with kzalloc
On Tue, Aug 27, 2013 at 10:13:27PM -0400, Lidza Louina wrote: > @@ -501,7 +501,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) > > /* get the board structure and prep it */ > brd = dgnc_Board[dgnc_NumBoards] = > - (struct board_t *) dgnc_driver_kzmalloc(sizeof(struct board_t), > GFP_KERNEL); > + (struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL); > if (!brd) { > APR(("memory allocation for board structure failed\n")); > return(-ENOMEM); So you didn't introduce this, but here are the style problems in this section, in case you want to fix them in a later patch. 1) Bad indenting. 2) Unneeded casting. 3) Use sizeof(*brd) instead of sizeof(struct board_t). 4) board_t is a bad and wrong name for this data type. "board" is too generic, and "_t" means "typedef" but this is a not a typedef. 5) Put the two assignments on two lines. First assign "brd" and then initialize "dgnc_Board[dgnc_NumBoards]" after allocating "brd->msgbuf". 6) Comment is obvious and at the same time wrong. It means "allocate the board structure" instead of "get". Delete. 7) kmalloc() has its own error message which is much more useful. No need to print a useless error message. Also this error will never occur in real life so adding code for something which will never happen and it's a waste of time for people reading the code. 8) No parenthesis around the return. > @@ -509,7 +509,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) > > /* make a temporary message buffer for the boot messages */ > brd->msgbuf = brd->msgbuf_head = > - (char *) dgnc_driver_kzmalloc(sizeof(char) * 8192, GFP_KERNEL); > + (char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL); > if (!brd->msgbuf) { > kfree(brd); > APR(("memory allocation for board msgbuf failed\n")); 9) I think we know the sizeof(char)... If we want to keep that then use kcalloc() instead of kzalloc(). But it's simplest to just say: brd->msgbuf = kzalloc(8192, GFP_KERNEL); 10) The error handling should be: if (!brd->msgbuf) { ret = -ENOMEM; goto err_free_brd; } [snip code in the middle] return 0; err_free_brd: kfree(brd); return ret; We leak memory later on in this function... regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[v2 PATCH 1/3] staging: ozwpan: Increase ISOC IN buffer depth
Buffer depth of 50 units is not sufficient when there is considerable delay occuring on air due to interference, increase ISOC IN buffer depth to 100 units. Signed-off-by: Rupesh Gujare --- drivers/staging/ozwpan/ozhcd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c index d6c3d0e..d9c43c3 100644 --- a/drivers/staging/ozwpan/ozhcd.c +++ b/drivers/staging/ozwpan/ozhcd.c @@ -39,7 +39,7 @@ * Number of units of buffering to capture for an isochronous IN endpoint before * allowing data to be indicated up. */ -#define OZ_IN_BUFFERING_UNITS 50 +#define OZ_IN_BUFFERING_UNITS 100 /* Name of our platform device. */ -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[v2 PATCH 2/3] staging: ozwpan: Change error number.
Incorrect error number was returned here (EPERM), ENXIO is more appropriate. Signed-off-by: Rupesh Gujare --- drivers/staging/ozwpan/ozcdev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 03b41ee..50722ea 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -161,7 +161,7 @@ static ssize_t oz_cdev_write(struct file *filp, const char __user *buf, oz_pd_get(pd); spin_unlock_bh(&g_cdev.lock); if (pd == NULL) - return -1; + return -ENXIO; eb = &pd->elt_buff; ei = oz_elt_info_alloc(eb); if (ei == NULL) { -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[v2 PATCH 3/3] staging: ozwpan: Return error, if PD is not connected.
Return error if we receive write(), while PD is not connected. Signed-off-by: Rupesh Gujare --- drivers/staging/ozwpan/ozcdev.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 50722ea..6ccb64f 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -162,6 +162,8 @@ static ssize_t oz_cdev_write(struct file *filp, const char __user *buf, spin_unlock_bh(&g_cdev.lock); if (pd == NULL) return -ENXIO; + if (!(pd->state & OZ_PD_S_CONNECTED)) + return -EAGAIN; eb = &pd->elt_buff; ei = oz_elt_info_alloc(eb); if (ei == NULL) { -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] staging: rtl8188eu: Include version.h header in xmit_linux.c
On 08/28/2013 12:35 AM, Sachin Kamat wrote: Include version.h header file as detected by versioncheck. Signed-off-by: Sachin Kamat --- drivers/staging/rtl8188eu/os_dep/xmit_linux.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c index 1e2c8ab..2e586c0 100644 --- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c @@ -19,6 +19,7 @@ **/ #define _XMIT_OSDEP_C_ +#include #include #include Acked-by: Larry Finger This applies to all 3 of these patches. Thanks, Larry ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: rtl8188eu: Remove duplicate header inclusion in ioctl_linux.c
On 08/28/2013 12:55 AM, Sachin Kamat wrote: Removed the header files included twice. Signed-off-by: Sachin Kamat Cc: Larry Finger --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c |2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index d438256..cd4100f 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -29,13 +29,11 @@ #include #include #include -#include #include #include #include #include -#include #include #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) Acked-by: Larry Finger Both patches in this series are Acked. Thanks, Larry Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: crystalhd: fixed whitespace and string style issues
Fixed 3 instances of user-visible string being broken into two string. Fixed 2 instances of illegal whitespace. --- drivers/staging/crystalhd/crystalhd_cmds.c |3 +-- drivers/staging/crystalhd/crystalhd_hw.c |7 +++ drivers/staging/crystalhd/crystalhd_lnx.c |3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/crystalhd/crystalhd_cmds.c b/drivers/staging/crystalhd/crystalhd_cmds.c index 3ab502b..07a2f24 100644 --- a/drivers/staging/crystalhd/crystalhd_cmds.c +++ b/drivers/staging/crystalhd/crystalhd_cmds.c @@ -94,8 +94,7 @@ static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx, for (i = 0; i < BC_LINK_MAX_OPENS; i++) { if (ctx->user[i].mode == DTS_DIAG_MODE || ctx->user[i].mode == DTS_PLAYBACK_MODE) { - BCMLOG_ERR("multiple playback sessions are not " - "supported..\n"); + BCMLOG_ERR("multiple playback sessions are not supported..\n"); return BC_STS_ERR_USAGE; } } diff --git a/drivers/staging/crystalhd/crystalhd_hw.c b/drivers/staging/crystalhd/crystalhd_hw.c index 0c8cb32..5845e89 100644 --- a/drivers/staging/crystalhd/crystalhd_hw.c +++ b/drivers/staging/crystalhd/crystalhd_hw.c @@ -1061,7 +1061,7 @@ static void cpy_pib_to_app(struct c011_pib *src_pib, dst_pib->aspect_ratio= src_pib->ppb.aspect_ratio; dst_pib->colour_primaries = src_pib->ppb.colour_primaries; dst_pib->picture_meta_payload = src_pib->ppb.picture_meta_payload; - dst_pib->frame_rate = src_pib->resolution ; + dst_pib->frame_rate = src_pib->resolution; return; } @@ -1553,11 +1553,10 @@ static void crystalhd_rx_isr(struct crystalhd_hw *hw, uint32_t intr_sts) crystalhd_get_dnsz(hw, i, &y_dn_sz, &uv_dn_sz); /* FIXME: jarod: this is where my mini pci-e card is tripping up */ - BCMLOG(BCMLOG_DBG, "list_index:%x rx[%d] Y:%x " - "UV:%x Int:%x YDnSz:%x UVDnSz:%x\n", + BCMLOG(BCMLOG_DBG, "list_index:%x rx[%d] Y:%x UV:%x Int:%x YDnSz:%x UVDnSz:%x\n", i, hw->stats.rx_errors, y_err_sts, uv_err_sts, intr_sts, y_dn_sz, -uv_dn_sz); + uv_dn_sz); hw->rx_list_sts[i] = sts_free; comp_sts = BC_STS_ERROR; break; diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c index c1f6163..b17fbf8 100644 --- a/drivers/staging/crystalhd/crystalhd_lnx.c +++ b/drivers/staging/crystalhd/crystalhd_lnx.c @@ -545,8 +545,7 @@ static int chd_dec_pci_probe(struct pci_dev *pdev, int rc; enum BC_STATUS sts = BC_STS_SUCCESS; - BCMLOG(BCMLOG_DBG, "PCI_INFO: Vendor:0x%04x Device:0x%04x " - "s_vendor:0x%04x s_device: 0x%04x\n", + BCMLOG(BCMLOG_DBG, "PCI_INFO: Vendor:0x%04x Device:0x%04x s_vendor:0x%04x s_device: 0x%04x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device); -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3] i2c: move of helpers into the core
On Thu, 22 Aug 2013 18:00:14 +0200, Wolfram Sang wrote: > I2C of helpers used to live in of_i2c.c but experience (from SPI) shows > that it is much cleaner to have this in the core. This also removes a > circular dependency between the helpers and the core, and so we can > finally register child nodes in the core instead of doing this manually > in each driver. So, fix the drivers and documentation, too. > > Acked-by: Rob Herring > Reviewed-by: Felipe Balbi > Acked-by: Rafael J. Wysocki > Tested-by: Sylwester Nawrocki > Signed-off-by: Wolfram Sang Acked-by: Grant Likely > --- > > V2->V3: Was trying to be too smart by only fixing includes needed. > Took a more general approach this time, converting of_i2c.h > to i2c.h in case i2c.h was not already there. Otherwise > remove it. Improved my build scripts and no build failures, > no complaints from buildbot as well. > > > Documentation/acpi/enumeration.txt |1 - > arch/powerpc/platforms/44x/warp.c |1 - > drivers/gpu/drm/tilcdc/tilcdc_slave.c |1 - > drivers/gpu/drm/tilcdc/tilcdc_tfp410.c |1 - > drivers/gpu/host1x/drm/output.c |2 +- > drivers/i2c/busses/i2c-at91.c |3 - > drivers/i2c/busses/i2c-cpm.c|6 -- > drivers/i2c/busses/i2c-davinci.c|2 - > drivers/i2c/busses/i2c-designware-platdrv.c |2 - > drivers/i2c/busses/i2c-gpio.c |3 - > drivers/i2c/busses/i2c-i801.c |2 - > drivers/i2c/busses/i2c-ibm_iic.c|4 - > drivers/i2c/busses/i2c-imx.c|3 - > drivers/i2c/busses/i2c-mpc.c|2 - > drivers/i2c/busses/i2c-mv64xxx.c|3 - > drivers/i2c/busses/i2c-mxs.c|3 - > drivers/i2c/busses/i2c-nomadik.c|3 - > drivers/i2c/busses/i2c-ocores.c |3 - > drivers/i2c/busses/i2c-octeon.c |3 - > drivers/i2c/busses/i2c-omap.c |3 - > drivers/i2c/busses/i2c-pnx.c|3 - > drivers/i2c/busses/i2c-powermac.c |9 +- > drivers/i2c/busses/i2c-pxa.c|2 - > drivers/i2c/busses/i2c-s3c2410.c|2 - > drivers/i2c/busses/i2c-sh_mobile.c |2 - > drivers/i2c/busses/i2c-sirf.c |3 - > drivers/i2c/busses/i2c-stu300.c |2 - > drivers/i2c/busses/i2c-tegra.c |3 - > drivers/i2c/busses/i2c-versatile.c |2 - > drivers/i2c/busses/i2c-wmt.c|3 - > drivers/i2c/busses/i2c-xiic.c |3 - > drivers/i2c/i2c-core.c | 109 +- > drivers/i2c/i2c-mux.c |3 - > drivers/i2c/muxes/i2c-arb-gpio-challenge.c |1 - > drivers/i2c/muxes/i2c-mux-gpio.c|1 - > drivers/i2c/muxes/i2c-mux-pinctrl.c |1 - > drivers/media/platform/exynos4-is/fimc-is-i2c.c |4 +- > drivers/media/platform/exynos4-is/fimc-is.c |2 +- > drivers/media/platform/exynos4-is/media-dev.c |1 - > drivers/of/Kconfig |6 -- > drivers/of/Makefile |1 - > drivers/of/of_i2c.c | 114 > --- > drivers/staging/imx-drm/imx-tve.c |2 +- > include/linux/i2c.h | 20 > include/linux/of_i2c.h | 46 - > sound/soc/fsl/imx-sgtl5000.c|2 +- > sound/soc/fsl/imx-wm8962.c |2 +- > 47 files changed, 138 insertions(+), 262 deletions(-) > delete mode 100644 drivers/of/of_i2c.c > delete mode 100644 include/linux/of_i2c.h > > diff --git a/Documentation/acpi/enumeration.txt > b/Documentation/acpi/enumeration.txt > index d9be7a9..958266e 100644 > --- a/Documentation/acpi/enumeration.txt > +++ b/Documentation/acpi/enumeration.txt > @@ -238,7 +238,6 @@ An I2C bus (controller) driver does: > if (ret) > /* handle error */ > > - of_i2c_register_devices(adapter); > /* Enumerate the slave devices behind this bus via ACPI */ > acpi_i2c_register_devices(adapter); > > diff --git a/arch/powerpc/platforms/44x/warp.c > b/arch/powerpc/platforms/44x/warp.c > index 4cfa499..534574a 100644 > --- a/arch/powerpc/platforms/44x/warp.c > +++ b/arch/powerpc/platforms/44x/warp.c > @@ -16,7 +16,6 @@ > #include > #include > #include > -#include > #include > #include > > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave.c > b/drivers/gpu/drm/tilcdc/tilcdc_slave.c > index dfffaf0..a19f657 100644 > --- a/drivers/gpu/drm/tilcdc/tilcdc_slave.c > +++ b/drivers/gpu/drm/tilcdc/tilcdc_slave.c > @@ -16,7 +16,6 @@ > */ > > #include
[PATCH 00/11] staging: comedi: tidy up digital output (*insn_bits)
Consolidate the boilerplate code used to mask and set the output channels of DIO and DO subdevices. H Hartley Sweeten (11): staging: comedi: core: introduce comedi_dio_insn_bits() staging: comedi: skel: use comedi_dio_insn_bits() staging: comedi: usbdux drivers: use comedi_dio_insn_bits() staging: comedi: drivers: use comedi_dio_insn_bits() staging: comedi: core: initialize subdevice s->io_bits in postconfig staging: comedi: core: only update outputs with comedi_dio_insn_bits() staging: comedi: drivers: use comedi_dio_insn_bits() for DIO subdevices staging: comedi: drivers: more users of comedi_dio_insn_bits() staging: comedi: ssv_dnp: use comedi_dio_insn_bits() staging: comedi: adq12b: remove 'digital_state' from private data staging: comedi: adq12b: use comedi_dio_insn_bits() drivers/staging/comedi/comedidev.h | 2 + drivers/staging/comedi/drivers.c | 32 +++ drivers/staging/comedi/drivers/8255.c | 28 ++--- .../staging/comedi/drivers/addi-data/addi_common.c | 2 - .../comedi/drivers/addi-data/hwdrv_apci1564.c | 7 +-- .../comedi/drivers/addi-data/hwdrv_apci3200.c | 7 +-- drivers/staging/comedi/drivers/addi_apci_1516.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_16xx.c| 11 +--- drivers/staging/comedi/drivers/addi_apci_2032.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_2200.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_3120.c| 2 - drivers/staging/comedi/drivers/addi_apci_3501.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_3xxx.c| 23 ++-- drivers/staging/comedi/drivers/adl_pci6208.c | 10 +--- drivers/staging/comedi/drivers/adl_pci7x3x.c | 13 + drivers/staging/comedi/drivers/adl_pci9111.c | 9 +-- drivers/staging/comedi/drivers/adl_pci9118.c | 11 ++-- drivers/staging/comedi/drivers/adq12b.c| 27 - drivers/staging/comedi/drivers/adv_pci1710.c | 13 ++--- drivers/staging/comedi/drivers/adv_pci1723.c | 13 ++--- drivers/staging/comedi/drivers/adv_pci_dio.c | 24 drivers/staging/comedi/drivers/aio_iiro_16.c | 4 +- .../staging/comedi/drivers/amplc_dio200_common.c | 24 +++- drivers/staging/comedi/drivers/amplc_pc263.c | 17 +++--- drivers/staging/comedi/drivers/amplc_pci263.c | 17 +++--- drivers/staging/comedi/drivers/cb_das16_cs.c | 9 +-- drivers/staging/comedi/drivers/cb_pcidas64.c | 14 + drivers/staging/comedi/drivers/contec_pci_dio.c| 12 +--- drivers/staging/comedi/drivers/das16.c | 9 +-- drivers/staging/comedi/drivers/das800.c| 6 +- drivers/staging/comedi/drivers/dmm32at.c | 66 +- drivers/staging/comedi/drivers/dt2801.c| 21 --- drivers/staging/comedi/drivers/dt2811.c| 8 +-- drivers/staging/comedi/drivers/dt2817.c| 44 ++- drivers/staging/comedi/drivers/dt282x.c| 10 ++-- drivers/staging/comedi/drivers/dt3000.c| 9 ++- drivers/staging/comedi/drivers/dt9812.c| 9 +-- drivers/staging/comedi/drivers/dyna_pci10xx.c | 20 ++- drivers/staging/comedi/drivers/icp_multi.c | 14 + drivers/staging/comedi/drivers/ii_pci20kc.c| 37 +--- drivers/staging/comedi/drivers/me4000.c| 50 ++-- drivers/staging/comedi/drivers/me_daq.c| 15 + drivers/staging/comedi/drivers/multiq3.c | 8 +-- drivers/staging/comedi/drivers/ni_6527.c | 28 +++-- drivers/staging/comedi/drivers/ni_660x.c | 1 - drivers/staging/comedi/drivers/ni_670x.c | 11 +--- drivers/staging/comedi/drivers/ni_at_ao.c | 8 +-- drivers/staging/comedi/drivers/ni_atmio16d.c | 9 ++- drivers/staging/comedi/drivers/ni_daq_700.c| 19 +++ drivers/staging/comedi/drivers/ni_mio_common.c | 40 ++--- drivers/staging/comedi/drivers/ni_pcidio.c | 9 ++- drivers/staging/comedi/drivers/pcl711.c| 12 ++-- drivers/staging/comedi/drivers/pcl726.c| 11 ++-- drivers/staging/comedi/drivers/pcl730.c| 16 ++ drivers/staging/comedi/drivers/pcl812.c| 11 ++-- drivers/staging/comedi/drivers/pcl818.c| 18 ++ drivers/staging/comedi/drivers/pcmuio.c| 10 +--- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 8 +-- drivers/staging/comedi/drivers/rtd520.c| 8 +-- drivers/staging/comedi/drivers/rti800.c| 8 +-- drivers/staging/comedi/drivers/s526.c | 9 +-- drivers/staging/comedi/drivers/s626.c | 13 + drivers/staging/comedi/drivers/skel.c | 43 +- drivers/staging/comedi/drivers/ssv_dnp.c | 51 +++-- drivers/staging/comedi/drivers/usbdux.c| 6 +- drivers/staging/comedi/drivers/usbduxsigma.c |
[PATCH 02/11] staging: comedi: skel: use comedi_dio_insn_bits()
Convert this driver to use the comedi_dio_insn_bits() helper function. Tidy up the comments to reflect the new code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/skel.c | 43 +++ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 9e96495..58ccbc3 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -332,30 +332,43 @@ static int skel_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, return i; } -/* DIO devices are slightly special. Although it is possible to +/* + * DIO devices are slightly special. Although it is possible to * implement the insn_read/insn_write interface, it is much more * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write */ + * This allows packed reading/writing of the DIO channels. The + * comedi core can convert between insn_bits and insn_read/write. + */ static int skel_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { - /* The insn data is a mask in data[0] and the new data -* in data[1], each channel cooresponding to a bit. */ - if (data[0]) { - s->state &= ~data[0]; - s->state |= data[0] & data[1]; + /* +* The insn data is a mask in data[0] and the new data +* in data[1], each channel cooresponding to a bit. +* +* The core provided comedi_dio_insn_bits() function can +* be used to handle the state update to DIO subdevices +* with <= 32 channels. This function will return '0' if +* the the state does not change. +*/ + if (comedi_dio_insn_bits(dev, s, insn, data)) { /* Write out the new digital output lines */ /* outw(s->state,dev->iobase + SKEL_DIO); */ } - /* on return, data[1] contains the value of the digital -* input and output lines. */ - /* data[1]=inw(dev->iobase + SKEL_DIO); */ - /* or we could just return the software copy of the output values if -* it was a purely digital output subdevice */ - /* data[1]=s->state; */ + /* +* On return, data[1] contains the value of the digital +* input and output lines. +*/ + /* data[1] = inw(dev->iobase + SKEL_DIO); */ + + /* +* Or we could just return the software copy of the output +* values if it was a purely digital output subdevice. +*/ + /* data[1] = s->state; */ return insn->n; } -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/11] staging: comedi: usbdux drivers: use comedi_dio_insn_bits()
Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state. These drivers always need to update the hardware in order to update the i/o configuration regardless of if the state has changed. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbdux.c | 6 ++ drivers/staging/comedi/drivers/usbduxsigma.c | 6 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 701ad1a..5804cb5 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1133,15 +1133,13 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, { struct usbdux_private *devpriv = dev->private; - unsigned int mask = data[0]; - unsigned int bits = data[1]; int ret; down(&devpriv->sem); - s->state &= ~mask; - s->state |= (bits & mask); + comedi_dio_insn_bits(dev, s, insn, data); + /* Always update the hardware. See the (*insn_config). */ devpriv->dux_commands[1] = s->io_bits; devpriv->dux_commands[2] = s->state; diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index c47f408..25606e4 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1059,15 +1059,13 @@ static int usbduxsigma_dio_insn_bits(struct comedi_device *dev, unsigned int *data) { struct usbduxsigma_private *devpriv = dev->private; - unsigned int mask = data[0]; - unsigned int bits = data[1]; int ret; down(&devpriv->sem); - s->state &= ~mask; - s->state |= (bits & mask); + comedi_dio_insn_bits(dev, s, insn, data); + /* Always update the hardware. See the (*insn_config). */ devpriv->dux_commands[1] = s->io_bits & 0xff; devpriv->dux_commands[4] = s->state & 0xff; devpriv->dux_commands[2] = (s->io_bits >> 8) & 0xff; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/11] staging: comedi: drivers: use comedi_dio_insn_bits()
Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state for DIO and DO subdevices. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c | 25 ++-- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 7 +-- .../comedi/drivers/addi-data/hwdrv_apci3200.c | 7 +-- drivers/staging/comedi/drivers/addi_apci_1516.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_2032.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_2200.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_3501.c| 8 +-- drivers/staging/comedi/drivers/addi_apci_3xxx.c| 8 +-- drivers/staging/comedi/drivers/adl_pci6208.c | 9 +-- drivers/staging/comedi/drivers/adl_pci7x3x.c | 13 + drivers/staging/comedi/drivers/adl_pci9111.c | 9 +-- drivers/staging/comedi/drivers/adl_pci9118.c | 9 ++- drivers/staging/comedi/drivers/adv_pci1710.c | 9 ++- drivers/staging/comedi/drivers/adv_pci1723.c | 13 ++--- drivers/staging/comedi/drivers/adv_pci_dio.c | 24 drivers/staging/comedi/drivers/aio_iiro_16.c | 4 +- drivers/staging/comedi/drivers/amplc_pc263.c | 17 +++--- drivers/staging/comedi/drivers/amplc_pci263.c | 17 +++--- drivers/staging/comedi/drivers/cb_das16_cs.c | 9 +-- drivers/staging/comedi/drivers/contec_pci_dio.c| 12 +--- drivers/staging/comedi/drivers/das16.c | 9 +-- drivers/staging/comedi/drivers/das800.c| 6 +- drivers/staging/comedi/drivers/dmm32at.c | 66 +- drivers/staging/comedi/drivers/dt2801.c| 21 --- drivers/staging/comedi/drivers/dt2811.c| 8 +-- drivers/staging/comedi/drivers/dt2817.c| 44 ++- drivers/staging/comedi/drivers/dt282x.c| 10 ++-- drivers/staging/comedi/drivers/dt3000.c| 9 ++- drivers/staging/comedi/drivers/dt9812.c| 9 +-- drivers/staging/comedi/drivers/dyna_pci10xx.c | 20 ++- drivers/staging/comedi/drivers/icp_multi.c | 11 +--- drivers/staging/comedi/drivers/multiq3.c | 8 +-- drivers/staging/comedi/drivers/ni_6527.c | 28 +++-- drivers/staging/comedi/drivers/ni_670x.c | 11 +--- drivers/staging/comedi/drivers/ni_at_ao.c | 8 +-- drivers/staging/comedi/drivers/ni_atmio16d.c | 9 ++- drivers/staging/comedi/drivers/ni_daq_700.c| 18 +++--- drivers/staging/comedi/drivers/ni_mio_common.c | 20 +++ drivers/staging/comedi/drivers/ni_pcidio.c | 9 ++- drivers/staging/comedi/drivers/pcl711.c| 12 ++-- drivers/staging/comedi/drivers/pcl726.c| 11 ++-- drivers/staging/comedi/drivers/pcl730.c| 16 ++ drivers/staging/comedi/drivers/pcl812.c| 11 ++-- drivers/staging/comedi/drivers/pcl818.c| 18 ++ drivers/staging/comedi/drivers/quatech_daqp_cs.c | 8 +-- drivers/staging/comedi/drivers/rtd520.c| 8 +-- drivers/staging/comedi/drivers/rti800.c| 8 +-- drivers/staging/comedi/drivers/s526.c | 9 +-- 48 files changed, 211 insertions(+), 438 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 2f070fd..d29f404 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -126,30 +126,17 @@ EXPORT_SYMBOL_GPL(subdev_8255_interrupt); static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { struct subdev_8255_private *spriv = s->private; unsigned long iobase = spriv->iobase; - unsigned int mask; - unsigned int bits; unsigned int v; - mask = data[0]; - bits = data[1]; - - if (mask) { - v = s->state; - v &= ~mask; - v |= (bits & mask); - - if (mask & 0xff) - spriv->io(1, _8255_DATA, v & 0xff, iobase); - if (mask & 0xff00) - spriv->io(1, _8255_DATA + 1, (v >> 8) & 0xff, iobase); - if (mask & 0xff) - spriv->io(1, _8255_DATA + 2, (v >> 16) & 0xff, iobase); - - s->state = v; + if (comedi_dio_insn_bits(dev, s, insn, data)) { + spriv->io(1, _8255_DATA, s->state & 0xff, iobase); + spriv->io(1, _8255_DATA + 1, (s->state >> 8) & 0xff, iobase); + spriv->io(1, _8255_DATA + 2, (s->state >> 16) & 0xff, iobase); } v = spriv->io(0, _8255_DATA, 0, iobase); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/
[PATCH 06/11] staging: comedi: core: only update outputs with comedi_dio_insn_bits()
Make sure only the state of the channels configured as outputs is updated by comedi_dio_insn_bits(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 7477514..8d8bf22 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -202,7 +202,7 @@ int comedi_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - unsigned int mask = data[0]; + unsigned int mask = data[0] & s->io_bits; /* outputs only */ unsigned int bits = data[1]; if (mask) { -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/11] staging: comedi: drivers: more users of comedi_dio_insn_bits()
Convert a couple more comedi drivers to use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/amplc_dio200_common.c | 22 +- drivers/staging/comedi/drivers/cb_pcidas64.c | 14 +++--- drivers/staging/comedi/drivers/ni_mio_common.c | 20 +--- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 8c6fa1e..0fc0081 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -946,26 +946,22 @@ static void dio200_subdev_8255_set_dir(struct comedi_device *dev, */ static int dio200_subdev_8255_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { struct dio200_subdev_8255 *subpriv = s->private; - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); - if (data[0] & 0xff) - dio200_write8(dev, subpriv->ofs, s->state & 0xff); - if (data[0] & 0xff00) - dio200_write8(dev, subpriv->ofs + 1, - (s->state >> 8) & 0xff); - if (data[0] & 0xff) - dio200_write8(dev, subpriv->ofs + 2, - (s->state >> 16) & 0xff); + if (comedi_dio_insn_bits(dev, s, insn, data)) { + dio200_write8(dev, subpriv->ofs, s->state & 0xff); + dio200_write8(dev, subpriv->ofs + 1, (s->state >> 8) & 0xff); + dio200_write8(dev, subpriv->ofs + 2, (s->state >> 16) & 0xff); } + data[1] = dio200_read8(dev, subpriv->ofs); data[1] |= dio200_read8(dev, subpriv->ofs + 1) << 8; data[1] |= dio200_read8(dev, subpriv->ofs + 2) << 16; - return 2; + + return insn->n; } /* diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 388dbd7..67c27b2 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -3495,13 +3495,8 @@ static int do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, { struct pcidas64_private *devpriv = dev->private; - data[0] &= 0xf; - /* zero bits we are going to change */ - s->state &= ~data[0]; - /* set new bits */ - s->state |= data[0] & data[1]; - - writeb(s->state, devpriv->dio_counter_iobase + DO_REG); + if (comedi_dio_insn_bits(dev, s, insn, data)) + writeb(s->state, devpriv->dio_counter_iobase + DO_REG); data[1] = s->state; @@ -3531,12 +3526,9 @@ static int dio_60xx_wbits(struct comedi_device *dev, struct comedi_subdevice *s, { struct pcidas64_private *devpriv = dev->private; - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); + if (comedi_dio_insn_bits(dev, s, insn, data)) writeb(s->state, devpriv->dio_counter_iobase + DIO_DATA_60XX_REG); - } data[1] = readb(devpriv->dio_counter_iobase + DIO_DATA_60XX_REG); diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index c2c5d1f..9f1819f 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3597,11 +3597,9 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev, data[1]); #endif - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); + if (comedi_dio_insn_bits(dev, s, insn, data)) ni_writel(s->state, M_Offset_Static_Digital_Output); - } + data[1] = ni_readl(M_Offset_Static_Digital_Input); return insn->n; @@ -5349,20 +5347,20 @@ static int ni_config_filter(struct comedi_device *dev, unsigned pfi_channel, static int ni_pfi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv __maybe_unused = dev->private; - if ((board->reg_type & ni_reg_m_series_mask) == 0) { + if ((board->reg_type & ni_reg_m_series_mask) == 0) return -E
[PATCH 07/11] staging: comedi: drivers: use comedi_dio_insn_bits() for DIO subdevices
Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state for DIO subdevices. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_16xx.c | 11 +- drivers/staging/comedi/drivers/addi_apci_3xxx.c | 15 ++-- drivers/staging/comedi/drivers/ii_pci20kc.c | 37 +++--- drivers/staging/comedi/drivers/me4000.c | 50 - drivers/staging/comedi/drivers/me_daq.c | 14 ++- drivers/staging/comedi/drivers/pcmuio.c | 10 ++--- drivers/staging/comedi/drivers/s626.c | 13 +-- 7 files changed, 42 insertions(+), 108 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_16xx.c b/drivers/staging/comedi/drivers/addi_apci_16xx.c index 9652374..ffb3a4c 100644 --- a/drivers/staging/comedi/drivers/addi_apci_16xx.c +++ b/drivers/staging/comedi/drivers/addi_apci_16xx.c @@ -87,17 +87,8 @@ static int apci16xx_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - unsigned int mask = data[0]; - unsigned int bits = data[1]; - - /* Only update the channels configured as outputs */ - mask &= s->io_bits; - if (mask) { - s->state &= ~mask; - s->state |= (bits & mask); - + if (comedi_dio_insn_bits(dev, s, insn, data)) outl(s->state, dev->iobase + APCI16XX_OUT_REG(s->index)); - } data[1] = inl(dev->iobase + APCI16XX_IN_REG(s->index)); diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c b/drivers/staging/comedi/drivers/addi_apci_3xxx.c index 40e8d56..f3b8514 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c @@ -711,20 +711,11 @@ static int apci3xxx_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - unsigned int mask = data[0]; - unsigned int bits = data[1]; unsigned int val; - /* only update output channels */ - mask &= s->io_bits; - if (mask) { - s->state &= ~mask; - s->state |= (bits & mask); - - if (mask & 0xff) - outl(s->state & 0xff, dev->iobase + 80); - if (mask & 0xff) - outl((s->state >> 16) & 0xff, dev->iobase + 112); + if (comedi_dio_insn_bits(dev, s, insn, data)) { + outl(s->state & 0xff, dev->iobase + 80); + outl((s->state >> 16) & 0xff, dev->iobase + 112); } val = inl(dev->iobase + 80); diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index 5c3a318..a2e38fe 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -378,31 +378,22 @@ static int ii20k_dio_insn_bits(struct comedi_device *dev, unsigned int *data) { struct ii20k_private *devpriv = dev->private; - unsigned int mask = data[0] & s->io_bits; /* outputs only */ - unsigned int bits = data[1]; - - if (mask) { - s->state &= ~mask; - s->state |= (bits & mask); - - if (mask & 0x00ff) - writeb((s->state >> 0) & 0xff, - devpriv->ioaddr + II20K_DIO0_REG); - if (mask & 0xff00) - writeb((s->state >> 8) & 0xff, - devpriv->ioaddr + II20K_DIO1_REG); - if (mask & 0x00ff) - writeb((s->state >> 16) & 0xff, - devpriv->ioaddr + II20K_DIO2_REG); - if (mask & 0xff00) - writeb((s->state >> 24) & 0xff, - devpriv->ioaddr + II20K_DIO3_REG); + void __iomem *ioaddr = devpriv->ioaddr; + unsigned int val; + + if (comedi_dio_insn_bits(dev, s, insn, data)) { + writeb((s->state >> 0) & 0xff, ioaddr + II20K_DIO0_REG); + writeb((s->state >> 8) & 0xff, ioaddr + II20K_DIO1_REG); + writeb((s->state >> 16) & 0xff, ioaddr + II20K_DIO2_REG); + writeb((s->state >> 24) & 0xff, ioaddr + II20K_DIO3_REG); } - data[1] = readb(devpriv->ioaddr + II20K_DIO0_REG); - data[1] |= readb(devpriv->ioaddr + II20K_DIO1_REG) << 8; - data[1] |= readb(devpriv->ioaddr + II20K_DIO2_REG) << 16; - data[1] |= readb(devpriv->ioaddr + II20K_DIO3_REG) << 24; + val = readb(ioaddr + II20K_DIO0_REG); + val |= readb(ioaddr + II20K_DIO1_REG) << 8; + val |= readb(ioaddr + II20K_DIO2_REG) << 16; + val |= readb(ioaddr + II20K_DIO3_REG) << 24; + + data[1] = val; retur
[PATCH 10/11] staging: comedi: adq12b: remove 'digital_state' from private data
Use the subdevice 'state' to hold the digital output state instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adq12b.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index cdf5ba2..054bed3 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -119,7 +119,6 @@ struct adq12b_private { int differential; /* option 3 of comedi_config */ int last_channel; int last_range; - unsigned int digital_state; }; /* @@ -188,7 +187,6 @@ static int adq12b_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - struct adq12b_private *devpriv = dev->private; int channel; for (channel = 0; channel < 8; channel++) @@ -198,11 +196,11 @@ static int adq12b_do_insn_bits(struct comedi_device *dev, /* store information to retrieve when asked for reading */ if (data[0]) { - devpriv->digital_state &= ~data[0]; - devpriv->digital_state |= (data[0] & data[1]); + s->state &= ~data[0]; + s->state |= (data[0] & data[1]); } - data[1] = devpriv->digital_state; + data[1] = s->state; return insn->n; } @@ -223,7 +221,6 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->unipolar = it->options[1]; devpriv->differential = it->options[2]; - devpriv->digital_state = 0; /* * initialize channel and range to -1 so we make sure we * always write at least once to the CTREG in the instruction -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/11] staging: comedi: ssv_dnp: use comedi_dio_insn_bits()
Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ssv_dnp.c | 51 +--- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 11758a5..b79e691 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -46,51 +46,40 @@ Status: unknown #define PCMR 0xa3 /* Port C Mode Register */ #define PCDR 0xa7 /* Port C Data Register */ -/* - */ -/* The insn_bits interface allows packed reading/writing of DIO channels.*/ -/* The comedi core can convert between insn_bits and insn_read/write, so you */ -/* are able to use these instructions as well. */ -/* - */ - static int dnp_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, -struct comedi_insn *insn, unsigned int *data) +struct comedi_insn *insn, +unsigned int *data) { - /* The insn data is a mask in data[0] and the new data in data[1], */ - /* each channel cooresponding to a bit. */ - - /* Ports A and B are straight forward: each bit corresponds to an*/ - /* output pin with the same order. Port C is different: bits 0...3 */ - /* correspond to bits 4...7 of the output register (PCDR). */ + unsigned int val; - if (data[0]) { + /* +* Ports A and B are straight forward: each bit corresponds to an +* output pin with the same order. Port C is different: bits 0...3 +* correspond to bits 4...7 of the output register (PCDR). +*/ + outb(PADR, CSCIR); + s->state = inb(CSCDR); + outb(PBDR, CSCIR); + s->state |= (inb(CSCDR) << 8); + outb(PCDR, CSCIR); + val = inb(CSCDR); + s->state |= ((val & 0xf0) << 12); + if (comedi_dio_insn_bits(dev, s, insn, data)) { outb(PADR, CSCIR); - outb((inb(CSCDR) - & ~(u8) (data[0] & 0xFF)) -| (u8) (data[1] & 0xFF), CSCDR); + outb(s->state & 0xff, CSCDR); outb(PBDR, CSCIR); - outb((inb(CSCDR) - & ~(u8) ((data[0] & 0x00FF00) >> 8)) -| (u8) ((data[1] & 0x00FF00) >> 8), CSCDR); + outb((s->state >> 8) & 0xff, CSCDR); outb(PCDR, CSCIR); - outb((inb(CSCDR) - & ~(u8) ((data[0] & 0x0F) >> 12)) -| (u8) ((data[1] & 0x0F) >> 12), CSCDR); + outb(((val & 0x0f) | (s->state >> 12)) & 0xff, CSCDR); } - /* on return, data[1] contains the value of the digital input lines. */ - outb(PADR, CSCIR); - data[0] = inb(CSCDR); - outb(PBDR, CSCIR); - data[0] += inb(CSCDR) << 8; - outb(PCDR, CSCIR); - data[0] += ((inb(CSCDR) & 0xF0) << 12); + data[0] = s->state; return insn->n; - } static int dnp_dio_insn_config(struct comedi_device *dev, -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/11] staging: comedi: adq12b: use comedi_dio_insn_bits()
Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adq12b.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index 054bed3..3093c392 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -185,19 +185,17 @@ static int adq12b_di_insn_bits(struct comedi_device *dev, static int adq12b_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { - int channel; - - for (channel = 0; channel < 8; channel++) - if (((data[0] >> channel) & 0x01) != 0) - outbdata[1] >> channel) & 0x01) << 3) | channel, -dev->iobase + ADQ12B_OUTBR); - - /* store information to retrieve when asked for reading */ - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); + unsigned int val; + int chan; + + if (comedi_dio_insn_bits(dev, s, insn, data)) { + for (chan = 0; chan < 8; chan++) { + val = (s->state >> chan) & 0x01; + outb((val << 3) | chan, dev->iobase + ADQ12B_OUTBR); + } } data[1] = s->state; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/11] staging: comedi: core: initialize subdevice s->io_bits in postconfig
The subdevice 'io_bits' is a bit mask of the i/o configuration for digital subdevices. '0' values indicate that a channel is configured as an input and '1' values that the channel is an output. Since the subdevice data is kzalloc()'d, all channels default as inputs. Modify __comedi_device_postconfig() so that the 'io_bits' are correctly initialized for Digital Output subdevices. Remove all the unnecessary initializations of 's->io_bits' from the drivers. Also, remove the unnecessary initialization of the 's->state'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 7 +++ drivers/staging/comedi/drivers/8255.c | 3 --- drivers/staging/comedi/drivers/addi-data/addi_common.c | 2 -- drivers/staging/comedi/drivers/addi_apci_3120.c| 2 -- drivers/staging/comedi/drivers/adl_pci6208.c | 1 - drivers/staging/comedi/drivers/adl_pci9118.c | 2 -- drivers/staging/comedi/drivers/adv_pci1710.c | 4 drivers/staging/comedi/drivers/amplc_dio200_common.c | 2 -- drivers/staging/comedi/drivers/icp_multi.c | 3 --- drivers/staging/comedi/drivers/me_daq.c| 1 - drivers/staging/comedi/drivers/ni_660x.c | 1 - drivers/staging/comedi/drivers/ni_daq_700.c| 1 - 12 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 2bbd9d0..7477514 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -310,6 +310,13 @@ static int __comedi_device_postconfig(struct comedi_device *dev) if (s->type == COMEDI_SUBD_UNUSED) continue; + if (s->type == COMEDI_SUBD_DO) { + if (s->n_chan < 32) + s->io_bits = (1 << s->n_chan) - 1; + else + s->io_bits = 0x; + } + if (s->len_chanlist == 0) s->len_chanlist = 1; diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index d29f404..9279596 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -275,9 +275,6 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, s->insn_bits= subdev_8255_insn; s->insn_config = subdev_8255_insn_config; - s->state= 0; - s->io_bits = 0; - subdev_8255_do_config(dev, s); return 0; diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 63dff77..dc87df0 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -204,7 +204,6 @@ static int addi_auto_attach(struct comedi_device *dev, s->len_chanlist = devpriv->s_EeParameters.i_NbrDiChannel; s->range_table = &range_digital; - s->io_bits = 0; /* all bits input */ s->insn_config = this_board->di_config; s->insn_read = this_board->di_read; s->insn_write = this_board->di_write; @@ -223,7 +222,6 @@ static int addi_auto_attach(struct comedi_device *dev, s->len_chanlist = devpriv->s_EeParameters.i_NbrDoChannel; s->range_table = &range_digital; - s->io_bits = 0xf; /* all bits output */ /* insn_config - for digital output memory */ s->insn_config = this_board->do_config; diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index d804957..67d09e8 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -164,7 +164,6 @@ static int apci3120_auto_attach(struct comedi_device *dev, s->maxdata = 1; s->len_chanlist = this_board->i_NbrDiChannel; s->range_table = &range_digital; - s->io_bits = 0; /* all bits input */ s->insn_bits = apci3120_di_insn_bits; /* Allocate and Initialise DO Subdevice Structures */ @@ -176,7 +175,6 @@ static int apci3120_auto_attach(struct comedi_device *dev, s->maxdata = this_board->i_DoMaxdata; s->len_chanlist = this_board->i_NbrDoChannel; s->range_table = &range_digital; - s->io_bits = 0xf; /* all bits output */ s->insn_bits = apci3120_do_insn_bits; /* Allocate and Initialise Timer Subdevice Structures */ diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 3e7c812..87bf2be 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pc
[PATCH 01/11] staging: comedi: core: introduce comedi_dio_insn_bits()
The (*insn_bits) functions for DIO and DO subdevices typically use the subdevice 's->state' to hold the current state of the output channels. The 'insn' passed to these functions, INSN_BITS, specifies two parameters passed in the 'data'. data[0] = 'mask', the channels to update data[1] = 'bits', the new state for the channels Introduce a helper function to handle this boilerplate. The function returns: 0 if there are no changes in the state 1 if the driver needs to update the hardware to a new state Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 2 ++ drivers/staging/comedi/drivers.c | 25 + 2 files changed, 27 insertions(+) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 2e19f65..de36499 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -345,6 +345,8 @@ void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, int comedi_dio_insn_config(struct comedi_device *, struct comedi_subdevice *, struct comedi_insn *, unsigned int *data, unsigned int mask); +int comedi_dio_insn_bits(struct comedi_device *, struct comedi_subdevice *, +struct comedi_insn *, unsigned int *data); void *comedi_alloc_devpriv(struct comedi_device *, size_t); int comedi_alloc_subdevices(struct comedi_device *, int); diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 317a821..2bbd9d0 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -190,6 +190,31 @@ int comedi_dio_insn_config(struct comedi_device *dev, } EXPORT_SYMBOL_GPL(comedi_dio_insn_config); +/** + * comedi_dio_insn_bits() - boilerplate (*insn_bits) for DIO and DO subdevices. + * @dev: comedi_device struct + * @s: comedi_subdevice struct + * @insn: comedi_insn struct + * @data: parameters for the @insn + */ +int comedi_dio_insn_bits(struct comedi_device *dev, +struct comedi_subdevice *s, +struct comedi_insn *insn, +unsigned int *data) +{ + unsigned int mask = data[0]; + unsigned int bits = data[1]; + + if (mask) { + s->state &= ~mask; + s->state |= (bits & mask); + + return 1; + } + return 0; +} +EXPORT_SYMBOL_GPL(comedi_dio_insn_bits); + static int insn_rw_emulate_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/15] staging: comedi: comedi_parport: tidy up the register map
Rename the register map defines to better describe the hardware. Add defines for the control register bits that enable the irq and change the direction of the data register. This gets rid of the "magic" numbers. Remove PARPORT_SIZE, it's only used when requesting the i/o region with comedi_request_region(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 41 + 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index f28a15f..72b0771 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -82,11 +82,14 @@ pin, which can be used to wake up tasks. #include "comedi_fc.h" -#define PARPORT_SIZE 3 - -#define PARPORT_A 0 -#define PARPORT_B 1 -#define PARPORT_C 2 +/* + * Register map + */ +#define PARPORT_DATA_REG 0x00 +#define PARPORT_STATUS_REG 0x01 +#define PARPORT_CTRL_REG 0x02 +#define PARPORT_CTRL_IRQ_ENA (1 << 4) +#define PARPORT_CTRL_BIDIR_ENA (1 << 5) struct parport_private { unsigned int a_data; @@ -103,10 +106,10 @@ static int parport_insn_a(struct comedi_device *dev, struct comedi_subdevice *s, devpriv->a_data &= ~data[0]; devpriv->a_data |= (data[0] & data[1]); - outb(devpriv->a_data, dev->iobase + PARPORT_A); + outb(devpriv->a_data, dev->iobase + PARPORT_DATA_REG); } - data[1] = inb(dev->iobase + PARPORT_A); + data[1] = inb(dev->iobase + PARPORT_DATA_REG); return insn->n; } @@ -119,12 +122,12 @@ static int parport_insn_config_a(struct comedi_device *dev, if (data[0]) { s->io_bits = 0xff; - devpriv->c_data &= ~(1 << 5); + devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA; } else { s->io_bits = 0; - devpriv->c_data |= (1 << 5); + devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA; } - outb(devpriv->c_data, dev->iobase + PARPORT_C); + outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); return 1; } @@ -137,7 +140,7 @@ static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s, /* anyone??? */ } - data[1] = (inb(dev->iobase + PARPORT_B) >> 3); + data[1] = (inb(dev->iobase + PARPORT_STATUS_REG) >> 3); return insn->n; } @@ -152,7 +155,7 @@ static int parport_insn_c(struct comedi_device *dev, struct comedi_subdevice *s, devpriv->c_data &= ~data[0]; devpriv->c_data |= (data[0] & data[1]); - outb(devpriv->c_data, dev->iobase + PARPORT_C); + outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); } data[1] = devpriv->c_data & 0xf; @@ -215,8 +218,8 @@ static int parport_intr_cmd(struct comedi_device *dev, { struct parport_private *devpriv = dev->private; - devpriv->c_data |= 0x10; - outb(devpriv->c_data, dev->iobase + PARPORT_C); + devpriv->c_data |= PARPORT_CTRL_IRQ_ENA; + outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); devpriv->enable_irq = 1; @@ -228,8 +231,8 @@ static int parport_intr_cancel(struct comedi_device *dev, { struct parport_private *devpriv = dev->private; - devpriv->c_data &= ~0x10; - outb(devpriv->c_data, dev->iobase + PARPORT_C); + devpriv->c_data &= ~PARPORT_CTRL_IRQ_ENA; + outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); devpriv->enable_irq = 0; @@ -260,7 +263,7 @@ static int parport_attach(struct comedi_device *dev, unsigned int irq; int ret; - ret = comedi_request_region(dev, it->options[0], PARPORT_SIZE); + ret = comedi_request_region(dev, it->options[0], 0x03); if (ret) return ret; @@ -325,9 +328,9 @@ static int parport_attach(struct comedi_device *dev, } devpriv->a_data = 0; - outb(devpriv->a_data, dev->iobase + PARPORT_A); + outb(devpriv->a_data, dev->iobase + PARPORT_DATA_REG); devpriv->c_data = 0; - outb(devpriv->c_data, dev->iobase + PARPORT_C); + outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); return 0; } -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/15] staging: comedi: comedi_parport: remove 'a_data' from private data
Use the subdevice s->state to hold the current state of the data register outputs instead of carrying it in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 72b0771..5565a99 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -92,7 +92,6 @@ pin, which can be used to wake up tasks. #define PARPORT_CTRL_BIDIR_ENA (1 << 5) struct parport_private { - unsigned int a_data; unsigned int c_data; int enable_irq; }; @@ -100,13 +99,11 @@ struct parport_private { static int parport_insn_a(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - struct parport_private *devpriv = dev->private; - if (data[0]) { - devpriv->a_data &= ~data[0]; - devpriv->a_data |= (data[0] & data[1]); + s->state &= ~data[0]; + s->state |= (data[0] & data[1]); - outb(devpriv->a_data, dev->iobase + PARPORT_DATA_REG); + outb(s->state, dev->iobase + PARPORT_DATA_REG); } data[1] = inb(dev->iobase + PARPORT_DATA_REG); @@ -327,8 +324,7 @@ static int parport_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - devpriv->a_data = 0; - outb(devpriv->a_data, dev->iobase + PARPORT_DATA_REG); + outb(0, dev->iobase + PARPORT_DATA_REG); devpriv->c_data = 0; outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/15] staging: comedi: comedi_parport: fix parport_insn_config_a()
This is the (*insn_config) function for a DIO subdevice. It should be using the data[0] value as the "instruction" to perform on the subdevice. Use the comedi_dio_insn_config() helper to properly handle instructions. Also, rename the function to better describe it's use. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 6880b69..a0dbb32 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -109,22 +109,25 @@ static int parport_data_reg_insn_bits(struct comedi_device *dev, return insn->n; } -static int parport_insn_config_a(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, unsigned int *data) +static int parport_data_reg_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct parport_private *devpriv = dev->private; + int ret; - if (data[0]) { - s->io_bits = 0xff; + ret = comedi_dio_insn_config(dev, s, insn, data, 0xff); + if (ret) + return ret; + + if (s->io_bits) devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA; - } else { - s->io_bits = 0; + else devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA; - } outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); - return 1; + return insn->n; } static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s, @@ -288,7 +291,7 @@ static int parport_attach(struct comedi_device *dev, s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = parport_data_reg_insn_bits; - s->insn_config = parport_insn_config_a; + s->insn_config = parport_data_reg_insn_config; s = &dev->subdevices[1]; s->type = COMEDI_SUBD_DI; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/15] staging: comedi: comedi_parport: tidy up parport_insn_a()
Rename this function to better describe it's use. Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 5565a99..6880b69 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -96,15 +96,13 @@ struct parport_private { int enable_irq; }; -static int parport_insn_a(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int parport_data_reg_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); - + if (comedi_dio_insn_bits(dev, s, insn, data)) outb(s->state, dev->iobase + PARPORT_DATA_REG); - } data[1] = inb(dev->iobase + PARPORT_DATA_REG); @@ -289,7 +287,7 @@ static int parport_attach(struct comedi_device *dev, s->n_chan = 8; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = parport_insn_a; + s->insn_bits = parport_data_reg_insn_bits; s->insn_config = parport_insn_config_a; s = &dev->subdevices[1]; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/15] staging: comedi: comedi_parport: tidy up parport_insn_c()
Rename this function to better describe it's use. Use comedi_dio_insn_bits() to handle the boilerplate code to update the subdevice s->state. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 04feec7..7180b0c 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -140,20 +140,20 @@ static int parport_status_reg_insn_bits(struct comedi_device *dev, return insn->n; } -static int parport_insn_c(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int parport_ctrl_reg_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct parport_private *devpriv = dev->private; - data[0] &= 0x0f; - if (data[0]) { - devpriv->c_data &= ~data[0]; - devpriv->c_data |= (data[0] & data[1]); - + if (comedi_dio_insn_bits(dev, s, insn, data)) { + devpriv->c_data &= ~((1 << s->n_chan) - 1); + devpriv->c_data |= s->state; outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); } - data[1] = devpriv->c_data & 0xf; + data[1] = s->state; return insn->n; } @@ -304,7 +304,7 @@ static int parport_attach(struct comedi_device *dev, s->n_chan = 4; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = parport_insn_c; + s->insn_bits = parport_ctrl_reg_insn_bits; s = &dev->subdevices[3]; if (irq) { -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/15] staging: comedi: comedi_parport: remove 'enable_irq' from private data
The enabled state of the interrupt can be checked by reading the control register. Remove 'enabled_irq' from the private data. Since the private data is now empty, remove it completely and remove the allocation of it in parport_attach(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 20 +++- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 3944c19..26f0aad 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -91,10 +91,6 @@ pin, which can be used to wake up tasks. #define PARPORT_CTRL_IRQ_ENA (1 << 4) #define PARPORT_CTRL_BIDIR_ENA (1 << 5) -struct parport_private { - int enable_irq; -}; - static int parport_data_reg_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -212,40 +208,35 @@ static int parport_intr_cmdtest(struct comedi_device *dev, static int parport_intr_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { - struct parport_private *devpriv = dev->private; unsigned int ctrl; ctrl = inb(dev->iobase + PARPORT_CTRL_REG); ctrl |= PARPORT_CTRL_IRQ_ENA; outb(ctrl, dev->iobase + PARPORT_CTRL_REG); - devpriv->enable_irq = 1; - return 0; } static int parport_intr_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - struct parport_private *devpriv = dev->private; unsigned int ctrl; ctrl = inb(dev->iobase + PARPORT_CTRL_REG); ctrl &= ~PARPORT_CTRL_IRQ_ENA; outb(ctrl, dev->iobase + PARPORT_CTRL_REG); - devpriv->enable_irq = 0; - return 0; } static irqreturn_t parport_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct parport_private *devpriv = dev->private; struct comedi_subdevice *s = &dev->subdevices[3]; + unsigned int ctrl; - if (!devpriv->enable_irq) + ctrl = inb(dev->iobase + PARPORT_CTRL_REG); + if (!(ctrl & PARPORT_CTRL_IRQ_ENA)) return IRQ_NONE; comedi_buf_put(s->async, 0); @@ -258,7 +249,6 @@ static irqreturn_t parport_interrupt(int irq, void *d) static int parport_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct parport_private *devpriv; struct comedi_subdevice *s; unsigned int irq; int ret; @@ -282,10 +272,6 @@ static int parport_attach(struct comedi_device *dev, if (ret) return ret; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - s = &dev->subdevices[0]; s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/15] staging: comedi: comedi_parport: don't fail attach if irq is not available
Interrupt support in this driver is optional. Don't fail the attach of the board if the request_irq() fails. Only allocate and setup the subdevice for the interrupt if the request_irq() was successful. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 26f0aad..133de71 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -250,25 +250,20 @@ static int parport_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - unsigned int irq; int ret; ret = comedi_request_region(dev, it->options[0], 0x03); if (ret) return ret; - irq = it->options[1]; - if (irq) { - ret = request_irq(irq, parport_interrupt, 0, dev->board_name, - dev); - if (ret < 0) { - dev_err(dev->class_dev, "irq not available\n"); - return -EINVAL; - } - dev->irq = irq; + if (it->options[1]) { + ret = request_irq(it->options[1], parport_interrupt, 0, + dev->board_name, dev); + if (ret == 0) + dev->irq = it->options[1]; } - ret = comedi_alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, dev->irq ? 4 : 3); if (ret) return ret; @@ -297,8 +292,8 @@ static int parport_attach(struct comedi_device *dev, s->range_table = &range_digital; s->insn_bits = parport_ctrl_reg_insn_bits; - s = &dev->subdevices[3]; - if (irq) { + if (dev->irq) { + s = &dev->subdevices[3]; dev->read_subdev = s; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE | SDF_CMD_READ; @@ -309,8 +304,6 @@ static int parport_attach(struct comedi_device *dev, s->do_cmdtest = parport_intr_cmdtest; s->do_cmd = parport_intr_cmd; s->cancel = parport_intr_cancel; - } else { - s->type = COMEDI_SUBD_UNUSED; } outb(0, dev->iobase + PARPORT_DATA_REG); -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/15] staging: comedi: comedi_parport: tidy up parport_attach()
Add some whitespace to tidy up the subdevice init. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 64 + 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 133de71..9183997 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -267,43 +267,47 @@ static int parport_attach(struct comedi_device *dev, if (ret) return ret; + /* Digial I/O subdevice - Parallel port DATA register */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_data_reg_insn_bits; - s->insn_config = parport_data_reg_insn_config; - + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= parport_data_reg_insn_bits; + s->insn_config = parport_data_reg_insn_config; + + /* Digial Input subdevice - Parallel port STATUS register */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 5; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_status_reg_insn_bits; - + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 5; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= parport_status_reg_insn_bits; + + /* Digial Output subdevice - Parallel port CONTROL register */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_ctrl_reg_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= parport_ctrl_reg_insn_bits; if (dev->irq) { + /* Digial Input subdevice - Interrupt support */ s = &dev->subdevices[3]; dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_intr_insn; - s->do_cmdtest = parport_intr_cmdtest; - s->do_cmd = parport_intr_cmd; - s->cancel = parport_intr_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= parport_intr_insn; + s->do_cmdtest = parport_intr_cmdtest; + s->do_cmd = parport_intr_cmd; + s->cancel = parport_intr_cancel; } outb(0, dev->iobase + PARPORT_DATA_REG); -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/15] staging: comedi: comedi_parport: reorder #include's
For aesthetic reasons, reorder the #include list. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 408f43e..81520cc 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -65,9 +65,10 @@ */ #include -#include "../comedidev.h" #include +#include "../comedidev.h" + #include "comedi_fc.h" /* -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/15] staging: comedi: comedi_parport: tidy up multi-line comments
Tidy up the multi-line comments to follow the CodingStyle. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 136 +++- 1 file changed, 62 insertions(+), 74 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 9183997..408f43e 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -1,79 +1,67 @@ /* -comedi/drivers/comedi_parport.c -hardware driver for standard parallel port - -COMEDI - Linux Control and Measurement Device Interface -Copyright (C) 1998,2001 David A. Schleef - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -*/ -/* -Driver: comedi_parport -Description: Standard PC parallel port -Author: ds -Status: works in immediate mode -Devices: [standard] parallel port (comedi_parport) -Updated: Tue, 30 Apr 2002 21:11:45 -0700 - -A cheap and easy way to get a few more digital I/O lines. Steal -additional parallel ports from old computers or your neighbors' -computers. - -Option list: - 0: I/O port base for the parallel port. - 1: IRQ - -Parallel Port Lines: - -pin subdev chanaka -- --- -1 2 0 strobe -2 0 0 data 0 -3 0 1 data 1 -4 0 2 data 2 -5 0 3 data 3 -6 0 4 data 4 -7 0 5 data 5 -8 0 6 data 6 -9 0 7 data 7 -10 1 3 acknowledge -11 1 4 busy -12 1 2 output -13 1 1 printer selected -14 2 1 auto LF -15 1 0 error -16 2 2 init -17 2 3 select printer -18-25 ground - -Notes: - -Subdevices 0 is digital I/O, subdevice 1 is digital input, and -subdevice 2 is digital output. Unlike other Comedi devices, -subdevice 0 defaults to output. - -Pins 13 and 14 are inverted once by Comedi and once by the -hardware, thus cancelling the effect. - -Pin 1 is a strobe, thus acts like one. There's no way in software -to change this, at least on a standard parallel port. - -Subdevice 3 pretends to be a digital input subdevice, but it always -returns 0 when read. However, if you run a command with -scan_begin_src=TRIG_EXT, it uses pin 10 as a external triggering -pin, which can be used to wake up tasks. -*/ + * comedi_parport.c + * Comedi driver for standard parallel port + * + * For more information see: + * http://retired.beyondlogic.org/spp/parallel.htm + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 1998,2001 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + /* - see http://www.beyondlogic.org/ for information. - or http://www.linux-magazin.de/ausgabe/1999/10/IO/io.html + * Driver: comedi_parport + * Description: Standard PC parallel port + * Author: ds + * Status: works in immediate mode + * Devices: (standard) parallel port [comedi_parport] + * Updated: Tue, 30 Apr 2002 21:11:45 -0700 + * + * A cheap and easy way to get a few more digital I/O lines. Steal + * additional parallel ports from old computers or your neighbors' + * computers. + * + * Option list: + * 0: I/O port base for the parallel port. + * 1: IRQ (optional) + * + * Parallel Port Lines: + * + * pin subdev chan type name + * - -- -- + * 1 2 0DO strobe + * 2 0 0DIO data 0 + * 3 0 1DIO data 1 + * 4 0 2DIO data 2 + * 5 0 3DIO data 3 + * 6 0 4DIO data 4 + * 7 0 5DIO data 5 + * 8 0 6DIO data 6 + * 9 0 7DIO data 7 + * 10 1 3DI ack + * 11 1 4DI busy + * 12 1 2DI paper out + * 13 1
[PATCH 14/15] staging: comedi: comedi_parport: use dev->read_subdev in interrupt handler
Use the dev->read_subdev to get the comedi_subdevice instead of accessing the dev->subdevices array directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 30ae0ec..5610030 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -222,7 +222,7 @@ static int parport_intr_cancel(struct comedi_device *dev, static irqreturn_t parport_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct comedi_subdevice *s = &dev->subdevices[3]; + struct comedi_subdevice *s = dev->read_subdev; unsigned int ctrl; ctrl = inb(dev->iobase + PARPORT_CTRL_REG); -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/15] staging: comedi: comedi_parport: rename parport_intr_insn()
For aesthetic reasons, rename this function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 81520cc..30ae0ec 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -144,9 +144,10 @@ static int parport_ctrl_reg_insn_bits(struct comedi_device *dev, return insn->n; } -static int parport_intr_insn(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, unsigned int *data) +static int parport_intr_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { data[1] = 0; return insn->n; @@ -293,7 +294,7 @@ static int parport_attach(struct comedi_device *dev, s->n_chan = 1; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits= parport_intr_insn; + s->insn_bits= parport_intr_insn_bits; s->do_cmdtest = parport_intr_cmdtest; s->do_cmd = parport_intr_cmd; s->cancel = parport_intr_cancel; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Drivers: hv: vmbus: Do not attempt to negoatiate a new version prematurely
The current code would attempt to negotiate a different protocol version if the current negotiation timed out. This triggers an assert in the host (on debug builds). Avoid this by negotiating a newer version only if the host properly rejects the current version being negotiated. Signed-off-by: K. Y. Srinivasan --- drivers/hv/connection.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index ec3b8cd..8f4743a 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -195,7 +195,10 @@ int vmbus_connect(void) do { ret = vmbus_negotiate_version(msginfo, version); - if (ret == 0) + if (ret) + goto cleanup; + + if (vmbus_connection.conn_state == CONNECTED) break; version = vmbus_get_next_version(version); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: pcmad: use comedi_range_is_bipolar()
Use the core provided helper function instead of duplicating it as a private function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmad.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmad.c b/drivers/staging/comedi/drivers/pcmad.c index 423f236..fe482fd 100644 --- a/drivers/staging/comedi/drivers/pcmad.c +++ b/drivers/staging/comedi/drivers/pcmad.c @@ -75,12 +75,6 @@ static int pcmad_ai_wait_for_eoc(struct comedi_device *dev, return -ETIME; } -static bool pcmad_range_is_bipolar(struct comedi_subdevice *s, - unsigned int range) -{ - return s->range_table->range[range].min < 0; -} - static int pcmad_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -106,7 +100,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, if (s->maxdata == 0x0fff) val >>= 4; - if (pcmad_range_is_bipolar(s, range)) { + if (comedi_range_is_bipolar(s, range)) { /* munge the two's complement value */ val ^= ((s->maxdata + 1) >> 1); } -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH Resend 1/4] staging: dgap: Include version.h header in dgap_kcompat.h
On Wed, Aug 28, 2013 at 10:35:46AM +0530, Sachin Kamat wrote: > Include version.h header file as detected by versioncheck. > > Cc: Lidza Louina > Signed-off-by: Sachin Kamat > --- > drivers/staging/dgap/dgap_kcompat.h |2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/staging/dgap/dgap_kcompat.h > b/drivers/staging/dgap/dgap_kcompat.h > index 8ebf4b7..f21c8d7 100644 > --- a/drivers/staging/dgap/dgap_kcompat.h > +++ b/drivers/staging/dgap/dgap_kcompat.h > @@ -28,6 +28,8 @@ > #ifndef __DGAP_KCOMPAT_H > #define __DGAP_KCOMPAT_H > > +#include Please just remove the KERNEL_VERSION check, and the use of the macro in this file entirely, as it's pointless here. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 3/3] staging: dgnc: driver.c and .h: removes dgnc_driver_kzmalloc func
On Wed, Aug 28, 2013 at 12:57 AM, Greg KH wrote: > On Tue, Aug 27, 2013 at 10:13:28PM -0400, Lidza Louina wrote: >> This patch removes the dgnc_driver_kzmalloc function from >> driver.c and driver.h. A previous patch replaced all >> dgnc_driver_kzmalloc function calls with kzalloc. >> >> Signed-off-by: Lidza Louina >> --- >> drivers/staging/dgnc/dgnc_driver.c | 15 --- >> drivers/staging/dgnc/dgnc_driver.h | 1 - >> 2 files changed, 16 deletions(-) > > This patch had to be edited by hand, due to some fuzz in it when > applying to my tree. That means I think we are out of sync again with > what you have sent, and what I have applied. > > Can you resync on my tree again and resend anything I haven't applied, > and then work from there, to make sure I didn't accidentally drop > something you thought I applied? Absolutely. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 3/3] staging: dgnc: driver.c and .h: removes dgnc_driver_kzmalloc func
On Wed, Aug 28, 2013 at 6:34 PM, Lidza Louina wrote: > On Wed, Aug 28, 2013 at 12:57 AM, Greg KH wrote: >> On Tue, Aug 27, 2013 at 10:13:28PM -0400, Lidza Louina wrote: >>> This patch removes the dgnc_driver_kzmalloc function from >>> driver.c and driver.h. A previous patch replaced all >>> dgnc_driver_kzmalloc function calls with kzalloc. >>> >>> Signed-off-by: Lidza Louina >>> --- >>> drivers/staging/dgnc/dgnc_driver.c | 15 --- >>> drivers/staging/dgnc/dgnc_driver.h | 1 - >>> 2 files changed, 16 deletions(-) >> >> This patch had to be edited by hand, due to some fuzz in it when >> applying to my tree. That means I think we are out of sync again with >> what you have sent, and what I have applied. >> >> Can you resync on my tree again and resend anything I haven't applied, >> and then work from there, to make sure I didn't accidentally drop >> something you thought I applied? > > Absolutely. I just checked the branch and it seems that those three patches were applied. I got an email about them too. Do you still need me to resend them? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 3/3] staging: dgnc: driver.c and .h: removes dgnc_driver_kzmalloc func
On Wed, Aug 28, 2013 at 06:50:44PM -0400, Lidza Louina wrote: > On Wed, Aug 28, 2013 at 6:34 PM, Lidza Louina wrote: > > On Wed, Aug 28, 2013 at 12:57 AM, Greg KH > > wrote: > >> On Tue, Aug 27, 2013 at 10:13:28PM -0400, Lidza Louina wrote: > >>> This patch removes the dgnc_driver_kzmalloc function from > >>> driver.c and driver.h. A previous patch replaced all > >>> dgnc_driver_kzmalloc function calls with kzalloc. > >>> > >>> Signed-off-by: Lidza Louina > >>> --- > >>> drivers/staging/dgnc/dgnc_driver.c | 15 --- > >>> drivers/staging/dgnc/dgnc_driver.h | 1 - > >>> 2 files changed, 16 deletions(-) > >> > >> This patch had to be edited by hand, due to some fuzz in it when > >> applying to my tree. That means I think we are out of sync again with > >> what you have sent, and what I have applied. > >> > >> Can you resync on my tree again and resend anything I haven't applied, > >> and then work from there, to make sure I didn't accidentally drop > >> something you thought I applied? > > > > Absolutely. > > I just checked the branch and it seems that those three patches > were applied. I got an email about them too. Do you still need me > to resend them? No, not if it's already in my tree, due to the fuzz I was guessing that I was missing something. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/15] staging: comedi: comedi_parport: tidy up parport_insn_b()
Rename this function to better describe it's use. Tidy it up to follow the normal comedi (*insn_bits) for DI subdevices. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index a0dbb32..04feec7 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -130,15 +130,12 @@ static int parport_data_reg_insn_config(struct comedi_device *dev, return insn->n; } -static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int parport_status_reg_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { - if (data[0]) { - /* should writes be ignored? */ - /* anyone??? */ - } - - data[1] = (inb(dev->iobase + PARPORT_STATUS_REG) >> 3); + data[1] = inb(dev->iobase + PARPORT_STATUS_REG) >> 3; return insn->n; } @@ -299,7 +296,7 @@ static int parport_attach(struct comedi_device *dev, s->n_chan = 5; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = parport_insn_b; + s->insn_bits = parport_status_reg_insn_bits; s = &dev->subdevices[2]; s->type = COMEDI_SUBD_DO; -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/15] staging: comedi: comedi_parport: cleanup driver
Use the new comedi_dio_insn_bits() and comedi_dio_insn_config() helpers to tidy up the digital subdevices in this driver. Remove the need for the kzalloc'd private data. H Hartley Sweeten (15): staging: comedi: comedi_parport: tidy up the register map staging: comedi: comedi_parport: remove 'a_data' from private data staging: comedi: comedi_parport: tidy up parport_insn_a() staging: comedi: comedi_parport: fix parport_insn_config_a() staging: comedi: comedi_parport: tidy up parport_insn_b() staging: comedi: comedi_parport: tidy up parport_insn_c() staging: comedi: comedi_parport: remove 'c_data' from private data staging: comedi: comedi_parport: remove 'enable_irq' from private data staging: comedi: comedi_parport: don't fail attach if irq is not available staging: comedi: comedi_parport: tidy up parport_attach() staging: comedi: comedi_parport: tidy up multi-line comments staging: comedi: comedi_parport: reorder #include's staging: comedi: comedi_parport: rename parport_intr_insn() staging: comedi: comedi_parport: use dev->read_subdev in interrupt handler staging: comedi: comedi_parport: change MODULE_DESCRIPTION drivers/staging/comedi/drivers/comedi_parport.c | 380 +++- 1 file changed, 177 insertions(+), 203 deletions(-) -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/15] staging: comedi: comedi_parport: remove 'c_data' from private data
The control register for the parallel port is readable so there is no need to cache the current value in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 34 ++--- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 7180b0c..3944c19 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -92,7 +92,6 @@ pin, which can be used to wake up tasks. #define PARPORT_CTRL_BIDIR_ENA (1 << 5) struct parport_private { - unsigned int c_data; int enable_irq; }; @@ -114,18 +113,19 @@ static int parport_data_reg_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct parport_private *devpriv = dev->private; + unsigned int ctrl; int ret; ret = comedi_dio_insn_config(dev, s, insn, data, 0xff); if (ret) return ret; + ctrl = inb(dev->iobase + PARPORT_CTRL_REG); if (s->io_bits) - devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA; + ctrl &= ~PARPORT_CTRL_BIDIR_ENA; else - devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA; - outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); + ctrl |= PARPORT_CTRL_BIDIR_ENA; + outb(ctrl, dev->iobase + PARPORT_CTRL_REG); return insn->n; } @@ -145,12 +145,13 @@ static int parport_ctrl_reg_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct parport_private *devpriv = dev->private; + unsigned int ctrl; if (comedi_dio_insn_bits(dev, s, insn, data)) { - devpriv->c_data &= ~((1 << s->n_chan) - 1); - devpriv->c_data |= s->state; - outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); + ctrl = inb(dev->iobase + PARPORT_CTRL_REG); + ctrl &= (PARPORT_CTRL_IRQ_ENA | PARPORT_CTRL_BIDIR_ENA); + ctrl |= s->state; + outb(ctrl, dev->iobase + PARPORT_CTRL_REG); } data[1] = s->state; @@ -212,9 +213,11 @@ static int parport_intr_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct parport_private *devpriv = dev->private; + unsigned int ctrl; - devpriv->c_data |= PARPORT_CTRL_IRQ_ENA; - outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); + ctrl = inb(dev->iobase + PARPORT_CTRL_REG); + ctrl |= PARPORT_CTRL_IRQ_ENA; + outb(ctrl, dev->iobase + PARPORT_CTRL_REG); devpriv->enable_irq = 1; @@ -225,9 +228,11 @@ static int parport_intr_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { struct parport_private *devpriv = dev->private; + unsigned int ctrl; - devpriv->c_data &= ~PARPORT_CTRL_IRQ_ENA; - outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); + ctrl = inb(dev->iobase + PARPORT_CTRL_REG); + ctrl &= ~PARPORT_CTRL_IRQ_ENA; + outb(ctrl, dev->iobase + PARPORT_CTRL_REG); devpriv->enable_irq = 0; @@ -323,8 +328,7 @@ static int parport_attach(struct comedi_device *dev, } outb(0, dev->iobase + PARPORT_DATA_REG); - devpriv->c_data = 0; - outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); + outb(0, dev->iobase + PARPORT_CTRL_REG); return 0; } -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/15] staging: comedi: comedi_parport: change MODULE_DESCRIPTION
Change the MODULE_DESCRIPTION to something useful instead of the generic "Comedi low-level driver". Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 5610030..e7098fb 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -315,5 +315,5 @@ static struct comedi_driver parport_driver = { module_comedi_driver(parport_driver); MODULE_AUTHOR("Comedi http://www.comedi.org";); -MODULE_DESCRIPTION("Comedi low-level driver"); +MODULE_DESCRIPTION("Comedi: Standard parallel port driver"); MODULE_LICENSE("GPL"); -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: ni_labpc: use comedi_range_is_unipolar()
Use the core provided helper function instead of duplicating it as a private function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 1add114..27daccb 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -201,12 +201,6 @@ static int labpc_counter_set_mode(struct comedi_device *dev, return i8254_set_mode(base_address, 0, counter_number, mode); } -static bool labpc_range_is_unipolar(struct comedi_subdevice *s, - unsigned int range) -{ - return s->range_table->range[range].min >= 0; -} - static int labpc_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { struct labpc_private *devpriv = dev->private; @@ -272,7 +266,7 @@ static void labpc_setup_cmd6_reg(struct comedi_device *dev, devpriv->cmd6 &= ~CMD6_NRSE; /* bipolar or unipolar range? */ - if (labpc_range_is_unipolar(s, range)) + if (comedi_range_is_unipolar(s, range)) devpriv->cmd6 |= CMD6_ADCUNI; else devpriv->cmd6 &= ~CMD6_ADCUNI; @@ -1046,7 +1040,7 @@ static int labpc_ao_insn_write(struct comedi_device *dev, /* set range */ if (board->is_labpc1200) { range = CR_RANGE(insn->chanspec); - if (labpc_range_is_unipolar(s, range)) + if (comedi_range_is_unipolar(s, range)) devpriv->cmd6 |= CMD6_DACUNI(channel); else devpriv->cmd6 &= ~CMD6_DACUNI(channel); -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/3] staging: dgnc: driver.c and tty.c: replaces dgnc_driver_kzmalloc with kzalloc
On Wed, Aug 28, 2013 at 12:54 AM, Greg KH wrote: > I'll take this for now, but all of these casts of the kzalloc() call > need to go away, as they are pointless (kzalloc() returns a void *, > which automatically can be assigned to any pointer type, no need to be > explicit about it.) > > So that means you'll get another patch accepted modifying these same > lines now :) Alrighty, I'll send patch with this change. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/3] staging: dgnc: driver.c and tty.c: replaces dgnc_driver_kzmalloc with kzalloc
On Wed, Aug 28, 2013 at 4:30 AM, Dan Carpenter wrote: > On Tue, Aug 27, 2013 at 10:13:27PM -0400, Lidza Louina wrote: >> @@ -501,7 +501,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) >> >> /* get the board structure and prep it */ >> brd = dgnc_Board[dgnc_NumBoards] = >> - (struct board_t *) dgnc_driver_kzmalloc(sizeof(struct board_t), >> GFP_KERNEL); >> + (struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL); >> if (!brd) { >> APR(("memory allocation for board structure failed\n")); >> return(-ENOMEM); > > So you didn't introduce this, but here are the style problems in this > section, in case you want to fix them in a later patch. > > 1) Bad indenting. I'll fix this when I work on checkpatch warnings. > 2) Unneeded casting. I'll send a patch for this soon. > 3) Use sizeof(*brd) instead of sizeof(struct board_t). Okay. > 4) board_t is a bad and wrong name for this data type. "board" is too >generic, and "_t" means "typedef" but this is a not a typedef. Okay, I'll change it to dgnc_board. > 5) Put the two assignments on two lines. First assign "brd" and then >initialize "dgnc_Board[dgnc_NumBoards]" after allocating >"brd->msgbuf". Okay. > 6) Comment is obvious and at the same time wrong. It means "allocate >the board structure" instead of "get". Delete. Okay. > 7) kmalloc() has its own error message which is much more useful. No >need to print a useless error message. Also this error will never >occur in real life so adding code for something which will never >happen and it's a waste of time for people reading the code. Okay, I'll remove that. > 8) No parenthesis around the return. Okay, I'll fix this when I work on checkpatch warnings. >> @@ -509,7 +509,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) >> >> /* make a temporary message buffer for the boot messages */ >> brd->msgbuf = brd->msgbuf_head = >> - (char *) dgnc_driver_kzmalloc(sizeof(char) * 8192, GFP_KERNEL); >> + (char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL); >> if (!brd->msgbuf) { >> kfree(brd); >> APR(("memory allocation for board msgbuf failed\n")); > > 9) I think we know the sizeof(char)... If we want to keep that then > use kcalloc() instead of kzalloc(). But it's simplest to just say: > > brd->msgbuf = kzalloc(8192, GFP_KERNEL); Okay. > 10) The error handling should be: > > if (!brd->msgbuf) { > ret = -ENOMEM; > goto err_free_brd; > } > > [snip code in the middle] > > return 0; > > err_free_brd: > kfree(brd); > > return ret; > > We leak memory later on in this function... Okay, I'll replace error handling with goto statements where it is appropriate. Thanks for the feedback. I'm going to be making a TODO for this driver. If there's anything else I can do to fix it, let me know. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/3] staging: dgnc: driver.c and tty.c: replaces dgnc_driver_kzmalloc with kzalloc
On Wed, Aug 28, 2013 at 4:30 AM, Dan Carpenter wrote: > On Tue, Aug 27, 2013 at 10:13:27PM -0400, Lidza Louina wrote: >> @@ -501,7 +501,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) >> >> /* get the board structure and prep it */ >> brd = dgnc_Board[dgnc_NumBoards] = >> - (struct board_t *) dgnc_driver_kzmalloc(sizeof(struct board_t), >> GFP_KERNEL); >> + (struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL); >> if (!brd) { >> APR(("memory allocation for board structure failed\n")); >> return(-ENOMEM); > > So you didn't introduce this, but here are the style problems in this > section, in case you want to fix them in a later patch. > > 1) Bad indenting. > 2) Unneeded casting. > 3) Use sizeof(*brd) instead of sizeof(struct board_t). > 4) board_t is a bad and wrong name for this data type. "board" is too >generic, and "_t" means "typedef" but this is a not a typedef. > 5) Put the two assignments on two lines. First assign "brd" and then >initialize "dgnc_Board[dgnc_NumBoards]" after allocating >"brd->msgbuf". > 6) Comment is obvious and at the same time wrong. It means "allocate >the board structure" instead of "get". Delete. > 7) kmalloc() has its own error message which is much more useful. No >need to print a useless error message. Also this error will never >occur in real life so adding code for something which will never >happen and it's a waste of time for people reading the code. > 8) No parenthesis around the return. > >> @@ -509,7 +509,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) >> >> /* make a temporary message buffer for the boot messages */ >> brd->msgbuf = brd->msgbuf_head = >> - (char *) dgnc_driver_kzmalloc(sizeof(char) * 8192, GFP_KERNEL); >> + (char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL); >> if (!brd->msgbuf) { >> kfree(brd); >> APR(("memory allocation for board msgbuf failed\n")); > > 9) I think we know the sizeof(char)... If we want to keep that then > use kcalloc() instead of kzalloc(). But it's simplest to just say: > > brd->msgbuf = kzalloc(8192, GFP_KERNEL); > > 10) The error handling should be: > > if (!brd->msgbuf) { > ret = -ENOMEM; > goto err_free_brd; > } > > [snip code in the middle] > > return 0; > > err_free_brd: > kfree(brd); > > return ret; > > We leak memory later on in this function... Also, can I put your name in the Reported-by: section of these patches? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH Resend 1/4] staging: dgap: Include version.h header in dgap_kcompat.h
On 29 August 2013 03:45, Greg KH wrote: > On Wed, Aug 28, 2013 at 10:35:46AM +0530, Sachin Kamat wrote: >> Include version.h header file as detected by versioncheck. >> >> Cc: Lidza Louina >> Signed-off-by: Sachin Kamat >> --- >> drivers/staging/dgap/dgap_kcompat.h |2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/staging/dgap/dgap_kcompat.h >> b/drivers/staging/dgap/dgap_kcompat.h >> index 8ebf4b7..f21c8d7 100644 >> --- a/drivers/staging/dgap/dgap_kcompat.h >> +++ b/drivers/staging/dgap/dgap_kcompat.h >> @@ -28,6 +28,8 @@ >> #ifndef __DGAP_KCOMPAT_H >> #define __DGAP_KCOMPAT_H >> >> +#include > > Please just remove the KERNEL_VERSION check, and the use of the macro in > this file entirely, as it's pointless here. Agreed. That was my initial thought too. Will update and re-spin. -- With warm regards, Sachin ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel