xref: /openbmc/linux/drivers/infiniband/hw/mlx5/fs.h (revision f21e49be)
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
4  */
5 
6 #ifndef _MLX5_IB_FS_H
7 #define _MLX5_IB_FS_H
8 
9 #include "mlx5_ib.h"
10 
11 #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
12 int mlx5_ib_fs_init(struct mlx5_ib_dev *dev);
13 #else
14 static inline int mlx5_ib_fs_init(struct mlx5_ib_dev *dev)
15 {
16 	dev->flow_db = kzalloc(sizeof(*dev->flow_db), GFP_KERNEL);
17 
18 	if (!dev->flow_db)
19 		return -ENOMEM;
20 
21 	mutex_init(&dev->flow_db->lock);
22 	return 0;
23 }
24 #endif
25 static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev)
26 {
27 	kfree(dev->flow_db);
28 }
29 #endif /* _MLX5_IB_FS_H */
30