If the open entry for char-device just does
file->private_data = inode->i_private;
we can use simple_open instead.
Generated by: coccinelle/api/simple_open.cocci
Reported-by: Fengguang Wu <[email protected]>
Signed-off-by: Or Gerlitz <[email protected]>
---
drivers/infiniband/hw/mlx5/mr.c | 11 ++---------
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 13 +++----------
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 15 ++-------------
3 files changed, 7 insertions(+), 32 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 6b76150..2b5d336 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -49,13 +49,6 @@ static __be64 *mr_align(__be64 *ptr, int align)
return (__be64 *)(((unsigned long)ptr + mask) & ~mask);
}
-static int file_open(struct inode *inode, struct file *file)
-{
- file->private_data = inode->i_private;
-
- return 0;
-}
-
static int order2idx(struct mlx5_ib_dev *dev, int order)
{
struct mlx5_mr_cache *cache = &dev->cache;
@@ -224,7 +217,7 @@ static ssize_t size_read(struct file *filp, char __user
*buf, size_t count,
static const struct file_operations size_fops = {
.owner = THIS_MODULE,
- .open = file_open,
+ .open = simple_open,
.write = size_write,
.read = size_read,
};
@@ -286,7 +279,7 @@ static ssize_t limit_read(struct file *filp, char __user
*buf, size_t count,
static const struct file_operations limit_fops = {
.owner = THIS_MODULE,
- .open = file_open,
+ .open = simple_open,
.write = limit_write,
.read = limit_read,
};
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index a0c8941..c1c0eef 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -95,13 +95,6 @@ enum {
MLX5_CMD_STAT_BAD_SIZE_OUTS_CQES_ERR = 0x40,
};
-static int dbg_open(struct inode *inode, struct file *file)
-{
- file->private_data = inode->i_private;
-
- return 0;
-}
-
static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5_cmd *cmd,
struct mlx5_cmd_msg *in,
struct mlx5_cmd_msg *out,
@@ -715,7 +708,7 @@ static ssize_t dbg_write(struct file *filp, const char
__user *buf,
static const struct file_operations fops = {
.owner = THIS_MODULE,
- .open = dbg_open,
+ .open = simple_open,
.write = dbg_write,
};
@@ -935,7 +928,7 @@ static ssize_t data_read(struct file *filp, char __user
*buf, size_t count,
static const struct file_operations dfops = {
.owner = THIS_MODULE,
- .open = dbg_open,
+ .open = simple_open,
.write = data_write,
.read = data_read,
};
@@ -1003,7 +996,7 @@ static ssize_t outlen_write(struct file *filp, const char
__user *buf,
static const struct file_operations olfops = {
.owner = THIS_MODULE,
- .open = dbg_open,
+ .open = simple_open,
.write = outlen_write,
.read = outlen_read,
};
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
index 8acb754..5e9cf2b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
@@ -142,17 +142,6 @@ void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev)
debugfs_remove_recursive(dev->priv.eq_debugfs);
}
-static int dbg_open(struct inode *inode, struct file *file)
-{
- /*
- * inode.i_private is equal to the data argument passed to
- * debugfs_create_file
- */
- file->private_data = inode->i_private;
-
- return 0;
-}
-
static ssize_t average_read(struct file *filp, char __user *buf, size_t count,
loff_t *pos)
{
@@ -200,7 +189,7 @@ static ssize_t average_write(struct file *filp, const char
__user *buf,
static const struct file_operations stats_fops = {
.owner = THIS_MODULE,
- .open = dbg_open,
+ .open = simple_open,
.read = average_read,
.write = average_write,
};
@@ -467,7 +456,7 @@ static ssize_t dbg_read(struct file *filp, char __user
*buf, size_t count,
static const struct file_operations fops = {
.owner = THIS_MODULE,
- .open = dbg_open,
+ .open = simple_open,
.read = dbg_read,
};
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html