aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ioport.h
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-01-20 02:00:26 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:36 -0500
commit9ac7849e35f705830f7b016ff272b0ff1f7ff759 (patch)
tree7f17cdff87e154937a15cc2ec8da9b4e6018ce8e /include/linux/ioport.h
parent77a527eadb425b60db3f5f0aae6a4c51c38e35e5 (diff)
devres: device resource management
Implement device resource management, in short, devres. A device driver can allocate arbirary size of devres data which is associated with a release function. On driver detach, release function is invoked on the devres data, then, devres data is freed. devreses are typed by associated release functions. Some devreses are better represented by single instance of the type while others need multiple instances sharing the same release function. Both usages are supported. devreses can be grouped using devres group such that a device driver can easily release acquired resources halfway through initialization or selectively release resources (e.g. resources for port 1 out of 4 ports). This patch adds devres core including documentation and the following managed interfaces. * alloc/free : devm_kzalloc(), devm_kzfree() * IO region : devm_request_region(), devm_release_region() * IRQ : devm_request_irq(), devm_free_irq() * DMA : dmam_alloc_coherent(), dmam_free_coherent(), dmam_declare_coherent_memory(), dmam_pool_create(), dmam_pool_destroy() * PCI : pcim_enable_device(), pcim_pin_device(), pci_is_managed() * iomap : devm_ioport_map(), devm_ioport_unmap(), devm_ioremap(), devm_ioremap_nocache(), devm_iounmap(), pcim_iomap_table(), pcim_iomap(), pcim_iounmap() Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include/linux/ioport.h')
-rw-r--r--include/linux/ioport.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 15228d79c5bc..6859a3b14088 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -137,4 +137,24 @@ static inline int __deprecated check_region(resource_size_t s,
137{ 137{
138 return __check_region(&ioport_resource, s, n); 138 return __check_region(&ioport_resource, s, n);
139} 139}
140
141/* Wrappers for managed devices */
142struct device;
143#define devm_request_region(dev,start,n,name) \
144 __devm_request_region(dev, &ioport_resource, (start), (n), (name))
145#define devm_request_mem_region(dev,start,n,name) \
146 __devm_request_region(dev, &iomem_resource, (start), (n), (name))
147
148extern struct resource * __devm_request_region(struct device *dev,
149 struct resource *parent, resource_size_t start,
150 resource_size_t n, const char *name);
151
152#define devm_release_region(start,n) \
153 __devm_release_region(dev, &ioport_resource, (start), (n))
154#define devm_release_mem_region(start,n) \
155 __devm_release_region(dev, &iomem_resource, (start), (n))
156
157extern void __devm_release_region(struct device *dev, struct resource *parent,
158 resource_size_t start, resource_size_t n);
159
140#endif /* _LINUX_IOPORT_H */ 160#endif /* _LINUX_IOPORT_H */