2 * Copyright (c) 2013 Google, Inc
5 * Pavel Herrmann <morpheus.ibis@gmail.com>
7 * SPDX-License-Identifier: GPL-2.0+
10 #ifndef _DM_UCLASS_INTERNAL_H
11 #define _DM_UCLASS_INTERNAL_H
14 * uclass_find_device() - Return n-th child of uclass
15 * @id: Id number of the uclass
16 * @index: Position of the child in uclass's list
17 * #devp: Returns pointer to device, or NULL on error
19 * The device is not prepared for use - this is an internal function
21 * @return the uclass pointer of a child at the given index or
22 * return NULL on error.
24 int uclass_find_device(enum uclass_id id, int index, struct device **devp);
27 * uclass_bind_device() - Associate device with a uclass
29 * Connect the device into uclass's list of devices.
31 * @dev: Pointer to the device
32 * #return 0 on success, -ve on error
34 int uclass_bind_device(struct device *dev);
37 * uclass_unbind_device() - Deassociate device with a uclass
39 * Disconnect the device from uclass's list of devices.
41 * @dev: Pointer to the device
42 * #return 0 on success, -ve on error
44 int uclass_unbind_device(struct device *dev);
47 * uclass_post_probe_device() - Deal with a device that has just been probed
49 * Perform any post-processing of a probed device that is needed by the
52 * @dev: Pointer to the device
53 * #return 0 on success, -ve on error
55 int uclass_post_probe_device(struct device *dev);
58 * uclass_pre_remove_device() - Handle a device which is about to be removed
60 * Perform any pre-processing of a device that is about to be removed.
62 * @dev: Pointer to the device
63 * #return 0 on success, -ve on error
65 int uclass_pre_remove_device(struct device *dev);
68 * uclass_find() - Find uclass by its id
70 * @id: Id to serach for
71 * @return pointer to uclass, or NULL if not found
73 struct uclass *uclass_find(enum uclass_id key);
76 * uclass_destroy() - Destroy a uclass
78 * Destroy a uclass and all its devices
80 * @uc: uclass to destroy
81 * @return 0 on success, -ve on error
83 int uclass_destroy(struct uclass *uc);