GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
12 years agoiio: Introduce a new fractional value type
Lars-Peter Clausen [Fri, 14 Sep 2012 15:21:00 +0000 (16:21 +0100)]
iio: Introduce a new fractional value type

Currently IIO uses a decimal fixed point representations for real type numbers.
This patch introduces a new representation for rational type numbers. The number
will be expressed by specifying a numerator and denominator. For converting a
raw value to a processed value multiply it by the numerator and divide it by the
denominator.

The reasoning for introducing this new type is that for a lot of devices the
scale can be represented easily by a fractional number, but it is not possible
to represent it as fixed point number without rounding.  E.g. for a simple DAC
the scale is often the reference voltage divided by the number of possible
values (Usually 2**n_bits - 1). Each driver currently implements the conversion
of this fraction to a fixed point number on its own.

Also when it comes to the in-kernel interface this allows to directly use the
fractional factors to convert a raw value to a processed value. This should on
one hand require less instructions and on the other hand increase the
precision.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agoiio: Documentation change for inkern interface.
anish kumar [Sat, 8 Sep 2012 19:42:00 +0000 (20:42 +0100)]
iio: Documentation change for inkern interface.

This commit- 314be14bb renamed the _st_ functions to loose the bit
that was meant for staging version but forgot to change
the documentation which still have _st_ sprinkled in some of the
places.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agoiio:ad7476: Add support for ad7273/ad7274/ad7276/ad7277/ad7278
Lars-Peter Clausen [Mon, 10 Sep 2012 09:33:00 +0000 (10:33 +0100)]
iio:ad7476: Add support for ad7273/ad7274/ad7276/ad7277/ad7278

The ad7276/ad7277/ad7278 are similar to the ad7476/ad7477/ad7478 but have the
same number of leading zeros as the ad7940. The ad7273/ad7274 have a extra pin
for VREF where as for the ad7276/ad7277/ad7278 VREF is taken from VDD, but
otherwise they are compatible to the ad7276/ad7277.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agoiio:ad7476: Add ad7940 support
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
iio:ad7476: Add ad7940 support

The AD7940 is a single channel 14 bit ADC similar to the ADCs already supported
by the ad7476 driver, but it does have a different shift factor.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agoiio:ad7476: Add ad7910/ad7920 device table entries
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
iio:ad7476: Add ad7910/ad7920 device table entries

The ad7910/ad7920 are software compatible to the ad7467/ad7466.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agoiio: Move ad7476 driver out of staging
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
iio: Move ad7476 driver out of staging

The ad7476 driver is a driver for simple single channel ADCs. The driver does
not export any experimental or custom ABI files nor do the static code check
tools report any issues, so move the driver out of staging.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging:iio:ad7476: Use be16_to_cpup instead of open-coding it
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
staging:iio:ad7476: Use be16_to_cpup instead of open-coding it

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging:iio:ad7476: Squash driver into a single file.
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
staging:iio:ad7476: Squash driver into a single file.

After the recent cleanups the buffer support is just a single 23 line function.
This does not really justify a file on its own, so move it to the main driver
file. And with only one source file left the header file containing the device
state struct becomes superflousious so move the content of the header
file to the main driver source file as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging:iio:ad7476: Rework reference voltage handling
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
staging:iio:ad7476: Rework reference voltage handling

Slightly rework the reference voltage handling for the ad7476 driver. Now the only
way to specify a external reference voltage is to use the regulator API,
previously it was possible to use either platform_data or the regulator API. The
new way is more consistent with what other drivers do.

Also do not ignore errors when requesting the regulator, since this will cope
very poorly with e.g. deferred probing.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging:iio:ad7476: Avoid alloc/free for each sample in buffered mode
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
staging:iio:ad7476: Avoid alloc/free for each sample in buffered mode

The ad7476 driver has only support for 1 channel ADCs. So the upper limit for
the buffer size is the size of one sample plus the size of the timestamp.
Preallocate a buffer large enough to hold this to avoid having to allocate and
free a new buffer for each sample being captured.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging:iio:ad7476: Remove duplicated chip info entries
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
staging:iio:ad7476: Remove duplicated chip info entries

Some of the parts supported by this driver are software compatible. The
difference between them is only in the operating voltage range. So we do not
need extra chip info entries for them.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging:iio:ad7476: Fix off by one error for channel shift
Lars-Peter Clausen [Mon, 10 Sep 2012 08:34:00 +0000 (09:34 +0100)]
staging:iio:ad7476: Fix off by one error for channel shift

The datasheet is a bit confusing about this. It says that a dataword has 4
leading zeros, but the first zero is already put on the bus when CS is pulled
low and the second zero is put on the bus on the first leading edge of SCLK, so
when the first bit is sampled on the first trailing edge it will sample what the
datasheet refers to as the second leading zero. Subsequently we only see 3
leading zeros in the 16 bit dataword and the result we get is shifted to the
left by one bit. Fix this by adjusting the channel shift by 1.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
12 years agostaging: ipack/bridges/tpci200: Use endianess-aware types where applicable.
Jens Taprogge [Wed, 12 Sep 2012 12:55:46 +0000 (14:55 +0200)]
staging: ipack/bridges/tpci200: Use endianess-aware types where applicable.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Unmap memory on device removal.
Jens Taprogge [Wed, 12 Sep 2012 12:55:45 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Unmap memory on device removal.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: update TODO file
Samuel Iglesias Gonsalvez [Wed, 12 Sep 2012 12:55:44 +0000 (14:55 +0200)]
Staging: ipack: update TODO file

With the latest patches, the TODO file was outdated.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: read more than one character from RX FIFO.
Samuel Iglesias Gonsalvez [Wed, 12 Sep 2012 12:55:43 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: read more than one character from RX FIFO.

The RX FIFO has a size of 3 characters. Check if when we are picking the
oldest one, we have more to read.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Get rid of ipoctal_list.
Jens Taprogge [Wed, 12 Sep 2012 12:55:42 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Get rid of ipoctal_list.

Use tty_dev->dev's drdata to associate struct ipocal_channel to the
respective tty_struct.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Use KBUILD_MODNAME instead of hardcoded string.
Jens Taprogge [Wed, 12 Sep 2012 12:55:41 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Use KBUILD_MODNAME instead of hardcoded string.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Check tty_register_device return value.
Jens Taprogge [Wed, 12 Sep 2012 12:55:40 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Check tty_register_device return value.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Clean up device removal.
Jens Taprogge [Wed, 12 Sep 2012 12:55:39 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Clean up device removal.

Make use of dev_set_drvdata() and dev_get_drvdata() to store and obtain
a pointer to the ipoctal struct corresponding to a struct dev.
Previously we relied on a private list of devices.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: Let interrupts return irqreturn_t.
Jens Taprogge [Wed, 12 Sep 2012 12:55:38 +0000 (14:55 +0200)]
Staging: ipack: Let interrupts return irqreturn_t.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: move tpci200_free_irq() and tpci200_request_irq()
Jens Taprogge [Wed, 12 Sep 2012 12:55:37 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: move tpci200_free_irq() and tpci200_request_irq()

Now, all the interrupt related functions are next to each other.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: More cleanups.
Jens Taprogge [Wed, 12 Sep 2012 12:55:36 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: More cleanups.

Rename __tpci_request_irq() to tpci_enable_irq() and __tpci_free_irq()
to tpci_disable_irq().  Change their second argument, move them above
tpci200_interrupt(), and use tpci_disable_irq() in the latter

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: Cleanup in tpci200_slot_irq() and tpci200_interrupt()
Jens Taprogge [Wed, 12 Sep 2012 12:55:35 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: Cleanup in tpci200_slot_irq() and tpci200_interrupt()

Minor cleanup.  No functional changes.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: Clean up interrupt handling.
Jens Taprogge [Wed, 12 Sep 2012 12:55:34 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: Clean up interrupt handling.

Previously the return value from tpci200_interrupt was not quite correct
if a slot had caused an interrupt but no handler was instellalled:
IRQ_NONE was returned.  However in this case we react to the interrupt
by disabling the IPack device interrupt.

Basically there are two cases the code now distinguishes:
 - The tpci200 has raised an interrupt.  We handle it and return
   IRQ_HANDLED.
 - Our device did not raise an interrupt. We return IRQ_NONE.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: Protect device registers with spinlock.
Jens Taprogge [Wed, 12 Sep 2012 12:55:33 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: Protect device registers with spinlock.

Some of the device registers are accessed from both interrupt and
non-interrupt context.  To ensure proper read-modify-write modification
of these registers we can not use the  "global" tpci200 mutex.  Instead
a spin-lock is used.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: RCU protect slot_irq pointers.
Jens Taprogge [Wed, 12 Sep 2012 12:55:32 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: RCU protect slot_irq pointers.

In tpci200_request_irq as well as tpci200_free_irq we set and unset the
pointer to struct slot_irq.  This pointer is accessed in
tpci200_interrupt.  To ensure that the pointer is not freed after it has
been fetched in tpci200_interrupt() it is now protected through RCU.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: remove superfluous function.
Jens Taprogge [Wed, 12 Sep 2012 12:55:31 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: remove superfluous function.

ipoctal_write_tty and ipoctal_write are merged.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Split interrupt service routine.
Jens Taprogge [Wed, 12 Sep 2012 12:55:30 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Split interrupt service routine.

Split the IRQ service routing in TX part and RX part.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Store isr masks in ipoctal_channel
Jens Taprogge [Wed, 12 Sep 2012 12:55:29 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Store isr masks in ipoctal_channel

This way interrupt handling becomes independent of the channel number.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: put ipoctal_channel into tty->driver_data.
Jens Taprogge [Wed, 12 Sep 2012 12:55:28 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: put ipoctal_channel into tty->driver_data.

Each tty's driver_data is now pointing to the channel it is talking to.  struct
ipoctal_channel contains all the information the callbacks require to do their
work.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: Directly use ioread/iowrite function.
Jens Taprogge [Wed, 12 Sep 2012 12:55:27 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: Directly use ioread/iowrite function.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: split ipoctal_channel from ipoctal.
Jens Taprogge [Wed, 12 Sep 2012 12:55:26 +0000 (14:55 +0200)]
Staging: ipack/devices/ipoctal: split ipoctal_channel from ipoctal.

By moving everything channel related into a separate struct we will be
able to clean up a lot of code.  In the end tty->driver_data will no
longer need to point to ipoctal but instead can point to the respective
channel.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: Clean up interrupt handler.
Jens Taprogge [Wed, 12 Sep 2012 12:55:25 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: Clean up interrupt handler.

This also removes a possible bug in the unhandles_ints part when
slots[i] is not set.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: Remove side effects of tpci200_{request,free}_irq.
Jens Taprogge [Wed, 12 Sep 2012 12:55:24 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: Remove side effects of tpci200_{request,free}_irq.

Use the __tpci200_{set,clear}_mask routines to access control
register.  Do not overwrite flags unrelated to interrupt handling.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: add helpers for writing control regs.
Jens Taprogge [Wed, 12 Sep 2012 12:55:23 +0000 (14:55 +0200)]
Staging: ipack/bridges/tpci200: add helpers for writing control regs.

Convert tpci200_set_clockrate and tpci200_interrupt.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging/gdm72xx: gdm_usb coding style clean up
Macpaul Lin [Wed, 12 Sep 2012 09:49:24 +0000 (17:49 +0800)]
staging/gdm72xx: gdm_usb coding style clean up

gdm_usb.* coding style clean up.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: xgifb: prevent video RAM size exceeding PCI window size
Aaro Koskinen [Tue, 11 Sep 2012 21:44:38 +0000 (00:44 +0300)]
staging: xgifb: prevent video RAM size exceeding PCI window size

Add a sanity check for the video RAM size. It should fit into the
PCI window.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: xgifb: validate the mode against video memory size
Aaro Koskinen [Tue, 11 Sep 2012 21:44:37 +0000 (00:44 +0300)]
staging: xgifb: validate the mode against video memory size

It's possible to select video mode that exceeds the available video
memory. This is potentially dangerous, fix by adding a check.

The patch fixes system hangs seen occasionally when playing random videos
with mplayer.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: silicom: remove S_IWOTH from proc declaration
Dan Carpenter [Wed, 12 Sep 2012 07:57:33 +0000 (10:57 +0300)]
Staging: silicom: remove S_IWOTH from proc declaration

We don't need these to be world writable or group writable.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agodrivers/staging/gdm72xx/gdm_sdio.c: Remove useless kfree
Peter Senna Tschudin [Wed, 12 Sep 2012 15:06:44 +0000 (17:06 +0200)]
drivers/staging/gdm72xx/gdm_sdio.c: Remove useless kfree

Remove useless kfree() and clean up code related to the removal.

The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
position p1,p2;
expression x;
@@

if (x@p1 == NULL) { ... kfree@p2(x); ... return ...; }

@unchanged exists@
position r.p1,r.p2;
expression e <= r.x,x,e1;
iterator I;
statement S;
@@

if (x@p1 == NULL) { ... when != I(x,...) S
                        when != e = e1
                        when != e += e1
                        when != e -= e1
                        when != ++e
                        when != --e
                        when != e++
                        when != e--
                        when != &e
   kfree@p2(x); ... return ...; }

@ok depends on unchanged exists@
position any r.p1;
position r.p2;
expression x;
@@

... when != true x@p1 == NULL
kfree@p2(x);

@depends on !ok && unchanged@
position r.p2;
expression x;
@@

*kfree@p2(x);
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agodrivers/staging/rtl8192u/r8192U_core.c: Remove useless kfree
Peter Senna Tschudin [Wed, 12 Sep 2012 15:06:43 +0000 (17:06 +0200)]
drivers/staging/rtl8192u/r8192U_core.c: Remove useless kfree

Remove useless kfree() and clean up code related to the removal.

The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
position p1,p2;
expression x;
@@

if (x@p1 == NULL) { ... kfree@p2(x); ... return ...; }

@unchanged exists@
position r.p1,r.p2;
expression e <= r.x,x,e1;
iterator I;
statement S;
@@

if (x@p1 == NULL) { ... when != I(x,...) S
                        when != e = e1
                        when != e += e1
                        when != e -= e1
                        when != ++e
                        when != --e
                        when != e++
                        when != e--
                        when != &e
   kfree@p2(x); ... return ...; }

@ok depends on unchanged exists@
position any r.p1;
position r.p2;
expression x;
@@

... when != true x@p1 == NULL
kfree@p2(x);

@depends on !ok && unchanged@
position r.p2;
expression x;
@@

*kfree@p2(x);
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Create and initialize new device id in InterfaceInit
Kevin McKinney [Wed, 12 Sep 2012 02:19:06 +0000 (22:19 -0400)]
Staging: bcm: Create and initialize new device id in InterfaceInit

This patch create and initalizes a new device
id of 0x172 as reported by Rinat Camalov
<richman1000000d@gmail.com>. In addition, a
comment is added to the potential invalid
existing device id.

Reported-by: Rinat Camalov <richman1000000d@gmail.com>
Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: adq12b: remove devpriv macro
H Hartley Sweeten [Tue, 11 Sep 2012 23:49:06 +0000 (16:49 -0700)]
staging: comedi: adq12b: remove devpriv macro

This macro relies on a local variable having a specific name.

Also, remove the kfree in the detach. The comedi core handles
the kfree of dev->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>
12 years agostaging: comedi: adl_pci9118: use cfc_check_trigger_src
H Hartley Sweeten [Tue, 11 Sep 2012 23:42:11 +0000 (16:42 -0700)]
staging: comedi: adl_pci9118: use cfc_check_trigger_src

The the cfc_check_trigger_src helper for the "step 1" tests in
pci9118_ai_cmdtest().

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>
12 years agostaging: comedi: adl_pci9118: remove forward declarations
H Hartley Sweeten [Tue, 11 Sep 2012 23:41:36 +0000 (16:41 -0700)]
staging: comedi: adl_pci9118: remove forward declarations

Move some 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>
12 years agostaging: comedi: adl_pci9118: remove commented out printk debug
H Hartley Sweeten [Tue, 11 Sep 2012 23:41:05 +0000 (16:41 -0700)]
staging: comedi: adl_pci9118: remove commented out printk debug

These debug messages should be removed from the final 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>
12 years agostaging: comedi: adl_pci9118: remove the function separation comments
H Hartley Sweeten [Tue, 11 Sep 2012 23:40:32 +0000 (16:40 -0700)]
staging: comedi: adl_pci9118: remove the function separation comments

These are just unnecessary whitespace.

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>
12 years agostaging: comedi: adl_pci9118: remove PCI9118_EXTDEBUG and DPRINTK
H Hartley Sweeten [Tue, 11 Sep 2012 23:39:44 +0000 (16:39 -0700)]
staging: comedi: adl_pci9118: remove PCI9118_EXTDEBUG and DPRINTK

These macros enable a bunch of function trace messages. These should
not be in the final 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>
12 years agostaging: comedi: adl_pci9118: remove devpriv and this_board macros
H Hartley Sweeten [Tue, 11 Sep 2012 23:39:10 +0000 (16:39 -0700)]
staging: comedi: adl_pci9118: remove devpriv and this_board macros

These macros rely on a local variable having a specific name.

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>
12 years agostaging: comedi: adv_pci1710: use cfc_check_trigger_is_unique
H Hartley Sweeten [Tue, 11 Sep 2012 22:09:39 +0000 (15:09 -0700)]
staging: comedi: adv_pci1710: use cfc_check_trigger_is_unique

Use the helper function cfc_check_trigger_is_unique for the "step 2a"
tests of pci171x_ai_cmdtest().

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>
12 years agostaging: comedi: adv_pci1710: single source triggers are unique
H Hartley Sweeten [Tue, 11 Sep 2012 22:09:23 +0000 (15:09 -0700)]
staging: comedi: adv_pci1710: single source triggers are unique

If a single source trigger passes "step 1" of the do_cmdtest function
they are already unique. There is no need to recheck 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>
12 years agostaging: comedi: adv_pci1710: use cfc_check_trigger_src
H Hartley Sweeten [Tue, 11 Sep 2012 22:09:06 +0000 (15:09 -0700)]
staging: comedi: adv_pci1710: use cfc_check_trigger_src

Use the helper function cfc_check_trigger_src for the "step 1"
tests of pci171x_ai_cmdtest().

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>
12 years agostaging: comedi: adv_pci1710: remove "dummy" boardinfo entry
H Hartley Sweeten [Tue, 11 Sep 2012 22:08:52 +0000 (15:08 -0700)]
staging: comedi: adv_pci1710: remove "dummy" boardinfo entry

The legacy attach used the "dummy" boardinfo entry to allow
matching a boardinfo to a pci card based on the "name" passed
by the comedi core. This driver now uses the PCI auto config
mechanism which always matches to the PCI vendor/device ids.

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>
12 years agostaging: comedi: adv_pci1710: remove unnecessary 'valid'
H Hartley Sweeten [Tue, 11 Sep 2012 22:08:37 +0000 (15:08 -0700)]
staging: comedi: adv_pci1710: remove unnecessary 'valid'

The 'valid' variable in the private data is only used in the
detach of the board to determine if the pci1710_reset() function
can be called. That function only requires a valid dev->iobase
to work. Use that for the check instead and remove the unneeded
variable from the private 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>
12 years agostaging: comedi: adv_pci1710: use attach_pci callback
H Hartley Sweeten [Tue, 11 Sep 2012 22:08:21 +0000 (15:08 -0700)]
staging: comedi: adv_pci1710: use attach_pci callback

Convert this PCI driver to use the comedi PCI auto config attach
mechanism by adding an 'attach_pci' callback function. Since the
driver does not require any external configuration options, and
the legacy 'attach' callback is now optional, remove it.

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>
12 years agostaging: comedi: adv_pci1710: remove board attach noise
H Hartley Sweeten [Tue, 11 Sep 2012 22:08:06 +0000 (15:08 -0700)]
staging: comedi: adv_pci1710: remove board attach noise

Remove the kernel message noise during the attach of the board.
Use a simple/clean dev_info at the end of the attach.

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>
12 years agoStaging: silicom: checkpatch cleanup: header tabs n spaces
Daniel Cotey [Wed, 12 Sep 2012 05:29:55 +0000 (22:29 -0700)]
Staging: silicom: checkpatch cleanup: header tabs n spaces

Fix defines to comply with style guidelines

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: silicom: minor cleanup: remove unused define
Daniel Cotey [Wed, 12 Sep 2012 05:29:06 +0000 (22:29 -0700)]
Staging: silicom: minor cleanup: remove unused define

DEVICE_NODE not used

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: silicom: checkpatch: cleanup macros
Daniel Cotey [Wed, 12 Sep 2012 05:28:08 +0000 (22:28 -0700)]
Staging: silicom: checkpatch: cleanup macros

Fix msec_delay_bp macro formatting

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: adl_pci9111: remove pci_dev_put()
H Hartley Sweeten [Tue, 11 Sep 2012 20:54:21 +0000 (13:54 -0700)]
staging: comedi: adl_pci9111: remove pci_dev_put()

This driver no longer walks the pci bus to find the pci_dev.
The pci_dev_put() is no longer needed.

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>
12 years agostaging: comedi: icp_multi: remove the function description comments
H Hartley Sweeten [Tue, 11 Sep 2012 20:51:16 +0000 (13:51 -0700)]
staging: comedi: icp_multi: remove the function description comments

These comments are pretty obvious. Remove 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>
12 years agostaging: comedi: icp_multi: remove devpriv macro
H Hartley Sweeten [Tue, 11 Sep 2012 20:50:56 +0000 (13:50 -0700)]
staging: comedi: icp_multi: remove devpriv macro

This macro relies on a local variable having a specific name.

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>
12 years agostaging: comedi: icp_multi: use attach_pci callback
H Hartley Sweeten [Tue, 11 Sep 2012 20:50:41 +0000 (13:50 -0700)]
staging: comedi: icp_multi: use attach_pci callback

Convert this PCI driver to use the comedi PCI auto config attach
mechanism by adding an 'attach_pci' callback function. Since the
driver does not require any external configuration options, and
the legacy 'attach' callback is now optional, remove it. The
boardinfo is also not needed now so remove it also.

This also allows removing the icp_multi.h header completely.

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>
12 years agostaging: comedi: icp_multi: remove board attach noise
H Hartley Sweeten [Tue, 11 Sep 2012 20:50:06 +0000 (13:50 -0700)]
staging: comedi: icp_multi: remove board attach noise

Remove the kernel message noise during the attach of the board.
Use a simple/clean dev_info at the end of the attach.

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>
12 years agostaging: comedi: icp_multi: the number of subdevices is fixed
H Hartley Sweeten [Tue, 11 Sep 2012 20:49:43 +0000 (13:49 -0700)]
staging: comedi: icp_multi: the number of subdevices is fixed

This board always has 5 subdevices.

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>
12 years agostaging: comedi: icp_multi: remove have_irq from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:49:26 +0000 (13:49 -0700)]
staging: comedi: icp_multi: remove have_irq from boardinfo

The board supported by this driver always supports interrupts.
Remove the boardinfo.

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>
12 years agostaging: comedi: icp_multi: remove iorange from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:49:10 +0000 (13:49 -0700)]
staging: comedi: icp_multi: remove iorange from boardinfo

This variable is not used in the driver. Remove it.

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>
12 years agostaging: comedi: icp_multi: remove cardtype from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:48:50 +0000 (13:48 -0700)]
staging: comedi: icp_multi: remove cardtype from boardinfo

This variable is not used in the driver. Remove it.

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>
12 years agostaging: comedi: icp_multi: remove rangecode from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:48:27 +0000 (13:48 -0700)]
staging: comedi: icp_multi: remove rangecode from boardinfo

The analog inputs and outputs for this driver use the same table
to set the analog range. Remove the boardinfo for it and just
reference the table 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>
12 years agostaging: comedi: icp_multi: remove rangelist_ai from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:48:09 +0000 (13:48 -0700)]
staging: comedi: icp_multi: remove rangelist_ai from boardinfo

There is only one board type supported by this driver and the
analog input ranges are constant. Remove the boardinfo for it.

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>
12 years agostaging: comedi: icp_multi: remove ranglist_ao from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:47:52 +0000 (13:47 -0700)]
staging: comedi: icp_multi: remove ranglist_ao from boardinfo

This variable is not used by the driver. Remove it.

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>
12 years agostaging: comedi: icp_multi: remove ai_maxdata from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:47:36 +0000 (13:47 -0700)]
staging: comedi: icp_multi: remove ai_maxdata from boardinfo

The analog inputs of this board always have 12-bit resolution.
Remove the boardinfo and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove ao_maxdata from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:47:20 +0000 (13:47 -0700)]
staging: comedi: icp_multi: remove ao_maxdata from boardinfo

The analog outputs of this board always have 12-bit resolution.
Remove the boardinfo and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove n_aichand from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:47:03 +0000 (13:47 -0700)]
staging: comedi: icp_multi: remove n_aichand from boardinfo

The analog inputs for this board always support differential
inputs and the number of channels is half the normal analog
input number.

Remove the n_aichand field from the boardinfo and fix the code
accordingly.

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>
12 years agostaging: comedi: icp_multi: remove n_aichan from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:46:34 +0000 (13:46 -0700)]
staging: comedi: icp_multi: remove n_aichan from boardinfo

There is only one board type supported by this driver and the
number of analog input channels is constant. Remove the
boardinfo for it and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove n_aochan from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:46:17 +0000 (13:46 -0700)]
staging: comedi: icp_multi: remove n_aochan from boardinfo

There is only one board type supported by this driver and the
number of analog output channels is constant. Remove the
boardinfo for it and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove n_dichan from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:46:02 +0000 (13:46 -0700)]
staging: comedi: icp_multi: remove n_dichan from boardinfo

There is only one board type supported by this driver and the
number of digital input channels is constant. Remove the
boardinfo for it and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove n_dochan from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:45:46 +0000 (13:45 -0700)]
staging: comedi: icp_multi: remove n_dochan from boardinfo

There is only one board type supported by this driver and the
number of digital output channels is constant. Remove the
boardinfo for it and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove n_ctrs from boardinfo
H Hartley Sweeten [Tue, 11 Sep 2012 20:45:31 +0000 (13:45 -0700)]
staging: comedi: icp_multi: remove n_ctrs from boardinfo

There is only one board type supported by this driver and the
number of counter channels is constant. Remove the boardinfo
for it and just open-code the value.

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>
12 years agostaging: comedi: icp_multi: remove ICP_MULTI_EXTDEBUG
H Hartley Sweeten [Tue, 11 Sep 2012 20:45:16 +0000 (13:45 -0700)]
staging: comedi: icp_multi: remove ICP_MULTI_EXTDEBUG

This define enables a bunch of function trace messages. These
should be removed in the final 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>
12 years agostaging: comedi: icp_multi: convert to a pci_driver
H Hartley Sweeten [Tue, 11 Sep 2012 20:44:59 +0000 (13:44 -0700)]
staging: comedi: icp_multi: convert to a pci_driver

This driver is for a PCI device not a legacy device.

Convert it from a module_comedi_driver to a module_comedi_pci_driver.
This will allow using the comedi_pci_auto_config mechanism to attach
to the device.

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>
12 years agoStaging: ipack/bridges/tpci200: Store the irq holder in slot_irq.
Jens Taprogge [Tue, 11 Sep 2012 11:35:13 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: Store the irq holder in slot_irq.

This way we do no longer need to keep a dangling pointer to struct
ipack_device in tpci200_slot after the device has been removed.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: delete .remove_device() callback
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:12 +0000 (13:35 +0200)]
Staging: ipack: delete .remove_device() callback

As the IP module driver takes care of freeing its resources.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove tpci200_slot_unregister
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:11 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: remove tpci200_slot_unregister

It is not needed as the IP module should free its IRQ using
tpci200_free_irq callback.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: delete ipack_device_unregister calls when exiting
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:10 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: delete ipack_device_unregister calls when exiting

As the ipack_bus_unregister() takes care of unregistering the devices plugged
in the carrier, it is not needed to do it in the carrier driver.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: unregister devices when uninstall the carrier device.
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:09 +0000 (13:35 +0200)]
Staging: ipack: unregister devices when uninstall the carrier device.

Find the IP modules that are plugged to the carrier and unregister them.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: free the IRQ.
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:08 +0000 (13:35 +0200)]
Staging: ipack/devices/ipoctal: free the IRQ.

As the IRQ was requested by the driver, it should free it also.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: change exiting procedure
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:07 +0000 (13:35 +0200)]
Staging: ipack/devices/ipoctal: change exiting procedure

The ipoctal devices can be uninstalled from the ipack_driver_unregister()
call as the device model calles the bus's .remove() function for each device
registered by the driver and it will execute the .remove() function of the
ipoctal driver.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: fix the uninstall the ipack device
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:06 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: fix the uninstall the ipack device

Using the call to the ipack_device_unregister() function to avoid the
strange way it was doing, as the device model will take care of calling
the bus's .remove function when a device is being unregistered.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: increment the reference counter of the pci_dev
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:05 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: increment the reference counter of the pci_dev

As indicated in the documentation of pci_dev_get.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: reorder the iounmap and pci_release_region
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:04 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: reorder the iounmap and pci_release_region

Move iounmap and pci_release_region to tpci200_unregister(), as it is the place
where the clean-up of the device is done.

Also, renamed iounmap() to pci_iounmap() as the mapped region was requested
from PCI bus.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: check the device ID space CRC.
Jens Taprogge [Tue, 11 Sep 2012 11:35:03 +0000 (13:35 +0200)]
Staging: ipack: check the device ID space CRC.

We check the CRC and store the result of the check in struct ipac_device.
A warning is emitted if the check fails.  However we leave it to the
IPack module device to refuse to initialize due to a bad CRC.  I have seen
otherwise good modules with bad CRCs.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: reset previous timeouts during device registration.
Jens Taprogge [Tue, 11 Sep 2012 11:35:02 +0000 (13:35 +0200)]
Staging: ipack: reset previous timeouts during device registration.

Resetting the previous timeout we avoid to read the timeout status register
and see timeout errors that don't correspond to the present state of the
device.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: Switch to 8MHz operation before reading ID.
Jens Taprogge [Tue, 11 Sep 2012 11:35:01 +0000 (13:35 +0200)]
Staging: ipack: Switch to 8MHz operation before reading ID.

Reading the ID space at 8 MHz is always supported.  Most carriers will
boot up in 8MHz mode.  Still, play it safe and ensure we are operating at
8Mhz.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove struct list_head
Samuel Iglesias Gonsálvez [Tue, 11 Sep 2012 11:35:00 +0000 (13:35 +0200)]
Staging: ipack/bridges/tpci200: remove struct list_head

As the linked list was removed before, delete the useless struct list_head

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: remove field driver from struct ipack_device.
Jens Taprogge [Tue, 11 Sep 2012 11:34:59 +0000 (13:34 +0200)]
Staging: ipack: remove field driver from struct ipack_device.

After a successful match is found the driver field in struct device is
set by the core device code. We can use this field.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: Choose the optimum bus speed by default.
Jens Taprogge [Tue, 11 Sep 2012 11:34:58 +0000 (13:34 +0200)]
Staging: ipack: Choose the optimum bus speed by default.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: Obtain supported speeds from ID ROM.
Jens Taprogge [Tue, 11 Sep 2012 11:34:57 +0000 (13:34 +0200)]
Staging: ipack: Obtain supported speeds from ID ROM.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: provide new callbacks to tpci200
Jens Taprogge [Tue, 11 Sep 2012 11:34:56 +0000 (13:34 +0200)]
Staging: ipack/bridges/tpci200: provide new callbacks to tpci200

Provide get_clockrate, set_clockrate, get_error, get_timeout and reset_timeout
callbacks.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>