0001
0002 #ifndef _HWBM_H
0003 #define _HWBM_H
0004
0005 #include <linux/mutex.h>
0006
0007 struct hwbm_pool {
0008
0009 int size;
0010
0011 int frag_size;
0012
0013 int buf_num;
0014
0015 int (*construct)(struct hwbm_pool *bm_pool, void *buf);
0016
0017 struct mutex buf_lock;
0018
0019 void *priv;
0020 };
0021 #ifdef CONFIG_HWBM
0022 void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
0023 int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
0024 int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
0025 #else
0026 static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
0027
0028 static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
0029 { return 0; }
0030
0031 static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
0032 unsigned int buf_num)
0033 { return 0; }
0034 #endif
0035 #endif