Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _HWBM_H
 3#define _HWBM_H
 4
 5#include <linux/mutex.h>
 6
 7struct hwbm_pool {
 8	/* Capacity of the pool */
 9	int size;
10	/* Size of the buffers managed */
11	int frag_size;
12	/* Number of buffers currently used by this pool */
13	int buf_num;
14	/* constructor called during allocation */
15	int (*construct)(struct hwbm_pool *bm_pool, void *buf);
16	/* protect access to the buffer counter*/
17	struct mutex buf_lock;
18	/* private data */
19	void *priv;
20};
21#ifdef CONFIG_HWBM
22void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
23int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
24int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
25#else
26static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
27
28static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
29{ return 0; }
30
31static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
32				unsigned int buf_num)
33{ return 0; }
34#endif /* CONFIG_HWBM */
35#endif /* _HWBM_H */
v4.6
 
 1#ifndef _HWBM_H
 2#define _HWBM_H
 3
 
 
 4struct hwbm_pool {
 5	/* Capacity of the pool */
 6	int size;
 7	/* Size of the buffers managed */
 8	int frag_size;
 9	/* Number of buffers currently used by this pool */
10	int buf_num;
11	/* constructor called during alocation */
12	int (*construct)(struct hwbm_pool *bm_pool, void *buf);
13	/* protect acces to the buffer counter*/
14	spinlock_t lock;
15	/* private data */
16	void *priv;
17};
18#ifdef CONFIG_HWBM
19void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
20int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
21int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp);
22#else
23void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
24int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
25int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
 
 
 
 
26{ return 0; }
27#endif /* CONFIG_HWBM */
28#endif /* _HWBM_H */