Commit Graph

348408 Commits

Author SHA1 Message Date
Greg Kroah-Hartman 17cb3be61b 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>
2013-01-07 15:17:52 -08:00
Omar Ramirez Luna e16a922a27 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>
2013-01-07 15:03:56 -08:00
Enric Balletbo i Serra fe02508529 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>
2013-01-07 15:02:37 -08:00
Cruz Julian Bishop d7f9729f6e 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>
2013-01-07 14:59:57 -08:00
Cruz Julian Bishop 167bccbd80 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>
2013-01-07 14:59:57 -08:00
Cruz Julian Bishop 0f5afdd238 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>
2013-01-07 14:59:57 -08:00
Peter Huewe 94b84e4510 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>
2013-01-07 14:56:04 -08:00
Masanari Iida dbc320f749 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>
2013-01-07 14:56:04 -08:00
Masanari Iida 2cc1dd939c 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>
2013-01-07 14:56:04 -08:00
Cyril Roelandt 2df29e7bf2 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>
2013-01-07 14:53:58 -08:00
Cyril Roelandt ac6a98d452 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>
2013-01-07 14:53:58 -08:00
H Hartley Sweeten fd958f7eb4 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>
2013-01-07 14:51:11 -08:00
Ian Abbott c0729eeefd 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>
2013-01-07 14:48:25 -08:00
Ian Abbott 34ffb33e09 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>
2013-01-07 14:48:24 -08:00
Lijo Antony 5eaf711b53 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>
2013-01-07 14:40:00 -08:00
Ian Abbott ae6eee39ae 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>
2013-01-07 14:37:13 -08:00
Ian Abbott 0642c94bcb 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>
2013-01-07 14:37:13 -08:00
Ian Abbott 8bd48c9ef1 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>
2013-01-07 14:37:12 -08:00
Ian Abbott ea4f72b279 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>
2013-01-07 14:37:12 -08:00
Ian Abbott 594dc67c23 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>
2013-01-07 14:37:12 -08:00
Ian Abbott 0653bed679 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>
2013-01-07 14:37:12 -08:00
Lijo Antony 21f181f16c 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>
2013-01-07 14:34:49 -08:00
H Hartley Sweeten 90a35c15c5 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>
2013-01-07 14:28:19 -08:00
H Hartley Sweeten 71cf6d3ee9 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten a52840a98b 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten 401d99de5c 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten 9682e28c49 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten c098c21a9d 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten ade1764ff5 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten f012463068 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>
2013-01-07 14:25:49 -08:00
H Hartley Sweeten e0dac318ee 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten 74120719a7 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten bc252fd12c 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten 76cca89f4b 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten 91fa0b0c96 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten a5787824c0 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten 2714b019fd 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>
2013-01-07 14:25:48 -08:00
H Hartley Sweeten 5c87fef53c 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten ca081b1d7e 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten 0e700923bf 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten 7d8a25674f 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten ed69335c72 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten cd6b7636e9 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten e79c8d2100 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>
2013-01-07 14:25:47 -08:00
H Hartley Sweeten 87b1ad7a80 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>
2013-01-07 14:25:46 -08:00
H Hartley Sweeten 4da5fa9a43 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>
2013-01-07 14:25:46 -08:00
H Hartley Sweeten 85104e9b40 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>
2013-01-07 14:25:46 -08:00
H Hartley Sweeten 43bd33f224 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>
2013-01-07 14:25:46 -08:00
H Hartley Sweeten 2aae0076c9 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>
2013-01-07 14:25:46 -08:00
Ian Abbott 7d3135af39 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>
2013-01-07 14:22:37 -08:00