• 浅析struct device结构体


    device结构体:设备驱动模型中的基础结构体之一

    struct device {

      /*设备所依附的父设备

      大多数情况下,这样的设备是某种总线或主控制器

      如果该成员变量的值为NULL,表示当前设备是一个最顶端设备,通常这样的设备都不是你想得到的那个*/

      struct device *parent;

      struct device_private *p;

      struct kobject kobj;
      const char *init_name; /* initial name of the device */
      const struct device_type *type;

      struct mutex mutex; /* mutex to synchronize calls to  its driver.*/

      struct bus_type *bus; /* type of bus device is on */
      struct device_driver *driver; /* which driver has allocated this device */
      void *platform_data; /* Platform specific data, device core doesn't touch it */
       struct dev_pm_info power;
      struct dev_pm_domain *pm_domain;

    #ifdef CONFIG_NUMA
      int numa_node; /* NUMA node this device is close to */
    #endif
      u64 *dma_mask; /* dma mask (if dma'able device) */
      u64 coherent_dma_mask;/* Like dma_mask, but for alloc_coherent mappings as not all hardware supports
    64 bit addresses for consistent  allocations such descriptors. */

      struct device_dma_parameters *dma_parms;

      struct list_head dma_pools; /* dma pools (if dma'ble) */

      struct dma_coherent_mem *dma_mem; /* internal for coherent mem override */
    /* arch specific additions */
      struct dev_archdata archdata;

      struct device_node *of_node; /* associated device tree node */

      dev_t devt; /* dev_t, creates the sysfs "dev" */
      u32 id; /* device instance */

      spinlock_t devres_lock;
      struct list_head devres_head;

      struct klist_node knode_class;
      struct class *class;
      const struct attribute_group **groups; /* optional groups */

      void (*release)(struct device *dev);
    };

  • 相关阅读:
    C++总结
    KMP算法
    理解I/O Completion Port(完成端口)
    [转载]Windows网络编程系列教程之四:Select模型
    [转载]理解 I/O Completion Port (IOCP完成端口)
    [转载]IOCP模型的总结
    发个IOCP的C++例子
    说说网络通信模型
    几个网络模型的示例代码(BlockingModel、OverlappedModel、WSAEventSelect、CompletionRoutine)..c++
    关于Socket 多线程 的一篇好文章
  • 原文地址:https://www.cnblogs.com/-glb/p/10335854.html
Copyright © 2020-2023  润新知