Commit a916a391d3e19593a104a8c3c4779a3084f1ca5b
Committed by
Greg Kroah-Hartman
1 parent
5d6abf379d
Exists in
master
and in
6 other branches
staging: vme: get rid of struct vme_device_id and slots
Previously, the device-driver matching mechanism depended on the vme_device_id structure due to the need for a bind table per driver. This method of matching is no longer used so this patch merges the fields of struct vme_device_id into struct vme_dev. Since this also renders the slot field meaningless, it has also been removed in this patch. 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>
Showing 4 changed files with 16 additions and 35 deletions Side-by-side Diff
drivers/staging/vme/devices/vme_user.c
drivers/staging/vme/vme.c
... | ... | @@ -1377,16 +1377,14 @@ |
1377 | 1377 | err = -ENOMEM; |
1378 | 1378 | goto err_devalloc; |
1379 | 1379 | } |
1380 | - vdev->id.num = i; | |
1381 | - vdev->id.bus = bridge->num; | |
1382 | - vdev->id.slot = i + 1; | |
1380 | + vdev->num = i; | |
1383 | 1381 | vdev->bridge = bridge; |
1384 | 1382 | vdev->dev.platform_data = drv; |
1385 | 1383 | vdev->dev.release = vme_dev_release; |
1386 | 1384 | vdev->dev.parent = bridge->parent; |
1387 | 1385 | vdev->dev.bus = &vme_bus_type; |
1388 | - dev_set_name(&vdev->dev, "%s.%u-%u", drv->name, vdev->id.bus, | |
1389 | - vdev->id.num); | |
1386 | + dev_set_name(&vdev->dev, "%s.%u-%u", drv->name, bridge->num, | |
1387 | + vdev->num); | |
1390 | 1388 | |
1391 | 1389 | err = device_register(&vdev->dev); |
1392 | 1390 | if (err) |
drivers/staging/vme/vme.h
... | ... | @@ -96,18 +96,6 @@ |
96 | 96 | #define VME_SLOT_ALL -2 |
97 | 97 | |
98 | 98 | /** |
99 | - * VME device identifier structure | |
100 | - * @num: The device ID (ranges from 0 to N-1 for N devices) | |
101 | - * @bus: The bus ID of the bus the device is on | |
102 | - * @slot: The slot this device is plugged into | |
103 | - */ | |
104 | -struct vme_device_id { | |
105 | - int num; | |
106 | - int bus; | |
107 | - int slot; | |
108 | -}; | |
109 | - | |
110 | -/** | |
111 | 99 | * Structure representing a VME device |
112 | 100 | * @id: The ID of the device (currently the bus and slot number) |
113 | 101 | * @bridge: Pointer to the bridge device this device is on |
... | ... | @@ -116,7 +104,7 @@ |
116 | 104 | * @bridge_list: List of devices (per bridge) |
117 | 105 | */ |
118 | 106 | struct vme_dev { |
119 | - struct vme_device_id id; | |
107 | + int num; | |
120 | 108 | struct vme_bridge *bridge; |
121 | 109 | struct device dev; |
122 | 110 | struct list_head drv_list; |
drivers/staging/vme/vme_api.txt
... | ... | @@ -51,24 +51,17 @@ |
51 | 51 | 'struct vme_dev' structure looks like the following: |
52 | 52 | |
53 | 53 | struct vme_dev { |
54 | - struct vme_device_id id; | |
54 | + int num; | |
55 | 55 | struct vme_bridge *bridge; |
56 | 56 | struct device dev; |
57 | + struct list_head drv_list; | |
58 | + struct list_head bridge_list; | |
57 | 59 | }; |
58 | 60 | |
59 | -The 'bridge' field contains a pointer to the bridge device. The 'id' field | |
60 | -contains information useful for the probe function: | |
61 | +Here, the 'num' field refers to the sequential device ID for this specific | |
62 | +driver. The bridge number (or bus number) can be accessed using | |
63 | +dev->bridge->num. | |
61 | 64 | |
62 | - struct vme_device_id { | |
63 | - int bus; | |
64 | - int slot; | |
65 | - int num; | |
66 | - }; | |
67 | - | |
68 | -Here, 'bus' is the number of the bus the device being probed is on. 'slot' | |
69 | -refers to the specific slot on the VME bus. The 'num' field refers to the | |
70 | -sequential device ID for this specific driver. | |
71 | - | |
72 | 65 | A function is also provided to unregister the driver from the VME core and is |
73 | 66 | usually called from the device driver's exit routine: |
74 | 67 | |
... | ... | @@ -78,9 +71,11 @@ |
78 | 71 | Resource management |
79 | 72 | =================== |
80 | 73 | |
81 | -Once a driver has registered with the VME core the provided probe routine will | |
82 | -be called for each of the bus/slot combination that becomes valid as VME buses | |
83 | -are themselves registered. The probe routine is passed a pointer to the devices | |
74 | +Once a driver has registered with the VME core the provided match routine will | |
75 | +be called the number of times specified during the registration. If a match | |
76 | +succeeds, a non-zero value should be returned. A zero return value indicates | |
77 | +failure. For all successful matches, the probe routine of the corresponding | |
78 | +driver is called. The probe routine is passed a pointer to the devices | |
84 | 79 | device structure. This pointer should be saved, it will be required for |
85 | 80 | requesting VME resources. |
86 | 81 |