Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1660911
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4/7] zram: use class_groups instead of class_attrs |
| Date | 2017-06-08 10:20 +0200 |
| Message-ID | <tQ0PD-1Le-9@gated-at.bofh.it> (permalink) |
| References | <tQ0PD-1Le-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The class_attrs pointer is long depreciated, and is about to be finally
removed, so move to use the class_groups pointer instead.
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/block/zram/zram_drv.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index debee952dcc1..ebf5a45a0277 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1272,6 +1272,13 @@ static int zram_remove(struct zram *zram)
}
/* zram-control sysfs attributes */
+
+/*
+ * NOTE: hot_add attribute is not the usual read-only sysfs attribute. In a
+ * sense that reading from this file does alter the state of your system -- it
+ * creates a new un-initialized zram device and returns back this device's
+ * device_id (or an error code if it fails to create a new device).
+ */
static ssize_t hot_add_show(struct class *class,
struct class_attribute *attr,
char *buf)
@@ -1286,6 +1293,7 @@ static ssize_t hot_add_show(struct class *class,
return ret;
return scnprintf(buf, PAGE_SIZE, "%d\n", ret);
}
+static CLASS_ATTR(hot_add, 0400, hot_add_show, NULL);
static ssize_t hot_remove_store(struct class *class,
struct class_attribute *attr,
@@ -1316,23 +1324,19 @@ static ssize_t hot_remove_store(struct class *class,
mutex_unlock(&zram_index_mutex);
return ret ? ret : count;
}
+static CLASS_ATTR_WO(hot_remove);
-/*
- * NOTE: hot_add attribute is not the usual read-only sysfs attribute. In a
- * sense that reading from this file does alter the state of your system -- it
- * creates a new un-initialized zram device and returns back this device's
- * device_id (or an error code if it fails to create a new device).
- */
-static struct class_attribute zram_control_class_attrs[] = {
- __ATTR(hot_add, 0400, hot_add_show, NULL),
- __ATTR_WO(hot_remove),
- __ATTR_NULL,
+static struct attribute *zram_control_class_attrs[] = {
+ &class_attr_hot_add.attr,
+ &class_attr_hot_remove.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(zram_control_class);
static struct class zram_control_class = {
.name = "zram-control",
.owner = THIS_MODULE,
- .class_attrs = zram_control_class_attrs,
+ .class_groups = zram_control_class_groups,
};
static int zram_remove_cb(int id, void *ptr, void *data)
--
2.13.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
[PATCH 2/7] scsi: ibmvscsi_tgt: remove use of class_attrs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
Re: [PATCH 2/7] scsi: ibmvscsi_tgt: remove use of class_attrs "Bryant G. Ly" <bryantly@linux.vnet.ibm.com> - 2017-06-08 14:40 +0200
[PATCH 4/7] zram: use class_groups instead of class_attrs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
Re: [PATCH 4/7] zram: use class_groups instead of class_attrs Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-09 07:40 +0200
[PATCH 3/7] mtd: use class_groups instead of class_attrs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
Re: [PATCH 3/7] mtd: use class_groups instead of class_attrs Richard Weinberger <richard@nod.at> - 2017-06-08 12:30 +0200
[PATCH 7/7] driver core: remove class_attrs from struct class Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
[PATCH 1/7] uwb: use class_groups instead of class_attrs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
[PATCH 6/7] pktcdvd: use class_groups instead of class_attrs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
[PATCH 5/7] gpio: use class_groups instead of class_attrs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-08 10:20 +0200
Re: [PATCH 5/7] gpio: use class_groups instead of class_attrs "Robert P. J. Day" <rpjday@crashcourse.ca> - 2017-06-08 11:40 +0200
Re: [PATCH 5/7] gpio: use class_groups instead of class_attrs Linus Walleij <linus.walleij@linaro.org> - 2017-06-08 14:10 +0200
csiph-web