Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef _HWBM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define _HWBM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) struct hwbm_pool {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 	/* Capacity of the pool */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 	/* Size of the buffers managed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 	int frag_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	/* Number of buffers currently used by this pool */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	int buf_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	/* constructor called during alocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	int (*construct)(struct hwbm_pool *bm_pool, void *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	/* protect acces to the buffer counter*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	struct mutex buf_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	/* private data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifdef CONFIG_HWBM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 				unsigned int buf_num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif /* CONFIG_HWBM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #endif /* _HWBM_H */