blob: c0a360e99f6486fdb1a4e6554e8538260bedbc9e [file] [log] [blame]
Johannes Berg833c9542014-09-12 09:01:56 +02001#ifndef __DEVCOREDUMP_H
2#define __DEVCOREDUMP_H
3
4#include <linux/device.h>
5#include <linux/module.h>
6#include <linux/vmalloc.h>
7
8#ifdef CONFIG_DEV_COREDUMP
9void dev_coredumpv(struct device *dev, const void *data, size_t datalen,
10 gfp_t gfp);
11
12void dev_coredumpm(struct device *dev, struct module *owner,
13 const void *data, size_t datalen, gfp_t gfp,
14 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
15 const void *data, size_t datalen),
16 void (*free)(const void *data));
17#else
18static inline void dev_coredumpv(struct device *dev, const void *data,
19 size_t datalen, gfp_t gfp)
20{
21 vfree(data);
22}
23
24static inline void
25dev_coredumpm(struct device *dev, struct module *owner,
26 const void *data, size_t datalen, gfp_t gfp,
27 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
28 const void *data, size_t datalen),
29 void (*free)(const void *data))
30{
31 free(data);
32}
33#endif /* CONFIG_DEV_COREDUMP */
34
35#endif /* __DEVCOREDUMP_H */