linux-2.6-microblaze.git
11 years agostaging:iio:sca3000: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:sca3000: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The errors which the driver tries to handle in the remove function are
non-critical, so we can just ignore them and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:lis3l02dq: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:lis3l02dq: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The errors which the driver tries to handle in the remove function are
non-critical, so we can just ignore them and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ade7759: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:ade7759: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ade7758: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:ade7758: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ade7754: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:ade7754: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:ade7753: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:ade7753: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:adis16400: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:adis16400: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:adis16200: Do not return a error in remove function
Lars-Peter Clausen [Sat, 22 Sep 2012 08:56:00 +0000 (09:56 +0100)]
staging:iio:adis16200: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The error which the driver tries to handle in the remove function is
non-critical, so we can just ignore it and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: inkern: clean up error return code
Kim, Milo [Tue, 18 Sep 2012 04:56:00 +0000 (05:56 +0100)]
iio: inkern: clean up error return code

 When the IIO consumer tries to get specific IIO channel,
 few error cases can be happened.
 (a) Memory allocation failure
 (b) No matched ADC channel error
 (c) Invalid input arguments
 This patch enables cleaning up error handling in case of (a) and (b).

 In error handling code,
 (a): the reference count of the IIO device should be decreased.
 (b): the allocated memory should be freed with restoring the reference count.
 Therefore iio_deivce_put() is called in both cases.
 This can be handled in the last error statement.

 Additionally, integer variable is used for stating each error case explicitly.
 Then, the error returns as ERR_PTR() with this value.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: inkern: put the IIO device when it fails to allocate memory
Kim, Milo [Tue, 18 Sep 2012 04:55:00 +0000 (05:55 +0100)]
iio: inkern: put the IIO device when it fails to allocate memory

 The reference count of the IIO device is increased if the IIO map has
 matched consumer name.
 After then, it tries to allocate the iio_channel which is used by the consumer.
 If it fails to allocate memory, the reference count should be decreased.

 This patch enables restoring the reference count of the IIO device.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: dac/ad5755: signedness bug in ad5755_setup_pdata()
Dan Carpenter [Wed, 19 Sep 2012 06:27:00 +0000 (07:27 +0100)]
iio: dac/ad5755: signedness bug in ad5755_setup_pdata()

We need "ret" to be signed for the error handling to work correctly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: hid-sensors: Prevent crash during hot-unplug
Srinivas Pandruvada [Thu, 20 Sep 2012 00:15:00 +0000 (01:15 +0100)]
iio: hid-sensors: Prevent crash during hot-unplug

When hid sensor hub is unplugged, there is a crash in
iio_device_unregister_trigger_consumer.
In a typical IIO driver when remove is called, it will unregister and free
trigger and then it will call iio_device_free.
The function iio_trigger_free() will free the allocated memory for trigger.
If this trigger was assigned to iio_dev->trig, then it should be set to NULL.
Othewise when iio_device_free() is called later, it finally calls
iio_device_unregsister_trigger(), which checks for
       if (indio_dev->trig)
                iio_trigger_put(indio_dev->trig);
If indio_dev->trig is not set to NULL, it calls iio_trigger_put on a bad
pointer causing crash.
This scenerio can happen in any driver, which is storing trigger pointer in
iio_dev structure and following current procedure during remove.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoHID: sensors: remove some unneeded checks
Dan Carpenter [Fri, 14 Sep 2012 06:53:46 +0000 (06:53 +0000)]
HID: sensors: remove some unneeded checks

"report_id" is unsigned so it's never less than zero.  These checks can
be removed without any problem.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoHID: sensors: use GFP_ATOMIC under spinlock
Dan Carpenter [Fri, 14 Sep 2012 06:53:23 +0000 (06:53 +0000)]
HID: sensors: use GFP_ATOMIC under spinlock

We're holding a spinlock here so we can't call kmalloc() with
GFP_KERNEL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoHID: sensors: fix up for mfd_add_devices() API change
Stephen Rothwell [Wed, 12 Sep 2012 06:07:00 +0000 (07:07 +0100)]
HID: sensors: fix up for mfd_add_devices() API change

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoStaging: remove CONFIG_EXPERIMENTAL dependancies
Greg Kroah-Hartman [Tue, 18 Sep 2012 06:02:36 +0000 (23:02 -0700)]
Staging: remove CONFIG_EXPERIMENTAL dependancies

As discussed at the kernel summit this year, CONFIG_EXPERIMENTAL means
nothing, so let's get rid of it.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: ced1401: fix copy_from/to_user warning messages
Greg Kroah-Hartman [Tue, 18 Sep 2012 04:25:28 +0000 (21:25 -0700)]
Staging: ced1401: fix copy_from/to_user warning messages

Properly check the return value of copy_from/to_user() and handle any
errors that might happen.

This removes a bunch of compiler warnings.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging ced1401: cleanup coding style issues.
Greg Kroah-Hartman [Tue, 18 Sep 2012 04:12:59 +0000 (21:12 -0700)]
Staging ced1401: cleanup coding style issues.

A basic Lindent run on the .c files, clean up the .h file by hand.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: ced1401: add driver to the build
Greg Kroah-Hartman [Tue, 18 Sep 2012 02:43:33 +0000 (19:43 -0700)]
Staging: ced1401: add driver to the build

This adds the ced1401 driver to the build system.

Yes, there are a lot of warning messages, but it does compile, so it
should be good to get going.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: ced1401: add TODO file
Greg Kroah-Hartman [Tue, 18 Sep 2012 02:42:05 +0000 (19:42 -0700)]
Staging: ced1401: add TODO file

This adds a first cut of a TODO file to get this driver out of the
staging directory.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: ced1401: usb1401: fix build errors.
Greg Kroah-Hartman [Tue, 18 Sep 2012 02:36:03 +0000 (19:36 -0700)]
Staging: ced1401: usb1401: fix build errors.

This fixes up the usb1401.c file to remove the usage of err() (which is
gone), and the two-argument kmap_atomic() call, and the compat_ioctl
pointer warning.

The code now builds properly, there are lots of warnings still, but it's
a start.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: add ced1401 USB driver
Alois Schlögl [Tue, 18 Sep 2012 02:22:52 +0000 (19:22 -0700)]
Staging: add ced1401 USB driver

This was imported from the
http://pub.ist.ac.at/~schloegl/src/ced1401/.git git repo at the request
of Alois.  The driver originally came from Cambridge Electronic Design
Ltd and was authored by Greg P Smith and others, but Alois did the
maintance work to get it into a semi-building state and pushed to get it
into the main kernel tree here.

Cc: Alois Schlögl <alois.schloegl@ist.ac.at>
Cc: Greg P. Smith <greg@ced.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: jr3_pci: quiet "Using plain interger as NULL pointer" noise
H Hartley Sweeten [Mon, 17 Sep 2012 20:17:19 +0000 (13:17 -0700)]
staging: comedi: jr3_pci: quiet "Using plain interger as NULL pointer" noise

Quiet some sparse warnings about:

warning: Using plain integer as NULL pointer

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: pcmuio: pointers should be cleared with NULL
H Hartley Sweeten [Mon, 17 Sep 2012 20:17:03 +0000 (13:17 -0700)]
staging: comedi: pcmuio: pointers should be cleared with NULL

Pointer variables should be cleared with NULL on 0. This quiets
some sparse warnings about:

warning: Using plain integer as NULL pointer

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: pcmmio: remove kernel messages about IRQ
H Hartley Sweeten [Mon, 17 Sep 2012 20:16:45 +0000 (13:16 -0700)]
staging: comedi: pcmmio: remove kernel messages about IRQ

These messages are just added noise.

They also cause some sparse warnings due to MAX_ASICS evaluating
as 1. This causes the local variable 'irq' to be 'unsigned int irq[1]',
which makes the 'irq[1]' access invalid.

Just remove the messages.

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: mite: local symbols should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:16:05 +0000 (13:16 -0700)]
staging: comedi: mite: local symbols should not be exported

The function mite_fifo_size() is only referenced in this file. Make
it static.

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: ni_mio_cs: local symbols should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:15:32 +0000 (13:15 -0700)]
staging: comedi: ni_mio_cs: local symbols should not be exported

The symbol ni_mio_cs_driver is only referenced in this file. Make
it static.

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: ni_labpc_cs: local symbols should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:15:15 +0000 (13:15 -0700)]
staging: comedi: ni_labpc_cs: local symbols should not be exported

The symbol labpc_cs_driver and the functions labpc_init_module()
and labpc_exit_module() are only referenced in this file. Make
them static.

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: ni_daq_dio24: local symbols should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:14:59 +0000 (13:14 -0700)]
staging: comedi: ni_daq_dio24: local symbols should not be exported

The symbol dio24_cs_driver is only referenced in this file. Make
it static.

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: ni_pcidio: local functions should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:14:41 +0000 (13:14 -0700)]
staging: comedi: ni_pcidio: local functions should not be exported

The function ni_pcidio_event() is only referenced in this file.
Make it static.

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: ni_660x: local functions should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:14:24 +0000 (13:14 -0700)]
staging: comedi: ni_660x: local functions should not be exported

The function ni_660x_release_mite_channel() is only referenced in
this file. Make it static.

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: jr3_pci: local functions should not be exported
H Hartley Sweeten [Mon, 17 Sep 2012 20:14:08 +0000 (13:14 -0700)]
staging: comedi: jr3_pci: local functions should not be exported

The function read_idm_word() is only referenced in this file.
Make it static.

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: jr3_pci.h: remove vect_bits_t and warning_bits_t
H Hartley Sweeten [Mon, 17 Sep 2012 20:13:48 +0000 (13:13 -0700)]
staging: comedi: jr3_pci.h: remove vect_bits_t and warning_bits_t

Leave the enum's but remove their names. The names are not used
anywhere in the driver.

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: ni_mio_common: make internal functions static
H Hartley Sweeten [Mon, 17 Sep 2012 20:13:32 +0000 (13:13 -0700)]
staging: comedi: ni_mio_common: make internal functions static

The functions ni_release_gpct_mite_channel() and ni_prime_channelgain_list()
are only referenced in this file. Make it static.

The function ni_release_gpct_mite_channel() is also only called
when PCIDMA is enabled. Move the #ifdef to quite a sparse warning
about the function not being used.

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: make internal function static
H Hartley Sweeten [Mon, 17 Sep 2012 20:13:12 +0000 (13:13 -0700)]
staging: comedi: comedi_fops: make internal function static

The function do_become_nonbusy() is only referenced in this file.
Make it static.

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: sm7xxfb: remove smtc_VRAMBaseAddress
Javier M. Mellid [Mon, 17 Sep 2012 14:12:53 +0000 (16:12 +0200)]
staging: sm7xxfb: remove smtc_VRAMBaseAddress

This patch erases smtc_VRAMBaseAddress variable.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sm7xxfb: rename pFramebufferPhysical to mmio_base
Javier M. Mellid [Mon, 17 Sep 2012 14:12:52 +0000 (16:12 +0200)]
staging: sm7xxfb: rename pFramebufferPhysical to mmio_base

This patch renames pFramebufferPhysical name to mmio_base.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sm7xxfb: rename some smtcfb_info fields
Javier M. Mellid [Mon, 17 Sep 2012 14:12:51 +0000 (16:12 +0200)]
staging: sm7xxfb: rename some smtcfb_info fields

This patch improves naming style and comments on smtcfb_info fields.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sm7xxfb: annotate iomem pointers
Javier M. Mellid [Mon, 17 Sep 2012 14:12:50 +0000 (16:12 +0200)]
staging: sm7xxfb: annotate iomem pointers

This patch annotates iomem pointers.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sm7xxfb: cleanup on smtc_alloc_fb_info
Javier M. Mellid [Mon, 17 Sep 2012 14:12:49 +0000 (16:12 +0200)]
staging: sm7xxfb: cleanup on smtc_alloc_fb_info

This patch improves code legibility after last changes.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sm7xxfb: clean smtcfb_fix's id initialization
Javier M. Mellid [Mon, 17 Sep 2012 14:12:48 +0000 (16:12 +0200)]
staging: sm7xxfb: clean smtcfb_fix's id initialization

Setting up smtcfb_fix's id happens through smtc_alloc_fb_info. It adds
complexity and unnecesary code.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: sm7xxfb: clean fb_fix_screeninfo and fb_var_screeninfo initialization
Javier M. Mellid [Mon, 17 Sep 2012 14:12:47 +0000 (16:12 +0200)]
staging: sm7xxfb: clean fb_fix_screeninfo and fb_var_screeninfo initialization

Part of fb_fix_screeninfo and fb_var_screeninfo initialization happens
in smtc_alloc_fb_info. It duplicates code while hiding the real
functionality of smtc_alloc_fb_info. This patch groups initialization
together.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: "wlags49_h25" Fix typos.
Justin P. Mattock [Mon, 17 Sep 2012 15:20:24 +0000 (08:20 -0700)]
staging: "wlags49_h25" Fix typos.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: csr: wait for the exec in usermodehelper
Lauri Hintsala [Mon, 17 Sep 2012 13:26:31 +0000 (16:26 +0300)]
staging: csr: wait for the exec in usermodehelper

The order of wait values has been changed by commit 9d944ef32e.
Fix the wait parameter and start to use a define instead of
"magic number".

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: fix csr printk format warning
Randy Dunlap [Mon, 17 Sep 2012 17:33:18 +0000 (10:33 -0700)]
staging: fix csr printk format warning

Fix printk format warning on i386/X86_32 by using 't' for ptrdiff_t.
Also builds cleanly on x86_64.

drivers/staging/csr/csr_wifi_hip_udi.c: In function 'unifi_print_status':
drivers/staging/csr/csr_wifi_hip_udi.c:151:27: warning: format '%ld' expects type 'long int', but argument 5 has type 'int'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag 'iio-for-v3.7d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Mon, 17 Sep 2012 21:42:54 +0000 (14:42 -0700)]
Merge tag 'iio-for-v3.7d' of git://git./linux/kernel/git/jic23/iio into staging-next

IIO new drivers, features and rework for the 3.7 cycle, 4th set.

Here we have

1) a set cleaning up and moving the ad7476 driver out of staging.
Support for a number of additional parts is also added to that driver.

2) cleanups from various people for the in kernel interface code as that
is getting more an more real use and hence people are picking up on
minor issues that made it through review.  Also a related useful set
of utility functions to avoid duplicate code for converting IIO
representations to other forms.

3) a new fractional type for our read_raw / write_raw functions.
  This allows avoiding loss of accuracy via the in kernel interfaces in some
  cases as well as being rather convenient for a lot of range -> scale
  conversions.

4) New AD5755 DAC driver.

5) Some Blackfin timer trigger improvements including hardware pulse control
for device triggering.

6) Support for the ad7091r in the ad7476 driver.

11 years agoiio: ad7476: Add support for the ad7091r
Lars-Peter Clausen [Mon, 17 Sep 2012 12:26:00 +0000 (13:26 +0100)]
iio: ad7476: Add support for the ad7091r

Add support for the ad7091r 12 bit ADC to the ad7476 driver. Although the
ad7091r is not really related to any of the other devices supported by this
driver, luckily for us there are not so many ways (which are not totally insane)
how sampling a single channel ADC via SPI can be implemented and support for the
ad7091r can be added to the driver with just a few adjustments.

The ad7091r requires an external "conversion start" pulse to start a sample
conversion. After the conversion has finished the result can be read via SPI. We
depend on a IIO trigger to generate this signal, as a result only sampling in
buffered mode and not in manual mode is available.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:trigger:bfintmr Add output support
Lars-Peter Clausen [Mon, 17 Sep 2012 12:26:00 +0000 (13:26 +0100)]
staging:iio:trigger:bfintmr Add output support

Some converters require an external signal to start the conversion. This patch
adds support to the bfintmr trigger driver to generate such a signal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:trigger:bfintmr: Only enable timer when necessary
Lars-Peter Clausen [Mon, 17 Sep 2012 12:26:00 +0000 (13:26 +0100)]
staging:iio:trigger:bfintmr: Only enable timer when necessary

This patch hooks up the set_trigger_state callback for the blackfin timer
trigger driver and only enables the timer when a trigger consumer requests it to
be enabled. There really is no reason to keep the timer running and generate
interrupts if nobody is listening to them.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:trigger:bfintmr: Avoid divide by zero
Lars-Peter Clausen [Mon, 17 Sep 2012 12:26:00 +0000 (13:26 +0100)]
staging:iio:trigger:bfintmr: Avoid divide by zero

If the timer frequency has not been configured yet get_gptimer_period() will
return 0. Handle this case instead of blindly dividing by the returned value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging:iio:hwmon bridge: Use iio_read_channel_processed
Lars-Peter Clausen [Mon, 17 Sep 2012 12:17:00 +0000 (13:17 +0100)]
staging:iio:hwmon bridge: Use iio_read_channel_processed

Use the iio_read_channel_processed function to read the sample value in the
proper unit instead of using iio_read_channel_raw and iio_read_channel_scale and
doing the unit conversion manually.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:inkern: Add function to read the processed value
Lars-Peter Clausen [Mon, 17 Sep 2012 12:17:00 +0000 (13:17 +0100)]
iio:inkern: Add function to read the processed value

Add a function to read a processed value from a channel. The function will first
attempt to read the IIO_CHAN_INFO_PROCESSED attribute. If that fails it will
read the IIO_CHAN_INFO_RAW attribute and convert the result from a raw value to
a processed value.

The patch also introduces a function to convert raw value to a processed value
and exports it, in case a user needs or wants to do the conversion by itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: consumer.h: Fix kernel doc incosistency
Lars-Peter Clausen [Mon, 17 Sep 2012 12:17:00 +0000 (13:17 +0100)]
iio: consumer.h: Fix kernel doc incosistency

For the iio_read_channel_raw and iio_read_channel_scale the kerneldoc comment
refers to an argument called "channel", while the argument is called "chan" in
the function signature. This leads to the following warnings from kerneldoc:

Warning(include/linux/iio/consumer.h:71): No description found for parameter 'chan'
Warning(include/linux/iio/consumer.h:71): Excess function parameter 'channel' description in 'iio_read_channel_raw'
Warning(include/linux/iio/consumer.h:109): No description found for parameter 'chan'
Warning(include/linux/iio/consumer.h:109): Excess function parameter 'channel' description in 'iio_read_channel_scale'

This patch fixes the warnings by naming them consistently.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:dac: Add ad5755 driver
Lars-Peter Clausen [Mon, 17 Sep 2012 09:24:00 +0000 (10:24 +0100)]
iio:dac: Add ad5755 driver

This patch adds support for the AD5755, AD5755-1, AD5757, AD5735, AD5737 16 and
14 bit quad-channel DACs. The AD5757/AD5737 only have current outputs, but
for the AD5755/AD5757 each of the outputs can be configured to either be a
voltage or a current output. We only allow to configure this at device probe
time since usually this needs to match the external circuitry and should not be
changed on the fly.

A few trivial formatting changes on merge.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: inkern: add error case in iio_channel_get()
Kim, Milo [Mon, 17 Sep 2012 08:44:00 +0000 (09:44 +0100)]
iio: inkern: add error case in iio_channel_get()

 The datasheet name is defined in the IIO driver.
 On the other hand, the adc_channel_label is configured in
 the platform side.
 If the datasheet name is not matched with any adc_channel_label,
 the iio_channel_get() should be returned as error for preventing
 invalid channel data access.

 This can be handled either way.
 (a) checking null data when using it : in the xxx_read_raw()
 or
 (b) error returns when the channel is requested : this patch

 The IIO consumer can't use the channel with invalid channel spec.
 Therefore case (b) is more reasonable.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agostaging/gdm72xx: usb_boot: replace firmware upgrade API in em_download
Macpaul Lin [Fri, 14 Sep 2012 06:02:04 +0000 (14:02 +0800)]
staging/gdm72xx: usb_boot: replace firmware upgrade API in em_download

Replace firmware upgrade API in em_download_image().

Signed-off-by: Macpaul Lin <macpaul@gmail.com>
Cc: Paul Stewart <pstew@chromium.org>
Cc: Ben Chan <benchan@chromium.org>
Cc: Sage Ahn <syahn@gctsemi.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/rts_pstor: Use pr_ or dev_ printks in rtsx.c
Toshiaki Yamane [Sun, 16 Sep 2012 07:26:38 +0000 (16:26 +0900)]
staging/rts_pstor: Use pr_ or dev_ printks in rtsx.c

fixed some checkpatch warnings.
-WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
-WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
-WARNING: quoted string split across lines

And added pr_fmt.

Signed-off-by: Toshiaki Yamane <yamanetoshi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch.pl cleanup: pretty pointers
Daniel Cotey [Sat, 15 Sep 2012 13:12:36 +0000 (06:12 -0700)]
Staging: silicom: checkpatch.pl cleanup: pretty pointers

last of the unstylistic pointers cleaned up

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch.pl cleanup: pretty pointers
Daniel Cotey [Sat, 15 Sep 2012 13:12:05 +0000 (06:12 -0700)]
Staging: silicom: checkpatch.pl cleanup: pretty pointers

pointer style cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch.pl cleanup: pretty pointers
Daniel Cotey [Sat, 15 Sep 2012 13:11:41 +0000 (06:11 -0700)]
Staging: silicom: checkpatch.pl cleanup: pretty pointers

more checkpatch cleanups of pointers.

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch.pl cleanup: pretty pointers
Daniel Cotey [Sat, 15 Sep 2012 13:11:15 +0000 (06:11 -0700)]
Staging: silicom: checkpatch.pl cleanup: pretty pointers

More pointer style cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch.pl cleanup: pretty pointers
Daniel Cotey [Sat, 15 Sep 2012 13:10:49 +0000 (06:10 -0700)]
Staging: silicom: checkpatch.pl cleanup: pretty pointers

More notation fixes

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch.pl cleanup: pretty pointers
Daniel Cotey [Sat, 15 Sep 2012 13:10:21 +0000 (06:10 -0700)]
Staging: silicom: checkpatch.pl cleanup: pretty pointers

first chunk, straighten up the pointer notation

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch cleanup: fix includes
Daniel Cotey [Sat, 15 Sep 2012 13:09:54 +0000 (06:09 -0700)]
Staging: silicom: checkpatch cleanup: fix includes

checkpatch fixups

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch cleanup: header file whitespace
Daniel Cotey [Sat, 15 Sep 2012 13:09:26 +0000 (06:09 -0700)]
Staging: silicom: checkpatch cleanup: header file whitespace

Finish trailing spaces in libbp_sd.h

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: checkpatch cleanup: header file whitespace
Daniel Cotey [Sat, 15 Sep 2012 13:09:00 +0000 (06:09 -0700)]
Staging: silicom: checkpatch cleanup: header file whitespace

Whack all the line ending spaces so checkpatch.pl is happy.

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bypass.h: checkpatch whitespace
Daniel Cotey [Sat, 15 Sep 2012 13:08:36 +0000 (06:08 -0700)]
Staging: silicom: bypass.h: checkpatch whitespace

Remove trailing spaces, second chunk

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bypass.h: checkpatch whitespace
Daniel Cotey [Sat, 15 Sep 2012 13:08:07 +0000 (06:08 -0700)]
Staging: silicom: bypass.h: checkpatch whitespace

Remove trailing spaces, first chunk

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:06:44 +0000 (06:06 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

twelfth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:06:20 +0000 (06:06 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

eleventh chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:05:51 +0000 (06:05 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

tenth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:04:41 +0000 (06:04 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

ninth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:04:06 +0000 (06:04 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

eighth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:03:43 +0000 (06:03 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

seventh chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:03:18 +0000 (06:03 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

sixth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:02:52 +0000 (06:02 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

fifth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:02:22 +0000 (06:02 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

fourth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:01:40 +0000 (06:01 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

third chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 13:00:41 +0000 (06:00 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

second chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: bp_mod.h: checkpatch tab and space cleanup
Daniel Cotey [Sat, 15 Sep 2012 12:59:07 +0000 (05:59 -0700)]
Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

first chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: speakup_soft: Fix reading of init string
Ben Hutchings [Sun, 16 Sep 2012 03:18:50 +0000 (04:18 +0100)]
staging: speakup_soft: Fix reading of init string

softsynth_read() reads a character at a time from the init string;
when it finds the null terminator it sets the initialized flag but
then repeats the last character.

Additionally, if the read() buffer is not big enough for the init
string, the next read() will start reading from the beginning again.
So the caller may never progress to reading anything else.

Replace the simple initialized flag with the current position in
the init string, carried over between calls.  Switch to reading
real data once this reaches the null terminator.

(This assumes that the length of the init string can't change, which
seems to be the case.  Really, the string and position belong together
in a per-file private struct.)

Tested-by: Samuel Thibault <sthibault@debian.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: silicom: fix a comparing proc_dir_entry pointer against 0
Devendra Naga [Sun, 16 Sep 2012 16:01:59 +0000 (12:01 -0400)]
staging: silicom: fix a comparing proc_dir_entry pointer against 0

we should be using the NULL macro, not 0 to compare against
a pointer value, and also remove braces around the single
if conditional after the create_proc_entry

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ft1000: replace c99 comments with c88
Devendra Naga [Sun, 16 Sep 2012 17:49:40 +0000 (13:49 -0400)]
staging: ft1000: replace c99 comments with c88

replace some of the c99 comments to the structures with c88 comment style
no code change is done here.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: use kstrtoint_from_user()
Dan Carpenter [Fri, 14 Sep 2012 08:11:35 +0000 (11:11 +0300)]
Staging: silicom: use kstrtoint_from_user()

The main problem with the hand rolled code was that there weren't any
range checks so you could corrupt memory by writing too much data to
the proc file.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: silicom: add some range checks to proc functions
Dan Carpenter [Fri, 14 Sep 2012 06:56:00 +0000 (09:56 +0300)]
Staging: silicom: add some range checks to proc functions

If you tried to cat more than 255 characters (the last character is for
the terminator) to these proc files then it would corrupt kernel memory.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: use module_init()/module_exit()
Ian Abbott [Fri, 14 Sep 2012 16:34:35 +0000 (17:34 +0100)]
staging: comedi: mite: use module_init()/module_exit()

Rename the standard `init_module()` and `cleanup_module()` functions and
make them static.  Use `module_init()` and `module_exit()` to mark the
renamed functions as the module init and exit functions.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: remove list of devices
Ian Abbott [Fri, 14 Sep 2012 16:34:34 +0000 (17:34 +0100)]
staging: comedi: mite: remove list of devices

All the drivers that use the "mite" module now allocate a `struct
mite_struct` dynamically instead of searching the `mite_devices` list
populated during initialization of the "mite" module.

Remove the list of devices and the function that prints available NI
devices on the list (`mite_list_devices()`).  The list node and `used`
members in `struct mite_struct` are now redundant, so remove them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_pcimio: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:33 +0000 (17:34 +0100)]
staging: comedi: ni_pcimio: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_pcidio: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:32 +0000 (17:34 +0100)]
staging: comedi: ni_pcidio: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:31 +0000 (17:34 +0100)]
staging: comedi: ni_labpc: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_670x: remove spurious free_irq() call
Ian Abbott [Fri, 14 Sep 2012 16:34:30 +0000 (17:34 +0100)]
staging: comedi: ni_670x: remove spurious free_irq() call

This driver's comedi `detach` handler (`ni_670x_detach()`) calls
`free_irq()` but the driver doesn't call `request_irq()` anywhere.
Remove the spurious call.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_670x: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:29 +0000 (17:34 +0100)]
staging: comedi: ni_670x: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_660x: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:28 +0000 (17:34 +0100)]
staging: comedi: ni_660x: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_65xx: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:27 +0000 (17:34 +0100)]
staging: comedi: ni_65xx: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_6527: use mite_alloc()
Ian Abbott [Fri, 14 Sep 2012 16:34:26 +0000 (17:34 +0100)]
staging: comedi: ni_6527: use mite_alloc()

Allocate `struct mite_device` dynamically instead of searching for
one on the `mite_devices` list constructed by the "mite" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: add mite_alloc() and mite_free()
Ian Abbott [Fri, 14 Sep 2012 16:34:25 +0000 (17:34 +0100)]
staging: comedi: mite: add mite_alloc() and mite_free()

Add `mite_alloc()` to allow drivers to allocate and initialize a `struct
mite_struct` dynamically and export it.  Add `mite_free()`, which is
currently just an inline wrapper for `kfree()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: replace printk() calls
Ian Abbott [Fri, 14 Sep 2012 16:34:24 +0000 (17:34 +0100)]
staging: comedi: mite: replace printk() calls

Replace the `printk()` calls in this module with `dev_...()` calls where
possible or `pr_...()` calls otherwise.

Rework the normally ifdefed out (by the `DEBUG_MITE` macro)
`mite_dump_regs()` to dump register offsets instead of remapped
addresses.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: use ilog2()
Ian Abbott [Fri, 14 Sep 2012 16:34:23 +0000 (17:34 +0100)]
staging: comedi: mite: use ilog2()

The static inline functions `MITE_IODWBSR_1_WSIZE_bits()` and `CR_RL()`
in "mite.h" work out a base-2 logarithm using a `while` loop.  Change
them to use `ilog2()`.  Also change `CR_RL()` to clamp the maximum value
instead of printing an error.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: export mite_alloc_ring() and mite_free_ring()
Ian Abbott [Fri, 14 Sep 2012 16:34:22 +0000 (17:34 +0100)]
staging: comedi: mite: export mite_alloc_ring() and mite_free_ring()

The `mite_alloc_ring()` and `mite_free_ring()` static inline functions
in "mite.h" are reasonably large.  Transfer them to "mite.c" and export
them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: mite: make internal functions static
Ian Abbott [Fri, 14 Sep 2012 16:34:21 +0000 (17:34 +0100)]
staging: comedi: mite: make internal functions static

Declare some non-exported functions in "mite.c" `static` and remove
their declarations from "mite.h".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>