/** * struct bus_type - The bus type of the device * * @name: The name of the bus. * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). * @bus_groups: Default attributes of the bus. * @dev_groups: Default attributes of the devices on the bus. * @drv_groups: Default attributes of the device drivers on the bus. * @match: Called, perhaps multiple times, whenever a new device or driver * is added for this bus. It should return a positive value if the * given device can be handled by the given driver and zero * otherwise. It may also return error code if determining that * the driver supports the device is not possible. In case of * -EPROBE_DEFER it will queue the device for deferred probing. * @uevent: Called when a device is added, removed, or a few other things * that generate uevents to add the environment variables. * @probe: Called when a new device or driver add to this bus, and callback * the specific driver's probe to initial the matched device. * @sync_state: Called to sync device state to software state after all the * state tracking consumers linked to this device (present at * the time of late_initcall) have successfully bound to a * driver. If the device has no consumers, this function will * be called at late_initcall_sync level. If the device has * consumers that are never bound to a driver, this function * will never get called until they do. * @remove: Called when a device removed from this bus. * @shutdown: Called at shut-down time to quiesce the device. * @irq_get_affinity: Get IRQ affinity mask for the device on this bus. * * @online: Called to put the device back online (after offlining it). * @offline: Called to put the device offline for hot-removal. May fail. * * @suspend: Called when a device on this bus wants to go to sleep mode. * @resume: Called to bring a device on this bus out of sleep mode. * @num_vf: Called to find out how many virtual functions a device on this * bus supports. * @dma_configure: Called to setup DMA configuration on a device on * this bus. * @dma_cleanup: Called to cleanup DMA configuration on a device on * this bus. * @pm: Power management operations of this bus, callback the specific * device driver's pm-ops. * @need_parent_lock: When probing or removing a device on this bus, the * device core should lock the device's parent. * * A bus is a channel between the processor and one or more devices. For the * purposes of the device model, all devices are connected via a bus, even if * it is an internal, virtual, "platform" bus. Buses can plug into each other. * A USB controller is usually a PCI device, for example. The device model * represents the actual connections between buses and the devices they control. * A bus is represented by the bus_type structure. It contains the name, the * default attributes, the bus' methods, PM operations, and the driver core's * private data.
*/ struct bus_type { constchar *name; constchar *dev_name; conststruct attribute_group **bus_groups; conststruct attribute_group **dev_groups; conststruct attribute_group **drv_groups;
/* Matching function type for drivers/base APIs to find a specific device */ typedefint (*device_match_t)(struct device *dev, constvoid *data);
/* Generic device matching functions that all busses can use to match with */ int device_match_name(struct device *dev, constvoid *name); int device_match_type(struct device *dev, constvoid *type); int device_match_of_node(struct device *dev, constvoid *np); int device_match_fwnode(struct device *dev, constvoid *fwnode); int device_match_devt(struct device *dev, constvoid *pdevt); int device_match_acpi_dev(struct device *dev, constvoid *adev); int device_match_acpi_handle(struct device *dev, constvoid *handle); int device_match_any(struct device *dev, constvoid *unused);
/* Device iterating function type for various driver core for_each APIs */ typedefint (*device_iter_t)(struct device *dev, void *data);
/* iterator helpers for buses */ int bus_for_each_dev(conststruct bus_type *bus, struct device *start, void *data, device_iter_t fn); struct device *bus_find_device(conststruct bus_type *bus, struct device *start, constvoid *data, device_match_t match); /** * bus_find_device_by_name - device iterator for locating a particular device * of a specific name. * @bus: bus type * @start: Device to begin with * @name: name of the device to match
*/ staticinlinestruct device *bus_find_device_by_name(conststruct bus_type *bus, struct device *start, constchar *name)
{ return bus_find_device(bus, start, name, device_match_name);
}
/** * bus_find_device_by_of_node : device iterator for locating a particular device * matching the of_node. * @bus: bus type * @np: of_node of the device to match.
*/ staticinlinestruct device *
bus_find_device_by_of_node(conststruct bus_type *bus, conststruct device_node *np)
{ return bus_find_device(bus, NULL, np, device_match_of_node);
}
/** * bus_find_device_by_fwnode : device iterator for locating a particular device * matching the fwnode. * @bus: bus type * @fwnode: fwnode of the device to match.
*/ staticinlinestruct device *
bus_find_device_by_fwnode(conststruct bus_type *bus, conststruct fwnode_handle *fwnode)
{ return bus_find_device(bus, NULL, fwnode, device_match_fwnode);
}
/** * bus_find_device_by_devt : device iterator for locating a particular device * matching the device type. * @bus: bus type * @devt: device type of the device to match.
*/ staticinlinestruct device *bus_find_device_by_devt(conststruct bus_type *bus,
dev_t devt)
{ return bus_find_device(bus, NULL, &devt, device_match_devt);
}
/** * bus_find_next_device - Find the next device after a given device in a * given bus. * @bus: bus type * @cur: device to begin the search with.
*/ staticinlinestruct device *
bus_find_next_device(conststruct bus_type *bus,struct device *cur)
{ return bus_find_device(bus, cur, NULL, device_match_any);
}
#ifdef CONFIG_ACPI struct acpi_device;
/** * bus_find_device_by_acpi_dev : device iterator for locating a particular device * matching the ACPI COMPANION device. * @bus: bus type * @adev: ACPI COMPANION device to match.
*/ staticinlinestruct device *
bus_find_device_by_acpi_dev(conststruct bus_type *bus, conststruct acpi_device *adev)
{ return bus_find_device(bus, NULL, adev, device_match_acpi_dev);
} #else staticinlinestruct device *
bus_find_device_by_acpi_dev(conststruct bus_type *bus, constvoid *adev)
{ return NULL;
} #endif
int bus_for_each_drv(conststruct bus_type *bus, struct device_driver *start, void *data, int (*fn)(struct device_driver *, void *)); void bus_sort_breadthfirst(conststruct bus_type *bus, int (*compare)(conststruct device *a, conststruct device *b)); /* * Bus notifiers: Get notified of addition/removal of devices * and binding/unbinding of drivers to devices. * In the long run, it should be a replacement for the platform * notify hooks.
*/ struct notifier_block;
int bus_register_notifier(conststruct bus_type *bus, struct notifier_block *nb); int bus_unregister_notifier(conststruct bus_type *bus, struct notifier_block *nb);
/** * enum bus_notifier_event - Bus Notifier events that have happened * @BUS_NOTIFY_ADD_DEVICE: device is added to this bus * @BUS_NOTIFY_DEL_DEVICE: device is about to be removed from this bus * @BUS_NOTIFY_REMOVED_DEVICE: device is successfully removed from this bus * @BUS_NOTIFY_BIND_DRIVER: a driver is about to be bound to this device on this bus * @BUS_NOTIFY_BOUND_DRIVER: a driver is successfully bound to this device on this bus * @BUS_NOTIFY_UNBIND_DRIVER: a driver is about to be unbound from this device on this bus * @BUS_NOTIFY_UNBOUND_DRIVER: a driver is successfully unbound from this device on this bus * @BUS_NOTIFY_DRIVER_NOT_BOUND: a driver failed to be bound to this device on this bus * * These are the value passed to a bus notifier when a specific event happens. * * Note that bus notifiers are likely to be called with the device lock already * held by the driver core, so be careful in any notifier callback as to what * you do with the device structure. * * All bus notifiers are called with the target struct device * as an argument.
*/ enum bus_notifier_event {
BUS_NOTIFY_ADD_DEVICE,
BUS_NOTIFY_DEL_DEVICE,
BUS_NOTIFY_REMOVED_DEVICE,
BUS_NOTIFY_BIND_DRIVER,
BUS_NOTIFY_BOUND_DRIVER,
BUS_NOTIFY_UNBIND_DRIVER,
BUS_NOTIFY_UNBOUND_DRIVER,
BUS_NOTIFY_DRIVER_NOT_BOUND,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.