IB/core: Fix unable to change lifespan entry for hw_counters
authorParav Pandit <parav@mellanox.com>
Mon, 16 Oct 2017 05:45:14 +0000 (08:45 +0300)
committerDoug Ledford <dledford@redhat.com>
Wed, 18 Oct 2017 16:10:36 +0000 (12:10 -0400)
commit79c4d80b43b8e43684894574a508a871f0c196bf
treea55176331009b6ab29c3834c74b8bbdcc8c98fcd
parentc0348eb069687a2f27c0cd23dafb35918edf9e75
IB/core: Fix unable to change lifespan entry for hw_counters

This patch fixes the case where 'lifespan' entry of the hw_counters
is not writable. Currently write callback is not exposed for for
the hw_counters sysfs operation. Due to this, modifying lifespan
value results into permission denied error in below example.

echo 10 > /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan
-bash: /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan:
Permission denied

This patch adds the hook to modify any attribute which implements
store() operation.

Fixes: b40f4757daa1 ("IB/core: Make device counter infrastructure dynamic")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/sysfs.c