linux/drivers/of/device.c
<<
"v3. /spapti /formti a "v3. href="../linux+v3.7.2/drivers/of/device.c">"v3. img src="../.static/gfx/right.png" alt=">>">"v /spapti"v spap class="lxr_search">"v3."v3. input typvalhidden" namvalnavtarget" ion val">"v3. input typvaltext" namvalsearch" idalsearch">"v3. buttopttypvalsubmit">Search"v3. Prefsi /a>"v /spapti3. /divti3. form ac"v input typvalhidden" namvalajax_lookup" idalajax_lookup" ion val">"3. /formti"3. div class="headingbottom">i div idalfile_contents"t
   1 /a>#include <linux/string.h /a>>
   2 /a>#include <linux/kernel.h /a>>
   3 /a>#include <linux/of.h /a>>
   4 /a>#include <linux/of_device.h /a>>
   5 /a>#include <linux/init.h /a>>
   6 /a>#include <linux/module.h /a>>
   7 /a>#include <linux/mod_devicetable.h /a>>
   8 /a>#include <linux/slab.h /a>>
   9 /a>"  3.8.a>#include <asm/errno.h /a>>
  11 /a>"  12 /a> spap class="comment">/** /spapti  13 /a> spap class="comment"> * of_match_device - Tell if a struct device matches ap of_device_id list /spapti  14 /a> spap class="comment"> * @ids: array of of device match structures to search in /spapti  15 /a> spap class="comment"> * @dev: the of device structure to match against /spapti  16 /a> spap class="comment"> * /spapti  17 /a> spap class="comment"> * Used by a driver to check whether ap platform_device present in the /spapti  18 /a> spap class="comment"> * system is in its list of supported devices. /spapti  19 /a> spap class="comment"> */ /spapti  2.8.a>const struct of_device_id8.a> * a href="+code=of_match_device" class="sref">of_match_device8.a>(const struct of_device_id8.a> * a href="+code=matches" class="sref">matches8.a>,i  21 /a>                                           const struct device8.a> * a href="+code=dev" class="sref">dev8.a>)i  22 /a>{i  23 /a>        if ((! a href="+code=matches" class="sref">matches8.a>) || (! a href="+code=dev" class="sref">dev8.a>->of_node8.a>))i  24 /a>                return NULL /a>;
  25 /a>        return of_match_node8.a>( a href="+code=matches" class="sref">matches8.a>, dev8.a>->of_node8.a>);
  26 /a>}
  27 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL8.a>( a href="+code=of_match_device" class="sref">of_match_device8.a>);
  28 /a>"  29 /a>struct platform_device8.a> * a href="+code=of_dev_get" class="sref">of_dev_get8.a>(struct platform_device8.a> * a href="+code=dev" class="sref">dev8.a>)i  30 /a>{i  31 /a>        struct device8.a> * a href="+code=tmp" class="sref">tmp /a>;
  32 /a>"  33 /a>        if (! a href="+code=dev" class="sref">dev8.a>)i  34 /a>                return NULL /a>;
  35 /a>         a href="+code=tmp" class="sref">tmp /a> =  a href="+code=get_device" class="sref">get_device8.a>(&dev8.a>->dev8.a>);
  36 /a>        if ( a href="+code=tmp" class="sref">tmp /a>)i  3>
  
    3>
  
 elsev8.a>);
  34 /a>                return NULL /a>;
  26 /a>}
  27 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL8.a>( a href="+code=of_dev_get" class="sref">of_dev_tev8.a>);
  32 /a>" void struct pu_dev_get8.a>(struct platform_device8.a> * a href="+code=dev" class="sref">dev8.a>)i  30 /a>{i  36 /a>        if ( a href="+code=dev" class="sref">dev8.a>)i  34 /a>         struct dev8.a>->dev8.a>);
  26 /a>}
  27 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL8.a>( a href="+code=pu_dev_get" class="sref">pu_dev_dev8.a>);
   9 /a>" int struct of_adedev_get8.a>(struct platform_device8.a> * a href=of"+code=dev" class=of"+cef">dev8.a>)i  30 /a>{i  35 /a>         a href=BUG_ONode=dev" class=BUG_ON_SYMBOL8.a>( a href="+"+code=dev" class=of"+cef">dev8.a>->.a>->of_n =mp /a> =  a href="+code=NULL" class="sref">Ndev8.a>);
   9 /a>"  34 /a>  12 /a> spap class="comm="lin ande.c havtructbe set so that* @de"sref">p bus doesn't of_de"> */ /spapti  15 /a> spap class="commmmmmmmm*    fut"> onture tingmment"> */ /spapti  35 /a>         a href="+"+code=dev" class=of"+cef">dev8.a>->tmp /a> =  a href=ef">"linode=dev" class=ef">"lin_device8.a>(&dev8.a>->dev8.a>);
  35 /a>         a href="+"+code=dev" class=of"+cef">dev8.a>->);
  28 /a>"  34 /a>  12 /a> spap class="comm=ef">of_ade will spauin that* @is the of is oesent slin ef"> spnt"> */ /spapti  15 /a> spap class="commmmmmmmm*  @de"ars=". If  @drf is noe"ars=" thflasd, set  @deef">of"> */ /spapti  15 /a> spap class="commmmmmmmm* explicitlymment"> */ /spapti  35 /a>        if (! a href="+"+code=dev" class=of"+cef">dev8.a>->.a>->dev8.a>)i  33 /a>  35 /a>         a href=ssref">code=of_node" class=ssref">code=_device8.a>(&dev8.a>->hes8.a>, _to_ndevice_id" class="sref">_to_nde_SYMBOL8.a>( a href="+"+code=dev" class=of"+cef">dev8.a>->.a>->of_n)dev8.a>);
  28 /a>"  25 /a>        return of_adedev_gce8.a>(&dev8.a>->dev8.a>);
  26 /a>}
  28 /a>" int struct of_registerdev_get8.a>(struct platform_device8.a> * a href=p"+code=dev" class=p"+cef">dev8.a>)i  30 /a>{i  35 /a>         a href=ef">of_>linialize=device" class="sref"_>linializedev_gce8.a>(&dev8.a>->dev8.a>);
  25 /a>        return of_adedev_ge8.a> * a href=p"+code=dev" class=p"+cef">dev8.a>);
  26 /a>}
  27 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL8.a>( a href="+code=of_registervice_id" class="sref">of_registerdev_dev8.a>);
  28 /a>" void struct of_unregisterdev_get8.a>(struct platform_device8.a> * a href=of"+code=dev" class=of"+cef">dev8.a>)i  30 /a>{i  35 /a>         a href=ode>of_unregistervice_id" class=ef">of_unregisterdev_gce8.a>(&dev8.a>->dev8.a>);
  26 /a>}
  27 /a> a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL8.a>( a href="+code=of_unregistervice_id" class="sref">of_unregisterdev_dev8.a>);
  28 /a>"  27 /a> a href=ssize_"_device" class=ssize_"5">  OL8.a>( a href="+code=of_"sremodalia=matches" class="+code=of_"sremodalia=dev_get8.a>(struct  * a href="+code=dev" class="sref">, charice8.a> * a href=et8_device" class=stref">hes8.a>,   OL8.a>( a href=lvalhevice" class=lvaef">dev8.a>)i  22 /a>{i  33 /a>       charice8.a> * a href=clapa"_device" class=clapa"f">NULL /a>;
  34 /a> int struct hes8.a>, NULL /a>;
  35 /a>         a href=ssize_"_device" class=ssize_"5">  OL8.a>( a href=tsize=device" class=tsizeef">hes8.a>, hes8.a>, NULL /a>;
  28 /a>"  35 /a>  12 /a> spap class="comm=Nlin ce8.a Typemment"> */ /spapti  35 /a>         a href=csize=device" class=csizeef">tmp /a> =  a href=snprintf_device" class=snprintf_SYMBOL8.a>( a href=et8_device" class=stref">hes8.a>, ,  12 /a> spap >linux">"of:N%sT%s"nt"> */hes8.a>, dev8.a>->of_ndev8.a>->hes8.a>,i  34 /a>           35 /a>         a href="+code=dev" class="sref">dev8.a>->of_ndev8.a>->);
  28 /a>"  35 /a>  12 /a> spap class="comm=Ge  clapa"iblm_deoperty - Tenymment"> */ /spapti  35 /a>         a href=clapa"_device" class=clapa"f">Ntmp /a> =  a href="sr"sredeopertyof_node" class="sr"sredeoperty_SYMBOL8.a>( a href="+code=dev" class="sref">dev8.a>->of_n,  12 /a> spap >linux">"clapa"iblm"nt"> */hece8.a>(&dev8.a>);
  33 /a>        if (! a href=clapa"_device" class=clapa"f">Ndev8.a>)i  34 /a>                return ev8.a>);
  28 /a>"  35 /a>  12 /a> spap class="comm=Find t8.e ene (wtruclerate multiplv \0 at* @deene ment"> */ /spapti  35 /a> f">     if ( a href=ivice_id" class=df">Ntmp    if ( a href=cplvalhevice" class=cplvaef"> - 1);es8.a>, N ev8.= 0ece8.ace8.a    if (! a href=clapa"_device" class=clapa"f">N[s8.a>, N];es8.a>, N--dev8.a>)i  34 /a>            if ( a href=cplvalhevice" class=cplvaef">--ev8.a>);
  33 /a>        if (! a href=cplvalhevice" class=cplvaef">d  9 /a>"  34 /a>                return ev8.a>);
  35 /a>         a href=cplvalhevice" class=cplvaef">++ev8.a>);
  32 /a>"  35 /a>  12 /a> spap class="comm=Cer to12 ce (need cplva+1 charysteno.hingmfinal \0) ment"> */ /spapti  35 /a>         a href=tsize=device" class=tsizeef">tmp /a> =  a href=csize=device" class=csizeef">t+         a href=cplvalhevice" class=cplvaef">ev8.a>);
  35 /a>         a href=repenevice_id" class=repenef">Ntmp /a> =  a href=tsize=device" class=tsizeef">ev8.a>);
  28 /a>"  33 /a>      /a> =  a href=csize=device" class=csizeef">tev8.= OL8.a>( a href=lvalhevice" class=lvaef">d34 /a>          12 /a> spap class="comm=@* @delimit, ace -s acreadymfillee ment"> */ /spapti  34 /a>          valu2  >25=7v3.8.10"s=size=device" class=tsizeef">ev8.a>);
   9 /a>"  33 /a>      /a> =  a href=tsize=device" class=tsizeef">tev8.= OL8.a>( a href=lvalhevice" class=lvaef">d3{ /a>          12 /a> spap class="comm=limit clapa" in itment"> */ /spapti  21 /a>            if ( a href=cplvalhevice" class=cplvaef"> = OL8.a>( a href=lvalhevice" class=lvaef"> -  /a> =  a href=csize=device" class=csizeef">t- 1 /a>>
  21 /a>            if ( a href=repenevice_id" class=repenef">Ntmp /a> =  a href=lvalhevice" class=lvaef"> /a>>
  35 /a>  26 /a>}
  28 /a>"  35 /a>  12 /a> spap class="comm=Copy andedo charirepl cess="tment"> */ /spapti  35 /a>         a href=memcpyof_node" class=memcpydev_gce8.a>(&[s8.a>, t+ 1]hes8.a>, Nhes8.a>, dev8.a>);
  35 /a> f">     if ( a href=ivice_id" class=df">Ntmpreturn ees8.a>, N eltees8.a>, NUes8.a>, N++d3{v8.a>);
  34 /a>         charireturn tmp /a> =  a href=st8_device" class=stref">[s8.a>, N];v8.a>);
  34 /a>              /a> =  a href=c=device" class=cef">tm=  12 /a> spap >linux">'\0'nt"> */d  9 /a>"  34 /a>          35 /a>         a href=st8_device" class=stref">[s8.a>, N] =  12 /a> spap >linux">'C'nt"> */;v8.a>);
  21 /a>         else      /a> =  a href=c=device" class=cef">tm=  12 /a> spap >linux">' 'nt"> */d  9 /a>"  21 /a>          35 /a>         a href=st8_device" class=stref">[s8.a>, N] =  12 /a> spap >linux">'_'nt"> */;v8.a>);
  35 /a>  26 /a>}
  28 /a>"  25 /a>        return ev8.a>);
  26 /a>}
  28 /a>"  18 /a> spap class="comment">/** /spapti  19 /a> spap class="commches ap of_uevs="t- Displ y OF   la supuevs="tinf">paformnt">/** /spapti  15 /a> spap class="comment"> */ /spapti void struct (struct  * a href="+code=dev" class="sref">, et8.a>(struct  * a href=encode=dev" class=enc_devd  9 /a>"  22 /a>{i  33 /a>       charice8.a> * a href=clapa"_device" class=clapa"f">NULL /a>;
  34 /a> int struct tmp0hes8.a>, hes8.a>, NULL /a>;
  28 /a>"  36 /a>         if (! a href="+code=dev" class="sref">des8.a>) || (! a href="+code=dev" class="sref">dev8.a>->of_node8.a>))i  3>
  
    28 /a>"  34 /a> a>->( a href=encode=dev" class=enc_dev,  12 /a> spap >linux">"OF_NAME=%s"nt"> */hes8.a>, dev8.a>->of_ndev8.a>->dev8.a>);
  35 /a>         a href=add_uevs="_va8_device" class=add_uevs="_va8_SYMBOL8.a>( a href=encode=dev" class=enc_dev,  12 /a> spap >linux">"OF_FULLNAME=%s"nt"> */hes8.a>, dev8.a>->of_ndev8.a>->"linode=dev" class=full>"linef">dev8.a>);
  36 /a>     s8.a>, dev8.a>->of_ndev8.a>-> spap >linux">"elte"sre" altquot;nt"> */hes8.a>, dev8.a>->of_ndev8.a>->))i  21 /a>            if ( a href=add_uevs="_va8_device" class=add_uevs="_va8_SYMBOL8.a>( a href=encode=dev" class=enc_dev,  12 /a> spap >linux">"OF_TYPE=%s"nt"> */hes8.a>, dev8.a>->of_ndev8.a>->);
   9 /a>"  34 /a>  12 /a> spap class="comm=Since* @declapa"iblm_field c /a>ontain_devtty mu to nyttingid list /spapti  15 /a> spap class="commmmmmmmm* it's notn vally legalucturpli"tit out witheclamas. Weurpli"titid list /spapti  16 /a> spap class="commmmmmmmm* up usingma numberts lencironss="tva8ideviystestead.mment"> */ /spapti  35 /a>         a href=clapa"_device" class=clapa"f">Ntmp /a> =  a href="sr"sredeopertyof_node" class="sr"sredeoperty_SYMBOL8.a>( a href="+code=dev" class="sref">dev8.a>->of_n,  12 /a> spap >linux">"clapa"iblm"nt"> */hece8.a>(&dev8.a>);
  34 /a> whilm_  /a> =  a href=clapa"_device" class=clapa"f">Ntce8.ace8.a ce8.a> * a href=clapa"_device" class=clapa"f">Nece8.ace8.a         a href=cplvalhevice" class=cplvaef"> ev8.p0d3{v8.a>);
  34 /a>            if ( a href=add_uevs="_va8_device" class=add_uevs="_va8_SYMBOL8.a>( a href=encode=dev" class=enc_dev,  12 /a> spap >linux">"OF_COMPATIBLE_%d=%s"nt"> */hes8.a>, hes8.a>, Ndev8.a>);
  34 /a>         s8.a>, Ntmp /a> =  a href=st8lvalhevice" class=st8lva_SYMBOL8.a>( a href=clapa"_device" class=clapa"f">Ndt+ 1ev8.a>);
  21 /a>            if ( a href=clapa"_device" class=clapa"f">Ne+mp /a> =  a href=sllhevice" class=slf">NULL /a>;
  21 /a>            if ( a href=cplvalhevice" class=cplvaef"> -mp /a> =  a href=sllhevice" class=slf">NULL /a>;
  33 /a>  35 /a>         a href=ssvalhevice" class=sevaef">++ev8.a>);
  34 /a>  26 /a>}
  35 /a>         a href=add_uevs="_va8_device" class=add_uevs="_va8_SYMBOL8.a>( a href=encode=dev" class=enc_dev,  12 /a> spap >linux">"OF_COMPATIBLE_N=%d"nt"> */hes8.a>, dev8.a>);
  26 /a>}
  28 /a>" int struct (struct  * a href="+code=dev" class="sref">, et8.a>(struct  * a href=encode=dev" class=enc_devd  9 /a>"  30 /a>{i  33 /a>  nt struct NULL /a>;
  11 /a>"  35 /a>         if (! a href="+code=dev" class="sref">des8.a>) || (! a href="+code=dev" class="sref">dev8.a>->of_node8.a>))i  33 /a>  35 /a>        -a>->NULL /a>;
  28 /a>"  25 /a>  12 /a> spap class="comm=Drs/oftree modalia= -s lincky, we ade i pres2 etepsmment"> */ /spapti  36 /a>        if ( a href=add_uevs="_va8_device" class=add_uevs="_va8_SYMBOL8.a>( a href=encode=dev" class=enc_dev,  12 /a> spap >linux">"MODALIAS="nt"> */ode8.a>))i  3>
  
  NULL /a>;
  28 /a>"  34 /a> a>->Ntmp /a> =  a href="+code=of_"sremodalia=matches" class="+code=of_"sremodalia=dev_ge8.a> * a href="+code=dev" class="sref">, ce8.a>(&->[s8.a>, ->,i  34 /a>          35 /a>             sizeofBOL8.a>( a href=encode=dev" class=enc_devdev8.a>->) -  /a> =  a href=encode=dev" class=enc_devdev8.a>->);
  36 /a>     s8.a>, Ntev8.= (sizeofBOL8.a>( a href=encode=dev" class=enc_devdev8.a>->) -  /a> =  a href=encode=dev" class=enc_devdev8.a>->))i  21 /a>          valu2 -a>->NULL /a>;
  34 /a> a>->-> =  a href=sllhevice" class=slf">NULL /a>;
  28 /a>"  25 /a>        0ULL /a>;
  26 /a>}
 

i3.
    /divtalL17" footerv>
T@devriginal LXR software * U @de6 /a>}
LXR clasunity_SYM,* @is experiss="al ef="ion * U6 /a>}
lxr@lfref.no_SYM.
i3.
   /divtalL17" subfooterv>
lxr.lfref.no kindly host"> * U6 /a>}
Redpill Lfrpro AS_SYM,*providerts lLfref     ultingmand operaforms sers/ofs since*1995.
i3.
    //body  //html">