Commit 7a064fd1 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: comedi_pci.c: improve function documentation

Expand the descriptions of the functions and document the return values.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5e2ec8f9
...@@ -22,8 +22,14 @@ ...@@ -22,8 +22,14 @@
#include "comedi_pci.h" #include "comedi_pci.h"
/** /**
* comedi_to_pci_dev() - comedi_device pointer to pci_dev pointer. * comedi_to_pci_dev() - Return PCI device attached to COMEDI device
* @dev: comedi_device struct * @dev: COMEDI device.
*
* Assuming @dev->hw_dev is non-%NULL, it is assumed to be pointing to a
* a &struct device embedded in a &struct pci_dev.
*
* Returns: Attached PCI device if @dev->hw_dev is non-%NULL.
* Returns %NULL if @dev->hw_dev is %NULL.
*/ */
struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev) struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev)
{ {
...@@ -32,8 +38,22 @@ struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev) ...@@ -32,8 +38,22 @@ struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev)
EXPORT_SYMBOL_GPL(comedi_to_pci_dev); EXPORT_SYMBOL_GPL(comedi_to_pci_dev);
/** /**
* comedi_pci_enable() - Enable the PCI device and request the regions. * comedi_pci_enable() - Enable the PCI device and request the regions
* @dev: comedi_device struct * @dev: COMEDI device.
*
* Assuming @dev->hw_dev is non-%NULL, it is assumed to be pointing to a
* a &struct device embedded in a &struct pci_dev. Enable the PCI device
* and request its regions. Set @dev->ioenabled to %true if successful,
* otherwise undo what was done.
*
* Calls to comedi_pci_enable() and comedi_pci_disable() cannot be nested.
*
* Returns:
* 0 on success,
* -%ENODEV if @dev->hw_dev is %NULL,
* -%EBUSY if regions busy,
* or some negative error number if failed to enable PCI device.
*
*/ */
int comedi_pci_enable(struct comedi_device *dev) int comedi_pci_enable(struct comedi_device *dev)
{ {
...@@ -58,8 +78,13 @@ int comedi_pci_enable(struct comedi_device *dev) ...@@ -58,8 +78,13 @@ int comedi_pci_enable(struct comedi_device *dev)
EXPORT_SYMBOL_GPL(comedi_pci_enable); EXPORT_SYMBOL_GPL(comedi_pci_enable);
/** /**
* comedi_pci_disable() - Release the regions and disable the PCI device. * comedi_pci_disable() - Release the regions and disable the PCI device
* @dev: comedi_device struct * @dev: COMEDI device.
*
* Assuming @dev->hw_dev is non-%NULL, it is assumed to be pointing to a
* a &struct device embedded in a &struct pci_dev. If the earlier call
* to comedi_pci_enable() was successful, release the PCI device's regions
* and disable it. Reset @dev->ioenabled back to %false.
*/ */
void comedi_pci_disable(struct comedi_device *dev) void comedi_pci_disable(struct comedi_device *dev)
{ {
...@@ -74,8 +99,18 @@ void comedi_pci_disable(struct comedi_device *dev) ...@@ -74,8 +99,18 @@ void comedi_pci_disable(struct comedi_device *dev)
EXPORT_SYMBOL_GPL(comedi_pci_disable); EXPORT_SYMBOL_GPL(comedi_pci_disable);
/** /**
* comedi_pci_detach() - A generic (*detach) function for PCI drivers. * comedi_pci_detach() - A generic "detach" handler for PCI COMEDI drivers
* @dev: comedi_device struct * @dev: COMEDI device.
*
* COMEDI drivers for PCI devices that need no special clean-up of private data
* and have no ioremapped regions other than that pointed to by @dev->mmio may
* use this function as its "detach" handler called by the COMEDI core when a
* COMEDI device is being detached from the low-level driver. It may be also
* called from a more specific "detach" handler that does additional clean-up.
*
* Free the IRQ if @dev->irq is non-zero, iounmap @dev->mmio if it is
* non-%NULL, and call comedi_pci_disable() to release the PCI device's regions
* and disable it.
*/ */
void comedi_pci_detach(struct comedi_device *dev) void comedi_pci_detach(struct comedi_device *dev)
{ {
...@@ -97,12 +132,19 @@ void comedi_pci_detach(struct comedi_device *dev) ...@@ -97,12 +132,19 @@ void comedi_pci_detach(struct comedi_device *dev)
EXPORT_SYMBOL_GPL(comedi_pci_detach); EXPORT_SYMBOL_GPL(comedi_pci_detach);
/** /**
* comedi_pci_auto_config() - Configure/probe a comedi PCI driver. * comedi_pci_auto_config() - Configure/probe a PCI COMEDI device
* @pcidev: pci_dev struct * @pcidev: PCI device.
* @driver: comedi_driver struct * @driver: Registered COMEDI driver.
* @context: driver specific data, passed to comedi_auto_config() * @context: Driver specific data, passed to comedi_auto_config().
* *
* Typically called from the pci_driver (*probe) function. * Typically called from the pci_driver (*probe) function. Auto-configure
* a COMEDI device, using the &struct device embedded in *@pcidev as the
* hardware device. The @context value gets passed through to @driver's
* "auto_attach" handler. The "auto_attach" handler may call
* comedi_to_pci_dev() on the passed in COMEDI device to recover @pcidev.
*
* Returns: The result of calling comedi_auto_config() (0 on success, or
* a negative error number on failure).
*/ */
int comedi_pci_auto_config(struct pci_dev *pcidev, int comedi_pci_auto_config(struct pci_dev *pcidev,
struct comedi_driver *driver, struct comedi_driver *driver,
...@@ -113,10 +155,18 @@ int comedi_pci_auto_config(struct pci_dev *pcidev, ...@@ -113,10 +155,18 @@ int comedi_pci_auto_config(struct pci_dev *pcidev,
EXPORT_SYMBOL_GPL(comedi_pci_auto_config); EXPORT_SYMBOL_GPL(comedi_pci_auto_config);
/** /**
* comedi_pci_auto_unconfig() - Unconfigure/remove a comedi PCI driver. * comedi_pci_auto_unconfig() - Unconfigure/remove a PCI COMEDI device
* @pcidev: pci_dev struct * @pcidev: PCI device.
*
* Typically called from the pci_driver (*remove) function. Auto-unconfigure
* a COMEDI device attached to this PCI device, using a pointer to the
* &struct device embedded in *@pcidev as the hardware device. The COMEDI
* driver's "detach" handler will be called during unconfiguration of the
* COMEDI device.
* *
* Typically called from the pci_driver (*remove) function. * Note that the COMEDI device may have already been unconfigured using the
* %COMEDI_DEVCONFIG ioctl, in which case this attempt to unconfigure it
* again should be ignored.
*/ */
void comedi_pci_auto_unconfig(struct pci_dev *pcidev) void comedi_pci_auto_unconfig(struct pci_dev *pcidev)
{ {
...@@ -125,13 +175,15 @@ void comedi_pci_auto_unconfig(struct pci_dev *pcidev) ...@@ -125,13 +175,15 @@ void comedi_pci_auto_unconfig(struct pci_dev *pcidev)
EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig); EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig);
/** /**
* comedi_pci_driver_register() - Register a comedi PCI driver. * comedi_pci_driver_register() - Register a PCI COMEDI driver
* @comedi_driver: comedi_driver struct * @comedi_driver: COMEDI driver to be registered.
* @pci_driver: pci_driver struct * @pci_driver: PCI driver to be registered.
*
* This function is called from the module_init() of PCI COMEDI driver modules
* to register the COMEDI driver and the PCI driver. Do not call it directly,
* use the module_comedi_pci_driver() helper macro instead.
* *
* This function is used for the module_init() of comedi PCI drivers. * Returns: 0 on success, or a negative error number on failure.
* Do not call it directly, use the module_comedi_pci_driver() helper
* macro instead.
*/ */
int comedi_pci_driver_register(struct comedi_driver *comedi_driver, int comedi_pci_driver_register(struct comedi_driver *comedi_driver,
struct pci_driver *pci_driver) struct pci_driver *pci_driver)
...@@ -153,13 +205,13 @@ int comedi_pci_driver_register(struct comedi_driver *comedi_driver, ...@@ -153,13 +205,13 @@ int comedi_pci_driver_register(struct comedi_driver *comedi_driver,
EXPORT_SYMBOL_GPL(comedi_pci_driver_register); EXPORT_SYMBOL_GPL(comedi_pci_driver_register);
/** /**
* comedi_pci_driver_unregister() - Unregister a comedi PCI driver. * comedi_pci_driver_unregister() - Unregister a PCI COMEDI driver
* @comedi_driver: comedi_driver struct * @comedi_driver: COMEDI driver to be unregistered.
* @pci_driver: pci_driver struct * @pci_driver: PCI driver to be unregistered.
* *
* This function is used for the module_exit() of comedi PCI drivers. * This function is called from the module_exit() of PCI COMEDI driver modules
* Do not call it directly, use the module_comedi_pci_driver() helper * to unregister the PCI driver and the COMEDI driver. Do not call it
* macro instead. * directly, use the module_comedi_pci_driver() helper macro instead.
*/ */
void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver, void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
struct pci_driver *pci_driver) struct pci_driver *pci_driver)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment