• Home
  • Raw
  • Download

Lines Matching +full:device +full:- +full:id

21  *  rio_match_device - Tell if a RIO device has a matching RIO device id structure
22 * @id: the RIO device id structure to match against
23 * @rdev: the RIO device structure to match against
25 * Used from driver probe and bus matching to check whether a RIO device
26 * matches a device id structure provided by a RIO driver. Returns the
30 *id, in rio_match_device()
33 while (id->vid || id->asm_vid) { in rio_match_device()
34 if (((id->vid == RIO_ANY_ID) || (id->vid == rdev->vid)) && in rio_match_device()
35 ((id->did == RIO_ANY_ID) || (id->did == rdev->did)) && in rio_match_device()
36 ((id->asm_vid == RIO_ANY_ID) in rio_match_device()
37 || (id->asm_vid == rdev->asm_vid)) in rio_match_device()
38 && ((id->asm_did == RIO_ANY_ID) in rio_match_device()
39 || (id->asm_did == rdev->asm_did))) in rio_match_device()
40 return id; in rio_match_device()
41 id++; in rio_match_device()
47 * rio_dev_get - Increments the reference count of the RIO device structure
49 * @rdev: RIO device being referenced
51 * Each live reference to a device should be refcounted.
54 * their probe() methods, when they bind to a device, and release
60 get_device(&rdev->dev); in rio_dev_get()
66 * rio_dev_put - Release a use of the RIO device structure
68 * @rdev: RIO device being disconnected
70 * Must be called when a user of a device is finished with it.
71 * When the last user of the device calls this function, the
72 * memory of the device is freed.
77 put_device(&rdev->dev); in rio_dev_put()
81 * rio_device_probe - Tell if a RIO device structure has a matching RIO device id structure
82 * @dev: the RIO device structure to match against
84 * return 0 and set rio_dev->driver when drv claims rio_dev, else error
86 static int rio_device_probe(struct device *dev) in rio_device_probe()
88 struct rio_driver *rdrv = to_rio_driver(dev->driver); in rio_device_probe()
90 int error = -ENODEV; in rio_device_probe()
91 const struct rio_device_id *id; in rio_device_probe() local
93 if (!rdev->driver && rdrv->probe) { in rio_device_probe()
94 if (!rdrv->id_table) in rio_device_probe()
96 id = rio_match_device(rdrv->id_table, rdev); in rio_device_probe()
98 if (id) in rio_device_probe()
99 error = rdrv->probe(rdev, id); in rio_device_probe()
101 rdev->driver = rdrv; in rio_device_probe()
110 * rio_device_remove - Remove a RIO device from the system
112 * @dev: the RIO device structure to match against
114 * Remove a RIO device from the system. If it has an associated
118 static int rio_device_remove(struct device *dev) in rio_device_remove()
121 struct rio_driver *rdrv = rdev->driver; in rio_device_remove()
124 if (rdrv->remove) in rio_device_remove()
125 rdrv->remove(rdev); in rio_device_remove()
126 rdev->driver = NULL; in rio_device_remove()
134 static void rio_device_shutdown(struct device *dev) in rio_device_shutdown()
137 struct rio_driver *rdrv = rdev->driver; in rio_device_shutdown()
141 if (rdrv && rdrv->shutdown) in rio_device_shutdown()
142 rdrv->shutdown(rdev); in rio_device_shutdown()
146 * rio_register_driver - register a new RIO driver
151 * occurred, the driver remains registered even if no device
157 rdrv->driver.name = rdrv->name; in rio_register_driver()
158 rdrv->driver.bus = &rio_bus_type; in rio_register_driver()
161 return driver_register(&rdrv->driver); in rio_register_driver()
165 * rio_unregister_driver - unregister a RIO driver
170 * function for each device it was responsible for, and marks those
175 driver_unregister(&rdrv->driver); in rio_unregister_driver()
180 rdev->dev.bus = &rio_bus_type; in rio_attach_device()
185 * rio_match_bus - Tell if a RIO device structure has a matching RIO driver device id structure
186 * @dev: the standard device structure to match against
189 * Used by a driver to check whether a RIO device present in the
194 static int rio_match_bus(struct device *dev, struct device_driver *drv) in rio_match_bus()
198 const struct rio_device_id *id = rdrv->id_table; in rio_match_bus() local
201 if (!id) in rio_match_bus()
204 found_id = rio_match_device(id, rdev); in rio_match_bus()
212 static int rio_uevent(struct device *dev, struct kobj_uevent_env *env) in rio_uevent()
217 return -ENODEV; in rio_uevent()
221 return -ENODEV; in rio_uevent()
224 rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did)) in rio_uevent()
225 return -ENOMEM; in rio_uevent()
248 * rio_bus_init - Register the RapidIO bus with the device model
250 * Registers the RIO mport device class and RIO bus type with the Linux
251 * device model.