]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - include/linux/device.h
Merge tag 'docs-4.10' of git://git.lwn.net/linux
[mirror_ubuntu-zesty-kernel.git] / include / linux / device.h
index 36d3a9867da97a6fb9d661d4a9c5a514203e2f8c..94926d3ad6c6f497a8771d071c45f2c8200d4408 100644 (file)
@@ -698,6 +698,25 @@ static inline int devm_add_action_or_reset(struct device *dev,
        return ret;
 }
 
+/**
+ * devm_alloc_percpu - Resource-managed alloc_percpu
+ * @dev: Device to allocate per-cpu memory for
+ * @type: Type to allocate per-cpu memory for
+ *
+ * Managed alloc_percpu. Per-cpu memory allocated with this function is
+ * automatically freed on driver detach.
+ *
+ * RETURNS:
+ * Pointer to allocated memory on success, NULL on failure.
+ */
+#define devm_alloc_percpu(dev, type)      \
+       ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \
+                                                     __alignof__(type)))
+
+void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
+                                  size_t align);
+void devm_free_percpu(struct device *dev, void __percpu *pdata);
+
 struct device_dma_parameters {
        /*
         * a low level driver may set these to teach IOMMU code about