platform/adaptation/renesas_rcar/renesas_kernel.git
11 years agostaging: zram: drop zram_stat_dec/inc functions
Davidlohr Bueso [Wed, 2 Jan 2013 05:24:29 +0000 (21:24 -0800)]
staging: zram: drop zram_stat_dec/inc functions

It seems like an overkill to have adding and subtracting
1 functions from the 32bit counters. Just do it directly.

Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zram: show correct disksize
Davidlohr Bueso [Wed, 2 Jan 2013 05:24:22 +0000 (21:24 -0800)]
staging: zram: show correct disksize

The ->disksize variable stores values in units of bytes,
print the correct size in Kb

Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zram: simplify num_devices paramater
Davidlohr Bueso [Wed, 2 Jan 2013 05:24:13 +0000 (21:24 -0800)]
staging: zram: simplify num_devices paramater

Simplify dealing with num_devices when initializing zram.
Also cleanup some of the output messages.

Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ced1401: fix GFP_KERNEL in spinlock context
Alexey Khoroshilov [Fri, 11 Jan 2013 09:01:39 +0000 (13:01 +0400)]
staging: ced1401: fix GFP_KERNEL in spinlock context

Allowi() calls usb_submit_urb(pdx->pUrbCharIn, bInCallback ? GFP_ATOMIC : GFP_KERNEL)
under spin_lock_irqsave(&pdx->charInLock, flags). That means it should use GFP_ATOMIC anyway.
As soon as it is the only usage of bInCallback argument, the patch removes it at all.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: bcm: add a missing break statement
Dan Carpenter [Fri, 11 Jan 2013 06:55:18 +0000 (22:55 -0800)]
Staging: bcm: add a missing break statement

My static checker complains that there is a missing break statement
here.  From the context, it does look like a break statement was
intended.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: avoid CamelCase POD_* enums in pod.c
Stefan Hajnoczi [Fri, 11 Jan 2013 22:08:14 +0000 (23:08 +0100)]
staging: line6: avoid CamelCase POD_* enums in pod.c

Fix the following checkpatch.pl warnings:

  WARNING: Avoid CamelCase: <POD_monitor_level>
  #4512: FILE: staging/line6/pod.c:41:
  +       POD_monitor_level  = 0x04,

  WARNING: Avoid CamelCase: <POD_system_invalid>
  #4513: FILE: staging/line6/pod.c:42:
  +       POD_system_invalid = 0x10000

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: rename MidiBuffer to avoid CamelCase
Stefan Hajnoczi [Fri, 11 Jan 2013 22:08:09 +0000 (23:08 +0100)]
staging: line6: rename MidiBuffer to avoid CamelCase

Fix checkpatch.pl warnings related to MidiBuffer:

  WARNING: Avoid CamelCase: <MidiBuffer>
  #947: FILE: staging/line6/driver.c:363:
  +       struct MidiBuffer *mb = &line6->line6midi->midibuf_in;

Rename MidiBuffer to midi_buffer.

Note that "midibuf" would be another good name but sound/oss/midibuf.c
already uses it for a different concept.  Avoid possible confusion by
using "midi_buffer" instead.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: use pr_err() instead of printk(KERN_ERR, ...)
Stefan Hajnoczi [Fri, 11 Jan 2013 22:08:11 +0000 (23:08 +0100)]
staging: line6: use pr_err() instead of printk(KERN_ERR, ...)

Fix the following checkpatch.pl warning:

  WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
  #1861: FILE: staging/line6/driver.h:56:
  +       printk(KERN_ERR "line6usb driver bug: missing case in %s:%d\n", \

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: wrap comment to 80 chars in driver.c
Stefan Hajnoczi [Fri, 11 Jan 2013 22:08:10 +0000 (23:08 +0100)]
staging: line6: wrap comment to 80 chars in driver.c

Fix the following checkpatch.pl warning:

  WARNING: line over 80 characters
  #1107: FILE: staging/line6/driver.c:523:
  +       /* Wait for data length. We'll get a couple of 0xff until length arrives. */

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: wrap lines to 80 chars in pod.c
Stefan Hajnoczi [Fri, 11 Jan 2013 22:08:12 +0000 (23:08 +0100)]
staging: line6: wrap lines to 80 chars in pod.c

Fix the following checkpatch.pl warnings:

  WARNING: line over 80 characters
  #4508: FILE: staging/line6/pod.c:37:
  +       /* POD_SYSEX_DUMPMEM2  = 0x76 */   /* dumps entire internal memory of PODxt Pro */

  WARNING: line over 80 characters
  #4630: FILE: staging/line6/pod.c:159:
  +               if (memcmp(buf + 1, line6_midi_id, sizeof(line6_midi_id)) == 0) {

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: drop ToneportSourceInfo CamelCase name
Stefan Hajnoczi [Fri, 11 Jan 2013 22:08:13 +0000 (23:08 +0100)]
staging: line6: drop ToneportSourceInfo CamelCase name

Fix the following checkpatch.pl warning:

  WARNING: Avoid CamelCase: <ToneportSourceInfo>
  #5383: FILE: staging/line6/toneport.c:90:
  +struct ToneportSourceInfo {

Since the struct is only used to define the global
toneport_source_info[] table, I have chosen to make the struct
anonymous and part of the table definition.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove unused definitions from ethernet.h
Przemo Firszt [Mon, 10 Dec 2012 23:21:25 +0000 (23:21 +0000)]
rtl8712: remove unused definitions from ethernet.h

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove all NDIS_* definitions and use rndis.h instead
Przemo Firszt [Mon, 10 Dec 2012 23:21:24 +0000 (23:21 +0000)]
rtl8712: remove all NDIS_* definitions and use rndis.h instead

Remove duplicate code.The definitions are already in
include/linux/rndis.h

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove unused macros
Przemo Firszt [Mon, 10 Dec 2012 23:21:23 +0000 (23:21 +0000)]
rtl8712: remove unused macros

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: replace min with min_t
Przemo Firszt [Mon, 10 Dec 2012 23:21:22 +0000 (23:21 +0000)]
rtl8712: replace min with min_t

I've changed the ugly casting here and used min_t() instead.  I
also changed the u16 to a u32 because ->network.Ssid.SsidLength
is 32 bits.  It doesn't make a difference, but truncating the
upper bits away is sloppy.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: replace printk with better solutions
Przemo Firszt [Mon, 10 Dec 2012 23:21:21 +0000 (23:21 +0000)]
rtl8712: replace printk with better solutions

Replace printk with netdev_printk helpers, dev_printk helpers or
pr_err/warn/info if there is no device info available.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove unused macros from rtl8712/wifi.h
Przemo Firszt [Mon, 10 Dec 2012 23:21:20 +0000 (23:21 +0000)]
rtl8712: remove unused macros from rtl8712/wifi.h

Those definitions are not used anywhere in the kernel. If you know any
reason why they should stay in the code please speak up!

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: code clean up
Przemo Firszt [Mon, 10 Dec 2012 23:21:19 +0000 (23:21 +0000)]
rtl8712: code clean up

Clean some trivial formating problems in rtl8712 from staging tree. This patch
also changes the way preprocessor macros are defined to keep checkpatch.pl
quiet.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8192u: fixed coding style issues in r8192U_core.c
Patrik Karlin [Wed, 9 Jan 2013 08:40:56 +0000 (09:40 +0100)]
staging: rtl8192u: fixed coding style issues in r8192U_core.c

This patch fixes some coding style issuses in r8192U_core.c
No logic is changed

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8192u: removed some non used else's
Patrik Karlin [Wed, 9 Jan 2013 08:40:23 +0000 (09:40 +0100)]
staging: rtl8192u: removed some non used else's

This patch removes some else blocks that has no function in the
code

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8192u: fixed some coding style issues in r8192U_core.c
Patrik Karlin [Wed, 9 Jan 2013 08:39:44 +0000 (09:39 +0100)]
staging: rtl8192u: fixed some coding style issues in r8192U_core.c

This patch fixes some coding style issues. in r8192U_core.c
No logic is changed.

Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agortl8712: remove useless calls to memset().
Cyril Roelandt [Sun, 2 Dec 2012 02:40:21 +0000 (03:40 +0100)]
rtl8712: remove useless calls to memset().

These calls are followed by calls to memcpy() on the same memory area, so they
can be safely removed.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge branch 'staging-linus' into staging-next
Greg Kroah-Hartman [Mon, 7 Jan 2013 23:17:52 +0000 (15:17 -0800)]
Merge branch 'staging-linus' into staging-next

This is to get the comedi fixes, and resolve the issue in comdi_test.c
and comedi_fops.c that were caused by changes in both branches.

It also allows the fwserial driver changes to be applied, as they
required the fixes that are in staging-linus.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: tidspbridge: use prepare/unprepare on dsp clocks
Omar Ramirez Luna [Mon, 24 Dec 2012 14:10:25 +0000 (08:10 -0600)]
staging: tidspbridge: use prepare/unprepare on dsp clocks

This solves runtime failures while trying to enable WDT3 related
functionality on firmware load, however it does affect other clocks
controlled by the driver. Seen on 3.8-rc1.

CCF provides clk_prepare and clk_unprepare for enable and disable
operations respectively, this needs to be called in the correct
order while handling clocks.

Code path to enable/disable dsp clocks can still be reached from an
atomic context, hence we can't use clk_prepare_enable and
clk_disable_unprepare yet.

Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: tidspbridge: Fix build breakage due to splitting CM functions.
Enric Balletbo i Serra [Wed, 19 Dec 2012 09:48:46 +0000 (10:48 +0100)]
staging: tidspbridge: Fix build breakage due to splitting CM functions.

Commit ff4ae5d (ARM: OMAP2+: CM/hwmod: split CM functions into OMAP2, OMAP3-specific files)
resulted in a build breakage for tidspbridge driver.

   ...
   CC [M]  drivers/staging/tidspbridge/core/tiomap3430.o
   staging/tidspbridge/core/tiomap3430.c: In function ‘bridge_brd_start’:
   staging/tidspbridge/core/tiomap3430.c:550:24: error: ‘OMAP3430_CM_AUTOIDLE_PLL’
     undeclared (first use in this function)
   make[3]: *** [drivers/staging/tidspbridge/core/tiomap3430.o] Error 1
   ...

Fix this by including the appropriate header file.

Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: Add some Kconfig help entries
Cruz Julian Bishop [Fri, 21 Dec 2012 23:00:46 +0000 (09:00 +1000)]
staging: android: Add some Kconfig help entries

This commit adds Kconfig entries for the following:

1: ANDROID_BINDER_IPC
2: ASHMEM (additional text)
3: ANDROID_LOGGER

It also changes "Register" to "Registers" in
ANDROID_LOW_MEMORY_KILLER

Finally, all "help" instances are changed to "---help---",
as recommended by kconfig-language.txt in order to visually
aid developers.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: Fix two checkpatch issues in binder.c
Cruz Julian Bishop [Fri, 21 Dec 2012 23:00:45 +0000 (09:00 +1000)]
staging: android: Fix two checkpatch issues in binder.c

This fixes two instances of
"static const char * array should probably be static const char * const"

I have seen other commits doing this in other files, so I am
assuming it should be done here as well.

Please tell me if this is wrong :)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: android: Avoid using camelcase in binder.h
Cruz Julian Bishop [Fri, 21 Dec 2012 23:00:44 +0000 (09:00 +1000)]
staging: android: Avoid using camelcase in binder.h

This changes the following:

1: BinderDriverReturnProtocol -> binder_driver_return_protocol
2: BinderDriverCommandProtocol -> binder_driver_return_protocol

These enums are not currently used, but still generate noise in checkpatch.

Well, did. They don't now :)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/csr: Fix dereference before check
Peter Huewe [Mon, 7 Jan 2013 22:09:53 +0000 (23:09 +0100)]
staging/csr: Fix dereference before check

Smatch complains about some pointers that are dereferenced before being
checked:

drivers/staging/csr/sme_sys.c:285
CsrWifiRouterCtrlHipReqHandler() warn: variable dereferenced before
check 'priv' (see line 283)
drivers/staging/csr/sme_sys.c:1503
CsrWifiRouterMaPacketReqHandler() warn: variable dereferenced before
check 'priv' (see line 1501)
drivers/staging/csr/sme_sys.c:2062
CsrWifiRouterCtrlPeerDelReqHandler() warn: variable dereferenced before
check 'priv' (see line 2059)
drivers/staging/csr/sme_sys.c:2477
CsrWifiRouterCtrlPeerAddReqHandler() warn: variable dereferenced before
check 'priv' (see line 2474)
drivers/staging/csr/sme_sys.c:3045
CsrWifiRouterCtrlWapiRxPktReqHandler() warn: variable dereferenced
before check 'priv' (see line 3039)

We put the check before the dereferencing and prevent an oops and fix
the warning.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: Add angle bracket before and after the URL
Masanari Iida [Mon, 7 Jan 2013 14:28:10 +0000 (23:28 +0900)]
staging: Add angle bracket before and after the URL

Add missing angle bracket before and after the URL.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vme: Fix URL in Kconfig
Masanari Iida [Mon, 7 Jan 2013 14:38:35 +0000 (23:38 +0900)]
staging: vme: Fix URL in Kconfig

The URL vmelinux.org is not accessible.
Change it to www.vmelinux.org.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8712: avoid a useless call to memset().
Cyril Roelandt [Tue, 11 Dec 2012 00:20:48 +0000 (01:20 +0100)]
staging: rtl8712: avoid a useless call to memset().

In r8711_wx_get_wap(), make sure we do not call memcpy() on a memory area that
has just been zeroed by a call to memset().

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_th...
Cyril Roelandt [Wed, 12 Dec 2012 00:24:50 +0000 (01:24 +0100)]
staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_thermal_register_cpu_cooling().

The omap_bandgap_get_sensor_data() function returns ERR_PTR(), so we need to use
IS_ERR() rather than a NULL check.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: Makefile: conditionally compile multi-file core module
H Hartley Sweeten [Thu, 20 Dec 2012 00:49:24 +0000 (17:49 -0700)]
staging: comedi: Makefile: conditionally compile multi-file core module

Instead of using the #ifdef'ery in the comedi_compat32.c and proc.c
files to include/exclude them from the comedi core, modify the Makefile
to include those files automatically when enabled in the .config.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: fix race when cancelling command
Ian Abbott [Fri, 4 Jan 2013 11:33:21 +0000 (11:33 +0000)]
staging: comedi: comedi_test: fix race when cancelling command

Éric Piel reported a kernel oops in the "comedi_test" module.  It was a
NULL pointer dereference within `waveform_ai_interrupt()` (actually a
timer function) that sometimes occurred when a running asynchronous
command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing
the device file).

This seems to be a race between the caller of `waveform_ai_cancel()`
which on return from that function goes and tears down the running
command, and the timer function which uses the command.  In particular,
`async->cmd.chanlist` gets freed (and the pointer set to NULL) by
`do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled
`waveform_ai_interrupt()` timer function will dereference that pointer
regardless, leading to the oops.

Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()`
with `del_timer_sync()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reported-by: Éric Piel <piel@delmic.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC
Ian Abbott [Thu, 3 Jan 2013 12:15:26 +0000 (12:15 +0000)]
staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC

The 'ni_at_a2150' module links to `cfc_write_to_buffer` in the
'comedi_fc' module, so selecting 'COMEDI_NI_AT_A2150' in the kernel config
needs to also select 'COMEDI_FC'.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@vger.kernel.org> # 3.6+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: comedi: addi_common.c: checkpatch.pl fixes
Lijo Antony [Sat, 5 Jan 2013 14:12:54 +0000 (18:12 +0400)]
Staging: comedi: addi_common.c: checkpatch.pl fixes

checkpatch.pl style fixes:
- Broken license text into 80 char lines
- fixed two space before tab issues
- Removed unnecessary braces from if-else

Signed-off-by: Lijo Antony <lijo.kernel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: whitespace fixes
Ian Abbott [Fri, 4 Jan 2013 11:33:26 +0000 (11:33 +0000)]
staging: comedi: comedi_test: whitespace fixes

Fix lines over 80 characters and line up nearby comments.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: tidy up waveform_ai_interrupt()
Ian Abbott [Fri, 4 Jan 2013 11:33:25 +0000 (11:33 +0000)]
staging: comedi: comedi_test: tidy up waveform_ai_interrupt()

Use a local variable to reduce the indentation in
`waveform_ai_interrupt()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: make samples unsigned
Ian Abbott [Fri, 4 Jan 2013 11:33:24 +0000 (11:33 +0000)]
staging: comedi: comedi_test: make samples unsigned

Represent the fake samples as unsigned shorts instead of signed shorts,
as this is the usual Comedi convention.  There is no change to the
actual binary representation, although the `cfc_write_to_buffer()` call
currently expects a signed short for some bizarre reason.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: change end-of-acquisition test
Ian Abbott [Fri, 4 Jan 2013 11:33:23 +0000 (11:33 +0000)]
staging: comedi: comedi_test: change end-of-acquisition test

In the "comedi_test" module's acquisition timer function
`waveform_ai_interrupt()`, move the code for ending the acquisition
outside the scan loop.  Determine if the number of scans to be done is
sufficient to end the acquisition before entering the scan loop.  On
leaving the scan loop, set the `COMEDI_CB_EOA` event if the acquisition
is ending.  Only reschedule the timer if the acquisition is not ending.

Remove the somewhat useless `timer_running` flag from the private data.
This was intended to stop the timer function adding the timer back on
the timer queue periodically, but the flag setting wasn't synchronized
with the timer and we already use `del_timer_sync()` to synchronize
removal from the queue.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: remove unnecessary del_timer() call
Ian Abbott [Fri, 4 Jan 2013 11:33:22 +0000 (11:33 +0000)]
staging: comedi: comedi_test: remove unnecessary del_timer() call

In the "comedi_test" module, the timer function
`waveform_ai_interrupt()` doesn't need to remove the timer from the
timer queue as the caller has already removed it from the queue.  Remove
the call to `del_timer()` in this function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_test: fix race when cancelling command
Ian Abbott [Fri, 4 Jan 2013 11:33:21 +0000 (11:33 +0000)]
staging: comedi: comedi_test: fix race when cancelling command

Éric Piel reported a kernel oops in the "comedi_test" module.  It was a
NULL pointer dereference within `waveform_ai_interrupt()` (actually a
timer function) that sometimes occurred when a running asynchronous
command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing
the device file).

This seems to be a race between the caller of `waveform_ai_cancel()`
which on return from that function goes and tears down the running
command, and the timer function which uses the command.  In particular,
`async->cmd.chanlist` gets freed (and the pointer set to NULL) by
`do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled
`waveform_ai_interrupt()` timer function will dereference that pointer
regardless, leading to the oops.

Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()`
with `del_timer_sync()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reported-by: Éric Piel <piel@delmic.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: comedi: comedidev.h: fixed a camel case
Lijo Antony [Tue, 1 Jan 2013 18:41:06 +0000 (22:41 +0400)]
Staging: comedi: comedidev.h: fixed a camel case

Fixed a camel case issue.

Signed-off-by: Lijo Antony <lijo.kernel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: store the 'index' for each subdevice
H Hartley Sweeten [Thu, 20 Dec 2012 00:27:02 +0000 (17:27 -0700)]
staging: comedi: store the 'index' for each subdevice

Store the 'index' for each comedi_subdevice when they are initially
allocated by comedi_alloc_subdevice(). This allows removing the
pointer math in comedi_fops.c which is used to figure out the
index that user space uses to access the individual subdevices.

Fix the ni_mio_common driver so it also uses the 'index' instead
of doing the pointer math.

Also, remove a couple unused macros in the pcmda12, pcmmio, and
pcmuio drivers which also do the pointer math to figure out the
index.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: use kzalloc in comedi_alloc_subdevice_minor()
H Hartley Sweeten [Wed, 19 Dec 2012 22:45:34 +0000 (15:45 -0700)]
staging: comedi: comedi_fops: use kzalloc in comedi_alloc_subdevice_minor()

The hardware_device member of comedi_file_info is not set in this
function. Use kzalloc to make sure this pointer does not contain
invalid data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: cleanup comedi_mmap()
H Hartley Sweeten [Wed, 19 Dec 2012 22:45:12 +0000 (15:45 -0700)]
staging: comedi: comedi_fops: cleanup comedi_mmap()

Use comedi_dev_from_minor() to simplify the return -ENODEV tests.

Change the (foo == NULL) tests to simply (!foo).

Use a local variable to hold a pointer to the async->buf_page_list[]
when doing the remap_pfn_range(). This cleans up the ugly line breaks
for the page_to_pfn(virt_to_page(...) operation.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: cleanup comedi_{read, write}_subdevice()
H Hartley Sweeten [Wed, 19 Dec 2012 22:44:46 +0000 (15:44 -0700)]
staging: comedi: comedi_fops: cleanup comedi_{read, write}_subdevice()

Flip the info->device tests so than the return NULL occurs last.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: introduce comedi_is_subdevice_idle()
H Hartley Sweeten [Wed, 19 Dec 2012 22:44:24 +0000 (15:44 -0700)]
staging: comedi: comedi_fops: introduce comedi_is_subdevice_idle()

Introduce, and use, a helper to check the subdevice runflags to see if
it is not in error and not running.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: introduce comedi_is_subdevice_in_error()
H Hartley Sweeten [Wed, 19 Dec 2012 22:44:02 +0000 (15:44 -0700)]
staging: comedi: comedi_fops: introduce comedi_is_subdevice_in_error()

Introduce, and use, a helper to check the subdevice runflags to see if
the SRF_ERROR flag is set.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: don't export comedi_get_subdevice_runflags()
H Hartley Sweeten [Wed, 19 Dec 2012 22:43:40 +0000 (15:43 -0700)]
staging: comedi: comedi_fops: don't export comedi_get_subdevice_runflags()

The subdevice runflags are protected with a spin_lock. Only the comedi
core should be accessing them directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use comedi_is_subdevice_running()
H Hartley Sweeten [Wed, 19 Dec 2012 22:43:18 +0000 (15:43 -0700)]
staging: comedi: use comedi_is_subdevice_running()

Use the helper function comedi_is_subdevice_running() instead of getting
the subdevice runflags and then masking the result.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: introduce comedi_is_subdevice_running()
H Hartley Sweeten [Wed, 19 Dec 2012 22:42:47 +0000 (15:42 -0700)]
staging: comedi: comedi_fops: introduce comedi_is_subdevice_running()

Introduce a helper function that checks the subdevice runflags to
see if the subdevice is running a command.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: move comedi_get_subdevice_runflags()
H Hartley Sweeten [Wed, 19 Dec 2012 22:42:26 +0000 (15:42 -0700)]
staging: comedi: comedi_fops: move comedi_get_subdevice_runflags()

For aesthetic reasons, move this function so its near
comedi_set_subdevice_runflags().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: fix a number of sizeof(struct foo) forms
H Hartley Sweeten [Wed, 19 Dec 2012 22:42:02 +0000 (15:42 -0700)]
staging: comedi: comedi_fops: fix a number of sizeof(struct foo) forms

As mentioned in CodingStyle, the prefered form is:

p = kmalloc(sizeof(*p), ...);

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: move comedi_cleanup_legacy_minors()
H Hartley Sweeten [Wed, 19 Dec 2012 22:41:42 +0000 (15:41 -0700)]
staging: comedi: comedi_fops: move comedi_cleanup_legacy_minors()

This function is only called by the module_{init,exit} functions. For
aesthetic reasons, move it near them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: move the module_{init, exit} functions to EOF
H Hartley Sweeten [Wed, 19 Dec 2012 22:41:19 +0000 (15:41 -0700)]
staging: comedi: comedi_fops: move the module_{init, exit} functions to EOF

For aesthetic reasons, move the module_{init,exit} functions to the end
of the file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: move the MODULE_* information to EOF
H Hartley Sweeten [Wed, 19 Dec 2012 22:40:59 +0000 (15:40 -0700)]
staging: comedi: comedi_fops: move the MODULE_* information to EOF

For aesthetic reasons, move the MODULE_* information to the end of
the file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: remove the goto's in comedi_write()
H Hartley Sweeten [Wed, 19 Dec 2012 22:40:34 +0000 (15:40 -0700)]
staging: comedi: comedi_fops: remove the goto's in comedi_write()

Use comedi_dev_from_minor() to simplify the return -ENODEV tests.

Cleanup the sanity checking a bit and remove the need for the goto's
when returning an initial error condition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: remove the goto's in comedi_read()
H Hartley Sweeten [Wed, 19 Dec 2012 22:40:08 +0000 (15:40 -0700)]
staging: comedi: comedi_fops: remove the goto's in comedi_read()

Use comedi_dev_from_minor() to simplify the return -ENODEV tests.

Cleanup the sanity checking a bit and remove the need for the goto's
when returning an initial error condition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: cleanup comedi_poll()
H Hartley Sweeten [Wed, 19 Dec 2012 22:39:44 +0000 (15:39 -0700)]
staging: comedi: comedi_fops: cleanup comedi_poll()

Consolidate the local variables 'read_subdev' and 'write_subdev' into a
single local variable 's'.

Use comedi_dev_from_minor() to simplify the return -ENODEV tests.

Use a goto in the !dev->attached test so that the mutex_unlock() call
is in a common place.

Cleanup the formating of the || in the read and write subdevice poll
code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: cleanup do_devinfo_ioctl()
H Hartley Sweeten [Wed, 19 Dec 2012 22:39:18 +0000 (15:39 -0700)]
staging: comedi: comedi_fops: cleanup do_devinfo_ioctl()

Consolidate the local variables 'read_subdev' and 'write_subdev' into a
single local variable 's'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: rename comedi_{read,write}_subdevice()
H Hartley Sweeten [Wed, 19 Dec 2012 22:38:53 +0000 (15:38 -0700)]
staging: comedi: comedi_fops: rename comedi_{read,write}_subdevice()

The 'get' usually implies increasing a reference count of an object.
These function return a pointer but do not do any reference counting.
For aesthetic reasons, rename the functions to better represent what
they do.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: rename comedi_get_device_file_info()
H Hartley Sweeten [Wed, 19 Dec 2012 22:38:30 +0000 (15:38 -0700)]
staging: comedi: comedi_fops: rename comedi_get_device_file_info()

The 'get' usually implies increasing a reference count of an object.
This function returns a pointer but does not do any reference counting.
For aesthetic reasons, rename the function to better represent what
its doing.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: rename struct comedi_device_file_info
H Hartley Sweeten [Wed, 19 Dec 2012 22:38:02 +0000 (15:38 -0700)]
staging: comedi: comedi_fops: rename struct comedi_device_file_info

For aesthetic reasons, rename this struct to comedi_file_info. It's
a bit shorter and allows fixing some of the ugly line breaks used
to keep the lines < 80 chars.

Also, consistently use the local variable name 'info' instead of the
longer 'dev_file_info' to also fix some ugly line breaks.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: don't expose struct comedi_device_file_info
H Hartley Sweeten [Wed, 19 Dec 2012 22:36:42 +0000 (15:36 -0700)]
staging: comedi: don't expose struct comedi_device_file_info

This structure is only used in comedi_fops.c as part of handling
the file operations and sysfs files. Remove it's defenition from
comedidev.h so it's not exposed to the comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: don't export comedi_get_device_file_info()
H Hartley Sweeten [Wed, 19 Dec 2012 22:36:00 +0000 (15:36 -0700)]
staging: comedi: comedi_fops: don't export comedi_get_device_file_info()

This function is now only used in comedi_fops.c and does not need
to be exported.

Make it static and move it to avoid forward declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use comedi_dev_from_minor()
H Hartley Sweeten [Wed, 19 Dec 2012 22:35:23 +0000 (15:35 -0700)]
staging: comedi: use comedi_dev_from_minor()

Remove the need to export comedi_get_device_file_info() by using the
new helper comedi_dev_from_minor(). This will also allow us to make
the comedi_device_file_info struct private.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: introduce comedi_dev_from_minor()
H Hartley Sweeten [Wed, 19 Dec 2012 22:34:40 +0000 (15:34 -0700)]
staging: comedi: comedi_fops: introduce comedi_dev_from_minor()

A number of functions have to call comedi_get_device_file_info()
to get the comedi_device_file_info pointer for a given minor. That
pointer is only used to get the actual comedi_device pointer for
the minor.

Introduce a new helper function, comedi_dev_from_minor(), to simplify
this operation. This will also allow us to make the comedi_device_file_info
struct private.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: don't expose comedi_get_{read, write}_subdevice
H Hartley Sweeten [Wed, 19 Dec 2012 22:33:29 +0000 (15:33 -0700)]
staging: comedi: don't expose comedi_get_{read, write}_subdevice

These two inline helper function in comedidev.h are only used in
comedi_fops.c. They return information that should only be used
by the comedi core.

Move both functions to comedi_fops.c so they aren't exposed to
the comedi drivers. Also, remove the inline tag and let the
compiler figure it out.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: comedi_fops: remove forward declarations
H Hartley Sweeten [Wed, 19 Dec 2012 22:31:57 +0000 (15:31 -0700)]
staging: comedi: comedi_fops: remove forward declarations

Move a couple of the functions to remove the need for the forward
declarations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: prevent auto-unconfig of manually configured devices
Ian Abbott [Tue, 4 Dec 2012 15:59:55 +0000 (15:59 +0000)]
staging: comedi: prevent auto-unconfig of manually configured devices

When a low-level comedi driver auto-configures a device, a `struct
comedi_dev_file_info` is allocated (as well as a `struct
comedi_device`) by `comedi_alloc_board_minor()`.  A pointer to the
hardware `struct device` is stored as a cookie in the `struct
comedi_dev_file_info`.  When the low-level comedi driver
auto-unconfigures the device, `comedi_auto_unconfig()` uses the cookie
to find the `struct comedi_dev_file_info` so it can detach the comedi
device from the driver, clean it up and free it.

A problem arises if the user manually unconfigures and reconfigures the
comedi device using the `COMEDI_DEVCONFIG` ioctl so that is no longer
associated with the original hardware device.  The problem is that the
cookie is not cleared, so that a call to `comedi_auto_unconfig()` from
the low-level driver will still find it, detach it, clean it up and free
it.

Stop this problem occurring by always clearing the `hardware_device`
cookie in the `struct comedi_dev_file_info` whenever the
`COMEDI_DEVCONFIG` ioctl call is successful.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: fix minimum AO period for NI 625x and NI 628x
Éric Piel [Wed, 19 Dec 2012 12:03:13 +0000 (13:03 +0100)]
staging: comedi: fix minimum AO period for NI 625x and NI 628x

The minimum period was set to 357 ns, while the divider for these boards is 50
ns. This prevented to output at maximum speed as ni_ao_cmdtest() would return
357 but would not accept it.

Not sure why it was set to 357 ns (this was done before the git history,
which starts 5 years ago). My guess is that it comes from reading the
specification stating a 2.8 MHz rate (~ 357 ns). The latest
specification states a 2.86 MHz rate (~ 350 ns), which makes a lot
more sense.

Tested on a pci-6251.

Signed-off-by: Éric Piel <piel@delmic.com>
Acked-By: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: pcm_common: remove module
H Hartley Sweeten [Tue, 4 Dec 2012 22:47:14 +0000 (15:47 -0700)]
staging: comedi: pcm_common: remove module

This module is built whenever CONFIG_COMEDI is enabled but it is
only used by the pcmmio and pcmuio drivers. The pcm_common module
consists of one exported function. Put a local copy of the function
in the pcmmio and pcmuio drivers.

This removes the need for the pcm_common module and the now unused
pcm_common.[ch] files can be deleted and removed from the Makefile.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: support stop_src == TRIG_COUNT
Ian Abbott [Mon, 3 Dec 2012 18:15:47 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: support stop_src == TRIG_COUNT

When setting up asynchronous commands on the special interrupt
subdevice, support the `TRIG_COUNT` stop source to allow the command to
stop automatically after a specified number of scans.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: always initialize interrupt subdevice
Ian Abbott [Mon, 3 Dec 2012 18:15:46 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: always initialize interrupt subdevice

Initialize the special interrupt subdevice as a digital input subdevice
even if the interrupt handler cannot be registered.  It's `insn_bits`
handler will still read the interrupt status register.  This hardware
status bits in this register might be valid even if they haven't been
enabled in the interrupt control register, but this needs to be checked.
In any case, initializing the subdevice as a digital input subdevice is
harmless.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: use channel list
Ian Abbott [Mon, 3 Dec 2012 18:15:45 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: use channel list

When setting up asynchronous commands for the special interrupt
subdevice, use the channel list to decide which interrupt sources to
enable.  Set the maximum length of the channel list to be the same as
the number of channels (2).  Normally, the channel list would include
channel 0, channel 1 or both.

When reading the scan data in the interrupt routine, the readings from
each channel in the channel list will be packed into a single unsigned
short data value.  Make each bit in this value correspond to an index in
the channel list.

Since all the channels in the channel list are read at the same time,
insist that the scan end argument is the length of the channel list and
that the conversion source is `TRIG_NOW`.

Allocate some private data for the special interrupt subdevice to hold a
spin-lock, the channels to be enabled and an indication of whether the
command is still active.  Stop the command if a buffer overflow occurs.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: only disable triggered interrupts
Ian Abbott [Mon, 3 Dec 2012 18:15:44 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: only disable triggered interrupts

The interrupt handler disables all interrupt sources when a valid
interrupt occurs.  Just disable the triggered interrupt source so we can
still get interrupts for the other interrupt source.

Also add a comment indicating why the triggered interrupt source is
disabled.  The interrupt sources are level-sensitive and indicate
hardware errors that are likely to be persistent, so if we reenabled
them they would just keep triggering repeatedly.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: make insn_bits read live data
Ian Abbott [Mon, 3 Dec 2012 18:15:43 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: make insn_bits read live data

The `insn_bits` handler for the special digital input subdevice used for
interrupts currently uses `s->state` for the data value, which is set to
the value of the APCI2032_INT_STATUS_REG register when a valid interrupt
occurs.  Just read the live register contents in the `insn_bits` handler
instead of relying on the interrupt service routine to read it for us.

The register contains a couple of hardware error status bits.  They
might also be valid even when the corresponding bits have not been
enabled in the APCI_INT_CTRL_REG register in which case this would be
useful for checking for hardware errors without using interrupts, but
this needs to be checked.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: set COMEDI_CB_OVERFLOW
Ian Abbott [Mon, 3 Dec 2012 18:15:42 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: set COMEDI_CB_OVERFLOW

If the call to `comedi_buf_put()` fails in the interrupt routine, set
the `COMEDI_CB_OVERFLOW` event flag.  Note that the `COMEDI_CB_ERROR`
flag will have also been set by `comedi_buf_put()` in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: correct interrupt subdevice
Ian Abbott [Mon, 3 Dec 2012 18:15:41 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: correct interrupt subdevice

The subdevice type and flags are initialized incorrectly for the
interrupt subdevice - the SDF_CMD_READ value belongs in the subdevice
flags.  Fix it.  Also set the number of channels to 2 since there are 2
interrupt sources each with its own status bit.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: addi_apci_2032: interrupt safety change
Ian Abbott [Mon, 3 Dec 2012 18:15:40 +0000 (18:15 +0000)]
staging: comedi: addi_apci_2032: interrupt safety change

Put the hardware into a safe state before enabling the interrupt.  In
the interrupt routine, check the device has been fully configured by
checking `dev->attached`.  In particular, `dev->read_subdev` could be
NULL early on and although the hardware's status register should
indicate no interrupt has occurred (since it's been put into a safe
state), it's better not to rely on it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: speakup: Turn some symbols static
Samuel Thibault [Wed, 2 Jan 2013 01:36:56 +0000 (02:36 +0100)]
staging: speakup: Turn some symbols static

Turn static some symbols which do not actually need to be
externally-visible

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: speakup: Prefix externally-visible symbols
Samuel Thibault [Wed, 2 Jan 2013 01:37:40 +0000 (02:37 +0100)]
staging: speakup: Prefix externally-visible symbols

This prefixes all externally-visible symbols of speakup with "spk_".

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: et131x: Use register defines instead of magic numbers
Mark Einon [Fri, 4 Jan 2013 22:25:46 +0000 (22:25 +0000)]
staging: et131x: Use register defines instead of magic numbers

Use register name defines instead of magic numbers where a bit of
clarity would be useful.

Also a small typo fix and some register prefixes added, for further
clarity.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: et131x: Replace rxdma csr register magic numbers with defines
Mark Einon [Fri, 4 Jan 2013 22:25:45 +0000 (22:25 +0000)]
staging: et131x: Replace rxdma csr register magic numbers with defines

Several magic numbers were used to represent rxdma csr register bitmasks.
Replace them with descriptive defines.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: echo.c: fix memory leakage
Cong Ding [Sat, 22 Dec 2012 16:12:26 +0000 (17:12 +0100)]
staging: echo.c: fix memory leakage

we should check the return value of calling function fir16_create(): a NULL
value means the memory allocation fails.

this patch also cleans up the error handling in function function oslec_create()

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: csr: remove unneeded call to memset().
Cyril Roelandt [Tue, 4 Dec 2012 20:41:07 +0000 (21:41 +0100)]
staging: csr: remove unneeded call to memset().

In uf_send_pkt_to_encrypt(), the memory area zeroed by this call to memset() is
overwritten by a call to memcpy() a few instructions later, so it is not needed.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: echo: remove unused variable
Cong Ding [Tue, 4 Dec 2012 01:21:44 +0000 (01:21 +0000)]
staging: echo: remove unused variable

the variable j isn't used in the loop

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: delete an unused function
Dan Carpenter [Wed, 5 Dec 2012 18:43:16 +0000 (21:43 +0300)]
staging: line6: delete an unused function

line6_send_sysex_message_async() isn't called from anywhere.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Johannes Thumshirn <morbidrsa@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: Use kmemdup rather than duplicating its implementation
Laurent Navet [Mon, 3 Dec 2012 13:20:25 +0000 (14:20 +0100)]
staging: line6: Use kmemdup rather than duplicating its implementation

staging: line6: driver.c
 The semantic patch that makes this output is available
 in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: line6: pcm.c fix checkpatch issues
Laurent Navet [Fri, 30 Nov 2012 10:57:32 +0000 (11:57 +0100)]
staging: line6: pcm.c fix checkpatch issues

fix those checkpatch issues
drivers/staging/line6/pcm.c:84:
WARNING: simple_strtoul is obsolete, use kstrtoul instead
call to obsolete simple_strtoul() replaced by kstrtoint()

drivers/staging/line6/pcm.c:423:
ERROR: switch and case should be at the same indent
realigns comments

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vme_pio2: fix oops on module unloading
Konstantin Khlebnikov [Fri, 14 Dec 2012 11:02:44 +0000 (15:02 +0400)]
staging: vme_pio2: fix oops on module unloading

This patch forbids loading vme_pio2 module without specifing "num_bus" parameter.
Otherwise on module unloading pio2_exit() calls vme_unregister_driver() for not
registered pio2_driver.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Manohar Vanga <manohar.vanga@gmail.com>
Acked-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: speakup: avoid out-of-range access in synth_add()
Samuel Thibault [Mon, 7 Jan 2013 21:03:51 +0000 (22:03 +0100)]
staging: speakup: avoid out-of-range access in synth_add()

Check that array index is in-bounds before accessing the synths[] array.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: stable <stable@vger.kernel.org>
Cc: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: speakup: avoid out-of-range access in synth_init()
Nickolai Zeldovich [Sat, 5 Jan 2013 19:17:45 +0000 (14:17 -0500)]
staging: speakup: avoid out-of-range access in synth_init()

Check that array index is in-bounds before accessing the synths[] array.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: stable <stable@vger.kernel.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: keucr: Fix parens/braces
Kurt Kanzenbach [Fri, 30 Nov 2012 11:18:19 +0000 (12:18 +0100)]
staging: keucr: Fix parens/braces

Fixed a coding style issue. Fixed positions
of braces regarding to linux coding style.

Signed-off-by: Kurt Kanzenbach <shifty91@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: keucr: Removed trailing whitespaces
Kurt Kanzenbach [Fri, 30 Nov 2012 11:18:18 +0000 (12:18 +0100)]
staging: keucr: Removed trailing whitespaces

Fixed a coding style issue. Removed trailing
whitespaces in code.

Signed-off-by: Kurt Kanzenbach <shifty91@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: keucr: Replaced c99 comments
Kurt Kanzenbach [Fri, 30 Nov 2012 11:18:17 +0000 (12:18 +0100)]
staging: keucr: Replaced c99 comments

Fixed a coding style issue. Replaced all
c99 comments by c89 ones and deleted
commented out code.

Signed-off-by: Kurt Kanzenbach <shifty91@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8192e: Fix failure to check pci_map_single()
Larry Finger [Thu, 27 Dec 2012 02:51:12 +0000 (20:51 -0600)]
staging: rtl8192e: Fix failure to check pci_map_single()

Beginning with kernel 3.8, the DMA mapping routines issue a warning
for the first call to pci_map_single() that is not checked with a
pci_dma_mapping_error() call.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: rtl8187se: Fix failure to check pci_map_single()
Larry Finger [Thu, 27 Dec 2012 02:51:13 +0000 (20:51 -0600)]
staging: rtl8187se: Fix failure to check pci_map_single()

Beginning with kernel 3.8, the DMA mapping routines issue a warning
for the first call to pci_map_single() that is not checked with a
pci_dma_mapping_error() call.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>