uclass-internal.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2013 Google, Inc
  3. *
  4. * (C) Copyright 2012
  5. * Pavel Herrmann <morpheus.ibis@gmail.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef _DM_UCLASS_INTERNAL_H
  10. #define _DM_UCLASS_INTERNAL_H
  11. /**
  12. * uclass_find_device() - Return n-th child of uclass
  13. * @id: Id number of the uclass
  14. * @index: Position of the child in uclass's list
  15. * #devp: Returns pointer to device, or NULL on error
  16. *
  17. * The device is not prepared for use - this is an internal function
  18. *
  19. * @return the uclass pointer of a child at the given index or
  20. * return NULL on error.
  21. */
  22. int uclass_find_device(enum uclass_id id, int index, struct device **devp);
  23. /**
  24. * uclass_bind_device() - Associate device with a uclass
  25. *
  26. * Connect the device into uclass's list of devices.
  27. *
  28. * @dev: Pointer to the device
  29. * #return 0 on success, -ve on error
  30. */
  31. int uclass_bind_device(struct device *dev);
  32. /**
  33. * uclass_unbind_device() - Deassociate device with a uclass
  34. *
  35. * Disconnect the device from uclass's list of devices.
  36. *
  37. * @dev: Pointer to the device
  38. * #return 0 on success, -ve on error
  39. */
  40. int uclass_unbind_device(struct device *dev);
  41. /**
  42. * uclass_post_probe_device() - Deal with a device that has just been probed
  43. *
  44. * Perform any post-processing of a probed device that is needed by the
  45. * uclass.
  46. *
  47. * @dev: Pointer to the device
  48. * #return 0 on success, -ve on error
  49. */
  50. int uclass_post_probe_device(struct device *dev);
  51. /**
  52. * uclass_pre_remove_device() - Handle a device which is about to be removed
  53. *
  54. * Perform any pre-processing of a device that is about to be removed.
  55. *
  56. * @dev: Pointer to the device
  57. * #return 0 on success, -ve on error
  58. */
  59. int uclass_pre_remove_device(struct device *dev);
  60. /**
  61. * uclass_find() - Find uclass by its id
  62. *
  63. * @id: Id to serach for
  64. * @return pointer to uclass, or NULL if not found
  65. */
  66. struct uclass *uclass_find(enum uclass_id key);
  67. /**
  68. * uclass_destroy() - Destroy a uclass
  69. *
  70. * Destroy a uclass and all its devices
  71. *
  72. * @uc: uclass to destroy
  73. * @return 0 on success, -ve on error
  74. */
  75. int uclass_destroy(struct uclass *uc);
  76. #endif