diff options
author | Manohar Vanga | 2011-09-26 11:27:15 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2011-10-18 00:43:13 +0200 |
commit | 8f966dc444b11adff6011a1d1fce424abdd876d8 (patch) | |
tree | 4ab26a8f584d360cac808dd8d0401e4377723aaa /drivers/staging/vme/vme_api.txt | |
parent | staging:iio:dummy Add buffered reading support (diff) | |
download | kernel-qcow2-linux-8f966dc444b11adff6011a1d1fce424abdd876d8.tar.gz kernel-qcow2-linux-8f966dc444b11adff6011a1d1fce424abdd876d8.tar.xz kernel-qcow2-linux-8f966dc444b11adff6011a1d1fce424abdd876d8.zip |
staging: vme: add struct vme_dev for VME devices
Instead of using a vanilla 'struct device' for VME devices, add new
'struct vme_dev'. Modifications have been made to the VME framework
API as well as all in-tree VME drivers.
The new vme_dev structure has the following advantages from the
current model used by the driver:
* Driver functions (probe, remove) now receive a VME device
instead of a pointer to the bridge device (cleaner design)
* It's easier to differenciate API calls as bridge-based or
device-based (ie. cleaner interface).
Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>
Cc: Martyn Welch <martyn.welch@ge.com>
Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vme/vme_api.txt')
-rw-r--r-- | drivers/staging/vme/vme_api.txt | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/drivers/staging/vme/vme_api.txt b/drivers/staging/vme/vme_api.txt index 4910e92c52af..03f481347067 100644 --- a/drivers/staging/vme/vme_api.txt +++ b/drivers/staging/vme/vme_api.txt @@ -20,8 +20,8 @@ registration function. The structure is as follows: struct list_head node; char *name; const struct vme_device_id *bind_table; - int (*probe) (struct device *, int, int); - int (*remove) (struct device *, int, int); + int (*probe) (struct vme_dev *); + int (*remove) (struct vme_dev *); void (*shutdown) (void); struct device_driver driver; }; @@ -33,7 +33,26 @@ to the probe routine. The arguments of the probe routine are as follows: - probe(struct device *dev, int bus, int slot); + probe(struct vme_dev *dev); + +The device structure looks like the following: + + struct vme_dev { + struct vme_device_id id; + struct vme_bridge *bridge; + struct device dev; + }; + +The 'bridge' field contains a pointer to the bridge device. The 'id' field +contains information useful for the probe function: + + struct vme_device_id { + int bus; + int slot; + }; + +'bus' is the number of the bus the device being probed is on. 'slot' refers +to the specific slot on the VME bus. The '.bind_table' is a pointer to an array of type 'vme_device_id': @@ -71,13 +90,13 @@ specific window or DMA channel (which may be used by a different driver) this driver allows a resource to be assigned based on the required attributes of the driver in question: - struct vme_resource * vme_master_request(struct device *dev, + struct vme_resource * vme_master_request(struct vme_dev *dev, vme_address_t aspace, vme_cycle_t cycle, vme_width_t width); - struct vme_resource * vme_slave_request(struct device *dev, + struct vme_resource * vme_slave_request(struct vme_dev *dev, vme_address_t aspace, vme_cycle_t cycle); - struct vme_resource *vme_dma_request(struct device *dev, + struct vme_resource *vme_dma_request(struct vme_dev *dev, vme_dma_route_t route); For slave windows these attributes are split into those of type 'vme_address_t' @@ -301,10 +320,10 @@ status ID combination. Any given combination can only be assigned a single callback function. A void pointer parameter is provided, the value of which is passed to the callback function, the use of this pointer is user undefined: - int vme_irq_request(struct device *dev, int level, int statid, + int vme_irq_request(struct vme_dev *dev, int level, int statid, void (*callback)(int, int, void *), void *priv); - void vme_irq_free(struct device *dev, int level, int statid); + void vme_irq_free(struct vme_dev *dev, int level, int statid); The callback parameters are as follows. Care must be taken in writing a callback function, callback functions run in interrupt context: @@ -318,7 +337,7 @@ Interrupt Generation The following function can be used to generate a VME interrupt at a given VME level and VME status ID: - int vme_irq_generate(struct device *dev, int level, int statid); + int vme_irq_generate(struct vme_dev *dev, int level, int statid); Location monitors @@ -334,7 +353,7 @@ Location Monitor Management The following functions are provided to request the use of a block of location monitors and to free them after they are no longer required: - struct vme_resource * vme_lm_request(struct device *dev); + struct vme_resource * vme_lm_request(struct vme_dev *dev); void vme_lm_free(struct vme_resource * res); @@ -380,4 +399,4 @@ Slot Detection This function returns the slot ID of the provided bridge. - int vme_slot_get(struct device *dev); + int vme_slot_get(struct vme_dev *dev); |