Lines Matching refs:device
3 * drivers/base/core.c - core driver model code (device registration, etc)
13 #include <linux/device.h>
44 static void __fw_devlink_link_to_consumers(struct device *dev);
57 * The driver core will use the fwnode link to create a device link between the
58 * two device objects corresponding to @con and @sup when they are created. The
215 * If the @fwnode has a corresponding struct device and the device supports
217 * MANAGED device links to this device, so leave @fwnode and its descendant's
276 static bool device_is_ancestor(struct device *dev, struct device *target)
295 * device_is_dependent - Check if one device depends on another one
299 * Check if @target depends on @dev or any device dependent on it (its child or
302 int device_is_dependent(struct device *dev, void *target)
309 * device has not been completely initialized yet and it is still
310 * missing from the list of children of its parent device.
334 struct device *consumer,
335 struct device *supplier)
377 static int device_reorder_to_tail(struct device *dev, void *not_used)
402 * device_pm_move_to_tail - Move set of devices to the end of device lists
410 void device_pm_move_to_tail(struct device *dev)
423 static ssize_t status_show(struct device *dev,
456 static ssize_t auto_remove_on_show(struct device *dev,
473 static ssize_t runtime_pm_show(struct device *dev,
482 static ssize_t sync_state_only_show(struct device *dev,
526 static void devlink_dev_release(struct device *dev)
546 static int devlink_add_symlinks(struct device *dev)
551 struct device *sup = link->supplier;
552 struct device *con = link->consumer;
595 static void devlink_remove_symlinks(struct device *dev)
599 struct device *sup = link->supplier;
600 struct device *con = link->consumer;
612 WARN(1, "Unable to properly free device link symlinks!\n");
678 * the DL_FLAG_AUTOREMOVE_CONSUMER and DL_FLAG_AUTOREMOVE_SUPPLIER device link
683 * device, so the link can be deleted at that point. If none of them is set,
689 * managed device link is being added), the DL_FLAG_AUTOPROBE_CONSUMER flag can
691 * driver after successfully binding a driver to the supplier device.
696 * However, if a device link between the given @consumer and @supplier pair
705 * devices_kset list by moving the consumer device and all devices depending
709 * The supplier device is required to be registered when this function is called
710 * and NULL will be returned if that is not the case. The consumer device need
713 struct device_link *device_link_add(struct device *consumer,
714 struct device *supplier, u32 flags)
758 * SYNC_STATE_ONLY links are useless once a consumer device has probed.
933 WARN(1, "Unable to drop a managed device link reference\n");
961 void device_link_remove(void *consumer, struct device *supplier)
981 static void device_links_missing_supplier(struct device *dev)
998 static bool dev_is_best_effort(struct device *dev)
1021 * @dev: Consumer device.
1023 * Check links from this device to any suppliers. Walk the list of the device's
1029 * that function checks the device's links to consumers. This means we need to
1035 int device_links_check_suppliers(struct device *dev)
1093 * __device_links_queue_sync_state - Queue a device for sync_state() callback
1097 * Queues a device for a sync_state() callback when the device links write lock
1098 * isn't held. This allows the sync_state() execution flow to use device links
1102 * This function does a get_device() to make sure the device is not freed while
1108 * put_device() is called on this device.
1110 static void __device_links_queue_sync_state(struct device *dev,
1128 * Set the flag here to avoid adding the same device to a list more
1129 * than once. This can happen if new consumers get added to the device
1149 * context where a device lock is already held.
1152 struct device *dont_lock_dev)
1154 struct device *dev, *tmp;
1180 struct device *dev, *tmp;
1213 static void __device_links_supplier_defer_sync(struct device *sup)
1226 static ssize_t waiting_for_supplier_show(struct device *dev,
1242 * device_links_force_bind - Prepares device to be force bound
1243 * @dev: Consumer device.
1245 * device_bind_driver() force binds a device to a driver without calling any
1247 * supplier before it's bound to the driver. We still want the device link
1251 * supplier device links and checks if the supplier is bound. If it is, then
1252 * the device link status is set to CONSUMER_PROBE. Otherwise, the device link
1255 void device_links_force_bind(struct device *dev)
1277 * device_links_driver_bound - Update device links after probing its driver.
1280 * The probe has been successful, so update links from this device to any
1287 void device_links_driver_bound(struct device *dev)
1293 * If a device binds successfully, it's expected to have created all
1294 * the device links it needs to or make new device links as it needs
1295 * them. So, fw_devlink no longer needs to create device links to any
1296 * of the device's suppliers.
1298 * Also, if a child firmware node of this bound device is not added as a
1299 * device by now, assume it is never going to be added. Make this bound
1300 * device the fallback supplier to the dangling consumers of the child
1301 * firmware node because this bound device is probably implementing the
1303 * consumers to defer probe indefinitely waiting for a device for the
1347 struct device *supplier;
1365 * When dev_is_best_effort() is true, we ignore device
1367 * consumer device still managed to probe, there's no
1368 * point in maintaining a device link in a weird state
1379 * DL_FLAG_SYNC_STATE_ONLY device link in case it was the last
1380 * device link that was preventing the supplier from getting a
1397 * __device_links_no_driver - Update links of a device without a driver.
1400 * Delete all non-persistent links from this device to any suppliers.
1408 static void __device_links_no_driver(struct device *dev)
1446 void device_links_no_driver(struct device *dev)
1459 * a probing consumer while this device was still probing.
1483 void device_links_driver_cleanup(struct device *dev)
1518 * Check each consumer of the device and return 'true' if its link's status
1528 bool device_links_busy(struct device *dev)
1554 * device_links_unbind_consumers - Force unbind consumers of the given device.
1558 * "consumer probe" state, wait for all device probes in progress to complete
1568 void device_links_unbind_consumers(struct device *dev)
1591 struct device *consumer = link->consumer;
1609 * @dev: Target device.
1611 static void device_links_purge(struct device *dev)
1619 * Delete all of the remaining links from this device to any other
1747 static int fw_devlink_no_driver(struct device *dev, void *data)
1766 static int fw_devlink_dev_sync_state(struct device *dev, void *data)
1769 struct device *sup = link->supplier;
1805 * wait_for_init_devices_probe - Try to probe any device needed for init
1823 * and probe the device if possible. By the time this function returns, all such
1824 * "best effort" probes are guaranteed to be completed. If a device successfully
1826 * device where the supplier hasn't yet probed successfully because they have to
1860 static void fw_devlink_unblock_consumers(struct device *dev)
1876 struct device *dev;
1905 * @con: Potential consumer device.
1908 * Needs to be called with fwnode_lock and device link lock held.
1912 * and @con. When such dependency cycles are found, convert all device links
1913 * created solely by fw_devlink into SYNC_STATE_ONLY device links. Also, mark
1915 * converted into a device link in the future, they are created as
1916 * SYNC_STATE_ONLY device links. This is the equivalent of doing
1923 static bool __fw_devlink_relax_cycles(struct device *con,
1926 struct device *sup_dev = NULL, *par_dev = NULL;
1970 * Give priority to device parent over fwnode parent to account for any
2009 * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
2010 * @con: consumer device for the device link
2012 * @link: fwnode link that's being converted to a device link
2014 * This function will try to create a device link between the consumer device
2015 * @con and the supplier device represented by @sup_handle.
2018 * fwnode links can sometimes cause the supplier device to never be created.
2020 * device link from the consumer to a missing supplier.
2023 * 0 on successfully creating a device link
2024 * -EINVAL if the device link cannot be created as expected
2025 * -EAGAIN if the device link cannot be created right now, but it may be
2028 static int fw_devlink_create_devlink(struct device *con,
2032 struct device *sup_dev;
2042 * In some cases, a device P might also be a supplier to its child node
2044 * completes successfully. This is perfectly fine in the device driver
2045 * model. device_add() doesn't guarantee probe completion of the device
2053 * When such a flag is set, we can't create device links where P is the
2061 * SYNC_STATE_ONLY device links don't block probing and supports cycles.
2063 * However, if the device link was marked as SYNC_STATE_ONLY because
2088 * their device using driver core, then don't wait on this
2089 * supplier device indefinitely.
2101 dev_err(con, "Failed to create device link (0x%x) with %s\n",
2111 * device or being probed by a driver.
2127 * __fw_devlink_link_to_consumers - Create device links to consumers of a device
2130 * This function looks at all the consumer fwnodes of @dev and creates device
2131 * links between the consumer device and @dev (supplier).
2133 * If the consumer device has not been added yet, then this function creates a
2134 * SYNC_STATE_ONLY link between @dev (supplier) and the closest ancestor device
2136 * sync_state() callback before the real consumer device gets to be added and
2139 * Once device links are created from the real consumer to @dev (supplier), the
2142 static void __fw_devlink_link_to_consumers(struct device *dev)
2148 struct device *con_dev;
2154 * If consumer device is not available yet, make a "proxy"
2155 * SYNC_STATE_ONLY link from the consumer's parent device to
2156 * the supplier device. This is necessary to make sure the
2158 * consumer can create a device link to the supplier.
2161 * consumer's parent device is added before the supplier.
2166 * However, if the consumer's parent device is also the
2169 * device. Such a dependency is impossible.
2193 * __fw_devlink_link_to_suppliers - Create device links to suppliers of a device
2194 * @dev: The consumer device that needs to be linked to its suppliers
2195 * @fwnode: Root of the fwnode tree that is used to create device links
2198 * @fwnode and creates device links between @dev (consumer) and all the
2201 * The function creates normal (non-SYNC_STATE_ONLY) device links between @dev
2202 * and the real suppliers of @dev. Once these device links are created, the
2208 * driver core. So, this function creates SYNC_STATE_ONLY device links between
2211 * their device links. The fwnode links that correspond to the child devices
2212 * aren't delete because they are needed later to create the device links
2215 static void __fw_devlink_link_to_suppliers(struct device *dev,
2234 * Make "proxy" SYNC_STATE_ONLY device links to represent the needs of
2236 * case where the supplier is added before the consumer's parent device
2243 static void fw_devlink_link_device(struct device *dev)
2260 int (*platform_notify)(struct device *dev) = NULL;
2261 int (*platform_notify_remove)(struct device *dev) = NULL;
2293 static inline int device_is_not_partition(struct device *dev)
2298 static inline int device_is_not_partition(struct device *dev)
2304 static void device_platform_notify(struct device *dev)
2314 static void device_platform_notify_remove(struct device *dev)
2325 * dev_driver_string - Return a device's driver name, if at all possible
2326 * @dev: struct device to get the name of
2328 * Will return the device's driver's name if it is bound to a device. If
2329 * the device is not bound to a driver, it will return the name of the bus
2333 const char *dev_driver_string(const struct device *dev)
2352 struct device *dev = kobj_to_dev(kobj);
2368 struct device *dev = kobj_to_dev(kobj);
2383 ssize_t device_store_ulong(struct device *dev,
2400 ssize_t device_show_ulong(struct device *dev,
2409 ssize_t device_store_int(struct device *dev,
2429 ssize_t device_show_int(struct device *dev,
2439 ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
2451 ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
2461 * device_release - free device structure.
2462 * @kobj: device's kobject.
2465 * reaches 0. We forward the call to the device's release
2470 struct device *dev = kobj_to_dev(kobj);
2478 * Drivers still can add resources into device after device
2500 const struct device *dev = kobj_to_dev(kobj);
2511 const struct device *dev = kobj_to_dev(kobj);
2530 const struct device *dev = kobj_to_dev(kobj);
2541 const struct device *dev = kobj_to_dev(kobj);
2552 const struct device *dev = kobj_to_dev(kobj);
2555 /* add device node properties if present */
2584 /* Add common DT information about the device */
2591 pr_debug("device: '%s': %s: bus uevent() returned %d\n",
2599 pr_debug("device: '%s': %s: class uevent() "
2604 /* have the device type specific function add its stuff */
2608 pr_debug("device: '%s': %s: dev_type uevent() "
2622 static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,
2632 /* search the kset, the device belongs to */
2665 static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,
2681 static ssize_t online_show(struct device *dev, struct device_attribute *attr,
2692 static ssize_t online_store(struct device *dev, struct device_attribute *attr,
2712 static ssize_t removable_show(struct device *dev, struct device_attribute *attr,
2731 int device_add_groups(struct device *dev, const struct attribute_group **groups)
2737 void device_remove_groups(struct device *dev,
2749 static void devm_attr_group_remove(struct device *dev, void *res)
2758 static void devm_attr_groups_remove(struct device *dev, void *res)
2768 * devm_device_add_group - given a device, create a managed attribute group
2769 * @dev: The device to create the group for
2777 int devm_device_add_group(struct device *dev, const struct attribute_group *grp)
2801 * @dev: The device to create the group for
2812 int devm_device_add_groups(struct device *dev,
2835 static int device_add_attrs(struct device *dev)
2902 static void device_remove_attrs(struct device *dev)
2924 static ssize_t dev_show(struct device *dev, struct device_attribute *attr,
2935 * devices_kset_move_before - Move device in the devices_kset's list.
2939 static void devices_kset_move_before(struct device *deva, struct device *devb)
2951 * devices_kset_move_after - Move device in the devices_kset's list.
2955 static void devices_kset_move_after(struct device *deva, struct device *devb)
2967 * devices_kset_move_last - move the device to the end of devices_kset's list.
2968 * @dev: device to move
2970 void devices_kset_move_last(struct device *dev)
2981 * device_create_file - create sysfs attribute file for device.
2982 * @dev: device.
2983 * @attr: device attribute descriptor.
2985 int device_create_file(struct device *dev,
3006 * @dev: device.
3007 * @attr: device attribute descriptor.
3009 void device_remove_file(struct device *dev,
3019 * @dev: device.
3020 * @attr: device attribute descriptor.
3024 bool device_remove_file_self(struct device *dev,
3035 * device_create_bin_file - create sysfs binary attribute file for device.
3036 * @dev: device.
3037 * @attr: device binary attribute descriptor.
3039 int device_create_bin_file(struct device *dev,
3051 * @dev: device.
3052 * @attr: device binary attribute descriptor.
3054 void device_remove_bin_file(struct device *dev,
3065 struct device *dev = p->device;
3073 struct device *dev = p->device;
3079 * device_initialize - init device structure.
3080 * @dev: device.
3082 * This prepares the device for use by other layers by initializing
3098 void device_initialize(struct device *dev)
3122 struct kobject *virtual_device_parent(struct device *dev)
3184 static struct kobject *get_device_parent(struct device *dev,
3185 struct device *parent)
3196 * Class-devices with a non class-device as parent, live
3224 /* or create a new class-directory at the parent device */
3234 struct device *dev_root = bus_get_dev_root(dev->bus);
3249 struct device *dev)
3270 static inline struct kobject *get_glue_dir(struct device *dev)
3297 static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
3308 * and adding a new device under the glue directory.
3341 * Before CPU1 remove last child device under glue dir, if CPU2 add
3342 * a new device under glue dir, the glue_dir kobject reference count
3361 static int device_add_class_symlinks(struct device *dev)
3371 /* An error here doesn't warrant bringing down the device */
3384 "device");
3389 /* link in the class directory pointing to the device */
3396 sysfs_remove_link(&dev->kobj, "device");
3406 static void device_remove_class_symlinks(struct device *dev)
3417 sysfs_remove_link(&dev->kobj, "device");
3424 * dev_set_name - set a device name
3425 * @dev: device
3426 * @fmt: format string for the device's name
3428 int dev_set_name(struct device *dev, const char *fmt, ...)
3440 /* select a /sys/dev/ directory for the device */
3441 static struct kobject *device_to_dev_kobj(struct device *dev)
3449 static int device_create_sys_dev_entry(struct device *dev)
3463 static void device_remove_sys_dev_entry(struct device *dev)
3474 static int device_private_init(struct device *dev)
3479 dev->p->device = dev;
3487 * device_add - add device to device hierarchy.
3488 * @dev: device.
3494 * to the global and sibling lists for the device, then
3498 * any device structure. The driver model core is not designed to work
3502 * and register a fresh new struct device instead.
3513 int device_add(struct device *dev)
3516 struct device *parent;
3544 /* subsystems can specify simple device enumeration */
3552 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
3575 /* notify platform of device entry */
3608 /* Notify clients of device addition. This call must come
3616 * this device (supplier) to be added so that they can create a device
3624 * device and the driver sync_state callback is called for this device.
3634 * If all driver registration is done and a newly added device doesn't
3636 * case the consumer device is able to operate without this supplier.
3648 /* tie the class to the device */
3651 /* notify any interfaces that the device is here */
3693 * device_register - register a device with the system.
3694 * @dev: pointer to the device structure
3696 * This happens in two clean steps - initialize the device
3700 * have a clearly defined need to use and refcount the device
3710 int device_register(struct device *dev)
3718 * get_device - increment reference count for device.
3719 * @dev: device.
3725 struct device *get_device(struct device *dev)
3733 * @dev: device in question.
3735 void put_device(struct device *dev)
3743 bool kill_device(struct device *dev)
3746 * Require the device lock and set the "dead" flag to guarantee that
3750 * underneath the device.
3762 * device_del - delete device from system.
3763 * @dev: device.
3765 * This is the first part of the device unregistration
3766 * sequence. This removes the device from the lists we control
3774 void device_del(struct device *dev)
3777 struct device *parent = dev->parent;
3789 /* Notify clients of device removal. This call must come
3809 /* notify any interfaces that the device is now gone */
3813 /* remove the device from the class list */
3827 * If a device does not have a driver attached, we need to clean
3829 * it's never called (and we leak the device) if a managed
3830 * resource holds a reference to the device. So release all
3848 * device_unregister - unregister device from system.
3849 * @dev: device going away.
3854 * is the final reference count, the device will be cleaned up
3856 * stick around until the final reference to the device is dropped.
3858 void device_unregister(struct device *dev)
3860 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
3866 static struct device *prev_device(struct klist_iter *i)
3869 struct device *dev = NULL;
3874 dev = p->device;
3879 static struct device *next_device(struct klist_iter *i)
3882 struct device *dev = NULL;
3887 dev = p->device;
3893 * device_get_devnode - path of device node file
3894 * @dev: device
3900 * Return the relative path of a possible device node.
3905 const char *device_get_devnode(const struct device *dev,
3913 /* the device type may provide a specific name */
3937 * device_for_each_child - device child iterator.
3938 * @parent: parent struct device.
3939 * @fn: function to be called for each device.
3948 int device_for_each_child(struct device *parent, void *data,
3949 int (*fn)(struct device *dev, void *data))
3952 struct device *child;
3967 * device_for_each_child_reverse - device child iterator in reversed order.
3968 * @parent: parent struct device.
3969 * @fn: function to be called for each device.
3978 int device_for_each_child_reverse(struct device *parent, void *data,
3979 int (*fn)(struct device *dev, void *data))
3982 struct device *child;
3997 * device_find_child - device iterator for locating a particular device.
3998 * @parent: parent struct device
3999 * @match: Callback function to check device
4003 * returns a reference to a device that is 'found' for later use, as
4006 * The callback should return 0 if the device doesn't match and non-zero
4008 * current device can be obtained, this function will return to the caller
4013 struct device *device_find_child(struct device *parent, void *data,
4014 int (*match)(struct device *dev, void *data))
4017 struct device *child;
4032 * device_find_child_by_name - device iterator for locating a child device.
4033 * @parent: parent struct device
4034 * @name: name of the child device
4037 * returns a reference to a device that has the name @name.
4041 struct device *device_find_child_by_name(struct device *parent,
4045 struct device *child;
4059 static int match_any(struct device *dev, void *unused)
4065 * device_find_any_child - device iterator for locating a child device, if any.
4066 * @parent: parent struct device
4069 * returns a reference to a child device, if any.
4073 struct device *device_find_any_child(struct device *parent)
4105 static int device_check_offline(struct device *dev, void *not_used)
4117 * device_offline - Prepare the device for hot-removal.
4120 * Execute the device bus type's .offline() callback, if present, to prepare
4121 * the device for a subsequent hot-removal. If that succeeds, the device must
4127 int device_offline(struct device *dev)
4156 * device_online - Put the device back online after successful device_offline().
4159 * If device_offline() has been successfully executed for @dev, but the device
4161 * to indicate that the device can be used again.
4165 int device_online(struct device *dev)
4187 struct device dev;
4191 static inline struct root_device *to_root_device(struct device *d)
4196 static void root_device_release(struct device *dev)
4202 * __root_device_register - allocate and register a root device
4203 * @name: root device name
4204 * @owner: owner module of the root device, usually THIS_MODULE
4206 * This function allocates a root device and registers it
4208 * device, use root_device_unregister().
4212 * allocate a root device and then use it as the parent of
4213 * any device which should appear under /sys/devices/{name}
4219 * Returns &struct device pointer on success, or ERR_PTR() on error.
4223 struct device *__root_device_register(const char *name, struct module *owner)
4264 * root_device_unregister - unregister and free a root device
4265 * @dev: device going away
4267 * This function unregisters and cleans up a device that was created by
4270 void root_device_unregister(struct device *dev)
4282 static void device_create_release(struct device *dev)
4284 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
4288 static __printf(6, 0) struct device *
4289 device_create_groups_vargs(const struct class *class, struct device *parent,
4294 struct device *dev = NULL;
4330 * device_create - creates a device and registers it with sysfs
4331 * @class: pointer to the struct class that this device should be registered to
4332 * @parent: pointer to the parent struct device of this new device, if any
4333 * @devt: the dev_t for the char device to be added
4334 * @drvdata: the data to be added to the device for callbacks
4335 * @fmt: string for the device's name
4337 * This function can be used by char device classes. A struct device
4340 * A "dev" file will be created, showing the dev_t for the device, if
4342 * If a pointer to a parent struct device is passed in, the newly created
4343 * struct device will be a child of that device in sysfs.
4344 * The pointer to the struct device will be returned from the call.
4348 * Returns &struct device pointer on success, or ERR_PTR() on error.
4350 struct device *device_create(const struct class *class, struct device *parent,
4354 struct device *dev;
4365 * device_create_with_groups - creates a device and registers it with sysfs
4366 * @class: pointer to the struct class that this device should be registered to
4367 * @parent: pointer to the parent struct device of this new device, if any
4368 * @devt: the dev_t for the char device to be added
4369 * @drvdata: the data to be added to the device for callbacks
4371 * @fmt: string for the device's name
4373 * This function can be used by char device classes. A struct device
4378 * A "dev" file will be created, showing the dev_t for the device, if
4380 * If a pointer to a parent struct device is passed in, the newly created
4381 * struct device will be a child of that device in sysfs.
4382 * The pointer to the struct device will be returned from the call.
4386 * Returns &struct device pointer on success, or ERR_PTR() on error.
4388 struct device *device_create_with_groups(const struct class *class,
4389 struct device *parent, dev_t devt,
4395 struct device *dev;
4406 * device_destroy - removes a device that was created with device_create()
4407 * @class: pointer to the struct class that this device was registered with
4408 * @devt: the dev_t of the device that was previously registered
4410 * This call unregisters and cleans up a device that was created with a
4415 struct device *dev;
4426 * device_rename - renames a device
4427 * @dev: the pointer to the struct device to be renamed
4428 * @new_name: the new name of the device
4432 * on the same device to ensure that new_name is valid and
4444 * connect the event to the old and new device. Device nodes are not renamed at
4451 * kernel device renaming. Besides that, it's not even implemented now for
4455 * some other attributes for userspace to find the device, or use udev to add
4460 int device_rename(struct device *dev, const char *new_name)
4506 static int device_move_class_links(struct device *dev,
4507 struct device *old_parent,
4508 struct device *new_parent)
4513 sysfs_remove_link(&dev->kobj, "device");
4516 "device");
4521 * device_move - moves a device to a new parent
4522 * @dev: the pointer to the struct device to be moved
4523 * @new_parent: the new parent of the device (can be NULL)
4526 int device_move(struct device *dev, struct device *new_parent,
4530 struct device *old_parent;
4546 pr_debug("device: '%s': %s: moving to '%s'\n", dev_name(dev),
4609 static int device_attrs_change_owner(struct device *dev, kuid_t kuid,
4619 * Change the device groups of the device class for @dev to
4630 * Change the device groups of the device type for @dev to
4639 /* Change the device groups of @dev to @kuid/@kgid. */
4645 /* Change online device attributes of @dev to @kuid/@kgid. */
4656 * device_change_owner - change the owner of an existing device.
4657 * @dev: device.
4667 int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
4696 * Change the device groups, the device groups associated with the
4697 * device class, and the groups associated with the device type of @dev
4710 * the device class associated with @dev which points to the actual
4729 * device_shutdown - call ->shutdown() on each device to shutdown.
4733 struct device *dev, *parent;
4743 * Beware that device unplug events may also start pulling
4747 dev = list_entry(devices_kset->list.prev, struct device,
4751 * hold reference count of device's parent to
4758 * Make sure the device is off the kset list, in the
4806 set_dev_info(const struct device *dev, struct dev_printk_info *dev_info)
4822 * Add device identifier DEVICE=:
4836 snprintf(dev_info->device, sizeof(dev_info->device),
4841 snprintf(dev_info->device, sizeof(dev_info->device),
4844 snprintf(dev_info->device, sizeof(dev_info->device),
4849 int dev_vprintk_emit(int level, const struct device *dev,
4860 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
4875 static void __dev_printk(const char *level, const struct device *dev,
4882 printk("%s(NULL device *): %pV", level, vaf);
4885 void _dev_printk(const char *level, const struct device *dev,
4903 void func(const struct device *dev, const char *fmt, ...) \
4931 * @dev: the pointer to the struct device
4961 int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
4989 * set_primary_fwnode - Change the primary firmware node of a given device.
4991 * @fwnode: New primary firmware node of the device.
4993 * Set the device's firmware node pointer to @fwnode, but if a secondary
4994 * firmware node of the device is present, preserve it.
5002 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
5004 struct device *parent = dev->parent;
5034 * set_secondary_fwnode - Change the secondary firmware node of a given device.
5036 * @fwnode: New secondary firmware node of the device.
5038 * If a primary firmware node of the device is present, set its secondary
5039 * pointer to @fwnode. Otherwise, set the device's firmware node pointer to
5042 void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
5055 * device_set_of_node_from_dev - reuse device-tree node of another device
5056 * @dev: device whose device-tree node is being set
5057 * @dev2: device whose device-tree node is being reused
5059 * Takes another reference to the new device-tree node after first dropping
5062 void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
5070 void device_set_node(struct device *dev, struct fwnode_handle *fwnode)
5077 int device_match_name(struct device *dev, const void *name)
5083 int device_match_of_node(struct device *dev, const void *np)
5089 int device_match_fwnode(struct device *dev, const void *fwnode)
5095 int device_match_devt(struct device *dev, const void *pdevt)
5101 int device_match_acpi_dev(struct device *dev, const void *adev)
5107 int device_match_acpi_handle(struct device *dev, const void *handle)
5113 int device_match_any(struct device *dev, const void *unused)