Patchwork [2/6] nbd: make device_attribute const

login
register
mail settings
Submitter Bhumika Goyal
Date Aug. 21, 2017, 11:43 a.m.
Message ID <1503315792-14837-3-git-send-email-bhumirks@gmail.com>
Download mbox | patch
Permalink /patch/9912277/
State New
Headers show

Comments

Bhumika Goyal - Aug. 21, 2017, 11:43 a.m.
Make this const as is is only passed as an argument to the
function device_create_file and device_remove_file and the corresponding
arguments are of type const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Jens Axboe - Aug. 28, 2017, 9:21 p.m.
On 08/21/2017 05:43 AM, Bhumika Goyal wrote:
> Make this const as is is only passed as an argument to the
> function device_create_file and device_remove_file and the corresponding
> arguments are of type const.
> Done using Coccinelle

Added for 4.14, thanks.

Patch

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5bdf923..49d7763 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -165,7 +165,7 @@  static ssize_t pid_show(struct device *dev,
 	return sprintf(buf, "%d\n", task_pid_nr(nbd->task_recv));
 }
 
-static struct device_attribute pid_attr = {
+static const struct device_attribute pid_attr = {
 	.attr = { .name = "pid", .mode = S_IRUGO},
 	.show = pid_show,
 };