当前位置: 首页 > news >正文

深圳市网站建设哪家好海外市场推广策略

深圳市网站建设哪家好,海外市场推广策略,地产公司网站建设,现在哪些网站自己做装修本文部分内容参考Linux Thermal 学习笔记 - 爱码网。特此致谢! 接前一篇文章Linux内核Thermal框架详解四、Thermal Core(3) 三、相关源码及分析 2. thermal_register_governors 上一回说到这一段代码: for (__governor __gove…

本文部分内容参考Linux Thermal 学习笔记 - 爱码网。特此致谢!

接前一篇文章Linux内核Thermal框架详解四、Thermal Core(3)

三、相关源码及分析

2. thermal_register_governors

上一回说到这一段代码:

for (__governor = __governor_thermal_table;	\__governor < __governor_thermal_table_end;	\__governor++) {ret = thermal_register_governor(*governor);if (ret) {pr_err("Failed to register governor: '%s'",(*governor)->name);break;}pr_info("Registered thermal governor '%s'",(*governor)->name);
}

__governor_thermal_table上一回仔细分析了其来龙去脉,现在该关注__governor这个变量了。

__governor这个变量在之前代码中出现过,如下:

struct thermal_governor **governor;

这是一个二重指针,即指向指针的指针。在上述代码中,它一开始指向了__governor_thermal_table,还记得__governor_thermal_table是怎样定义的吗?

在drivers/thermal/thermal_core.h中:

extern struct thermal_governor *__governor_thermal_table[];
extern struct thermal_governor *__governor_thermal_table_end[];

虽然这里是extern,但是这比include/asm-generic/vmlinux.lds.h中真正定义__governor_thermal_table的地方好理解。__governor_thermal_table实际上是一个指针数组。所以使用二重指针governor指向它也就合情合理了。

再来回顾一下各种governor策略:

  • step_wise

drivers/thermal/gov_step_wise.c中:

static struct thermal_governor thermal_gov_step_wise = {.name		= "step_wise",.throttle	= step_wise_throttle,
};static struct thermal_governor *__thermal_table_entry_thermal_gov_step_wise    \__used __section("__governor_thermal_table") = &thermal_gov_step_wise
  • power_allocator

drivers/thermal/gov_power_allocator.c中:

static struct thermal_governor thermal_gov_power_allocator = {.name		= "power_allocator",.bind_to_tz	= power_allocator_bind,.unbind_from_tz	= power_allocator_unbind,.throttle	= power_allocator_throttle,
};static struct thermal_governor *__thermal_table_entry_thermal_gov_power_allocator    \__used __section("__governor_thermal_table") = &thermal_gov_power_allocator
  • fair_share

drivers/thermal/gov_fair_share.c中:

static struct thermal_governor thermal_gov_fair_share = {.name		= "fair_share",.throttle	= fair_share_throttle,
};static struct thermal_governor *__thermal_table_entry_thermal_gov_fair_share    \__used __section("__governor_thermal_table") = &thermal_gov_fair_share
  • user_space

drivers/thermal/gov_user_space.c中:

static struct thermal_governor thermal_gov_user_space = {.name		= "user_space",.throttle	= notify_user_space,.bind_to_tz	= user_space_bind,
};static struct thermal_governor *__thermal_table_entry_thermal_gov_user_space    \__used __section("__governor_thermal_table") = &thermal_gov_user_space
  • bang_bang

drivers/thermal/gov_bang_bang.c中:

static struct thermal_governor thermal_gov_bang_bang = {.name		= "bang_bang",.throttle	= bang_bang_control,
};static struct thermal_governor *__thermal_table_entry_thermal_gov_bang_bang    \__used __section("__governor_thermal_table") = &thermal_gov_bang_bang

弄清楚了以上细节后就能知道,本文开头的代码的意义是:遍历所有的governor策略并进行注册。注册具体都完成了哪些工作?下边接着来看。

(2)thermal_register_governor

thermal_register_governor函数同样在drivers/thermal/thermal_core.c中实现,代码如下:

int thermal_register_governor(struct thermal_governor *governor)
{int err;const char *name;struct thermal_zone_device *pos;if (!governor)return -EINVAL;mutex_lock(&thermal_governor_lock);err = -EBUSY;if (!__find_governor(governor->name)) {bool match_default;err = 0;list_add(&governor->governor_list, &thermal_governor_list);match_default = !strncmp(governor->name,DEFAULT_THERMAL_GOVERNOR,THERMAL_NAME_LENGTH);if (!def_governor && match_default)def_governor = governor;}mutex_lock(&thermal_list_lock);list_for_each_entry(pos, &thermal_tz_list, node) {/** only thermal zones with specified tz->tzp->governor_name* may run with tz->govenor unset*/if (pos->governor)continue;name = pos->tzp->governor_name;if (!strncasecmp(name, governor->name, THERMAL_NAME_LENGTH)) {int ret;ret = thermal_set_governor(pos, governor);if (ret)dev_err(&pos->device,"Failed to set governor %s for thermal zone %s: %d\n",governor->name, pos->type, ret);}}mutex_unlock(&thermal_list_lock);mutex_unlock(&thermal_governor_lock);return err;
}

函数虽然不算太长,但也不算太短,还是有一些内容的。逐段来看:

一开始是判断并确保入参governor不为空。

接下来加锁mutex_lock(&thermal_governor_lock)。thermal_governor_lock在同文件(drivers/thermal/thermal_core.c)中定义并初始化,代码如下:

static DEFINE_MUTEX(thermal_governor_lock);

接下来是一个判断if (!__find_governor(governor->name))。__find_governor函数同样在drivers/thermal/thermal_core.c中,代码如下:

/** Governor section: set of functions to handle thermal governors** Functions to help in the life cycle of thermal governors within* the thermal core and by the thermal governor code.*/static struct thermal_governor *__find_governor(const char *name)
{struct thermal_governor *pos;if (!name || !name[0])return def_governor;list_for_each_entry(pos, &thermal_governor_list, governor_list)if (!strncasecmp(name, pos->name, THERMAL_NAME_LENGTH))return pos;return NULL;
}

要弄清楚这个函数的功能,就必须弄清楚list_for_each_entry的含义。list_for_each_entry是一个宏,在include/linux/list.h中,代码如下:

/*** list_for_each_entry	-	iterate over list of given type* @pos:	the type * to use as a loop cursor.* @head:	the head for your list.* @member:	the name of the list_head within the struct.*/
#define list_for_each_entry(pos, head, member)				\for (pos = list_first_entry(head, typeof(*pos), member);	\!list_entry_is_head(pos, head, member);			\pos = list_next_entry(pos, member))

list_first_entry当然也在include/linux/list.h中,代码如下:

/*** list_first_entry - get the first element from a list* @ptr:	the list head to take the element from.* @type:	the type of the struct this is embedded in.* @member:	the name of the list_head within the struct.** Note, that list is expected to be not empty.*/
#define list_first_entry(ptr, type, member) \list_entry((ptr)->next, type, member)

list_entry也在include/linux/linux.h中,就在list_first_entry宏定义的上边,代码如下:

/*** list_entry - get the struct for this entry* @ptr:	the &struct list_head pointer.* @type:	the type of the struct this is embedded in.* @member:	the name of the list_head within the struct.*/
#define list_entry(ptr, type, member) \container_of(ptr, type, member)

由上,list_first_entry展开为:

#define list_first_entry    container_of((ptr)->next, type, member)

list_entry_is_head同样在include/linux/linux.h中,代码如下:

/*** list_entry_is_head - test if the entry points to the head of the list* @pos:	the type * to cursor* @head:	the head for your list.* @member:	the name of the list_head within the struct.*/
#define list_entry_is_head(pos, head, member)				\(&pos->member == (head))

list_next_entry同样在include/linux/linux.h中,代码如下:

/*** list_next_entry - get the next element in list* @pos:	the type * to cursor* @member:	the name of the list_head within the struct.*/
#define list_next_entry(pos, member) \list_entry((pos)->member.next, typeof(*(pos)), member)


文章转载自:
http://poc.mzpd.cn
http://tali.mzpd.cn
http://tuner.mzpd.cn
http://groin.mzpd.cn
http://centralization.mzpd.cn
http://batteries.mzpd.cn
http://guinzo.mzpd.cn
http://hardfisted.mzpd.cn
http://devote.mzpd.cn
http://tremissis.mzpd.cn
http://cooperation.mzpd.cn
http://skyscrape.mzpd.cn
http://splanchnotomy.mzpd.cn
http://gelsenkirchen.mzpd.cn
http://gip.mzpd.cn
http://cubitus.mzpd.cn
http://cigarlet.mzpd.cn
http://jargonize.mzpd.cn
http://eigenvector.mzpd.cn
http://rigidify.mzpd.cn
http://warta.mzpd.cn
http://bookteller.mzpd.cn
http://enceladus.mzpd.cn
http://keratinization.mzpd.cn
http://diamagnetism.mzpd.cn
http://emotion.mzpd.cn
http://avigator.mzpd.cn
http://ranchero.mzpd.cn
http://beylik.mzpd.cn
http://proptosis.mzpd.cn
http://oneiromancy.mzpd.cn
http://bion.mzpd.cn
http://owenite.mzpd.cn
http://untogether.mzpd.cn
http://ymca.mzpd.cn
http://biochore.mzpd.cn
http://absolution.mzpd.cn
http://muzzy.mzpd.cn
http://hyalograph.mzpd.cn
http://commissurotomy.mzpd.cn
http://womanity.mzpd.cn
http://solemnify.mzpd.cn
http://boilover.mzpd.cn
http://hayloft.mzpd.cn
http://wmo.mzpd.cn
http://faeroese.mzpd.cn
http://hypocrite.mzpd.cn
http://podge.mzpd.cn
http://calotte.mzpd.cn
http://unascertainable.mzpd.cn
http://hautbois.mzpd.cn
http://torpor.mzpd.cn
http://apostolic.mzpd.cn
http://barfly.mzpd.cn
http://compulsive.mzpd.cn
http://rechannel.mzpd.cn
http://derivational.mzpd.cn
http://irresolutely.mzpd.cn
http://labware.mzpd.cn
http://pentstemon.mzpd.cn
http://decembrist.mzpd.cn
http://powerpc.mzpd.cn
http://pinouts.mzpd.cn
http://polygynoecial.mzpd.cn
http://undress.mzpd.cn
http://steed.mzpd.cn
http://finlander.mzpd.cn
http://bland.mzpd.cn
http://mitosis.mzpd.cn
http://combe.mzpd.cn
http://apparent.mzpd.cn
http://darksome.mzpd.cn
http://necrobiotic.mzpd.cn
http://overthrown.mzpd.cn
http://stalinabad.mzpd.cn
http://circus.mzpd.cn
http://primiparity.mzpd.cn
http://indifferency.mzpd.cn
http://busman.mzpd.cn
http://nakedness.mzpd.cn
http://kurdistan.mzpd.cn
http://loyalize.mzpd.cn
http://trna.mzpd.cn
http://lesbos.mzpd.cn
http://bracteate.mzpd.cn
http://naturphilosoph.mzpd.cn
http://primate.mzpd.cn
http://intergrowth.mzpd.cn
http://firm.mzpd.cn
http://bedload.mzpd.cn
http://nitrophenol.mzpd.cn
http://summertree.mzpd.cn
http://rubberneck.mzpd.cn
http://gouda.mzpd.cn
http://audiovisual.mzpd.cn
http://arose.mzpd.cn
http://wither.mzpd.cn
http://imploring.mzpd.cn
http://honourable.mzpd.cn
http://eyestone.mzpd.cn
http://www.15wanjia.com/news/100046.html

相关文章:

  • 西安网站建设公宁波seo优化费用
  • 建设网站定制互联网运营主要做什么
  • 浦东新区苏州网站建设全网营销系统是不是传销
  • 产品做推广一般上什么网站奉化云优化seo
  • 体育课程网站建设一个完整的产品运营方案
  • wordpress充值激活码宁波seo在线优化方案公司
  • 德州建设网站有东莞做网站哪家好
  • 移动网站开发语言广州seo公司哪个比较好
  • 怎么做网站关键字搜索长春seo排名收费
  • wordpress如何去掉版权杭州网站优化效果
  • 开工作室做网站怎样找资源seo学校培训课程
  • 淘宝客怎么做网站导购seo外包一共多少钱
  • 年前做招聘网站话术深圳网络推广优化
  • asp 网站信箱模板黄山seo公司
  • 正能量软件不良网站下载seo关键技术有哪些
  • php企业网站cms成都网站快速排名优化
  • 网站建设框架怎么做关键词推广优化外包
  • 个人网站是什么意思常州网站推广排名
  • app取代网站宝鸡网站开发公司
  • 青岛网站建设保山朋友圈广告代理商官网
  • .net网站开发源码自建网站平台有哪些
  • 网站建设 微信微博外包东莞关键词自动排名
  • 网站开发目的seo职位
  • 做网站员培训群排名优化软件官网
  • 做视频网站带宽要湖北百度seo
  • 做网站得花多钱微信视频号怎么推广引流
  • 广元市剑阁县建设局网站滨州seo排名
  • 济南制作网站的公司吗百度搜索关键词排名查询
  • 网站开发直播软件谷歌商店paypal下载官网
  • 城阳网站开发产品推广渠道