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>
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.
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.
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.
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>
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.
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Replace the printk calls with dev_info, dev_err, etc. There were some
consecutive printk calls without newlines which now snprintf into a
temporary buffer and this bit of code has been factored out into new
function pc263_report_attach().
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 30 May 2012 18:04:39 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: 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_pc263' to 'amplc_pc263_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>
Ian Abbott [Wed, 30 May 2012 18:04:38 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: 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 is still conditionally compiled.
In pc263_attach() move the call to alloc_private() as it is only used
for PCI devices. (In pc263_detach(), for ISA devices a non-zero
dev->iobase means the I/O region needs releasing.)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 30 May 2012 18:04:36 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: Change DIO subdevice to DO
This is a relay output card with no inputs. It's single subdevice is
currently a digital input/output subdevice (COMEDI_SUBD_DIO). It should
really be a digital output subdevice (COMEDI_SUBD_DO). Change the
subdevice type and remove the insn_config() hook as it doesn't do
anything useful.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 30 May 2012 18:04:35 +0000 (19:04 +0100)]
staging: comedi: amplc_pc263: Correct initial state
The initial state of the relays is being read incorrectly. It's reading
a single 8-bit port twice, but should be reading two consecutive 8-bit
ports. Fix it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 30 May 2012 13:37:52 +0000 (14:37 +0100)]
staging: comedi: amplc_pc236: Remove most #if lines
Remove most of the #if IS_ENABLED(xxx) lines, but add extra if
(IS_ENABLED(xxx)) tests so the compiler can remove unreachable code.
The pci_driver stuff and device table is still conditionally compiled.
Also made pc236_find_pci() static as it was accidentally made non-static
by an earlier patch, so the compiler wouldn't remove it when it was
unreachable.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Implement the attach_pci() hook as function pc236_attach_pci(). This is
called bu comedi_pci_auto_config() in preference to the old attach()
hook (implemented by pc236_attach()) and avoids searching for the probed
PCI device.
Factor out code common to pc236_find_pci() and pc236_attach_pci() into
new function pc236_find_pci_board(). Factor out most code common to
pc236_attach() and pc236_attach_pci() into new functions
pc236_pci_common_attach() and pc236_common_attach().
Also #if out member 'devid' from struct pc236_board unless PCI boards
are supported as it is not used for ISA boards.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 29 May 2012 13:49:34 +0000 (14:49 +0100)]
staging: comedi: amplc_pc236: 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>
Ian Abbott [Tue, 29 May 2012 13:49:33 +0000 (14:49 +0100)]
staging: comedi: amplc_pc236: Change return type of pc236_find_pci()
pc236_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>
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 pc236_report_attach().
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 29 May 2012 13:49:29 +0000 (14:49 +0100)]
staging: comedi: amplc_pc236: 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_pc236' to 'amplc_pc236_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>
staging: comedi: Make COMEDI_FC a hidden Kconfig option
The COMEDI_FC Kconfig option is selected by the relevant drivers
when needed. Since it only contains shared functions, selecting
it manually serves no purpose. Just make it a hidden selection.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 24 May 2012 16:27:18 +0000 (17:27 +0100)]
staging: comedi: das08: Add attach_pci() hook
Implement the attach_pci() hook. This is called by
comedi_pci_auto_config() in preference to the old attach() hook and
avoids searching for the probed PCI device. Factor out some common code
used by both the attach() and attach_pci() hooks into a couple of new
functions, das08_pci_attach_common() and das08_find_pci_board().
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 24 May 2012 16:27:17 +0000 (17:27 +0100)]
staging: comedi: das08: Support multiple PCI card types in future
Rename the existing board entry named "das08" for the PCI-DAS08 board to
"pci-das08". Add a new wildcard board entry called "das08" that will
match any supported PCI board. If 'dev->board_ptr' points to the
wildcard board entry in the ->attach() routine, it will be replaced with
a supported PCI board entry if there are any (taking into account the
bus and slot specified by the device config options passed in to the
function).
Split the code that finds a matching PCI device into a new function
das08_find_pci().
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>