From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-block@vger.kernel.org, Jens Axboe <axboe@fb.com>,
Hannes Reinecke <hare@suse.com>, Jan Kara <jack@suse.cz>,
Mike Christie <mchristi@redhat.com>,
Bart Van Assche <Bart.VanAssche@sandisk.com>
Subject: [PATCH 6/7] pktcdvd: use class_groups instead of class_attrs
Date: Thu, 8 Jun 2017 10:12:41 +0200 [thread overview]
Message-ID: <20170608081242.27061-7-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20170608081242.27061-1-gregkh@linuxfoundation.org>
The class_attrs pointer is long depreciated, and is about to be finally
removed, so move to use the class_groups pointer instead.
Cc: <linux-block@vger.kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/block/pktcdvd.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 205b865ebeb9..98939ee97476 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -348,9 +348,9 @@ static void class_pktcdvd_release(struct class *cls)
{
kfree(cls);
}
-static ssize_t class_pktcdvd_show_map(struct class *c,
- struct class_attribute *attr,
- char *data)
+
+static ssize_t device_map_show(struct class *c, struct class_attribute *attr,
+ char *data)
{
int n = 0;
int idx;
@@ -368,11 +368,10 @@ static ssize_t class_pktcdvd_show_map(struct class *c,
mutex_unlock(&ctl_mutex);
return n;
}
+static CLASS_ATTR_RO(device_map);
-static ssize_t class_pktcdvd_store_add(struct class *c,
- struct class_attribute *attr,
- const char *buf,
- size_t count)
+static ssize_t add_store(struct class *c, struct class_attribute *attr,
+ const char *buf, size_t count)
{
unsigned int major, minor;
@@ -390,11 +389,10 @@ static ssize_t class_pktcdvd_store_add(struct class *c,
return -EINVAL;
}
+static CLASS_ATTR_WO(add);
-static ssize_t class_pktcdvd_store_remove(struct class *c,
- struct class_attribute *attr,
- const char *buf,
- size_t count)
+static ssize_t remove_store(struct class *c, struct class_attribute *attr,
+ const char *buf, size_t count)
{
unsigned int major, minor;
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
@@ -403,14 +401,15 @@ static ssize_t class_pktcdvd_store_remove(struct class *c,
}
return -EINVAL;
}
+static CLASS_ATTR_WO(remove);
-static struct class_attribute class_pktcdvd_attrs[] = {
- __ATTR(add, 0200, NULL, class_pktcdvd_store_add),
- __ATTR(remove, 0200, NULL, class_pktcdvd_store_remove),
- __ATTR(device_map, 0444, class_pktcdvd_show_map, NULL),
- __ATTR_NULL
+static struct attribute *class_pktcdvd_attrs[] = {
+ &class_attr_add.attr,
+ &class_attr_remove.attr,
+ &class_attr_device_map.attr,
+ NULL,
};
-
+ATTRIBUTE_GROUPS(class_pktcdvd);
static int pkt_sysfs_init(void)
{
@@ -426,7 +425,7 @@ static int pkt_sysfs_init(void)
class_pktcdvd->name = DRIVER_NAME;
class_pktcdvd->owner = THIS_MODULE;
class_pktcdvd->class_release = class_pktcdvd_release;
- class_pktcdvd->class_attrs = class_pktcdvd_attrs;
+ class_pktcdvd->class_groups = class_pktcdvd_groups;
ret = class_register(class_pktcdvd);
if (ret) {
kfree(class_pktcdvd);
--
2.13.1
next prev parent reply other threads:[~2017-06-08 8:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 8:12 [PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman
2017-06-08 8:12 ` [PATCH 1/7] uwb: use class_groups instead of class_attrs Greg Kroah-Hartman
2017-06-08 8:12 ` [PATCH 2/7] scsi: ibmvscsi_tgt: remove use " Greg Kroah-Hartman
2017-06-08 12:31 ` Bryant G. Ly
2017-06-08 8:12 ` [PATCH 3/7] mtd: use class_groups instead " Greg Kroah-Hartman
2017-06-08 10:23 ` Richard Weinberger
2017-06-08 8:12 ` [PATCH 4/7] zram: " Greg Kroah-Hartman
2017-06-09 5:39 ` Sergey Senozhatsky
2017-06-08 8:12 ` [PATCH 5/7] gpio: " Greg Kroah-Hartman
2017-06-08 8:23 ` Robert P. J. Day
2017-06-08 12:05 ` Linus Walleij
2017-06-08 8:12 ` Greg Kroah-Hartman [this message]
2017-06-08 14:05 ` [PATCH 6/7] pktcdvd: " Jens Axboe
2017-06-08 8:12 ` [PATCH 7/7] driver core: remove class_attrs from struct class Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170608081242.27061-7-gregkh@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Bart.VanAssche@sandisk.com \
--cc=axboe@fb.com \
--cc=hare@suse.com \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchristi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome