diff options
-rw-r--r-- | Documentation/vme_api.txt | 10 | ||||
-rw-r--r-- | drivers/staging/vme/devices/vme_user.c | 13 | ||||
-rw-r--r-- | drivers/vme/vme.c | 13 | ||||
-rw-r--r-- | include/linux/vme.h | 1 |
4 files changed, 34 insertions, 3 deletions
diff --git a/Documentation/vme_api.txt b/Documentation/vme_api.txt index 856efa35f6e3..126a1f1d5151 100644 --- a/Documentation/vme_api.txt +++ b/Documentation/vme_api.txt @@ -394,3 +394,13 @@ Slot Detection This function returns the slot ID of the provided bridge. int vme_slot_get(struct vme_dev *dev); + + +Bus Detection +============= + +This function returns the bus ID of the provided bridge. + + int vme_bus_num(struct vme_dev *dev); + + diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index daec15565a43..caee906f9b38 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -663,9 +663,16 @@ err_nocard: static int vme_user_match(struct vme_dev *vdev) { - if (vdev->num >= VME_USER_BUS_MAX) - return 0; - return 1; + int i; + + int cur_bus = vme_bus_num(vdev); + int cur_slot = vme_slot_get(vdev); + + for (i = 0; i < bus_num; i++) + if ((cur_bus == bus[i]) && (cur_slot == vdev->num)) + return 1; + + return 0; } /* diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c index f6856b427496..8df5e4efc1ca 100644 --- a/drivers/vme/vme.c +++ b/drivers/vme/vme.c @@ -1293,6 +1293,19 @@ int vme_slot_get(struct vme_dev *vdev) } EXPORT_SYMBOL(vme_slot_get); +int vme_bus_num(struct vme_dev *vdev) +{ + struct vme_bridge *bridge; + + bridge = vdev->bridge; + if (bridge == NULL) { + pr_err("Can't find VME bus\n"); + return -EINVAL; + } + + return bridge->num; +} +EXPORT_SYMBOL(vme_bus_num); /* - Bridge Registration --------------------------------------------------- */ diff --git a/include/linux/vme.h b/include/linux/vme.h index c9d65bf14cec..4eb42c8f097d 100644 --- a/include/linux/vme.h +++ b/include/linux/vme.h @@ -165,6 +165,7 @@ int vme_lm_detach(struct vme_resource *, int); void vme_lm_free(struct vme_resource *); int vme_slot_get(struct vme_dev *); +int vme_bus_num(struct vme_dev *); int vme_register_driver(struct vme_driver *, unsigned int); void vme_unregister_driver(struct vme_driver *); |