• struct uclass_driver


    1. /**
    2. * struct uclass_driver - Driver for the uclass
    3. *
    4. * A uclass_driver provides a consistent interface to a set of related
    5. * drivers.
    6. *
    7. * @name: Name of uclass driver
    8. * @id: ID number of this uclass
    9. * @post_bind: Called after a new device is bound to this uclass
    10. * @pre_unbind: Called before a device is unbound from this uclass
    11. * @pre_probe: Called before a new device is probed
    12. * @post_probe: Called after a new device is probed
    13. * @pre_remove: Called before a device is removed
    14. * @child_post_bind: Called after a child is bound to a device in this uclass
    15. * @child_pre_probe: Called before a child in this uclass is probed
    16. * @child_post_probe: Called after a child in this uclass is probed
    17. * @init: Called to set up the uclass
    18. * @destroy: Called to destroy the uclass
    19. * @priv_auto_alloc_size: If non-zero this is the size of the private data
    20. * to be allocated in the uclass's ->priv pointer. If zero, then the uclass
    21. * driver is responsible for allocating any data required.
    22. * @per_device_auto_alloc_size: Each device can hold private data owned
    23. * by the uclass. If required this will be automatically allocated if this
    24. * value is non-zero.
    25. * @per_device_platdata_auto_alloc_size: Each device can hold platform data
    26. * owned by the uclass as 'dev->uclass_platdata'. If the value is non-zero,
    27. * then this will be automatically allocated.
    28. * @per_child_auto_alloc_size: Each child device (of a parent in this
    29. * uclass) can hold parent data for the device/uclass. This value is only
    30. * used as a fallback if this member is 0 in the driver.
    31. * @per_child_platdata_auto_alloc_size: A bus likes to store information about
    32. * its children. If non-zero this is the size of this data, to be allocated
    33. * in the child device's parent_platdata pointer. This value is only used as
    34. * a fallback if this member is 0 in the driver.
    35. * @ops: Uclass operations, providing the consistent interface to devices
    36. * within the uclass.
    37. * @flags: Flags for this uclass (DM_UC_...)
    38. */
    39. struct uclass_driver {
    40. const char *name;
    41. enum uclass_id id;
    42. int (*post_bind)(struct udevice *dev);
    43. int (*pre_unbind)(struct udevice *dev);
    44. int (*pre_probe)(struct udevice *dev);
    45. int (*post_probe)(struct udevice *dev);
    46. int (*pre_remove)(struct udevice *dev);
    47. int (*child_post_bind)(struct udevice *dev);
    48. int (*child_pre_probe)(struct udevice *dev);
    49. int (*child_post_probe)(struct udevice *dev);
    50. int (*init)(struct uclass *class);
    51. int (*destroy)(struct uclass *class);
    52. int priv_auto_alloc_size;
    53. int per_device_auto_alloc_size;
    54. int per_device_platdata_auto_alloc_size;
    55. int per_child_auto_alloc_size;
    56. int per_child_platdata_auto_alloc_size;
    57. const void *ops;
    58. uint32_t flags;
    59. };
    • uclass_driver为一组相关的驱动提供了一致的接口。
    • name: ucclass驱动的名称
    • id:该类的id号
    • post_bind:在一个新设备绑定到这个类之后调用
    • pre_unbind:在设备从这个类解绑定之前调用
    • pre_probe:在探测新设备之前调用
    • post_probe:在探测新设备后调用
    • pre_remove:在移除设备之前调用
    • child_post_bind:在子类绑定到设备后调用
    • child_pre_probe:在探测类中的子节点之前调用
    • child_post_probe:在探测类中的子节点后调用
    • init:用来设置ucclass
    • destroy:用于销毁类
    • priv_auto_alloc_size:如果非零,这是要在ucclass的->priv指针中分配的私有数据的大小。如果为零,则为ucclass驱动程序负责分配所需的任何数据。
    • per_device_auto_alloc_size:每个设备可以保存ucclass拥有的私有数据。如果需要,如果该值非零,将自动分配此值。
    • per_device_platdata_auto_alloc_size:每个设备可以保存ucclass拥有的平台数据为'dev->uclass_platdata'。如果该值不为零,则会自动分配该值。
    • per_child_auto_alloc_size:每个子设备(在这个ucclass中的父设备)可以保存设备/ ucclass的父数据。此值仅在该成员在驱动程序中为0时用作回退。
    • per_child_platdata_auto_alloc_size:总线喜欢存储其子节点的信息。如果非零,这就是要分配的数据的大小
    • 在子设备的parent_platdata指针中。此值仅在该成员在驱动程序中为0时用作回退。
    • ops: Uclass操作,为ucclass内的设备提供一致的接口。
    • flags:这个ucclass的标志(DM_UC_…)
  • 相关阅读:
    任正非说:我们要改善和媒体的关系,而不是要利用媒体,不要自以为聪明。
    IGS文件格式说明与下载方式- Renix atx ANTEX: The Antenna Exchange Format
    2.2 Linux启动初始化文件系统
    Android 滑动事件消费监控,Debug 环境下通用思路
    商品销售管理系统java+mysql
    OpenGL之图形流水线中的光照计算、明暗处理
    JVM G1垃圾回收器学习笔记
    【Python】11 Conda常用命令
    Observability:集群监控 (一) - Elastic Stack 8.x
    ArtCoder——通过风格转换生成多元化艺术风格二维码
  • 原文地址:https://blog.csdn.net/gang542725/article/details/138222357