linux/drivers/acpi/glue.c
<<
e="ve="ve=o/spa6.2e=ospa6 class="lxr_search">e="ve="ve="ve="v typ Search.2 e="ve=o/spa6.2"ve=oinput typ e"v2 odiv id/ /1o/a>ospa6 class="comment">/*o/spa6.2/ /2o/a>ospa6 class="comment"> * Link physical devices with ACPI devices supporto/spa6.2/ /3o/a>ospa6 class="comment"> *o/spa6.2/ /4o/a>ospa6 class="comment"> * Copyright (c) 2005 David Shaohua Li <shaohua.li@intel.com>o/spa6.2/ /5o/a>ospa6 class="comment"> * Copyright (c) 2005 Intel Corp.o/spa6.2/ /6o/a>ospa6 class="comment"> *o/spa6.2/ /7o/a>ospa6 class="comment"> * This file is released under the GPL22.o/spa6.2/ /8o/a>ospa6 class="comment"> */o/spa6.2/ /9o/a>#include <linux/export.ho/a>>2/ va>#include <linux/init.ho/a>>2/ 11 va>#include <linux/list.ho/a>>2/ 12 va>#include <linux/device.ho/a>>2/ 13 va>#include <linux/slab.ho/a>>2/ 14 va>#include <linux/rwsem.ho/a>>2/ 15 va>#include <linux/acpi.ho/a>>2/ 16o/a>2/ 17 va>#include "internal.ho/a>"2/ 18o/a>2/ 19o/a>#define/oa href="+code=ACPI_GLUE_DEBUG" class="sref">ACPI_GLUE_DEBUGo/a> 02/ 2 va>#if/oa href="+code=ACPI_GLUE_DEBUG" class="sref">ACPI_GLUE_DEBUGo/a>2/ 21o/a>#define/oa href="+code=DBG" class="sref">DBGo/a>(oa href="+code=x" class="sref">xo/a>...)/oa href="+code=printk" class="sref">printko/a>(oa href="+code=PREFIX" class="sref">PREFIXo/a> oa href="+code=x" class="sref">xo/a>)2/ 22 va>#else2/ 23o/a>#define/oa href="+code=DBG" class="sref">DBGo/a>(oa href="+code=x" class="sref">xo/a>...)/do { } while(0)2/ 24 va>#endif2/ 25 va>static/oa href="+code=LIST_HEAD" class="sref">LIST_HEADo/a>(oa href="+code=bus_typ _list" class="sref">bus_typ _listo/a>);2/ 26 va>static/oa href="+code=DECLARE_RWSEM" class="sref">DECLARE_RWSEMo/a>(oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 27o/a>2/ 28o/a>#define/oa href="+code=PHYSICAL_NODE_STRING" class="sref">PHYSICAL_NODE_STRINGo/a> ospa6 class="string">"physical_node"/ 29o/a>2/ 3 va>int/oa href="+code=register_acpi_bus_typ " class="sref">register_acpi_bus_typ o/a>(struct/oa href="+code=acpi_bus_typ " class="sref">acpi_bus_typ o/a> *oa href="+code=typ " class="sref">typ o/a>)2/ 31o/a>{2/ 32 va> if/(oa href="+code=acpi_disabled" class="sref">acpi_disabledo/a>)2/ 33 va> return -oa href="+code=ENODEV" class="sref">ENODEV va>;2/ 34 va> if/(oa href="+code=typ " class="sref">typ o/a> &&/oa href="+code=typ " class="sref">typ o/a>->oa href="+code=bus" class="sref">buso/a> &&/oa href="+code=typ " class="sref">typ o/a>->oa href="+code=find_device" class="sref">find_deviceo/a>) {2/ 35 va> oa href="+code=down_write" class="sref">down_writeo/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 36 va> oa href="+code=list_add_tail" class="sref">list_add_tailo/a>(&oa href="+code=typ " class="sref">typ o/a>->oa href="+code=list" class="sref">listo/a>, &oa href="+code=bus_typ _list" class="sref">bus_typ _listo/a>);2/ 37 va> oa href="+code=up_write" class="sref">up_writeo/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 38 va> oa href="+code=printk" class="sref">printko/a>(oa href="+code=KERN_INFO" class="sref">KERN_INFOo/a> oa href="+code=PREFIX" class="sref">PREFIXo/a> ospa6 class="string">"bus typ %s registered\n"/ 39 va> oa href="+code=typ " class="sref">typ o/a>->oa href="+code=bus" class="sref">buso/a>->oa href="+code=nam " class="sref">nam o/a>);2/ 40 va> return 0;2/ 41 va> }2/ 42 va> return -oa href="+code=ENODEV" class="sref">ENODEV va>;2/ 43 va>}2/ 44o/a>oa href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLo/a>(oa href="+code=register_acpi_bus_typ " class="sref">register_acpi_bus_typ o/a>);2/ 45o/a>2/ 46 va>int/oa href="+code=unregister_acpi_bus_typ " class="sref">unregister_acpi_bus_typ o/a>(struct/oa href="+code=acpi_bus_typ " class="sref">acpi_bus_typ o/a> *oa href="+code=typ " class="sref">typ o/a>)2/ 47o/a>{2/ 48 va> if/(oa href="+code=acpi_disabled" class="sref">acpi_disabledo/a>)2/ 49 va> return 0;2/ 50 va> if/(oa href="+code=typ " class="sref">typ o/a>) {2/ 51 va> oa href="+code=down_write" class="sref">down_writeo/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 52 va> oa href="+code=list_del_init" class="sref">list_del_inito/a>(&oa href="+code=typ " class="sref">typ o/a>->oa href="+code=list" class="sref">listo/a>);2/ 53 va> oa href="+code=up_write" class="sref">up_writeo/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 54 va> oa href="+code=printk" class="sref">printko/a>(oa href="+code=KERN_INFO" class="sref">KERN_INFOo/a> oa href="+code=PREFIX" class="sref">PREFIXo/a> ospa6 class="string">"ACPI bus typ %s unregistered\n"/ 55 va> oa href="+code=typ " class="sref">typ o/a>->oa href="+code=bus" class="sref">buso/a>->oa href="+code=nam " class="sref">nam o/a>);2/ 56 va> return 0;2/ 57 va> }2/ 58 va> return -oa href="+code=ENODEV" class="sref">ENODEV va>;2/ 59 va>}2/ 60o/a>oa href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLo/a>(oa href="+code=unregister_acpi_bus_typ " class="sref">unregister_acpi_bus_typ o/a>);2/ 61o/a>2/ 62 va>static/struct/oa href="+code=acpi_bus_typ " class="sref">acpi_bus_typ o/a> *oa href="+code=acpi_get_bus_typ " class="sref">acpi_get_bus_typ o/a>(struct/oa href="+code=bus_typ " class="sref">bus_typ o/a> *oa href="+code=typ " class="sref">typ o/a>)2/ 63o/a>{2/ 64 va> struct/oa href="+code=acpi_bus_typ " class="sref">acpi_bus_typ o/a> *oa href="+code=tmp" class="sref">tmpo/a>, *oa href="+code=ret" class="sref">reto/a> =/oa href="+code=NULL" class="sref">NULL va>;2/ 65o/a>2/ 66 va> oa href="+code=down_read" class="sref">down_reado/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 67 va> oa href="+code=list_for_each_entry" class="sref">list_for_each_entryo/a>(oa href="+code=tmp" class="sref">tmpo/a>, &oa href="+code=bus_typ _list" class="sref">bus_typ _listo/a>, oa href="+code=list" class="sref">listo/a>) {2/ 68 va> if/(oa href="+code=tmp" class="sref">tmpo/a>->oa href="+code=bus" class="sref">buso/a> ==/oa href="+code=typ " class="sref">typ o/a>) {2/ 69 va> /oa href="+code=ret" class="sref">reto/a> =/oa href="+code=tmp" class="sref">tmpo/a>;2/ 70 va> break;2/ 71 va> }2/ 72 va> }2/ 73 va> oa href="+code=up_read" class="sref">up_reado/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 74 va> return oa href="+code=ret" class="sref">reto/a>;2/ 75 va>}2/ 76o/a>2/ 77 va>static/int/oa href="+code=acpi_find_bridge_device" class="sref">acpi_find_bridge_deviceo/a>(struct/oa href="+code=device" class="sref">deviceo/a> *oa href="+code=dev" class="sref">devo/a>, oa href="+code=acpi_handle" class="sref">acpi_handleo/a> * oa href="+code=handle" class="sref">handleo/a>)2/ 78o/a>{2/ 79 va> struct/oa href="+code=acpi_bus_typ " class="sref">acpi_bus_typ o/a> *oa href="+code=tmp" class="sref">tmpo/a>;2/ 80 va> int/oa href="+code=ret" class="sref">reto/a> =/-oa href="+code=ENODEV" class="sref">ENODEV va>;2/ 81o/a>2/ 82 va> oa href="+code=down_read" class="sref">down_reado/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 83 va> oa href="+code=list_for_each_entry" class="sref">list_for_each_entryo/a>(oa href="+code=tmp" class="sref">tmpo/a>, &oa href="+code=bus_typ _list" class="sref">bus_typ _listo/a>, oa href="+code=list" class="sref">listo/a>) {2/ 84 va> if/(oa href="+code=tmp" class="sref">tmpo/a>->oa href="+code=find_bridge" class="sref">find_bridge va> &&/!oa href="+code=tmp" class="sref">tmpo/a>->oa href="+code=find_bridge" class="sref">find_bridge va>(oa href="+code=dev" class="sref">devo/a>, oa href="+code=handle" class="sref">handleo/a>)) {2/ 85 va> /oa href="+code=ret" class="sref">reto/a> =/0;2/ 86 va> break;2/ 87 va> }2/ 88 va> }2/ 89 va> oa href="+code=up_read" class="sref">up_reado/a>(&oa href="+code=bus_typ _sem" class="sref">bus_typ _semo/a>);2/ 90 va> return oa href="+code=ret" class="sref">reto/a>;2/ 91 va>}2/ 92o/a>2/ 93o/a>ospa6 class="comment">/* Get device's handler per its address under its parent */o/spa6.2/ 94 va>struct/oa href="+code=acpi_find_child" class="sref">acpi_find_child va> {2/ 95 va> oa href="+code=acpi_handle" class="sref">acpi_handleo/a> oa href="+code=handle" class="sref">handleo/a>;2/ 96 va> oa href="+code=u64" class="sref">u64 va> oa href="+code=address" class="sref">addresso/a>;2/ 97 va>};2/ 98o/a>2/ 99 va>static/oa href="+code=acpi_status" class="sref">acpi_statuso/a>2/100o/a>oa href="+code=do_acpi_find_child" class="sref">do_acpi_find_child va>(oa href="+code=acpi_handle" class="sref">acpi_handleo/a> oa href="+code=handle" class="sref">handleo/a>, oa href="+code=u32" class="sref">u32 va> oa href="+code=lvl" class="sref">lvlo/a>, void *oa href="+code=context" class="sref">contexto/a>, void **oa href="+code=rv" class="sref">rvo/a>)2/101o/a>{2/102 va> oa href="+code=acpi_status" class="sref">acpi_statuso/a> oa href="+code=status" class="sref">statuso/a>;2/103 va> struct/oa href="+code=acpi_device_info" class="sref">acpi_device_infoo/a> *oa href="+code=info" class="sref">infoo/a>;2/104 va> struct/oa href="+code=acpi_find_child" class="sref">acpi_find_child va> *oa href="+code=find" class="sref">findo/a> =/oa href="+code=context" class="sref">contexto/a>;2/105o/a>2/106 va> oa href="+code=status" class="sref">statuso/a> =/oa href="+code=acpi_get_object_info" class="sref">acpi_get_object_info va>(oa href="+code=handle" class="sref">handleo/a>, &oa href="+code=info" class="sref">infoo/a>);2/107 va> if/(oa href="+code=ACPI_SUCCESS" class="sref">ACPI_SUCCESS va>(oa href="+code=status" class="sref">statuso/a>)) {2/108 va> if/((oa href="+code=info" class="sref">infoo/a>->oa href="+code=address" class="sref">addresso/a> ==/oa href="+code=find" class="sref">findo/a>->oa href="+code=address" class="sref">addresso/a>)2/109 va> /&&/(oa href="+code=info" class="sref">infoo/a>->oa href="+code=valid" class="sref">valid va> &/oa href="+code=ACPI_VALID_ADR" class="sref">ACPI_VALID_ADRo/a>))2/110 va> oa href="+code=find" class="sref">findo/a>->oa href="+code=handle" class="sref">handleo/a> =/oa href="+code=handle" class="sref">handleo/a>;2/111 va> oa href="+code=kfree" class="sref">kfree va>(oa href="+code=info" class="sref">infoo/a>);2/112 va> }2/113 va> return oa href="+code=AE_OK" class="sref">AE_OKo/a>;2/114 va>}2/115o/a>2/116o/a>oa href="+code=acpi_handle" class="sref">acpi_handleo/a> oa href="+code=acpi_get_child" class="sref">acpi_get_child va>(oa href="+code=acpi_handle" class="sref">acpi_handleo/a> oa href="+code=parent" class="sref">parento/a>, oa href="+code=u64" class="sref">u64 va> oa href="+code=address" class="sref">addresso/a>)2/117o/a>{2/118 va> struct/oa href="+code=acpi_find_child" class="sref">acpi_find_child va> oa href="+code=find" class="sref">findo/a> =/{/oa href="+code=NULL" class="sref">NULL va>, oa href="+code=address" class="sref">addresso/a> };2/119o/a>2/120 va> if/(!oa href="+code=parent" class="sref">parento/a>)2/121 va> return oa href="+code=NULL" class="sref">NULL va>;2/122 va> oa href="+code=acpi_walk_nam space" class="sref">acpi_walk_nam space va>(oa href="+code=ACPI_TYPE_DEVICE" class="sref">ACPI_TYPE_DEVICE va>, oa href="+code=parent" class="sref">parento/a>,2/123 va> 1, oa href="+code=do_acpi_find_child" class="sref">do_acpi_find_child va>, oa href="+code=NULL" class="sref">NULL va>, &oa href="+code=find" class="sref">findo/a>, oa href="+code=NULL" class="sref">NULL va>);2/124 va> return oa href="+code=find" class="sref">findo/a>.oa href="+code=handle" class="sref">handleo/a>;2/125 va>}2/126o/a>2/127o/a>oa href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL va>(oa href="+code=acpi_get_child" class="sref">acpi_get_child va>);2/128o/a>2/129 va>static/int/oa href="+code=acpi_bind_one" class="sref">acpi_bind_one va>(struct/oa href="+code=device" class="sref">deviceo/a> *oa href="+code=dev" class="sref">devo/a>, oa href="+code=acpi_handle" class="sref">acpi_handleo/a> oa href="+code=handle" class="sref">handleo/a>)2/13 va>{2/131 va> struct/oa href="+code=acpi_device" class="sref">acpi_deviceo/a> *oa href="+code=acpi_dev" class="sref">acpi_devo/a>;2/132 va> oa href="+code=acpi_status" class="sref">acpi_statuso/a> oa href="+code=status" class="sref">statuso/a>;2/133 va> struct/oa href="+code=acpi_device_physical_node" class="sref">acpi_device_physical_nodeo/a> *oa href="+code=physical_node" class="sref">physical_nodeo/a>;2/134 va> char oa href="+code=physical_node_nam " class="sref">physical_node_nam va>[sizeof(oa href="+code=PHYSICAL_NODE_STRING" class="sref">PHYSICAL_NODE_STRINGo/a>) + 2];2/135 va> int/oa href="+code=retval" class="sref">retvalo/a> =/-oa href="+code=EINVAL" class="sref">EINVALo/a>;2/136o/a>2/137 va> if/(oa href="+code=dev" class="sref">devo/a>->oa href="+code=archdata" class="sref">archdatao/a>.oa href="+code=acpi_handle" class="sref">acpi_handleo/a>) {2/138 va> oa href="+code=dev_warn" class="sref">dev_warn va>(oa href="+code=dev" class="sref">devo/a>, ospa6 class="string">"Drivers changed 'acpi_handle'\n"/139 va> return -oa href="+code=EINVAL" class="sref">EINVALo/a>;2/140 va> }2/141o/a>2/142 va> oa href="+code=get_device" class="sref">get_device va>(oa href="+code=dev" class="sref">devo/a>);2/143 va> oa href="+code=status" class="sref">statuso/a> =/oa href="+code=acpi_bus_get_device" class="sref">acpi_bus_get_device va>(oa href="+code=handle" class="sref">handleo/a>, &oa href="+code=acpi_dev" class="sref">acpi_devo/a>);2/144 va> if/(oa href="+code=ACPI_FAILURE" class="sref">ACPI_FAILURE va>(oa href="+code=status" class="sref">statuso/a>))2/145 va> goto/oa href="+code=err" class="sref">erro/a>;2/146o/a>2/147 va> oa href="+code=physical_node" class="sref">physical_nodeo/a> =/oa href="+code=kzalloc" class="sref">kzalloc va>(sizeof(struct/oa href="+code=acpi_device_physical_node" class="sref">acpi_device_physical_nodeo/a>),2/148 va> oa href="+code=GFP_KERNEL" class="sref">GFP_KERNELo/a>);2/149 va> if/(!oa href="+code=physical_node" class="sref">physical_nodeo/a>) {2/150 va> oa href="+code=retval" class="sref">retvalo/a> =/-oa href="+code=ENOMEM" class="sref">ENOMEMo/a>;2/151 va> goto/oa href="+code=err" class="sref">erro/a>;2/152 va> }2/153 va>2/154 va> oa href="+code=mutex_lock" class="sref">mutex_lock va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_lock" class="sref">physical_node_locko/a>);2/155 va> ospa6 class="comment">/* allocate physical node id according to/physical_node_id_bitmap */o/spa6.2/156 va> oa href="+code=physical_node" class="sref">physical_nodeo/a>->oa href="+code=node_id" class="sref">node_ido/a> =2/157 va> oa href="+code=find_first_zero_bit" class="sref">find_first_zero_bit va>(oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_id_bitmap" class="sref">physical_node_id_bitmapo/a>,2/158 va> oa href="+code=ACPI_MAX_PHYSICAL_NODE" class="sref">ACPI_MAX_PHYSICAL_NODEo/a>);2/159 va> if/(oa href="+code=physical_node" class="sref">physical_nodeo/a>->oa href="+code=node_id" class="sref">node_ido/a> >=/oa href="+code=ACPI_MAX_PHYSICAL_NODE" class="sref">ACPI_MAX_PHYSICAL_NODEo/a>) {2/160 va> oa href="+code=retval" class="sref">retvalo/a> =/-oa href="+code=ENOSPC" class="sref">ENOSPCo/a>;2/161 va> oa href="+code=mutex_unlock" class="sref">mutex_unlock va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_lock" class="sref">physical_node_locko/a>);2/162 va> oa href="+code=kfree" class="sref">kfree va>(oa href="+code=physical_node" class="sref">physical_nodeo/a>);2/163 va> goto/oa href="+code=err" class="sref">erro/a>;2/164 va> }2/165o/a>2/166 va> oa href="+code=set_bit" class="sref">set_bit va>(oa href="+code=physical_node" class="sref">physical_nodeo/a>->oa href="+code=node_id" class="sref">node_ido/a>, oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_id_bitmap" class="sref">physical_node_id_bitmapo/a>);2/167 va> oa href="+code=physical_node" class="sref">physical_nodeo/a>->oa href="+code=dev" class="sref">devo/a> =/oa href="+code=dev" class="sref">devo/a>;2/168 va> oa href="+code=list_add_tail" class="sref">list_add_tailo/a>(&oa href="+code=physical_node" class="sref">physical_nodeo/a>->oa href="+code=node" class="sref">nodeo/a>, &oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_list" class="sref">physical_node_listo/a>);2/169 va> oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_count" class="sref">physical_node_counto/a>++;2/170 va> oa href="+code=mutex_unlock" class="sref">mutex_unlock va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_lock" class="sref">physical_node_locko/a>);2/171o/a>2/172 va> oa href="+code=dev" class="sref">devo/a>->oa href="+code=archdata" class="sref">archdatao/a>.oa href="+code=acpi_handle" class="sref">acpi_handleo/a> =/oa href="+code=handle" class="sref">handleo/a>;2/173 va>2/174 va> if/(!oa href="+code=physical_node" class="sref">physical_nodeo/a>->oa href="+code=node_id" class="sref">node_ido/a>)2/175 va> oa href="+code=strcpy" class="sref">strcpy va>(oa href="+code=physical_node_nam " class="sref">physical_node_nam va>, oa href="+code=PHYSICAL_NODE_STRING" class="sref">PHYSICAL_NODE_STRINGo/a>);2/176 va> else2/177 va> oa href="+code=sprintf" class="sref">sprintf va>(oa href="+code=physical_node_nam " class="sref">physical_node_nam va>,2/ 17>/158 va> ="+code=pspa6 class="string">"physical_node%d"physical_nodeo/a>->oa href="+code=node_id" class="sref">node_ido/a>);2/179 va> oa href="+code=retval" class="sref">retvalo/a> =/oa href="+code=sysfs_create_link" class="sref">sysfs_create_link va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=dev" class="sref">devo/a>.oa href="+code=kobj" class="sref">kobjo/a>, &oa href="+code=dev" class="sref">devo/a>->oa href="+code=kobj" class="sref">kobjo/a>,2/180 va> oa href="+code=physical_node_nam " class="sref">physical_node_nam va>);2/181 va> oa href="+code=retval" class="sref">retvalo/a> =/oa href="+code=sysfs_create_link" class="sref">sysfs_create_link va>(&oa href="+code=dev" class="sref">devo/a>->oa href="+code=kobj" class="sref">kobjo/a>, &oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=dev" class="sref">devo/a>.oa href="+code=kobj" class="sref">kobjo/a>,2/182 va> ospa6 class="string">"firmware_node"/183 va>2/184 va> if/(oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=wakeup" class="sref">wakeupo/a>.oa href="+code=flags" class="sref">flagso/a>.oa href="+code=valid" class="sref">valid va>)2/185 va> oa href="+code=device_set_wakeup_capable" class="sref">device_set_wakeup_capable va>(oa href="+code=dev" class="sref">devo/a>, oa href="+code=true" class="sref">true va>);2/186o/a>2/187 va> return 0;2/188o/a>2/189 va> oa href="+code=err" class="sref">erro/a>:2/190 va> oa href="+code=put_device" class="sref">put_device va>(oa href="+code=dev" class="sref">devo/a>);2/191 va> return oa href="+code=retval" class="sref">retvalo/a>;2/192o/a>}2/193 va>2/194 va>static/int/oa href="+code=acpi_unbind_one" class="sref">acpi_unbind_one va>(struct/oa href="+code=device" class="sref">deviceo/a> *oa href="+code=dev" class="sref">devo/a>)2/195 va>{2/196 va> struct/oa href="+code=acpi_device_physical_node" class="sref">acpi_device_physical_nodeo/a> *oa href="+code=entry" class="sref">entryo/a>;2/197 va> struct/oa href="+code=acpi_device" class="sref">acpi_deviceo/a> *oa href="+code=acpi_dev" class="sref">acpi_devo/a>;2/198 va> oa href="+code=acpi_status" class="sref">acpi_statuso/a> oa href="+code=status" class="sref">statuso/a>;2/199 va> struct/oa href="+code=list_head" class="sref">list_heado/a> *oa href="+code=node" class="sref">nodeo/a>, *oa href="+code=next" class="sref">nexto/a>;2/200o/a>2/201 va> if/(!oa href="+code=dev" class="sref">devo/a>->oa href="+code=archdata" class="sref">archdatao/a>.oa href="+code=acpi_handle" class="sref">acpi_handleo/a>)2/202 va> return 0;2/203 va>2/204 va> oa href="+code=status" class="sref">statuso/a> =/oa href="+code=acpi_bus_get_device" class="sref">acpi_bus_get_device va>(oa href="+code=dev" class="sref">devo/a>->oa href="+code=archdata" class="sref">archdatao/a>.oa href="+code=acpi_handle" class="sref">acpi_handleo/a>,2/205 va> &oa href="+code=acpi_dev" class="sref">acpi_devo/a>);2/206 va> if/(oa href="+code=ACPI_FAILURE" class="sref">ACPI_FAILURE va>(oa href="+code=status" class="sref">statuso/a>))2/207 va> goto/oa href="+code=err" class="sref">erro/a>;2/208o/a>2/209 va> oa href="+code=mutex_lock" class="sref">mutex_lock va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_lock" class="sref">physical_node_locko/a>);2/210 va> oa href="+code=list_for_each_safe" class="sref">list_for_each_safe va>(oa href="+code=node" class="sref">nodeo/a>, oa href="+code=next" class="sref">nexto/a>, &oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_list" class="sref">physical_node_listo/a>) {2/211 va> char oa href="+code=physical_node_nam " class="sref">physical_node_nam va>[sizeof(oa href="+code=PHYSICAL_NODE_STRING" class="sref">PHYSICAL_NODE_STRINGo/a>) + 2];2/212o/a>2/213 va> oa href="+code=entry" class="sref">entryo/a> =/oa href="+code=list_entry" class="sref">list_entryo/a>(oa href="+code=node" class="sref">nodeo/a>, struct/oa href="+code=acpi_device_physical_node" class="sref">acpi_device_physical_nodeo/a>,2/214 va> oa href="+code=node" class="sref">nodeo/a>);2/215 va> if/(oa href="+code=entry" class="sref">entryo/a>->oa href="+code=dev" class="sref">devo/a> !=/oa href="+code=dev" class="sref">devo/a>)2/216 va> continue;2/217o/a>2/218 va> oa href="+code=list_del" class="sref">list_delo/a>(oa href="+code=node" class="sref">nodeo/a>);2/219 va> oa href="+code=clear_bit" class="sref">clear_bito/a>(oa href="+code=entry" class="sref">entryo/a>->oa href="+code=node_id" class="sref">node_ido/a>, oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_id_bitmap" class="sref">physical_node_id_bitmapo/a>);2/220o/a>2/221 va> oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_count" class="sref">physical_node_counto/a>--;2/222o/a>2/223 va> if/(!oa href="+code=entry" class="sref">entryo/a>->oa href="+code=node_id" class="sref">node_ido/a>)2/224 va> oa href="+code=strcpy" class="sref">strcpy va>(oa href="+code=physical_node_nam " class="sref">physical_node_nam va>, oa href="+code=PHYSICAL_NODE_STRING" class="sref">PHYSICAL_NODE_STRINGo/a>);2/225 va> else2/226 va> oa href="+code=sprintf" class="sref">sprintf va>(oa href="+code=physical_node_nam " class="sref">physical_node_nam va>,2/227 va> ospa6 class="string">"physical_node%d"entryo/a>->oa href="+code=node_id" class="sref">node_ido/a>);2/228o/a>2/229 va> oa href="+code=sysfs_remove_link" class="sref">sysfs_remove_link va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=dev" class="sref">devo/a>.oa href="+code=kobj" class="sref">kobjo/a>, oa href="+code=physical_node_nam " class="sref">physical_node_nam va>);2/230 va> oa href="+code=sysfs_remove_link" class="sref">sysfs_remove_link va>(&oa href="+code=dev" class="sref">devo/a>->oa href="+code=kobj" class="sref">kobjo/a>, ospa6 class="string">"firmware_node"/231 va> oa href="+code=dev" class="sref">devo/a>->oa href="+code=archdata" class="sref">archdatao/a>.oa href="+code=acpi_handle" class="sref">acpi_handleo/a> =/oa href="+code=NULL" class="sref">NULL va>;2/232 va> ospa6 class="comment">/* acpi_bind_one increase refcnt by one */o/spa6.2/233 va> oa href="+code=put_device" class="sref">put_device va>(oa href="+code=dev" class="sref">devo/a>);2/234 va> oa href="+code=kfree" class="sref">kfree va>(oa href="+code=entry" class="sref">entryo/a>);2/235 va> }2/236 va> oa href="+code=mutex_unlock" class="sref">mutex_unlock va>(&oa href="+code=acpi_dev" class="sref">acpi_devo/a>->oa href="+code=physical_node_lock" class="sref">physical_node_locko/a>);2/237o/a>2/238 va> return 0;2/239o/a>2/240o/a>oa href="+code=err" class="sref">erro/a>:2/241 va> oa href="+code=dev_err" class="sref">dev_err va>(oa href="+code=dev" class="sref">devo/a>, ospa6 class="string">"Oops, 'acpi_handle' corrupt\n"/242 va> return -oa href="+code=EINVAL" class="sref">EINVALo/a>;2/243 va>}2/244 va>2/245 va>static/int/oa href="+code=acpi_platform_notify" class="sref">acpi_platform_notify va>(struct/oa href="+code=device" class="sref">deviceo/a> *oa href="+code=dev" class="sref">devo/a>)2/246o/a>{2/247 va> struct/oa href="+code=acpi_bus_typ " class="sref">acpi_bus_typ o/a> *oa href="+code=typ " class="sref">typ o/a>;2/248 va> oa href="+code=acpi_handle" class="sref">acpi_handleo/a> oa href="+code=handle" class="sref">handleo/a>;2/249 va> int/oa href="+code=ret" class="sref">reto/a> =/-oa href="+code=EINVAL" class="sref">EINVALo/a>;2/250o/a>2/251 va> if/(!oa href="+code=dev" class="sref">devo/a>->oa href="+code=bus" class="sref">buso/a> ||/!oa href="+code=dev" class="sref">devo/a>->oa href="+code=parent" class="sref">parento/a>) {2/252 va> ospa6 class="comment">/* bridge devices genernally haven't bus or parent */o/spa6.2/253 va> oa href="+code=ret" class="sref">reto/a> =/oa href="+code=acpi_find_bridge_device" class="sref">acpi_find_bridge_device va>(oa href="+code=dev" class="sref">devo/a>, &oa href="+code=handle" class="sref">handleo/a>);2/254 va> goto/oa href="+code=end" class="sref">endo/a>;2/255 va> }2/256 va> oa href="+code=typ " class="sref">typ o/a> =/oa href="+code=acpi_get_bus_typ " class="sref">acpi_get_bus_typ va>(oa href="+code=dev" class="sref">devo/a>->oa href="+code=bus" class="sref">buso/a>);2/257 va> if/(!oa href="+code=typ " class="sref">typ o/a>) {2/258 va> oa href="+code=DBG" class="sref">DBG va>(ospa6 class="string">"No ACPI bus support for %s\n"dev_nam va>(oa href="+code=dev" class="sref">devo/a>));2/259 va> oa href="+code=ret" class="sref">reto/a> =/-oa href="+code=EINVAL" class="sref">EINVALo/a>;2/260 va> goto/oa href="+code=end" class="sref">endo/a>;2/261 va> }2/262 va> if/((oa href="+code=ret" class="sref">reto/a> =/oa href="+code=typ " class="sref">typ o/a>->oa href="+code=find_device" class="sref">find_device va>(oa href="+code=dev" class="sref">devo/a>, &oa href="+code=handle" class="sref">handleo/a>)) !=/0)2/263 va> oa href="+code=DBG" class="sref">DBG va>(ospa6 class="string">"Can't get handler for %s\n"dev_nam va>(oa href="+code=dev" class="sref">devo/a>));2/264 va> oa href="+code=end" class="sref">endo/a>:2/265 va> if/(!oa href="+code=ret" class="sref">reto/a>)2/266 va> oa href="+code=acpi_bind_one" class="sref">acpi_bind_one va>(oa href="+code=dev" class="sref">devo/a>, oa href="+code=handle" class="sref">handleo/a>);2/267o/a>2/268 va>#if/oa href="+code=ACPI_GLUE_DEBUG" class="sref">ACPI_GLUE_DEBUGo/a>2/269 va> if/(!oa href="+code=ret" class="sref">reto/a>) {2/270 va> struct/oa href="+code=acpi_buffer" class="sref">acpi_buffero/a> oa href="+code=buffer" class="sref">buffero/a> =/{/oa href="+code=ACPI_ALLOCATE_BUFFER" class="sref">ACPI_ALLOCATE_BUFFERo/a>, oa href="+code=NULL" class="sref">NULL va> };2/271o/a>2/272 va> oa href="+code=acpi_get_nam " class="sref">acpi_get_nam va>(oa href="+code=dev" class="sref">devo/a>->oa href="+code=archdata" class="sref">archdatao/a>.oa href="+code=acpi_handle" class="sref">acpi_handleo/a>,2/273 va> oa href="+code=ACPI_FULL_PATHNAME" class="sref">ACPI_FULL_PATHNAMEo/a>, &oa href="+code=buffer" class="sref">buffero/a>);2/274 va> oa href="+code=DBG" class="sref">DBG va>(ospa6 class="string">"Device %s -> %s\n"dev_nam va>(oa href="+code=dev" class="sref">devo/a>), (char *)oa href="+code=buffer" class="sref">buffero/a>.oa href="+code=pointer" class="sref">pointero/a>);2/275 va> oa href="+code=kfree" class="sref">kfree va>(oa href="+code=buffer" class="sref">buffero/a>.oa href="+code=pointer" class="sref">pointero/a>);2/276 va> } else2/277 va> oa href="+code=DBG" class="sref">DBG va>(ospa6 class="string">"Device %s -> No ACPI support\n"dev_nam va>(oa href="+code=dev" class="sref">devo/a>));2/ 27>/158#endif2/279o/a>2/280 va> return oa href="+code=ret" class="sref">reto/a>;2/281 va>}2/282o/a>2/283 va>static/int/oa href="+code=acpi_platform_notify_remove" class="sref">acpi_platform_notify_remove va>(struct/oa href="+code=device" class="sref">deviceo/a> *oa href="+code=dev" class="sref">devo/a>)2/284 va>{2/285 va> oa href="+code=acpi_unbind_one" class="sref">acpi_unbind_one va>(oa href="+code=dev" class="sref">devo/a>);2/286 va> return 0;2/287 va>}2/288o/a>2/289 va>int/oa href="+code=__init" class="sref">__inito/a> oa href="+code=init_acpi_device_notify" class="sref">init_acpi_device_notify va>(void)2/29 va>{2/291 va> if/(oa href="+code=platform_notify" class="sref">platform_notify va> ||/oa href="+code=platform_notify_remove" class="sref">platform_notify_remove va>) {2/292 va> oa href="+code=printk" class="sref">printk va>(oa href="+code=KERN_ERR" class="sref">KERN_ERRo/a> oa href="+code=PREFIX" class="sref">PREFIXo/a> ospa6 class="string">"Can't use platform_notify\n"/293 va> return 0;2/294 va> }2/295 va> oa href="+code=platform_notify" class="sref">platform_notify va> =/oa href="+code=acpi_platform_notify" class="sref">acpi_platform_notify va>;2/296 va> oa href="+code=platform_notify_remove" class="sref">platform_notify_remove va> =/oa href="+code=acpi_platform_notify_remove" class="sref">acpi_platform_notify_remove va>;2/297 va> return 0;2/298 va>}2/299 va>
lxr.linux.no kindly hosted by Redpill Linpro ASo/a>, provider of Linux consulting and operations services since 1995.