pktcdvd: use class_groups instead of class_attrs
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> Acked-by: 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>hifive-unleashed-5.1
parent
d83bb159f4
commit
dc307f921f
|
@ -348,9 +348,9 @@ static void class_pktcdvd_release(struct class *cls)
|
||||||
{
|
{
|
||||||
kfree(cls);
|
kfree(cls);
|
||||||
}
|
}
|
||||||
static ssize_t class_pktcdvd_show_map(struct class *c,
|
|
||||||
struct class_attribute *attr,
|
static ssize_t device_map_show(struct class *c, struct class_attribute *attr,
|
||||||
char *data)
|
char *data)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int idx;
|
int idx;
|
||||||
|
@ -368,11 +368,10 @@ static ssize_t class_pktcdvd_show_map(struct class *c,
|
||||||
mutex_unlock(&ctl_mutex);
|
mutex_unlock(&ctl_mutex);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
static CLASS_ATTR_RO(device_map);
|
||||||
|
|
||||||
static ssize_t class_pktcdvd_store_add(struct class *c,
|
static ssize_t add_store(struct class *c, struct class_attribute *attr,
|
||||||
struct class_attribute *attr,
|
const char *buf, size_t count)
|
||||||
const char *buf,
|
|
||||||
size_t count)
|
|
||||||
{
|
{
|
||||||
unsigned int major, minor;
|
unsigned int major, minor;
|
||||||
|
|
||||||
|
@ -390,11 +389,10 @@ static ssize_t class_pktcdvd_store_add(struct class *c,
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
static CLASS_ATTR_WO(add);
|
||||||
|
|
||||||
static ssize_t class_pktcdvd_store_remove(struct class *c,
|
static ssize_t remove_store(struct class *c, struct class_attribute *attr,
|
||||||
struct class_attribute *attr,
|
const char *buf, size_t count)
|
||||||
const char *buf,
|
|
||||||
size_t count)
|
|
||||||
{
|
{
|
||||||
unsigned int major, minor;
|
unsigned int major, minor;
|
||||||
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
|
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
|
||||||
|
@ -403,14 +401,15 @@ static ssize_t class_pktcdvd_store_remove(struct class *c,
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
static CLASS_ATTR_WO(remove);
|
||||||
|
|
||||||
static struct class_attribute class_pktcdvd_attrs[] = {
|
static struct attribute *class_pktcdvd_attrs[] = {
|
||||||
__ATTR(add, 0200, NULL, class_pktcdvd_store_add),
|
&class_attr_add.attr,
|
||||||
__ATTR(remove, 0200, NULL, class_pktcdvd_store_remove),
|
&class_attr_remove.attr,
|
||||||
__ATTR(device_map, 0444, class_pktcdvd_show_map, NULL),
|
&class_attr_device_map.attr,
|
||||||
__ATTR_NULL
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(class_pktcdvd);
|
||||||
|
|
||||||
static int pkt_sysfs_init(void)
|
static int pkt_sysfs_init(void)
|
||||||
{
|
{
|
||||||
|
@ -426,7 +425,7 @@ static int pkt_sysfs_init(void)
|
||||||
class_pktcdvd->name = DRIVER_NAME;
|
class_pktcdvd->name = DRIVER_NAME;
|
||||||
class_pktcdvd->owner = THIS_MODULE;
|
class_pktcdvd->owner = THIS_MODULE;
|
||||||
class_pktcdvd->class_release = class_pktcdvd_release;
|
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);
|
ret = class_register(class_pktcdvd);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(class_pktcdvd);
|
kfree(class_pktcdvd);
|
||||||
|
|
Loading…
Reference in New Issue