Copyright (c) 2000 Alexander Langer All rights reserved. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaim...
NAMEbus_release_resource - release resources on a bus
SYNOPSISIn sys/param.h In sys/bus.h
In machine/bus.h In sys/rman.h In machine/resource.h Ft int Fn bus_release_resource device_t dev int type int rid struct resource *r
DESCRIPTIONFree a resource allocated by bus_alloc_resource9. The resource must not be in use on release, i.e., call an appropriate function before (e.g. bus_teardown_intr9 for IRQs).
- Fa dev
- is the device that owns the resource.
- Fa type
- is the type of resource that is released. It must be of the same type you allocated it as before. See bus_alloc_resource9 for valid types.
- Fa rid
- is the resource ID of the resource. The Fa rid value must be the same as the one returned by bus_alloc_resource9.
- Fa r
- is the pointer to struct resource i.e., the resource itself, returned by bus_alloc_resource9.
RETURN VALUESEr EINVAL is returned, if the device Fa dev has no parent, 0 otherwise. The kernel will panic, if it cannot release the resource.
/* deactivate IRQ */ bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid); /* release IRQ resource */ bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid, foosoftc->irqres); /* release I/O port resource */ bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid, foosoftc->portres);