Lines Matching +full:key +full:- +full:release
1 // SPDX-License-Identifier: GPL-2.0
3 * device.h - generic, centralized driver model
5 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
6 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
7 * Copyright (c) 2008-2009 Novell Inc.
9 * See Documentation/driver-api/driver-model/ for more information.
52 * struct subsys_interface - interfaces to device functions
84 * This identifies the device type and carries type-specific
95 void (*release)(struct device *dev); member
101 * struct device_attribute - Interface for exporting device attributes.
115 * struct dev_ext_attribute - Exported device attribute with extra context.
138 * DEVICE_ATTR - Define a device attribute.
148 * .. code-block:: c
160 * DEVICE_ATTR_PREALLOC - Define a preallocated device attribute.
173 * DEVICE_ATTR_RW - Define a read-write device attribute.
183 * DEVICE_ATTR_ADMIN_RW - Define an admin-only read-write device attribute.
192 * DEVICE_ATTR_RO - Define a readable device attribute.
201 * DEVICE_ATTR_ADMIN_RO - Define an admin-only readable device attribute.
210 * DEVICE_ATTR_WO - Define an admin-only writable device attribute.
219 * DEVICE_ULONG_ATTR - Define a device attribute backed by an unsigned long.
232 * DEVICE_INT_ATTR - Define a device attribute backed by an int.
244 * DEVICE_BOOL_ATTR - Define a device attribute backed by a bool.
274 void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp,
276 #define devres_alloc(release, size, gfp) \ argument
277 __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release)
278 #define devres_alloc_node(release, size, gfp, nid) \ argument
279 __devres_alloc_node(release, size, gfp, nid, #release)
281 void devres_for_each_res(struct device *dev, dr_release_t release,
287 void *devres_find(struct device *dev, dr_release_t release,
291 void *devres_remove(struct device *dev, dr_release_t release,
293 int devres_destroy(struct device *dev, dr_release_t release,
295 int devres_release(struct device *dev, dr_release_t release,
367 return ERR_PTR(-EINVAL); in devm_ioremap_resource()
374 return ERR_PTR(-EINVAL); in devm_ioremap_resource_wc()
382 return ERR_PTR(-EINVAL); in devm_of_iomap()
392 #define devm_add_action(release, action, data) \ argument
393 __devm_add_action(release, action, data, #action)
406 #define devm_add_action_or_reset(release, action, data) \ argument
407 __devm_add_action_or_reset(release, action, data, #action)
410 * devm_alloc_percpu - Resource-managed alloc_percpu
411 * @dev: Device to allocate per-cpu memory for
412 * @type: Type to allocate per-cpu memory for
414 * Managed alloc_percpu. Per-cpu memory allocated with this function is
439 * enum device_link_state - Device link states.
448 DL_STATE_NONE = -1,
481 * enum dl_dev_state - Device driver presence tracking information.
495 * enum device_removable - Whether the device is removable. The criteria for a
511 * struct dev_links_info - Device data related to device links.
525 * struct dev_msi_info - Device data related to MSI
537 * enum device_physical_location_panel - Describes which panel surface of the
558 * enum device_physical_location_vertical_position - Describes vertical
571 * enum device_physical_location_horizontal_position - Describes horizontal
584 * struct device_physical_location - Device data related to physical location
606 * struct device - The basic device structure
609 * controller. If parent is NULL, the device, is a top-level device,
613 * @kobj: A top-level, abstract class from which other classes are derived.
616 * This identifies the device type and carries type-specific
624 * to board-specific structures describing devices and how they
628 * minimizes board-specific #ifdefs in drivers.
632 * See Documentation/driver-api/pm/devices.rst for details.
635 * along with subsystem-level and driver-level callbacks.
638 * See Documentation/driver-api/pin-control.rst for details.
644 * hardware supports 64-bit addresses for consistent allocations
658 * @archdata: For arch-specific additions.
668 * @release: Callback to free the device after all references have
681 * @of_node_reused: Set if the device-tree node is shared with an ancestor
690 * architecture supports non-coherent devices.
692 * streaming DMA operations (->map_* / ->unmap_* / ->sync_*),
695 * instance from ->dma_supported.
703 * a higher-level representation of the device.
787 void (*release)(struct device *dev); member
811 * struct device_link - Device link representation.
819 * @rpm_active: Whether or not the consumer device is runtime-PM-active.
841 * device_iommu_mapped - Returns true when the device DMA is translated
847 return (dev->iommu_group != NULL); in device_iommu_mapped()
854 * dev_name - Return a device's name.
861 if (dev->init_name) in dev_name()
862 return dev->init_name; in dev_name()
864 return kobject_name(&dev->kobj); in dev_name()
868 * dev_bus_name - Return a device's bus/class name, if at all possible
876 return dev->bus ? dev->bus->name : (dev->class ? dev->class->name : ""); in dev_bus_name()
884 return dev->numa_node; in dev_to_node()
888 dev->numa_node = node; in set_dev_node()
903 return dev->msi.domain; in dev_get_msi_domain()
912 dev->msi.domain = d; in dev_set_msi_domain()
918 return dev->driver_data; in dev_get_drvdata()
923 dev->driver_data = data; in dev_set_drvdata()
928 return dev ? dev->power.subsys_data : NULL; in dev_to_psd()
933 return dev->kobj.uevent_suppress; in dev_get_uevent_suppress()
938 dev->kobj.uevent_suppress = val; in dev_set_uevent_suppress()
943 return dev->kobj.state_in_sysfs; in device_is_registered()
948 if (!dev->power.is_prepared) in device_enable_async_suspend()
949 dev->power.async_suspend = true; in device_enable_async_suspend()
954 if (!dev->power.is_prepared) in device_disable_async_suspend()
955 dev->power.async_suspend = false; in device_disable_async_suspend()
960 return !!dev->power.async_suspend; in device_async_suspend_enabled()
965 return dev->power.no_pm; in device_pm_not_required()
970 dev->power.no_pm = true; in device_set_pm_not_required()
976 dev->power.syscore = val; in dev_pm_syscore_device()
982 dev->power.driver_flags = flags; in dev_pm_set_driver_flags()
987 return !!(dev->power.driver_flags & flags); in dev_pm_test_driver_flags()
992 mutex_lock(&dev->mutex); in device_lock()
997 return mutex_lock_interruptible(&dev->mutex); in device_lock_interruptible()
1002 return mutex_trylock(&dev->mutex); in device_trylock()
1007 mutex_unlock(&dev->mutex); in device_unlock()
1012 lockdep_assert_held(&dev->mutex); in device_lock_assert()
1019 return dev->of_node; in dev_of_node()
1026 if (dev->driver && dev->driver->sync_state) in dev_has_sync_state()
1028 if (dev->bus && dev->bus->sync_state) in dev_has_sync_state()
1036 dev->removable = removable; in dev_set_removable()
1041 return dev->removable == DEVICE_REMOVABLE; in dev_is_removable()
1046 return dev->removable != DEVICE_REMOVABLE_NOT_SUPPORTED; in dev_removable_is_valid()
1078 return dev->bus && dev->bus->offline && dev->bus->online; in device_supports_offline()
1081 #define __device_lock_set_class(dev, name, key) \ argument
1084 lock_set_class(&__d2->mutex.dep_map, name, key, 0, _THIS_IP_); \
1088 * device_lock_set_class - Specify a temporary lock class while a device
1091 * @key: lock class key data
1094 * from driver ->probe(). Take care to only override the default
1098 #define device_lock_set_class(dev, key) \ argument
1101 dev_WARN_ONCE(__d, !lockdep_match_class(&__d->mutex, \
1104 __device_lock_set_class(__d, #key, key); \
1107 #define device_lock_set_class(dev, key) __device_lock_set_class(dev, #key, key) argument
1111 * device_lock_reset_class - Return a device to the default lockdep novalidate state
1115 * from driver ->remove().
1120 lock_set_novalidate_class(&__d->mutex.dep_map, "&dev->mutex", \
1136 if (dev->bus && dev->bus->num_vf) in dev_num_vf()
1137 return dev->bus->num_vf(dev); in dev_num_vf()
1154 return dev->platform_data; in dev_get_platdata()
1211 * Platform "fixup" functions - allow the platform to have their say
1222 * get_device - atomically increment the reference count for the device.
1254 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
1256 MODULE_ALIAS("char-major-" __stringify(major) "-*")