// SPDX-License-Identifier: GPL-2.0 /* * The class-specific portions of the driver model * * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> * Copyright (c) 2008-2009 Novell Inc. * Copyright (c) 2012-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org> * Copyright (c) 2012-2019 Linux Foundation * * See Documentation/driver-api/driver-model/ for more information.
*/
/** * struct class - device classes * @name: Name of the class. * @class_groups: Default attributes of this class. * @dev_groups: Default attributes of the devices that belong to the class. * @dev_uevent: Called when a device is added, removed from this class, or a * few other things that generate uevents to add the environment * variables. * @devnode: Callback to provide the devtmpfs. * @class_release: Called to release this class. * @dev_release: Called to release the device. * @shutdown_pre: Called at shut-down time before driver shutdown. * @ns_type: Callbacks so sysfs can detemine namespaces. * @namespace: Namespace of the device belongs to this class. * @get_ownership: Allows class to specify uid/gid of the sysfs directories * for the devices belonging to the class. Usually tied to * device's namespace. * @pm: The default device power management operations of this class. * * A class is a higher-level view of a device that abstracts out low-level * implementation details. Drivers may see a SCSI disk or an ATA disk, but, * at the class level, they are all simply disks. Classes allow user space * to work with devices based on what they do, rather than how they are * connected or how they work.
*/ structclass { constchar *name;
/** * class_find_device_by_name - device iterator for locating a particular device * of a specific name. * @class: class type * @name: name of the device to match
*/ staticinlinestruct device *class_find_device_by_name(conststructclass *class, constchar *name)
{ return class_find_device(class, NULL, name, device_match_name);
}
/** * class_find_device_by_of_node : device iterator for locating a particular device * matching the of_node. * @class: class type * @np: of_node of the device to match.
*/ staticinlinestruct device *class_find_device_by_of_node(conststructclass *class, conststruct device_node *np)
{ return class_find_device(class, NULL, np, device_match_of_node);
}
/** * class_find_device_by_fwnode : device iterator for locating a particular device * matching the fwnode. * @class: class type * @fwnode: fwnode of the device to match.
*/ staticinlinestruct device *class_find_device_by_fwnode(conststructclass *class, conststruct fwnode_handle *fwnode)
{ return class_find_device(class, NULL, fwnode, device_match_fwnode);
}
/** * class_find_device_by_devt : device iterator for locating a particular device * matching the device type. * @class: class type * @devt: device type of the device to match.
*/ staticinlinestruct device *class_find_device_by_devt(conststructclass *class,
dev_t devt)
{ return class_find_device(class, NULL, &devt, device_match_devt);
}
#ifdef CONFIG_ACPI struct acpi_device; /** * class_find_device_by_acpi_dev : device iterator for locating a particular * device matching the ACPI_COMPANION device. * @class: class type * @adev: ACPI_COMPANION device to match.
*/ staticinlinestruct device *class_find_device_by_acpi_dev(conststructclass *class, conststruct acpi_device *adev)
{ return class_find_device(class, NULL, adev, device_match_acpi_dev);
} #else staticinlinestruct device *class_find_device_by_acpi_dev(conststructclass *class, constvoid *adev)
{ return NULL;
} #endif
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.