struct resource *platform_get_resource(struct platform_device *dev,            unsigned int type, unsigned int num)

{  int i;

    for (i = 0; i < dev->num_resources; i++)

    {   struct resource *r = &dev->resource[i];

         if (type == resource_type(r) && num-- == 0)   

         return r;  

    }

    return NULL;

}

summary point: 1. 从该函数的定义可以看出 num 参数是同一种类型资源下的资源索引,因为 if (type == resource_type(r) && num-- == 0) 这条判断语句的执行是先执行 && 前面的类型判断,然后才执行索引判断。

 

相关文章:

  • 2022-12-23
  • 2021-07-11
  • 2021-07-16
  • 2021-07-12
  • 2021-05-21
  • 2021-11-13
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2022-01-20
  • 2021-07-08
  • 2021-10-06
  • 2021-10-02
相关资源
相似解决方案