{"id":254972,"date":"2015-04-10T16:45:02","date_gmt":"2015-04-10T12:45:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=254972"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=254972","title":{"rendered":"\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u0434 \u0447\u0438\u0449\u0435: \u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0432 \u044f\u0434\u0440\u0435 Linux \u0434\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432"},"content":{"rendered":"<p>     \t\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u044f \u0437\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\u043c\u0438 \u0432 \u044f\u0434\u0440\u0435 Linux, \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u044e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u044f\u0434\u0440\u0430, \u0442\u043e\u0447\u043d\u0435\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 API, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u0439 \u0436\u0438\u0437\u043d\u044c \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043a\u043e\u0441\u043d\u0443\u0441\u044c \u0442\u0435\u043c\u044b, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0441\u043d\u044e \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438 \u043a\u0430\u043a \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432. <a name=\"habracut\"><\/a><\/p>\n<p>  \u0423\u0441\u043b\u043e\u0432\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u044c\u044e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 API \u043d\u0430:  <\/p>\n<ul>\n<li>\u041f\u0430\u043c\u044f\u0442\u044c, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f \u0434\u043b\u044f DMA \u0438 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430<\/li>\n<li>\u041f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/li>\n<li>\u0420\u0435\u0433\u0443\u043b\u044f\u0442\u043e\u0440\u044b \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>\u0414\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043d\u0430 \u0448\u0438\u043d\u0430\u0445 (PCI, SPI, IIO)<\/li>\n<li>GPIO, Pin control<\/li>\n<li>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435<\/li>\n<\/ul>\n<p>  \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041d\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0440\u0430\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438.<\/p>\n<h2><font color=\"blue\">\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432<\/font><\/h2>\n<p>  \u0412 \u0434\u0430\u043b\u0451\u043a\u043e\u043c 2007 \u0433\u043e\u0434\u0443 Tejun Heo \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0441\u043e\u0437\u0434\u0430\u0432 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 devres API.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043b\u0443\u0447\u0430\u0439 \u0432 2007<\/b><\/p>\n<div class=\"spoiler_text\">commit 9ac7849e35f705830f7b016ff272b0ff1f7ff759<br \/>  Author: Tejun Heo &lt;htejun@gmail.com&gt;<\/p>\n<p>  devres: device resource management  <\/div>\n<\/div>\n<p>  \u0418\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, <code>struct device<\/code>, \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u044f\u0434\u0440\u0430 Linux. \u0412 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>devres_head<\/code> (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 <code>-&gt;probe()<\/code>. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u043a\u0443\u0447\u0435 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 <code>kmalloc()<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <code>void *<\/code>.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u0430\u043f\u0435 <code>-&gt;probe()<\/code>, \u043a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 \u0436\u0435 <code>-&gt;remove()<\/code> \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0441\u0430\u043c\u0430 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0437\u0430\u043d\u044f\u0442\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0440\u043e\u0432\u043d\u043e \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u0438\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0414\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0438 \u044f\u0432\u043d\u043e. \u0417\u0434\u0435\u0441\u044c \u0436\u0435 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0438 <a href=\"#Issue\">\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<h2><font color=\"blue\">\u041f\u0430\u043c\u044f\u0442\u044c, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f \u0434\u043b\u044f DMA \u0438 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:  <\/p>\n<blockquote><p> devm_kasprintf()<br \/>   devm_kcalloc()<br \/>   devm_kmalloc()<br \/>   devm_kmemdup()<br \/>   devm_kstrdup()<br \/>   devm_kzalloc()  <\/p><\/blockquote>\n<p>  \u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e-\u043c\u043e\u0435\u043c\u0443 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430 \u044d\u0442\u043e\u043c. \u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u043b\u0430\u0441\u044c, \u043f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430.  <\/p>\n<pre><code class=\"cpp\">struct my_cool_device {  struct device *dev;  void *memregion; };  int mydev_probe(...) { struct device *dev = ...; struct my_cool_device *cool;  cool = devm_kzalloc(dev, ...); if (!cool) return -ENOMEM;  cool-&gt;memregion = devm_kmalloc(dev, ...); if (!cool-&gt;memregion) return -ENOMEM;  cool-&gt;dev = dev;  dev_info(dev, &quot;Found my cool device\\n&quot;); return 0; }  void mydev_remove(...) {  \/* Nothing! *\/ } <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a\u0430\u043a \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0443 \u043d\u0430\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0443\u0442\u044c \u0432\u044b\u0445\u043e\u0434\u0430 \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438? \u0418 \u043a\u0430\u043a \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 <code>-&gt;remove()<\/code>!<br \/>  <a name=\"Issue\"><\/a><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u0430\u043a \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044f\u0432\u043d\u043e.<br \/>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e:  <\/p>\n<pre><code class=\"cpp\">void mydev_remove(...) { struct device *dev = ...; struct my_cool_device *cool = ...; devm_kfree(dev, cool-&gt;memregion); } <\/code><\/pre>\n<p>  \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e:  <\/p>\n<pre><code class=\"cpp\">void mydev_remove(...) { struct my_cool_device *cool = ...; kfree(cool-&gt;memregion); } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0434\u043b\u044f DMA \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435  <\/p>\n<blockquote><p> dmam_alloc_coherent()<br \/>   dmam_alloc_noncoherent()<br \/>   dmam_pool_create()  <\/p><\/blockquote>\n<p>  \u0420\u0435\u0441\u0443\u0440\u0441\u044b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  <\/p>\n<blockquote><p> devm_ioport_map()<br \/>   devm_ioremap()<br \/>   devm_ioremap_resource(): \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0433\u0438\u043e\u043d \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<br \/>   pcim_iomap()<br \/>   pcim_iomap_regions(): \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0433\u0438\u043e\u043d \u0438 \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u043d\u0435\u0433\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 BAR-\u0430\u0445<br \/>   pcim_iomap_table(): \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u0438\u043d\u0434\u0435\u0441\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 BAR-\u0430  <\/p><\/blockquote>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043d\u0438\u0436\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u043d\u0430 \u0448\u0438\u043d\u0435 PCI, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0430 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430.<\/p>\n<h2><font color=\"blue\">\u041f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/font><\/h2>\n<p>  <\/p>\n<blockquote><p> devm_request_any_context_irq()<br \/>   devm_request_irq()<br \/>   devm_request_threaded_irq()  <\/p><\/blockquote>\n<h2><font color=\"blue\">\u0420\u0435\u0433\u0443\u043b\u044f\u0442\u043e\u0440\u044b \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f<\/font><\/h2>\n<p>  <\/p>\n<blockquote><p> devm_regulator_bulk_get()<br \/>   devm_regulator_get()<br \/>   devm_regulator_register()  <\/p><\/blockquote>\n<h2><font color=\"blue\">\u0414\u043b\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043d\u0430 \u0448\u0438\u043d\u0430\u0445 (PCI, SPI, IIO)<\/font><\/h2>\n<p>  \u0428\u0438\u043d\u0430 IIO:  <\/p>\n<blockquote><p> devm_iio_device_alloc()<br \/>   devm_iio_device_register()<br \/>   devm_iio_kfifo_allocate()<br \/>   devm_iio_trigger_alloc()  <\/p><\/blockquote>\n<p>  \u0428\u0438\u043d\u0430 MDIO:  <\/p>\n<blockquote><p> devm_mdiobus_alloc()<br \/>   devm_mdiobus_alloc_size()  <\/p><\/blockquote>\n<p>  \u0428\u0438\u043d\u0430 PCI:  <\/p>\n<blockquote><p> pcim_enable_device(): \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438<br \/>   pcim_pin_device(): \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f  <\/p><\/blockquote>\n<p>  \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <code>pcim_enable_device()<\/code>. \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u0435\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0438\u0445 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u0432 <a href=\"https:\/\/git.kernel.org\/cgit\/linux\/kernel\/git\/tiwai\/sound.git\/commit\/?id=5618955c4269b07c8177f88a8075d4879e74cd27\">commit 5618955c4269<\/a>.<\/p>\n<p>  \u0428\u0438\u043d\u0430 SPI:  <\/p>\n<blockquote><p> devm_spi_register_master()  <\/p><\/blockquote>\n<h2><font color=\"blue\">GPIO, Pin control<\/font><\/h2>\n<p>  GPIO:  <\/p>\n<blockquote><p> devm_gpiod_get()<br \/>   devm_gpiod_get_index()<br \/>   devm_gpiod_get_index_optional()<br \/>   devm_gpiod_get_optional()  <\/p><\/blockquote>\n<p>  Pin control:  <\/p>\n<blockquote><p> devm_pinctrl_get()  <\/p><\/blockquote>\n<p>  <\/p>\n<h2><font color=\"blue\">\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435<\/font><\/h2>\n<p>  \u042f \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b \u043b\u0438\u0448\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u044b\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438. \u041e\u0431 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 API \u044f\u0434\u0440\u0430: <a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/driver-model\/devres.txt\">devres.txt<\/a>.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/255459\/\"> http:\/\/habrahabr.ru\/post\/255459\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u044f \u0437\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\u043c\u0438 \u0432 \u044f\u0434\u0440\u0435 Linux, \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u044e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u044f\u0434\u0440\u0430, \u0442\u043e\u0447\u043d\u0435\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 API, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u0439 \u0436\u0438\u0437\u043d\u044c \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043a\u043e\u0441\u043d\u0443\u0441\u044c \u0442\u0435\u043c\u044b, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0441\u043d\u044e \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438 \u043a\u0430\u043a \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-254972","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254972"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254972\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}