Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1406087
| From | "Pranay Kr. Srivastava" <pranjas@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4/4] use device_attr macros for sysfs attribute |
| Date | 2016-05-24 13:30 +0200 |
| Message-ID | <rCiH7-2BC-17@gated-at.bofh.it> (permalink) |
| References | <rCiH7-2BC-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch changes the pid sysfs device attribute to use
DEVICE_ATTR_* macro.
Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
---
drivers/block/nbd.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 59db890..d6ab9c9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -436,10 +436,8 @@ 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 = {
- .attr = { .name = "pid", .mode = S_IRUGO},
- .show = pid_show,
-};
+
+static DEVICE_ATTR_RO(pid);
static int nbd_thread_recv(struct nbd_device *nbd, struct block_device *bdev)
{
@@ -452,7 +450,7 @@ static int nbd_thread_recv(struct nbd_device *nbd, struct block_device *bdev)
nbd->task_recv = current;
- ret = device_create_file(disk_to_dev(nbd->disk), &pid_attr);
+ ret = device_create_file(disk_to_dev(nbd->disk), &dev_attr_pid);
if (ret) {
dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n");
@@ -475,7 +473,7 @@ static int nbd_thread_recv(struct nbd_device *nbd, struct block_device *bdev)
nbd_size_clear(nbd, bdev);
- device_remove_file(disk_to_dev(nbd->disk), &pid_attr);
+ device_remove_file(disk_to_dev(nbd->disk), &dev_attr_pid);
nbd->task_recv = NULL;
--
1.7.9.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4]nbd: fixes for nbd "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-24 13:30 +0200
[PATCH 2/4] fix various coding standard warnings "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-24 13:30 +0200
[PATCH 1/4] fix might_sleep warning on socket shutdown. "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-24 13:30 +0200
Re: [PATCH 1/4] fix might_sleep warning on socket shutdown. Markus Pargmann <mpa@pengutronix.de> - 2016-05-30 14:10 +0200
[PATCH 3/4] make nbd device wait for its users. "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-24 13:30 +0200
Re: [PATCH 3/4] make nbd device wait for its users. Markus Pargmann <mpa@pengutronix.de> - 2016-05-30 12:50 +0200
[PATCH 4/4] use device_attr macros for sysfs attribute "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-24 13:30 +0200
Re: [PATCH 0/4]nbd: fixes for nbd Pranay Srivastava <pranjas@gmail.com> - 2016-05-30 05:40 +0200
Re: [PATCH 0/4]nbd: fixes for nbd Markus Pargmann <mpa@pengutronix.de> - 2016-05-30 14:30 +0200
csiph-web