linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Driver core: remove class_attrs from struct class
@ 2017-06-08  8:12 Greg Kroah-Hartman
  2017-06-08  8:12 ` [PATCH 1/7] uwb: use class_groups instead of class_attrs Greg Kroah-Hartman
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Bryant G. Ly, James E.J. Bottomley,
	Martin K. Petersen, Alexandre Courbot, Artem Bityutskiy,
	Bart Van Assche, Boris Brezillon, Brian Norris, Cyrille Pitchen,
	David Woodhouse, Hannes Reinecke, Jan Kara, Jens Axboe,
	Linus Walleij, Marek Vasut, Michael Cyr, Mike Christie,
	Minchan Kim, Nitin Gupta, Richard Weinberger, Sergey Senozhatsky

Some more patches that have long been sitting in a local tree...

The class_attrs field in struct class duplicates the same effort that
class_groups implements, so let's finally get rid of the last few users
of this field, and delete it, and the duplicated logic in the driver
core.

Subsystem maintainers, I'm glad to take this series in my driver core
tree, if you just want to ack your respective patches, that's fine with
me.

This series has passed 0-day test-builds from what I can tell.

Greg Kroah-Hartman (7):
  uwb: use class_groups instead of class_attrs
  scsi: ibmvscsi_tgt: remove use of class_attrs
  mtd: use class_groups instead of class_attrs
  zram: use class_groups instead of class_attrs
  gpio: use class_groups instead of class_attrs
  pktcdvd: use class_groups instead of class_attrs
  driver core: remove class_attrs from struct class

 drivers/base/class.c                     | 33 ------------------------------
 drivers/block/pktcdvd.c                  | 35 ++++++++++++++++----------------
 drivers/block/zram/zram_drv.c            | 26 ++++++++++++++----------
 drivers/gpio/gpiolib-sysfs.c             | 13 +++++++-----
 drivers/mtd/ubi/build.c                  | 16 ++++++++-------
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c |  5 -----
 drivers/uwb/driver.c                     | 11 +++++-----
 include/linux/device.h                   |  2 --
 8 files changed, 55 insertions(+), 86 deletions(-)

-- 
2.13.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/7] uwb: use class_groups instead of class_attrs
  2017-06-08  8:12 [PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman
@ 2017-06-08  8:12 ` Greg Kroah-Hartman
  2017-06-08  8:12 ` [PATCH 2/7] scsi: ibmvscsi_tgt: remove use " Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman

The class_attrs pointer is long depreciated, and is about to be finally
removed, so move to use the class_groups pointer instead.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/uwb/driver.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/uwb/driver.c b/drivers/uwb/driver.c
index 776bcb3c2140..ff2d4240b24a 100644
--- a/drivers/uwb/driver.c
+++ b/drivers/uwb/driver.c
@@ -94,17 +94,18 @@ ssize_t beacon_timeout_ms_store(struct class *class,
 	beacon_timeout_ms = bt;
 	return size;
 }
+static CLASS_ATTR_RW(beacon_timeout_ms);
 
-static struct class_attribute uwb_class_attrs[] = {
-	__ATTR(beacon_timeout_ms, S_IWUSR | S_IRUGO,
-	       beacon_timeout_ms_show, beacon_timeout_ms_store),
-	__ATTR_NULL,
+static struct attribute *uwb_class_attrs[] = {
+	&class_attr_beacon_timeout_ms.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(uwb_class);
 
 /** Device model classes */
 struct class uwb_rc_class = {
 	.name        = "uwb_rc",
-	.class_attrs = uwb_class_attrs,
+	.class_groups = uwb_class_groups,
 };
 
 
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/7] scsi: ibmvscsi_tgt: remove use of class_attrs
  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 ` 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
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Bryant G. Ly, Michael Cyr,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	target-devel

The class_attrs pointer is going away and it's not even being used in
this driver, so just remove it entirely.

Cc: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>
Cc: <target-devel@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index d390325c99ec..b480878e3258 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -3915,10 +3915,6 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
 
 static void ibmvscsis_dev_release(struct device *dev) {};
 
-static struct class_attribute ibmvscsis_class_attrs[] = {
-	__ATTR_NULL,
-};
-
 static struct device_attribute dev_attr_system_id =
 	__ATTR(system_id, S_IRUGO, system_id_show, NULL);
 
@@ -3938,7 +3934,6 @@ ATTRIBUTE_GROUPS(ibmvscsis_dev);
 static struct class ibmvscsis_class = {
 	.name		= "ibmvscsis",
 	.dev_release	= ibmvscsis_dev_release,
-	.class_attrs	= ibmvscsis_class_attrs,
 	.dev_groups	= ibmvscsis_dev_groups,
 };
 
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/7] mtd: use class_groups instead of class_attrs
  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  8:12 ` Greg Kroah-Hartman
  2017-06-08 10:23   ` Richard Weinberger
  2017-06-08  8:12 ` [PATCH 4/7] zram: " Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Artem Bityutskiy, Richard Weinberger,
	David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Cyrille Pitchen, linux-mtd

The class_attrs pointer is long depreciated, and is about to be finally
removed, so move to use the class_groups pointer instead.

Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Cc: <linux-mtd@lists.infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mtd/ubi/build.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 93e5d251a9e4..d854521962ef 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -104,23 +104,25 @@ DEFINE_MUTEX(ubi_devices_mutex);
 static DEFINE_SPINLOCK(ubi_devices_lock);
 
 /* "Show" method for files in '/<sysfs>/class/ubi/' */
-static ssize_t ubi_version_show(struct class *class,
-				struct class_attribute *attr, char *buf)
+/* UBI version attribute ('/<sysfs>/class/ubi/version') */
+static ssize_t version_show(struct class *class, struct class_attribute *attr,
+			    char *buf)
 {
 	return sprintf(buf, "%d\n", UBI_VERSION);
 }
+static CLASS_ATTR_RO(version);
 
-/* UBI version attribute ('/<sysfs>/class/ubi/version') */
-static struct class_attribute ubi_class_attrs[] = {
-	__ATTR(version, S_IRUGO, ubi_version_show, NULL),
-	__ATTR_NULL
+static struct attribute *ubi_class_attrs[] = {
+	&class_attr_version.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(ubi_class);
 
 /* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */
 struct class ubi_class = {
 	.name		= UBI_NAME_STR,
 	.owner		= THIS_MODULE,
-	.class_attrs	= ubi_class_attrs,
+	.class_groups	= ubi_class_groups,
 };
 
 static ssize_t dev_attribute_show(struct device *dev,
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/7] zram: use class_groups instead of class_attrs
  2017-06-08  8:12 [PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2017-06-08  8:12 ` [PATCH 3/7] mtd: use class_groups instead " Greg Kroah-Hartman
@ 2017-06-08  8:12 ` Greg Kroah-Hartman
  2017-06-09  5:39   ` Sergey Senozhatsky
  2017-06-08  8:12 ` [PATCH 5/7] gpio: " Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Minchan Kim, Nitin Gupta, Sergey Senozhatsky

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/7] gpio: use class_groups instead of class_attrs
  2017-06-08  8:12 [PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2017-06-08  8:12 ` [PATCH 4/7] zram: " Greg Kroah-Hartman
@ 2017-06-08  8:12 ` Greg Kroah-Hartman
  2017-06-08  8:23   ` Robert P. J. Day
  2017-06-08 12:05   ` Linus Walleij
  2017-06-08  8:12 ` [PATCH 6/7] pktcdvd: " Greg Kroah-Hartman
  2017-06-08  8:12 ` [PATCH 7/7] driver core: remove class_attrs from struct class Greg Kroah-Hartman
  6 siblings, 2 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Linus Walleij, Alexandre Courbot, linux-gpio

The class_attrs pointer is long depreciated, and is about to be finally
removed, so move to use the class_groups pointer instead.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: <linux-gpio@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpio/gpiolib-sysfs.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 4b44dd97c07f..16fe9742597b 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -479,6 +479,7 @@ static ssize_t export_store(struct class *class,
 		pr_debug("%s: status %d\n", __func__, status);
 	return status ? : len;
 }
+static CLASS_ATTR_WO(export);
 
 static ssize_t unexport_store(struct class *class,
 				struct class_attribute *attr,
@@ -514,18 +515,20 @@ static ssize_t unexport_store(struct class *class,
 		pr_debug("%s: status %d\n", __func__, status);
 	return status ? : len;
 }
+static CLASS_ATTR_WO(unexport);
 
-static struct class_attribute gpio_class_attrs[] = {
-	__ATTR(export, 0200, NULL, export_store),
-	__ATTR(unexport, 0200, NULL, unexport_store),
-	__ATTR_NULL,
+static struct attribute *gpio_class_attrs[] = {
+	&class_attr_export.attr,
+	&class_attr_unexport.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(gpio_class);
 
 static struct class gpio_class = {
 	.name =		"gpio",
 	.owner =	THIS_MODULE,
 
-	.class_attrs =	gpio_class_attrs,
+	.class_groups = gpio_class_groups,
 };
 
 
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/7] pktcdvd: use class_groups instead of class_attrs
  2017-06-08  8:12 [PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2017-06-08  8:12 ` [PATCH 5/7] gpio: " Greg Kroah-Hartman
@ 2017-06-08  8:12 ` Greg Kroah-Hartman
  2017-06-08 14:05   ` Jens Axboe
  2017-06-08  8:12 ` [PATCH 7/7] driver core: remove class_attrs from struct class Greg Kroah-Hartman
  6 siblings, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, linux-block, Jens Axboe, Hannes Reinecke,
	Jan Kara, Mike Christie, Bart Van Assche

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 7/7] driver core: remove class_attrs from struct class
  2017-06-08  8:12 [PATCH 0/7] Driver core: remove class_attrs from struct class Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2017-06-08  8:12 ` [PATCH 6/7] pktcdvd: " Greg Kroah-Hartman
@ 2017-06-08  8:12 ` Greg Kroah-Hartman
  6 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08  8:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman

This field is no longer used or needed (use class_groups instead), so it
can be removed along with the driver core functionality that created and
removed these files.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/class.c   | 33 ---------------------------------
 include/linux/device.h |  2 --
 2 files changed, 35 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index a2b2896693d6..52eb8e644acd 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -119,36 +119,6 @@ static void class_put(struct class *cls)
 		kset_put(&cls->p->subsys);
 }
 
-static int add_class_attrs(struct class *cls)
-{
-	int i;
-	int error = 0;
-
-	if (cls->class_attrs) {
-		for (i = 0; cls->class_attrs[i].attr.name; i++) {
-			error = class_create_file(cls, &cls->class_attrs[i]);
-			if (error)
-				goto error;
-		}
-	}
-done:
-	return error;
-error:
-	while (--i >= 0)
-		class_remove_file(cls, &cls->class_attrs[i]);
-	goto done;
-}
-
-static void remove_class_attrs(struct class *cls)
-{
-	int i;
-
-	if (cls->class_attrs) {
-		for (i = 0; cls->class_attrs[i].attr.name; i++)
-			class_remove_file(cls, &cls->class_attrs[i]);
-	}
-}
-
 static void klist_class_dev_get(struct klist_node *n)
 {
 	struct device *dev = container_of(n, struct device, knode_class);
@@ -217,8 +187,6 @@ int __class_register(struct class *cls, struct lock_class_key *key)
 	}
 	error = class_add_groups(class_get(cls), cls->class_groups);
 	class_put(cls);
-	error = add_class_attrs(class_get(cls));
-	class_put(cls);
 	return error;
 }
 EXPORT_SYMBOL_GPL(__class_register);
@@ -226,7 +194,6 @@ EXPORT_SYMBOL_GPL(__class_register);
 void class_unregister(struct class *cls)
 {
 	pr_debug("device class '%s': unregistering\n", cls->name);
-	remove_class_attrs(cls);
 	class_remove_groups(cls, cls->class_groups);
 	kset_unregister(&cls->p->subsys);
 }
diff --git a/include/linux/device.h b/include/linux/device.h
index 9ef518af5515..000d94b03964 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -365,7 +365,6 @@ int subsys_virtual_register(struct bus_type *subsys,
  * struct class - device classes
  * @name:	Name of the class.
  * @owner:	The module owner.
- * @class_attrs: Default attributes of this class.
  * @class_groups: Default attributes of this class.
  * @dev_groups:	Default attributes of the devices that belong to the class.
  * @dev_kobj:	The kobject that represents this class and links it into the hierarchy.
@@ -394,7 +393,6 @@ struct class {
 	const char		*name;
 	struct module		*owner;
 
-	struct class_attribute		*class_attrs;
 	const struct attribute_group	**class_groups;
 	const struct attribute_group	**dev_groups;
 	struct kobject			*dev_kobj;
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/7] gpio: use class_groups instead of class_attrs
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Robert P. J. Day @ 2017-06-08  8:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Linus Walleij, Alexandre Courbot, linux-gpio

On Thu, 8 Jun 2017, Greg Kroah-Hartman wrote:

> The class_attrs pointer is long depreciated, and is about to be finally
                                  ^^^^^^^^^^^ deprecated

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/7] mtd: use class_groups instead of class_attrs
  2017-06-08  8:12 ` [PATCH 3/7] mtd: use class_groups instead " Greg Kroah-Hartman
@ 2017-06-08 10:23   ` Richard Weinberger
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Weinberger @ 2017-06-08 10:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Artem Bityutskiy, David Woodhouse, Brian Norris, Boris Brezillon,
	Marek Vasut, Cyrille Pitchen, linux-mtd

Am 08.06.2017 um 10:12 schrieb Greg Kroah-Hartman:
> The class_attrs pointer is long depreciated, and is about to be finally
> removed, so move to use the class_groups pointer instead.
> 
> Cc: Artem Bityutskiy <dedekind1@gmail.com>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
> Cc: <linux-mtd@lists.infradead.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/7] gpio: use class_groups instead of class_attrs
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-06-08 12:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Alexandre Courbot, linux-gpio

On Thu, Jun 8, 2017 at 10:12 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:

> The class_attrs pointer is long depreciated, and is about to be finally
> removed, so move to use the class_groups pointer instead.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: <linux-gpio@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Please take this through the driver core tree.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/7] scsi: ibmvscsi_tgt: remove use of class_attrs
  2017-06-08  8:12 ` [PATCH 2/7] scsi: ibmvscsi_tgt: remove use " Greg Kroah-Hartman
@ 2017-06-08 12:31   ` Bryant G. Ly
  0 siblings, 0 replies; 14+ messages in thread
From: Bryant G. Ly @ 2017-06-08 12:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Michael Cyr, James E.J. Bottomley, Martin K. Petersen,
	linux-scsi, target-devel


> The class_attrs pointer is going away and it's not even being used in
> this driver, so just remove it entirely.
>
> Cc: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
> Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: <linux-scsi@vger.kernel.org>
> Cc: <target-devel@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 5 -----
>   1 file changed, 5 deletions(-)
>
> diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
> index d390325c99ec..b480878e3258 100644
> --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
> +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
> @@ -3915,10 +3915,6 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
>
>   static void ibmvscsis_dev_release(struct device *dev) {};
>
> -static struct class_attribute ibmvscsis_class_attrs[] = {
> -	__ATTR_NULL,
> -};
> -
>   static struct device_attribute dev_attr_system_id =
>   	__ATTR(system_id, S_IRUGO, system_id_show, NULL);
>
> @@ -3938,7 +3934,6 @@ ATTRIBUTE_GROUPS(ibmvscsis_dev);
>   static struct class ibmvscsis_class = {
>   	.name		= "ibmvscsis",
>   	.dev_release	= ibmvscsis_dev_release,
> -	.class_attrs	= ibmvscsis_class_attrs,
>   	.dev_groups	= ibmvscsis_dev_groups,
>   };
>
Thanks Greg, ACK.

-Bryant

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/7] pktcdvd: use class_groups instead of class_attrs
  2017-06-08  8:12 ` [PATCH 6/7] pktcdvd: " Greg Kroah-Hartman
@ 2017-06-08 14:05   ` Jens Axboe
  0 siblings, 0 replies; 14+ messages in thread
From: Jens Axboe @ 2017-06-08 14:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: linux-block, Hannes Reinecke, Jan Kara, Mike Christie, Bart Van Assche

On 06/08/2017 02:12 AM, Greg Kroah-Hartman wrote:
> The class_attrs pointer is long depreciated, and is about to be finally
> removed, so move to use the class_groups pointer instead.

Feel free to add my Acked-by to this.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/7] zram: use class_groups instead of class_attrs
  2017-06-08  8:12 ` [PATCH 4/7] zram: " Greg Kroah-Hartman
@ 2017-06-09  5:39   ` Sergey Senozhatsky
  0 siblings, 0 replies; 14+ messages in thread
From: Sergey Senozhatsky @ 2017-06-09  5:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Minchan Kim, Nitin Gupta, Sergey Senozhatsky

On (06/08/17 10:12), Greg Kroah-Hartman wrote:
> 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>

FWIW, looks good to me.

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-06-09  5:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 6/7] pktcdvd: " Greg Kroah-Hartman
2017-06-08 14:05   ` Jens Axboe
2017-06-08  8:12 ` [PATCH 7/7] driver core: remove class_attrs from struct class Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).