Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268838
b: refs/heads/master
c: a916a39
h: refs/heads/master
v: v3
  • Loading branch information
Manohar Vanga authored and Greg Kroah-Hartman committed Oct 17, 2011
1 parent 5d57804 commit e839ba3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d6abf379d73efe390488e8edba972af4e93cb1c
refs/heads/master: a916a391d3e19593a104a8c3c4779a3084f1ca5b
2 changes: 1 addition & 1 deletion trunk/drivers/staging/vme/devices/vme_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ static int __init vme_user_init(void)

static int vme_user_match(struct vme_dev *vdev)
{
if (vdev->id.num >= USER_BUS_MAX)
if (vdev->num >= USER_BUS_MAX)
return 0;
return 1;
}
Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/staging/vme/vme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,16 +1377,14 @@ static int __vme_register_driver_bus(struct vme_driver *drv,
err = -ENOMEM;
goto err_devalloc;
}
vdev->id.num = i;
vdev->id.bus = bridge->num;
vdev->id.slot = i + 1;
vdev->num = i;
vdev->bridge = bridge;
vdev->dev.platform_data = drv;
vdev->dev.release = vme_dev_release;
vdev->dev.parent = bridge->parent;
vdev->dev.bus = &vme_bus_type;
dev_set_name(&vdev->dev, "%s.%u-%u", drv->name, vdev->id.bus,
vdev->id.num);
dev_set_name(&vdev->dev, "%s.%u-%u", drv->name, bridge->num,
vdev->num);

err = device_register(&vdev->dev);
if (err)
Expand Down
14 changes: 1 addition & 13 deletions trunk/drivers/staging/vme/vme.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,6 @@ extern struct bus_type vme_bus_type;
#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;
};

/**
* Structure representing a VME device
* @id: The ID of the device (currently the bus and slot number)
Expand All @@ -116,7 +104,7 @@ struct vme_device_id {
* @bridge_list: List of devices (per bridge)
*/
struct vme_dev {
struct vme_device_id id;
int num;
struct vme_bridge *bridge;
struct device dev;
struct list_head drv_list;
Expand Down
27 changes: 11 additions & 16 deletions trunk/drivers/staging/vme/vme_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,16 @@ probe routine is passed a 'struct vme_dev' pointer as an argument. The
'struct vme_dev' structure looks like the following:

struct vme_dev {
struct vme_device_id id;
int num;
struct vme_bridge *bridge;
struct device dev;
struct list_head drv_list;
struct list_head bridge_list;
};

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;
int num;
};

Here, 'bus' is the number of the bus the device being probed is on. 'slot'
refers to the specific slot on the VME bus. The 'num' field refers to the
sequential device ID for this specific driver.
Here, the 'num' field refers to the sequential device ID for this specific
driver. The bridge number (or bus number) can be accessed using
dev->bridge->num.

A function is also provided to unregister the driver from the VME core and is
usually called from the device driver's exit routine:
Expand All @@ -78,9 +71,11 @@ usually called from the device driver's exit routine:
Resource management
===================

Once a driver has registered with the VME core the provided probe routine will
be called for each of the bus/slot combination that becomes valid as VME buses
are themselves registered. The probe routine is passed a pointer to the devices
Once a driver has registered with the VME core the provided match routine will
be called the number of times specified during the registration. If a match
succeeds, a non-zero value should be returned. A zero return value indicates
failure. For all successful matches, the probe routine of the corresponding
driver is called. The probe routine is passed a pointer to the devices
device structure. This pointer should be saved, it will be required for
requesting VME resources.

Expand Down

0 comments on commit e839ba3

Please sign in to comment.