summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vme/vme.h
diff options
context:
space:
mode:
authorManohar Vanga2011-09-26 11:27:16 +0200
committerGreg Kroah-Hartman2011-10-18 00:43:13 +0200
commit5d6abf379d73efe390488e8edba972af4e93cb1c (patch)
tree428bff86b71eeec6e24504221574092ab14c1cf1 /drivers/staging/vme/vme.h
parentstaging: vme: add struct vme_dev for VME devices (diff)
downloadkernel-qcow2-linux-5d6abf379d73efe390488e8edba972af4e93cb1c.tar.gz
kernel-qcow2-linux-5d6abf379d73efe390488e8edba972af4e93cb1c.tar.xz
kernel-qcow2-linux-5d6abf379d73efe390488e8edba972af4e93cb1c.zip
staging: vme: make match() driver specific to improve non-VME64x support
For jumper based boards (non VME64x), there is no mechanism for detecting the card that is plugged into a specific slot. This leads to issues in non-autodiscovery crates/cards when a card is plugged into a slot that is "claimed" by a different driver. In reality, there is no problem, but the driver rejects such a configuration due to its dependence on the concept of slots. This patch makes the concept of slots less critical and pushes the driver match() to individual drivers (similar to what happens in the ISA bus in driver/base/isa.c). This allows drivers to register the number of devices that they expect without any restrictions. Devices in this new model are now formatted as $driver_name-$bus_id.$device_id (as compared to the earlier vme-$bus_id.$slot_number). This model also makes the device model more logical as devices are only registered when they actually exist whereas earlier, a set of devices were being created automatically regardless of them actually being there. Another change introduced in this patch is that devices are now created within the VME driver structure rather than in the VME bridge structure. This way, things don't go haywire if the bridge driver is removed while a driver is using it. 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.h')
-rw-r--r--drivers/staging/vme/vme.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/staging/vme/vme.h b/drivers/staging/vme/vme.h
index d442cce33c09..95224d7452ea 100644
--- a/drivers/staging/vme/vme.h
+++ b/drivers/staging/vme/vme.h
@@ -88,15 +88,21 @@ struct vme_resource {
extern struct bus_type vme_bus_type;
+/* VME_MAX_BRIDGES comes from the type of vme_bus_numbers */
+#define VME_MAX_BRIDGES (sizeof(unsigned int)*8)
+#define VME_MAX_SLOTS 32
+
#define VME_SLOT_CURRENT -1
#define VME_SLOT_ALL -2
/**
* VME device identifier structure
+ * @num: The device ID (ranges from 0 to N-1 for N devices)
* @bus: The bus ID of the bus the device is on
* @slot: The slot this device is plugged into
*/
struct vme_device_id {
+ int num;
int bus;
int slot;
};
@@ -106,21 +112,26 @@ struct vme_device_id {
* @id: The ID of the device (currently the bus and slot number)
* @bridge: Pointer to the bridge device this device is on
* @dev: Internal device structure
+ * @drv_list: List of devices (per driver)
+ * @bridge_list: List of devices (per bridge)
*/
struct vme_dev {
struct vme_device_id id;
struct vme_bridge *bridge;
struct device dev;
+ struct list_head drv_list;
+ struct list_head bridge_list;
};
struct vme_driver {
struct list_head node;
const char *name;
- const struct vme_device_id *bind_table;
- int (*probe) (struct vme_dev *);
- int (*remove) (struct vme_dev *);
- void (*shutdown) (void);
- struct device_driver driver;
+ int (*match)(struct vme_dev *);
+ int (*probe)(struct vme_dev *);
+ int (*remove)(struct vme_dev *);
+ void (*shutdown)(void);
+ struct device_driver driver;
+ struct list_head devices;
};
void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *);
@@ -179,7 +190,7 @@ void vme_lm_free(struct vme_resource *);
int vme_slot_get(struct vme_dev *);
-int vme_register_driver(struct vme_driver *);
+int vme_register_driver(struct vme_driver *, unsigned int);
void vme_unregister_driver(struct vme_driver *);