1. Sep 20, 2014
    • Ian Abbott's avatar
      staging: comedi: addi_apci_3120: simplify setting of devpriv->us_UseDma · 062fdcad
      Ian Abbott authored
      
      
      `apci3120_auto_attach()` first sets `devpriv->us_UseDma` to 1, then sets
      it back to 0 if it fails to allocate the DMA buffer.  Since `*devpriv`
      is initially zeroed out by `comedi_alloc_devpriv()`, change it to only
      set `devpriv->us_UseDma` to 1 if the allocation succeeds.  Also, don't
      bother explicitly initializing `devpriv->b_DmaDoubleBuffer` to 0 as it
      is already zeroed out.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      062fdcad
    • Ian Abbott's avatar
      staging: comedi: addi_apci_3120: use dma_alloc_coherent() · fbfd9c8a
      Ian Abbott authored
      
      
      Use `dma_alloc_coherent()` to allocate the DMA buffers instead of
      using `__get_free_pages()` to allocate and `virt_to_bus()` to get the
      hardware address.  The coherent buffers are fairly small - at most 4
      pages (although there are two of them).  Use of `virt_to_bus()` is
      discouraged.
      
      Note: `struct addi_private` is used by some other ADDI-DATA drivers as
      well, but this is the only one using the affected members.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fbfd9c8a
    • Ian Abbott's avatar
      staging: comedi: addi_apci_3120: don't overallocate DMA buffer · 9c97e588
      Ian Abbott authored
      
      
      The last parameter of `__get_free_pages()` is log2 (the 'order') of the
      number of pages to be allocated.  This driver seems to think it is the
      linear number of pages, so `apci3120_auto_attach()` first tries to allocate
      16 pages, but only uses 4 of them, setting the buffer size to PAGE_SIZE
      multiplied by the 'order'.  If the allocation fails, it tries
      progressively smaller orders, down to 0.  If the allocation at order 0
      succeeds, the buffer size is set to 0, which is likely to cause
      problems.
      
      Set the buffer size to `PAGE_SIZE` shifted left by the allocation order.
      Since the maximum buffer size previously used was 4, start with an
      allocation order of 2 instead of 4.  Rename the `ui_DmaBufferPages` member of
      `struct addi_private` to `ui_DmaBufferPageOrder` and rename the `pages`
      local variable to `order` to make it clearer what it is.
      
      Note: `struct addi_private` is used by some other ADDI-DATA drivers as
      well, but this is the only one using the affected members.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c97e588
    • Ian Abbott's avatar
      staging: comedi: addi_apci_3120: don't allocate 2nd DMA buffer on failure · df567feb
      Ian Abbott authored
      
      
      `apci3120_auto_attach()` tries to allocate two DMA buffers but may
      allocate a single buffer or none at all.  If it fails to allocate the
      first buffer, it still tries to allocate the second buffer, even though
      it won't be used.  Change it to not bother trying to allocate the second
      buffer if the first one fails.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df567feb
    • Ian Abbott's avatar
      staging: comedi: remove comedi_board() · aee44756
      Ian Abbott authored
      
      
      All calls to the inline function `comedi_board()` in "comedidev.h" have
      been removed, so remove the function.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aee44756
    • Ian Abbott's avatar
      staging: comedi: adl_pci9118: use dma_alloc_coherent() · 75fbdbf6
      Ian Abbott authored
      
      
      Use `dma_alloc_coherent()` to allocate the DMA buffers instead of
      using `__get_free_pages()` to allocate and `virt_to_bus()` to get the
      hardware address.  The coherent buffers are fairly small - at most 4
      pages (although there are two of them).  Use of `virt_to_bus()` is
      discouraged.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75fbdbf6
    • Ian Abbott's avatar
      staging: comedi: adl_pci9118: don't overallocate DMA buffer · f39f87e9
      Ian Abbott authored
      
      
      The last parameter of `__get_free_pages()` is log2 (the 'order') of the
      number of pages to be allocated.  This driver seems to think it is the
      linear number of pages, so `pci9118_alloc_dma()` first tries to allocate
      16 pages, but only uses 4 of them, setting the buffer size to PAGE_SIZE
      multiplied by the 'order'.  If the allocation fails, it tries
      progressively smaller orders, down to 0.  If the allocation at order 0
      succeeds, the buffer size is set to 0, which is likely to cause
      problems.
      
      Set the buffer size to `PAGE_SIZE` shifted left by the allocation order.
      Since the maximum buffer size previously used was 4, start with an
      allocation order of 2 instead of 4.  Rename the `pages` member of
      `struct pci9118_dmabuf` (and the local variable in
      `pci9118_alloc_dma()`) to `order` to make it clearer what it is.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f39f87e9
    • Ian Abbott's avatar
      staging: comedi: adl_pci9118: don't allocate 2nd DMA buffer on failure · d5733baf
      Ian Abbott authored
      
      
      `pci9118_alloc_dma()` tries to allocate two DMA buffers but may allocate
      a single buffer or none at all.  If it fails to allocate the first
      buffer, it still tries to allocate the second buffer, even though it
      won't be used.  Change it to not bother trying to allocate the second
      buffer if the first one fails.
      
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d5733baf
    • Greg Kroah-Hartman's avatar
      Merge tag 'iio-for-3.18b' of... · 27f5a85f
      Greg Kroah-Hartman authored
      Merge tag 'iio-for-3.18b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
      
      Jonathan writes:
      
      Second round of new IIO drivers, features and cleanups for the 3.18 cycle.
      
      New drivers and part support
      * Bosch bmg160 Gyroscope driver
      * Dyna-Image al3320a ambient light sensor driver
      * Bosh bmi055 gyroscope part driver (accelerometer part supported by bmc150)
      * isl29018 - add support for isl29023 and isl29035
      * kxcjk-1013 - add support for kxcj9-1008 and kxtj2-1009
      * bmc150 - additional part support (BMI055 accelerometer part, BMA255,
        BMA222E, BMA250E and BMA280).  Different resolutions but otherwise similar
        parts.
      * bma180 - add BMA250 (note different from the BMA250E support above despite
        the naming).  A lot of driver reworking lead up to this - described below.
      
      New features
      * kxcjk1013 - add threshold event support.
      * rockchip - document DT bindings.
      * isl29018 - ACPI support
      * bma180 - enable use without IRQ
      
      Cleanups
      * Tree wide - drop owner field assignment if using the module_platform_driver
        helper as that assigns it anyway.
      * kxcjk1013 - drop a redundant assignment of the current range and fix a
        a defined but not used warning.
      * inv_mpu6050 - Remove an unnecessary cast form a void pointer.
      * rockchip - drop and unused variable.
      * at91_adc - make a local function static.
      * st-sensors-core - correctly handle an error in setting in
        st_sensors_set_drdy_int_pin
      * isl29018 - typo fix
      * bmc150 - fix incorrect scale value for 16G range (Driver new this cycle)
      * bmc150 - fix issues when CONFIG_PM_RUNTIME not set (Driver new this cycle)
      * ad7606 - line length tidy up.
      * bmg160 - set power state only if PM_RUNTIME is defined.
      * ak8975 - fix some unnecessary casting between char * and const char *
      * bma180 - prefix remaining bits and bobs with bma180_ and ensure consistent.
               - use a bool instead of an int for state (as its either on or off).
               - expose the temperature channel
               - statically allocate buffers to avoid need for update_scan_mode
                 callback.
               - refactor to allow futher chip variants including support for part
                 specific config and disable code + different resolutions.
      27f5a85f
  2. Sep 15, 2014