openwrt/staging/blogic.git
12 years agoStaging: ipack/bridges/tpci200: change device table definition and export it.
Miguel Gómez [Thu, 7 Jun 2012 08:24:58 +0000 (10:24 +0200)]
Staging: ipack/bridges/tpci200: change device table definition and export it.

Use DEFINE_PCI_DEVICE_TABLE() to create the device table and add
MODULE_DEVICE_TABLE() to export it.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: remove unused enum uart_parity_e.
Miguel Gómez [Thu, 7 Jun 2012 08:24:57 +0000 (10:24 +0200)]
Staging: ipack/devices/ipoctal: remove unused enum uart_parity_e.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: remove error_flag field from ipoctal struct.
Miguel Gómez [Thu, 7 Jun 2012 08:24:56 +0000 (10:24 +0200)]
Staging: ipack/devices/ipoctal: remove error_flag field from ipoctal struct.

Remove the error_flag field from the ipoctal structure, as the error code
is handled through the tty abstraction. Remove the values definition as well.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: remove ipoctal_config structure.
Miguel Gómez [Thu, 7 Jun 2012 08:24:55 +0000 (10:24 +0200)]
Staging: ipack/devices/ipoctal: remove ipoctal_config structure.

The configuration of the communication channel is handled by the tty
abstraction, so the ipoctal_config structure has become useless and it's
only used to store values that are never accesed. Remove it.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove gotos in tpci200_install()
Miguel Gómez [Thu, 7 Jun 2012 08:24:54 +0000 (10:24 +0200)]
Staging: ipack/bridges/tpci200: remove gotos in tpci200_install()

Remove the gotos when handling error conditions, as the code gets clearer
and the gotos are not really avoiding code replication.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove "out" label in tpci200_request_irq()
Miguel Gómez [Thu, 7 Jun 2012 08:24:53 +0000 (10:24 +0200)]
Staging: ipack/bridges/tpci200: remove "out" label in tpci200_request_irq()

Remove the "out" label from tpci200_request_irq(), as it can directly return
the error code instead of jumping.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove useless break in tpci200_slot_map_space()
Miguel Gómez [Thu, 7 Jun 2012 08:24:52 +0000 (10:24 +0200)]
Staging: ipack/bridges/tpci200: remove useless break in tpci200_slot_map_space()

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove "out" label in tpci200_slot_map_space()
Miguel Gómez [Thu, 7 Jun 2012 08:24:51 +0000 (10:24 +0200)]
Staging: ipack/bridges/tpci200: remove "out" label in tpci200_slot_map_space()

Remove the "out" label from tpci200_slot_map_space(), as it can directly return
the error code instead of jumping.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq().
Miguel Gómez [Thu, 7 Jun 2012 09:10:17 +0000 (11:10 +0200)]
Staging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq().

Handle error conditions with simple returns instead of usig gotos.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:magnetometer:ak8975: remove 'mode' attribute
Leed Aguilar [Wed, 6 Jun 2012 20:16:02 +0000 (16:16 -0400)]
staging:iio:magnetometer:ak8975: remove 'mode' attribute

The raw data reading process (ak8975_read_axis) sets the
single measurement mode to take a sample and once the
conversion is completed the device enters into power-down
mode automatically, therefore there is no need to enable
a flag for this to happen.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:magnetometer:ak8975: use gpio_request_one api
Leed Aguilar [Wed, 6 Jun 2012 20:15:40 +0000 (16:15 -0400)]
staging:iio:magnetometer:ak8975: use gpio_request_one api

Use gpio_request_one api, it looks cleaner.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:magnetometer:ak8975: set power-down mode after reading fuse ROM data
Leed Aguilar [Wed, 6 Jun 2012 20:14:56 +0000 (16:14 -0400)]
staging:iio:magnetometer:ak8975: set power-down mode after reading fuse ROM data

Fuse ROM data access mode is the only mode which does not
transition to power-down mode automatically.

As per the AK8975 data sheet, it is recomended to set the
power-down mode first before attempting to change into
another mode.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: iio_enum_available_read: Prevent possible buffer overflow
Lars-Peter Clausen [Tue, 5 Jun 2012 16:24:12 +0000 (18:24 +0200)]
iio: iio_enum_available_read: Prevent possible buffer overflow

Use scnprint instead of snprintf, because snprintf returns the number of bytes
that would have been written to the buffer if there was enough space, and as a
result writing to buf[len-1] might cause a access beyond the buffers limits.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: adf4350: fix compiler warning [-Wuninitialized]
Michael Hennerich [Tue, 5 Jun 2012 09:52:18 +0000 (11:52 +0200)]
iio: adf4350: fix compiler warning [-Wuninitialized]

drivers/iio/frequency/adf4350.c:316:32: warning: ‘val’ may be used uninitialized in this function
[-Wuninitialized]

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: change pr_* usage for dev_* functions
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 11:08:13 +0000 (13:08 +0200)]
Staging: ipack/devices/ipoctal: change pr_* usage for dev_* functions

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: change pr_* usage for dev_* functions
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 11:08:12 +0000 (13:08 +0200)]
Staging: ipack/bridges/tpci200: change pr_* usage for dev_* functions

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: fix kernel oops when uninstalling a device
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 08:03:05 +0000 (10:03 +0200)]
Staging: ipack/bridges/tpci200: fix kernel oops when uninstalling a device

When uninstalling a device, the call to the ipack_bus_ops remove() frees
resources in the ipack device driver but without unregistering the device.

It generates a kernel oops when somebody wants to unregister the device.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: avoid dereference of a freed tpci200->info
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 08:03:04 +0000 (10:03 +0200)]
Staging: ipack/bridges/tpci200: avoid dereference of a freed tpci200->info

tpci200->info is used later when uninstalling the module. As there is another
kfree in the proper place, this patch removes the wrong one.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/devices/ipoctal: avoid kernel oops when uninstalling
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 08:03:03 +0000 (10:03 +0200)]
Staging: ipack/devices/ipoctal: avoid kernel oops when uninstalling

When uninstalling a device, there is a loop of calls that produces, at the end,
two calls to __ipoctal_remove() function with the same ipack_device argument.

The first time works fine, but the second will fail in tty_unregister_driver()

To avoid this situation, the call to __ipoctal_remove() it is done only from the
ipack bus driver and not from the ipack device driver.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: delete the call to remove() in ipack_driver_register
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 08:03:02 +0000 (10:03 +0200)]
Staging: ipack: delete the call to remove() in ipack_driver_register

When a bus driver calls ipack_driver_register(), it should manages the returning
NULL value to undo all the operations it did before this call, and print the
corresponding trace.

It is not a task for the ipack driver to call the remove() function here.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: use idr interface for numbering buses
Samuel Iglesias Gonsalvez [Fri, 25 May 2012 08:03:01 +0000 (10:03 +0200)]
Staging: ipack: use idr interface for numbering buses

Use idr interface to give the bus number. That way, we remove the
limitation of 64 buses.

The mutex is removed because the ida interface uses spinlocks inside, so it is
not needed an extra lock.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: removed check of tpci200->slots[dev->slot].dev
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:47 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: removed check of tpci200->slots[dev->slot].dev

When ipack_device_register() is called, the variable
tpci200->slots[dev->slot].dev has not assigned a value and it gives an error
when the mezzanine driver is reading a register from the board for the match()
function, as all the I/O functions call check_slot().

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 name field from slot_irq
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:46 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: remove name field from slot_irq

This field is not needed at all, as the IRQ is registered for the carrier not
for the mezzanine.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: fix indention.
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:45 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: fix indention.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: check if the remove function is available
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:44 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: check if the remove function is available

To avoid a dereference of a NULL pointer, the availability of the function is
checked before its use.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: tpci200_slot_map_space() should return 0 if succeed.
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:43 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: tpci200_slot_map_space() should return 0 if succeed.

tpci200_slot_map_space() should return 0 if the operation was properly
done. If not, the caller will think that something wrong happened.

This patch establish the returned value to 0. It is overwritten in case of
error.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: tpci200_slot_unmap_space() should return 0 if succeed.
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:42 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: tpci200_slot_unmap_space() should return 0 if succeed.

tpci200_slot_unmap_space() should return 0 if the operation was properly done. If
not, the caller will think that something wrong happened.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: return proper value in match() function
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:41 +0000 (15:54 +0200)]
Staging: ipack: return proper value in match() function

It should return the same value given by the match function of the ipack_driver
that has been called.

Returning 0 here, means that the match has failed and it could be succeed.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack/bridges/tpci200: delete sysfs files
Samuel Iglesias Gonsalvez [Wed, 23 May 2012 13:54:40 +0000 (15:54 +0200)]
Staging: ipack/bridges/tpci200: delete sysfs files

To perform the installation of a mezzanine it was needed to write on these
files, now it is not needed at all as the device model is properly implemented.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: ipack: Remove version.h header file inclusion
Sachin Kamat [Mon, 4 Jun 2012 06:14:27 +0000 (11:44 +0530)]
Staging: ipack: Remove version.h header file inclusion

version.h header file is no longer required.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: iio: ak8975: Make it behave better as modules
Shubhrajyoti D [Mon, 4 Jun 2012 09:41:05 +0000 (15:11 +0530)]
staging: iio: ak8975: Make it behave better as modules

The memory regions of the probe and remove are move
to __devinit and __devexit respectively.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: iio: hmc5843: Make it behave better as modules
Shubhrajyoti D [Mon, 4 Jun 2012 09:41:04 +0000 (15:11 +0530)]
staging: iio: hmc5843: Make it behave better as modules

The memory regions of the probe and remove are move
to __devinit and __devexit respectively.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio: Move DAC drivers out of staging
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:28 +0000 (11:36 +0200)]
staging:iio: Move DAC drivers out of staging

The IIO DAC drivers are in a reasonably good shape. They all make use of channel
spec and non of them provides non-documented sysfs attributes. Code style should
be OK as well, both checkpatch and coccicheck only report trivial issues.

So lets move the whole folder out of staging.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5791: Move private structs and defines from header to C file
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:27 +0000 (11:36 +0200)]
staging:iio:dac:ad5791: Move private structs and defines from header to C file

The header for this driver contains some private structs and defines, which do
not have to be shared between multiple source files, as well as the platform
data struct for this driver, which has to be shared with other source files.
Since there is no need to expose those private structs and defines move them to
the source file.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5504: Move private structs and defines from header to C file
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:26 +0000 (11:36 +0200)]
staging:iio:dac:ad5504: Move private structs and defines from header to C file

The header for this driver contains some private structs and defines, which do
not have to be shared between multiple source files, as well as the platform
data struct for this driver, which has to be shared with other source files.
Since there is no need to expose those private structs and defines move them to
the source file.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5504: Check if IRQ was requested before freeing it
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:25 +0000 (11:36 +0200)]
staging:iio:dac:ad5504: Check if IRQ was requested before freeing it

IRQ support is optional, so we have to check whether it was actually requested
before we attempt to free it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5791: Use strtobool for boolean values
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:24 +0000 (11:36 +0200)]
staging:iio:dac:ad5791: Use strtobool for boolean values

Use strtobool for parsing the powerdown value instead of strict_strtol, since
the powerdown attribute is a boolean value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5624r: Use strtobool for boolean values
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:23 +0000 (11:36 +0200)]
staging:iio:dac:ad5624r: Use strtobool for boolean values

Use strtobool for parsing the powerdown value instead of strict_strtol, since
the powerdown attribute is a boolean value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5504: Use strtobool for boolean values
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:22 +0000 (11:36 +0200)]
staging:iio:dac:ad5504: Use strtobool for boolean values

Use strtobool for parsing the powerdown value instead of strict_strtol, since
the powerdown attribute is a boolean value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac: Remove dac.h
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:21 +0000 (11:36 +0200)]
staging:iio:dac: Remove dac.h

Now that all drivers have been converted to channel spec, we can finally remove
the dac.h file since it is no longer used.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:max517: Convert to channel spec
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:20 +0000 (11:36 +0200)]
staging:iio:dac:max517: Convert to channel spec

Convert the max517 driver to channel spec. As part of the conversion the
"out_voltage_1&2_raw" property, which updates both channel 1 and 2
simultaneously with the same value, is lost, since this is not really covered by
the IIO spec and has only a limited use case in practice.

Also the channel index for the sysfs files is now zero based instead of one
based, which means all channel numbers will be lower by one. E.g.
"out_voltage_1_scale" instead of "out_voltage_2_scale"

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac: Remove unused dac.h includes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:19 +0000 (11:36 +0200)]
staging:iio:dac: Remove unused dac.h includes

None of these drivers use anything from dac.h, so remove the include.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5791: Convert to extended channel attributes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:18 +0000 (11:36 +0200)]
staging:iio:dac:ad5791: Convert to extended channel attributes

Use extended channel attributes instead of raw sysfs files for the additional
channel attributes. This allows us to remove some boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5686: Convert to extended channel attributes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:17 +0000 (11:36 +0200)]
staging:iio:dac:ad5686: Convert to extended channel attributes

Use extended channel attributes instead of raw sysfs files for the additional
channel attributes. This allows us to remove some boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5624r: Convert to extended channel attributes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:16 +0000 (11:36 +0200)]
staging:iio:dac:ad5624r: Convert to extended channel attributes

Use extended channel attributes instead of raw sysfs files for the additional
channel attributes. This allows us to remove some boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5504: Convert to extended channel attributes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:15 +0000 (11:36 +0200)]
staging:iio:dac:ad5504: Convert to extended channel attributes

Use extended channel attributes instead of raw sysfs files for the additional
channel attributes. This allows us to remove some boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5380: Convert to extended channel attributes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:14 +0000 (11:36 +0200)]
staging:iio:dac:ad5380: Convert to extended channel attributes

Use extended channel attributes instead of raw sysfs files for the additional
channel attributes. This allows us to remove some boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5446: Use iio_enum for powerdown modes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:13 +0000 (11:36 +0200)]
staging:iio:dac:ad5446: Use iio_enum for powerdown modes

This allows us to remove some boilerplate code for comparing and formatting the
enum strings.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging:iio:dac:ad5064: Use iio_enum for powerdown modes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:12 +0000 (11:36 +0200)]
staging:iio:dac:ad5064: Use iio_enum for powerdown modes

This allows us to remove some boilerplate code for comparing and formatting the
enum strings.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: Add helper functions for enum style channel attributes
Lars-Peter Clausen [Mon, 4 Jun 2012 09:36:11 +0000 (11:36 +0200)]
iio: Add helper functions for enum style channel attributes

We often have the case were we do have a enum style channel attribute. These
attributes have in common that they are a list of string values which usually
map in a 1-to-1 fashion to integer values.

This patch implements some common helper code for implementing enum style
channel attributes using extended channel attributes. The helper functions take
care of converting between the string and integer values, as well providing a
function for "_available" attributes which list all available enum items.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio:inkern: Use iio_device_{get,put}
Lars-Peter Clausen [Mon, 4 Jun 2012 08:50:03 +0000 (10:50 +0200)]
iio:inkern: Use iio_device_{get,put}

Use iio_device_get and iio_device_put instead of open-coding it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: Add iio_device_get()
Lars-Peter Clausen [Mon, 4 Jun 2012 08:50:02 +0000 (10:50 +0200)]
iio: Add iio_device_get()

This patch add the iio_device_get() function, which increases the reference
count of a iio device. The matching function to decrease the reference count -
iio_device_put() - already exists.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: iio: Remove version.h header file inclusion
Sachin Kamat [Mon, 4 Jun 2012 06:04:49 +0000 (11:34 +0530)]
staging: iio: Remove version.h header file inclusion

version.h header file is no longer required.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: frequency: New driver for Analog Devices ADF4350/ADF4351 Wideband Synthesizers
Michael Hennerich [Tue, 29 May 2012 10:41:20 +0000 (12:41 +0200)]
iio: frequency: New driver for Analog Devices ADF4350/ADF4351 Wideband Synthesizers

Changes since V1:
Apply Jonathan's review feedback:
    Introduce and use IIO_ALTVOLTAGE.
    Fix up comments and documentation.
    Remove dead code.
    Reorder some code fragments.
    Add missing iio_device_free.

Convert to new API.
Fix-up out of staging includes.
Removed pll_locked attribute.

Changes since V2:
Use module_spi_driver.
adf4350_remove: move gpio_free after regulator.
target patch to drivers/iio

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator
Michael Hennerich [Tue, 29 May 2012 10:41:19 +0000 (12:41 +0200)]
iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator

Changes since V1:

Apply Jonathan's review feedback:
Revise device status attribute names, and split documentation into two sections.
Add additional comments, and fix indention issues.
Remove pointless zero initializations.
Revise return value handling.
Simplify some code sections.
Split store_eeprom and sync handling into separate functions.
Use strtobool where applicable.
Document platform data structures using kernel-doc style.

Use dev_to_iio_dev
write_raw IIO_CHAN_INFO_FREQUENCY: Reject values <= 0
Make patch target drivers/iio

Changes since V2:

Use for_each_clear_bit() and __set_bit() where applicable.
Add descriptive comment.
Avoid temporary for struct regulator.
spi_device_id name use ad9523-1, ad9523 will be added later.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoiio: add LM3533 ambient-light-sensor driver
Johan Hovold [Mon, 21 May 2012 12:18:06 +0000 (14:18 +0200)]
iio: add LM3533 ambient-light-sensor driver

Add sub-driver for the ambient-light-sensor interface on National
Semiconductor / TI LM3533 lighting power chips.

The sensor interface can be used to control the LEDs and backlights of
the chip through defining five light zones and three sets of
corresponding output-current values.

The driver provides raw and mean adc readings along with the current
light zone through sysfs. A threshold event can be generated on zone
changes. The ALS-control output values can be set per zone for the three
current output channels.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _MINI_ADAPTER and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:12 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _MINI_ADAPTER and call directly.

This patch removes typedef for _MINI_ADAPTER, changes the
name of the struct from _MINI_ADAPTER to bcm_mini_adapter.
In addition, any calls to the following typedefs
"MINI_ADAPTER, *PMINI_ADAPTER" are changed to call
the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _LEADER and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:11 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _LEADER and call directly.

This patch removes typedef for _LEADER, changes the
name of the struct from _LEADER to bcm_leader.
In addition, any calls to the following typedefs
"LEADER, *PLEADER" are changed to call
the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _PACKETTOSEND and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:10 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _PACKETTOSEND and call directly.

This patch removes typedef for _PACKETTOSEND, changes the
name of the struct from _PACKETTOSEND to bcm_packettosend.
In addition, any calls to the following typedefs
"PACKETTOSEND, *PPACKETTOSEND" are changed to call
the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _CONTROL_PACKET and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:09 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _CONTROL_PACKET and call directly.

This patch removes typedef for _CONTROL_PACKET,
changes the name of the struct from _CONTROL_PACKET
to bcm_control_packet. In addition, any calls to the
following typedefs "CONTROL_PACKET, *PCONTROL_PACKET"
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for link_request and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:08 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for link_request and call directly.

This patch removes typedef for link_request, changes the
name of the struct from link_request to bcm_link_request.
In addition, any calls to the following typedefs
"LINK_REQUEST, *PLINK_REQUEST, *CONTROL_MESSAGE"
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _ADD_CONNECTION.
Kevin McKinney [Sat, 26 May 2012 16:05:07 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _ADD_CONNECTION.

This patch removes typedef for _ADD_CONNECTION,
because it is not being used.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _CLASSIFICATION_RULE.
Kevin McKinney [Sat, 26 May 2012 16:05:06 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _CLASSIFICATION_RULE.

This patch removes typedef for _CLASSIFICATION_RULE,
because it is not being used.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _CLASSIFICATION_ONLY.
Kevin McKinney [Sat, 26 May 2012 16:05:05 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _CLASSIFICATION_ONLY.

This patch removes typedef for _CLASSIFICATION_ONLY,
because it is not being used.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _S_HDR_SUPRESSION_CONTEXTINFO and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:04 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _S_HDR_SUPRESSION_CONTEXTINFO and call directly.

This patch removes typedef for
_S_HDR_SUPRESSION_CONTEXTINFO, changes the name
of the struct from _S_HDR_SUPRESSION_CONTEXTINFO
to bcm_hdr_supression_contextinfo. In addition,
any calls to the following typedefs
"S_HDR_SUPRESSION_CONTEXTINFO" are changed to call the
struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _S_CLASSIFIER_RULE and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:03 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _S_CLASSIFIER_RULE and call directly.

This patch removes typedef for _S_CLASSIFIER_RULE,
changes the name of the struct from
_S_CLASSIFIER_RULE to bcm_classifier_rule.
In addition, any calls to the following typedefs
"S_CLASSIFIER_RULE" are changed to call the
struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _S_FRAGMENTED_PACKET_INFO and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:02 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _S_FRAGMENTED_PACKET_INFO and call directly.

This patch removes typedef for _S_FRAGMENTED_PACKET_INFO,
changes the name of the struct from
_S_FRAGMENTED_PACKET_INFO to bcm_fragmented_packet_info.
In addition, any calls to the following typedefs
"S_FRAGMENTED_PACKET_INFO, *PS_FRAGMENTED_PACKET_INFO"
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _packet_info and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:01 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _packet_info and call directly.

This patch removes typedef for _packet_info,
changes the name of the struct from
_packet_info to bcm_packet_info.
In addition, any calls to the following typedefs
"PacketInfo, _packet_info" are changed to call the
struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _PER_TARANG_DATA and call directly.
Kevin McKinney [Sat, 26 May 2012 16:05:00 +0000 (12:05 -0400)]
Staging: bcm: Remove typedef for _PER_TARANG_DATA and call directly.

This patch removes typedef for _PER_TARANG_DATA,
changes the name of the struct from
_PER_TARANG_DATA to bcm_per_tarang_data.
In addition, any calls to the following typedefs
"PER_TARANG_DATA, *PPER_TARANG_DATA" are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove condition check on macro REL_4_1 because it is not used.
Kevin McKinney [Sat, 26 May 2012 16:04:59 +0000 (12:04 -0400)]
Staging: bcm: Remove condition check on macro REL_4_1 because it is not used.

This patch removes the conditional check on
macro REL_4_1, and the corresponding controlled
text because it is not used.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _STTARGETDSXBUFFER and call directly.
Kevin McKinney [Sat, 26 May 2012 16:04:58 +0000 (12:04 -0400)]
Staging: bcm: Remove typedef for _STTARGETDSXBUFFER and call directly.

This patch removes typedef for _STTARGETDSXBUFFER,
changes the name of the struct from
_STTARGETDSXBUFFER to bcm_targetdsx_buffer.
In addition, any calls to the following typedefs
"STTARGETDSXBUFFER, *PSTTARGETDSXBUFFER" are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _ETH_HEADER_STRUC and call directly.
Kevin McKinney [Sat, 26 May 2012 16:04:57 +0000 (12:04 -0400)]
Staging: bcm: Remove typedef for _ETH_HEADER_STRUC and call directly.

This patch removes typedef for _ETH_HEADER_STRUC,
changes the name of the struct from
_ETH_HEADER_STRUC to bcm_eth_header.
In addition, any calls to the following typedefs
"ETH_HEADER_STRUC, *PETH_HEADER_STRUC" are
changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for FirmwareInfo and call directly.
Kevin McKinney [Sat, 26 May 2012 16:04:56 +0000 (12:04 -0400)]
Staging: bcm: Remove typedef for FirmwareInfo and call directly.

This patch removes typedef for FirmwareInfo,
changes the name from Firmwareinfo to
bcm_firmware_info. In addition, any calls to
the following typedefs "PFIRMWARE_INFO,
FIRMWARE_INFO" are changed to call the struct
directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _cntl_pkt in Adapter.h
Kevin McKinney [Sat, 26 May 2012 16:04:55 +0000 (12:04 -0400)]
Staging: bcm: Remove typedef for _cntl_pkt in Adapter.h

This patch removes typedef for _cntl_pkt because
it is not used.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef for _DDR_SETTING and call directly.
Kevin McKinney [Sat, 26 May 2012 16:04:54 +0000 (12:04 -0400)]
Staging: bcm: Remove typedef for _DDR_SETTING and call directly.

This patch removes the typedef for _DDR_SETTING,
changes the name of the struct from _DDR_SETTING,
to bcm_ddr_setting. In addition, any calls to the
following typedefs "DDR_SET_NODE and *PDDR_SET_NODE"
are changed to call the struct directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: bcm: Remove typedef from "eInterface_setting" in Adapter.h
Kevin McKinney [Sat, 26 May 2012 16:04:53 +0000 (12:04 -0400)]
Staging: bcm: Remove typedef from "eInterface_setting" in Adapter.h

This patch removes the typedef from
eInterface_setting, and renames the enum
to bcm_einterface_setting.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging "rts_pstor" fix some typos while reading through rts_pstor
Justin P. Mattock [Mon, 21 May 2012 14:56:57 +0000 (07:56 -0700)]
staging "rts_pstor" fix some typos while reading through rts_pstor

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agoStaging: android: alarm: Rename pr_alarm to alarm_dbg
Joe Perches [Sun, 20 May 2012 21:06:36 +0000 (14:06 -0700)]
Staging: android: alarm: Rename pr_alarm to alarm_dbg

Rename a macro to make it explicit it's for debugging.

Use %s: __func__ instead of embedding function names.
Coalesce formats, align arguments.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Remove forward declarations 4
Ian Abbott [Fri, 1 Jun 2012 16:31:45 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Remove forward declarations 4

Move these functions and remove their forward declarations:
pci230_ai_stop(), pci230_handle_ai().  Also move pci230_ai_cancel() for
aesthetic reasons.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Remove forward declarations 3
Ian Abbott [Fri, 1 Jun 2012 16:31:44 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Remove forward declarations 3

Move these functions and remove their forward declarations:
pci230_ao_stop(), pci230_handle_ao_nofifo(), pci230_handle_ao_fifo().
Also move pci230_ao_cancel() for aesthetic reasons.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Remove forward declarations 2
Ian Abbott [Fri, 1 Jun 2012 16:31:43 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Remove forward declarations 2

Remove some forward function declarations: pci230_ct_setup_ns_mode(),
pci230_ns_to_single_timer(), pci230_cancel_ct().  Also need to move:
divide_ns().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Remove forward declarations 1
Ian Abbott [Fri, 1 Jun 2012 16:31:42 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Remove forward declarations 1

Remove the redundant forward function declarations.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Add attach_pci() hook
Ian Abbott [Fri, 1 Jun 2012 16:31:41 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Add attach_pci() hook

Implement the attach_pci() hook as function pci230_attach_pci().  This
is called by comedi_pci_auto_config() in preference to the old attach()
hook (implemented by pci230_attach() and still required for "manual"
configuration of comedi devices).  The advantage of the attach_pci()
hook is that it avoids searching for the PCI device.

Refactor pci230_attach() and factor out code common to pci230_attach()
and pci230_attach_pci() into new functions pci230_match_pci_board(),
pci230_find_pci_board(), pci230_find_pci(), pci230_alloc_private() and
pci230_attach_common().

Finally, move pci230_attach() and pci230_detach() along with all the new
functions towards the bottom of the file as it makes the patch much
cleaner (though longer) and I plan to move things around soon to get
rid of the remaining forward references.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Remove thisboard and devpriv macros
Ian Abbott [Fri, 1 Jun 2012 16:31:40 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Remove thisboard and devpriv macros

The 'thisboard' and 'devpriv' macros rely on a local variable having a
specific name and yield pointers derived from that local variable.
Replace the macros with local variables wherever they occur.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci230: Replace printk calls
Ian Abbott [Fri, 1 Jun 2012 16:31:39 +0000 (17:31 +0100)]
staging: comedi: amplc_pci230: Replace printk calls

Replace the printk calls with dev_info, dev_err, etc.

A load of DPRINTK() macro calls which may result in printk() calls
have been left alone to be tackled en masse at a later date.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci224: Remove thisboard and devpriv macros
Ian Abbott [Thu, 31 May 2012 15:02:05 +0000 (16:02 +0100)]
staging: comedi: amplc_pci224: Remove thisboard and devpriv macros

The 'thisboard' and 'devpriv' macros rely on a local variable having a
specific name and yield pointers derived from that local variable.
Replace the macros with local variables wherever they occur.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci224: Change return type of pci224_find_pci()
Ian Abbott [Thu, 31 May 2012 15:02:04 +0000 (16:02 +0100)]
staging: comedi: amplc_pci224: Change return type of pci224_find_pci()

pci224_find_pci() finds a supported PCI device, returning 0 on success
or -EIO on failure and returning the pointer to the PCI device via a
struct pci_dev ** parameter.  Change it to return the struct pci_dev *
on success or NULL on failure.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci224: Replace printk calls
Ian Abbott [Thu, 31 May 2012 15:02:03 +0000 (16:02 +0100)]
staging: comedi: amplc_pci224: Replace printk calls

Replace the printk calls with dev_info, dev_err, etc.  There were some
consecutive printk calls without newlines which now scnprintf into a
temporary buffer and this bit of code has been factored out into new
function pci224_report_attach().

A couple of DPRINTK() macro calls which may result in printk() calls
have been left alone to be tackled en masse at a later date.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pci224: __devinit pci224_attach_pci()
Ian Abbott [Thu, 31 May 2012 15:02:02 +0000 (16:02 +0100)]
staging: comedi: amplc_pci224: __devinit pci224_attach_pci()

pci224_attach_pci() is only called during PCI probe, indirectly via
comedi_pci_auto_config(), so it can be marked __devinit.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Add attach_pci() hook
Ian Abbott [Thu, 31 May 2012 13:08:37 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Add attach_pci() hook

Implement the attach_pci() hook as function dio200_attach_pci().  This
is called by comedi_pci_auto_config() in preference to the old attach()
hook (implemented by dio200_attach()) and avoids searching for the
probed PCI device.

Factor out code common to dio200_find_pci() and dio200_attach_pci() into
new function dio200_find_pci_board().  Factor out most code common to
dio200_attach() and dio200_attach_pci() into new functions
dio200_pci_common_attach() and dio200_common_attach().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Remove thisboard, thislayout and devpriv macros
Ian Abbott [Thu, 31 May 2012 13:08:36 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Remove thisboard, thislayout and devpriv macros

The 'thisboard', 'thislayout' and 'devpriv' macros rely on a local
variable having a specific name and yield pointers derived from that
local variable.  Replace the macros with local variables wherever they
occur.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Change return type of dio200_find_pci()
Ian Abbott [Thu, 31 May 2012 13:08:35 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Change return type of dio200_find_pci()

dio200_find_pci() finds a supported PCI device, returning 0 on success
or -EIO on failure and returning the pointer to the PCI device via a
struct pci_dev ** parameter.  Change it to return the struct pci_dev *
on success or NULL on failure.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Replace printk calls
Ian Abbott [Thu, 31 May 2012 13:08:34 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Replace printk calls

Replace the printk calls with dev_info, dev_err, etc.  There were some
consecutive printk calls without newlines which now scnprintf into a
temporary buffer and this bit of code has been factored out into new
function dio200_report_attach().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Remove forward function declarations
Ian Abbott [Thu, 31 May 2012 13:08:33 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Remove forward function declarations

Moved some functions and variables to avoid forward declarations.  Moved
PCI table closer to the struct pci_driver that refers to it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Use module_comedi_{pci,}_driver()
Ian Abbott [Thu, 31 May 2012 13:08:32 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Use module_comedi_{pci,}_driver()

If PCI boards are supported, use the module_comedi_pci_driver() macro to
register the module as a comedi driver and a PCI driver.  Otherwise,
only ISA boards are supported so use the module_comedi_driver() macro to
register the module as a comedi driver.

Renamed 'driver_amplc_dio200' to 'amplc_dio200_driver' and removed
'driver_' prefix from PCI related functions and variables, purely for
aesthetic reasons.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_dio200: Use IS_ENABLED()
Ian Abbott [Thu, 31 May 2012 13:08:31 +0000 (14:08 +0100)]
staging: comedi: amplc_dio200: Use IS_ENABLED()

Change conditional compilation on kernel options to use the IS_ENABLED()
macro.  Remove most of the #ifdef lines and add extra if
(IS_ENABLED(xxx)) tests so the compiler can remove unreachable code.
The pci_driver stuff and device table and some of the static const data
is still conditionally compiled.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pc263: Add attach_pci() hook
Ian Abbott [Wed, 30 May 2012 18:04:45 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: Add attach_pci() hook

Implement the attach_pci() hook as function pc263_attach_pci().  This is
called bu comedi_pci_auto_config() in preference to the old attach()
hook (implemented by pc263_attach()) and avoids searching for the probed
PCI device.

Factor out code common to pc263_find_pci() and pc263_attach_pci() into
new function pc263_find_pci_board().  Factor out most code common to
pc263_attach() and pc263_attach_pci() into new functions
pc263_pci_common_attach() and pc263_common_attach().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pc263: Remove thisboard and devpriv macros
Ian Abbott [Wed, 30 May 2012 18:04:44 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: Remove thisboard and devpriv macros

The 'thisboard' and 'devpriv' macros rely on a local variable having a
specific name and yield pointers derived from that local variable.
Replace the macros with local variables wherever they occur.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pc263: Change return type of pc263_find_pci()
Ian Abbott [Wed, 30 May 2012 18:04:43 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: Change return type of pc263_find_pci()

pc263_find_pci() finds a supported PCI device, returning 0 on success
or -EIO on failure and returning the pointer to the PCI device via a
struct pci_dev ** parameter.  Change it to return the struct pci_dev *
on success or NULL on failure.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 years agostaging: comedi: amplc_pc263: Remove unused fancy_name
Ian Abbott [Wed, 30 May 2012 18:04:42 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: Remove unused fancy_name

Remove fancy_name member from struct pc263_board.  It is initialized in
pc263_boards[] but not used anywhere else.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>