/share/man/man9/bus_release_resource.9

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 106 lines · 104 code · 2 blank · 0 comment · 0 complexity · 931fd2e81abda180d8af89fad6ccbb6f MD5 · raw file

  1. .\" -*- nroff -*-
  2. .\"
  3. .\" Copyright (c) 2000 Alexander Langer
  4. .\"
  5. .\" All rights reserved.
  6. .\"
  7. .\" This program is free software.
  8. .\"
  9. .\" Redistribution and use in source and binary forms, with or without
  10. .\" modification, are permitted provided that the following conditions
  11. .\" are met:
  12. .\" 1. Redistributions of source code must retain the above copyright
  13. .\" notice, this list of conditions and the following disclaimer.
  14. .\" 2. Redistributions in binary form must reproduce the above copyright
  15. .\" notice, this list of conditions and the following disclaimer in the
  16. .\" documentation and/or other materials provided with the distribution.
  17. .\"
  18. .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
  19. .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  20. .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. .\"
  29. .\" $FreeBSD$
  30. .\"
  31. .Dd May 18, 2000
  32. .Dt BUS_RELEASE_RESOURCE 9
  33. .Os
  34. .Sh NAME
  35. .Nm bus_release_resource
  36. .Nd release resources on a bus
  37. .Sh SYNOPSIS
  38. .In sys/param.h
  39. .In sys/bus.h
  40. .Pp
  41. .In machine/bus.h
  42. .In sys/rman.h
  43. .In machine/resource.h
  44. .Ft int
  45. .Fn bus_release_resource "device_t dev" "int type" "int rid" "struct resource *r"
  46. .Sh DESCRIPTION
  47. Free a resource allocated by
  48. .Xr bus_alloc_resource 9 .
  49. The resource must not be in use on release, i.e., call an appropriate function
  50. before (e.g.\&
  51. .Xr bus_teardown_intr 9
  52. for IRQs).
  53. .Bl -item
  54. .It
  55. .Fa dev
  56. is the device that owns the resource.
  57. .It
  58. .Fa type
  59. is the type of resource that is released.
  60. It must be of the same type you allocated it as before.
  61. See
  62. .Xr bus_alloc_resource 9
  63. for valid types.
  64. .It
  65. .Fa rid
  66. is the resource ID of the resource.
  67. The
  68. .Fa rid
  69. value must be the same as the one returned by
  70. .Xr bus_alloc_resource 9 .
  71. .It
  72. .Fa r
  73. is the pointer to
  74. .Va struct resource ,
  75. i.e., the resource itself,
  76. returned by
  77. .Xr bus_alloc_resource 9 .
  78. .El
  79. .Sh RETURN VALUES
  80. .Er EINVAL
  81. is returned, if the device
  82. .Fa dev
  83. has no parent,
  84. .Dv 0
  85. otherwise.
  86. The kernel will panic, if it cannot release the resource.
  87. .Sh EXAMPLES
  88. .Bd -literal
  89. /* deactivate IRQ */
  90. bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);
  91. /* release IRQ resource */
  92. bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid,
  93. foosoftc->irqres);
  94. /* release I/O port resource */
  95. bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
  96. foosoftc->portres);
  97. .Ed
  98. .Sh SEE ALSO
  99. .Xr bus_alloc_resource 9 ,
  100. .Xr device 9 ,
  101. .Xr driver 9
  102. .Sh AUTHORS
  103. This manual page was written by
  104. .An Alexander Langer Aq alex@big.endian.de .