All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/36] remove dev_attrs usage in 'struct class'
@ 2013-07-24 22:05 Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 01/36] misc: c2port: use dev_bin_attrs instead of hand-coding it Greg Kroah-Hartman
                   ` (35 more replies)
  0 siblings, 36 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel

Hi all,

Here are a bunch of patches working to convert drivers to use the
dev_groups field in classes instead of using the dev_attrs field, which
will be going away soon, as we really only want to support groups in the
future, not multiple ways of creating default attributes.

They are all CC:ed the various driver authors, and can go in through
their trees, or through mine, which ever is easier.

thanks,

greg k-h


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

* [PATCH 01/36] misc: c2port: use dev_bin_attrs instead of hand-coding it
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 02/36] mips: convert vpe_class to use dev_groups Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rodolfo Giometti

Classes support a list of default binary attributes, so use that in the
c2port driver, instead of hand creating and destroying the file, which
is racing with userspace.  Bonus is this removes lines of code.

Cc: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/c2port/core.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index f32550a7..a3b8370c 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -867,14 +867,17 @@ static struct device_attribute c2port_attrs[] = {
 	__ATTR_NULL,
 };
 
-static struct bin_attribute c2port_bin_attrs = {
-	.attr	= {
-		.name	= "flash_data",
-		.mode	= 0644
+static struct bin_attribute c2port_bin_attrs[] = {
+	{
+		.attr	= {
+			.name	= "flash_data",
+			.mode	= 0644
+		},
+		.read	= c2port_read_flash_data,
+		.write	= c2port_write_flash_data,
+		/* .size is computed at run-time */
 	},
-	.read	= c2port_read_flash_data,
-	.write	= c2port_write_flash_data,
-	/* .size is computed at run-time */
+	__ATTR_NULL
 };
 
 /*
@@ -907,6 +910,8 @@ struct c2port_device *c2port_device_register(char *name,
 		goto error_idr_alloc;
 	c2dev->id = ret;
 
+	c2port_bin_attrs[0].size = ops->blocks_num * ops->block_size;
+
 	c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
 				   "c2port%d", c2dev->id);
 	if (unlikely(IS_ERR(c2dev->dev))) {
@@ -919,12 +924,6 @@ struct c2port_device *c2port_device_register(char *name,
 	c2dev->ops = ops;
 	mutex_init(&c2dev->mutex);
 
-	/* Create binary file */
-	c2port_bin_attrs.size = ops->blocks_num * ops->block_size;
-	ret = device_create_bin_file(c2dev->dev, &c2port_bin_attrs);
-	if (unlikely(ret))
-		goto error_device_create_bin_file;
-
 	/* By default C2 port access is off */
 	c2dev->access = c2dev->flash_access = 0;
 	ops->access(c2dev, 0);
@@ -937,9 +936,6 @@ struct c2port_device *c2port_device_register(char *name,
 
 	return c2dev;
 
-error_device_create_bin_file:
-	device_destroy(c2port_class, 0);
-
 error_device_create:
 	spin_lock_irq(&c2port_idr_lock);
 	idr_remove(&c2port_idr, c2dev->id);
@@ -959,7 +955,6 @@ void c2port_device_unregister(struct c2port_device *c2dev)
 
 	dev_info(c2dev->dev, "C2 port %s removed\n", c2dev->name);
 
-	device_remove_bin_file(c2dev->dev, &c2port_bin_attrs);
 	spin_lock_irq(&c2port_idr_lock);
 	idr_remove(&c2port_idr, c2dev->id);
 	spin_unlock_irq(&c2port_idr_lock);
@@ -985,6 +980,7 @@ static int __init c2port_init(void)
 		return PTR_ERR(c2port_class);
 	}
 	c2port_class->dev_attrs = c2port_attrs;
+	c2port_class->dev_bin_attrs = c2port_bin_attrs;
 
 	return 0;
 }
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 02/36] mips: convert vpe_class to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 01/36] misc: c2port: use dev_bin_attrs instead of hand-coding it Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 03/36] bsr: convert bsr_class " Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Ralf Baechle, John Crispin

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the MIPS vpe_class code to use
the correct field.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: John Crispin <blogic@openwrt.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Ralf, feel free to apply this to your tree, or ACK it and I can take it through
mine.

 arch/mips/kernel/vpe.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 1765bab0..faf84c5f 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1335,8 +1335,9 @@ static ssize_t store_kill(struct device *dev, struct device_attribute *attr,
 
 	return len;
 }
+static DEVICE_ATTR(kill, S_IWUSR, NULL, store_kill);
 
-static ssize_t show_ntcs(struct device *cd, struct device_attribute *attr,
+static ssize_t ntcs_show(struct device *cd, struct device_attribute *attr,
 			 char *buf)
 {
 	struct vpe *vpe = get_vpe(tclimit);
@@ -1344,7 +1345,7 @@ static ssize_t show_ntcs(struct device *cd, struct device_attribute *attr,
 	return sprintf(buf, "%d\n", vpe->ntcs);
 }
 
-static ssize_t store_ntcs(struct device *dev, struct device_attribute *attr,
+static ssize_t ntcs_store(struct device *dev, struct device_attribute *attr,
 			  const char *buf, size_t len)
 {
 	struct vpe *vpe = get_vpe(tclimit);
@@ -1365,12 +1366,14 @@ static ssize_t store_ntcs(struct device *dev, struct device_attribute *attr,
 out_einval:
 	return -EINVAL;
 }
+static DEVICE_ATTR_RW(ntcs);
 
-static struct device_attribute vpe_class_attributes[] = {
-	__ATTR(kill, S_IWUSR, NULL, store_kill),
-	__ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs),
-	{}
+static struct attribute vpe_attrs[] = {
+	&dev_attr_kill.attr,
+	&dev_attr_ntcs.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(vpe);
 
 static void vpe_device_release(struct device *cd)
 {
@@ -1381,7 +1384,7 @@ struct class vpe_class = {
 	.name = "vpe",
 	.owner = THIS_MODULE,
 	.dev_release = vpe_device_release,
-	.dev_attrs = vpe_class_attributes,
+	.dev_groups = vpe_groups,
 };
 
 struct device vpe_device;
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 03/36] bsr: convert bsr_class to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 01/36] misc: c2port: use dev_bin_attrs instead of hand-coding it Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 02/36] mips: convert vpe_class to use dev_groups Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 04/36] tile: srom: convert srom_class " Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Arnd Bergmann

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the bsr bsr_class code to use
the correct field.

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/char/bsr.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 97467053..0671e45d 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -95,6 +95,7 @@ bsr_size_show(struct device *dev, struct device_attribute *attr, char *buf)
 	struct bsr_dev *bsr_dev = dev_get_drvdata(dev);
 	return sprintf(buf, "%u\n", bsr_dev->bsr_bytes);
 }
+static DEVICE_ATTR_RO(bsr_size);
 
 static ssize_t
 bsr_stride_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -102,20 +103,23 @@ bsr_stride_show(struct device *dev, struct device_attribute *attr, char *buf)
 	struct bsr_dev *bsr_dev = dev_get_drvdata(dev);
 	return sprintf(buf, "%u\n", bsr_dev->bsr_stride);
 }
+static DEVICE_ATTR_RO(bsr_stride);
 
 static ssize_t
-bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf)
+bsr_length_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct bsr_dev *bsr_dev = dev_get_drvdata(dev);
 	return sprintf(buf, "%llu\n", bsr_dev->bsr_len);
 }
+static DEVICE_ATTR_RO(bsr_length);
 
-static struct device_attribute bsr_dev_attrs[] = {
-	__ATTR(bsr_size, S_IRUGO, bsr_size_show, NULL),
-	__ATTR(bsr_stride, S_IRUGO, bsr_stride_show, NULL),
-	__ATTR(bsr_length, S_IRUGO, bsr_len_show, NULL),
-	__ATTR_NULL
+static struct attribute *bsr_dev_attrs[] = {
+	&dev_attr_bsr_size.attr,
+	&dev_attr_bsr_stride.attr,
+	&dev_attr_bsr_length.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(bsr_dev);
 
 static int bsr_mmap(struct file *filp, struct vm_area_struct *vma)
 {
@@ -308,7 +312,7 @@ static int __init bsr_init(void)
 		ret = PTR_ERR(bsr_class);
 		goto out_err_1;
 	}
-	bsr_class->dev_attrs = bsr_dev_attrs;
+	bsr_class->dev_groups = bsr_dev_groups;
 
 	ret = alloc_chrdev_region(&bsr_dev, 0, BSR_MAX_DEVS, "bsr");
 	bsr_major = MAJOR(bsr_dev);
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 04/36] tile: srom: convert srom_class to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 03/36] bsr: convert bsr_class " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25 21:11   ` Chris Metcalf
  2013-07-24 22:05 ` [PATCH 05/36] dma: convert dma_devclass " Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Arnd Bergmann

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the tile srom_class code to use
the correct field.

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/char/tile-srom.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
index 7faeb1cd..344e97b9 100644
--- a/drivers/char/tile-srom.c
+++ b/drivers/char/tile-srom.c
@@ -279,33 +279,37 @@ loff_t srom_llseek(struct file *file, loff_t offset, int origin)
 	return fixed_size_llseek(file, offset, origin, srom->total_size);
 }
 
-static ssize_t total_show(struct device *dev,
-			  struct device_attribute *attr, char *buf)
+static ssize_t total_size_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
 {
 	struct srom_dev *srom = dev_get_drvdata(dev);
 	return sprintf(buf, "%u\n", srom->total_size);
 }
+static DEVICE_ATTR_RO(total_size);
 
-static ssize_t sector_show(struct device *dev,
-			   struct device_attribute *attr, char *buf)
+static ssize_t sector_size_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	struct srom_dev *srom = dev_get_drvdata(dev);
 	return sprintf(buf, "%u\n", srom->sector_size);
 }
+static DEVICE_ATTR_RO(sector_size);
 
-static ssize_t page_show(struct device *dev,
-			 struct device_attribute *attr, char *buf)
+static ssize_t page_size_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
 {
 	struct srom_dev *srom = dev_get_drvdata(dev);
 	return sprintf(buf, "%u\n", srom->page_size);
 }
+static DEVICE_ATTR_RO(page_size);
 
-static struct device_attribute srom_dev_attrs[] = {
-	__ATTR(total_size, S_IRUGO, total_show, NULL),
-	__ATTR(sector_size, S_IRUGO, sector_show, NULL),
-	__ATTR(page_size, S_IRUGO, page_show, NULL),
-	__ATTR_NULL
+static struct attribute srom_dev_attrs[] = {
+	&dev_attr_total_size.attr,
+	&dev_attr_sector_size.attr,
+	&dev_attr_page_size.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(srom_dev);
 
 static char *srom_devnode(struct device *dev, umode_t *mode)
 {
@@ -418,7 +422,7 @@ static int srom_init(void)
 		result = PTR_ERR(srom_class);
 		goto fail_cdev;
 	}
-	srom_class->dev_attrs = srom_dev_attrs;
+	srom_class->dev_groups = srom_dev_groups;
 	srom_class->devnode = srom_devnode;
 
 	/* Do per-partition initialization */
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 05/36] dma: convert dma_devclass to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 04/36] tile: srom: convert srom_class " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  8:40   ` Vinod Koul
  2013-07-24 22:05 ` [PATCH 06/36] devfreq: convert devfreq_class " Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Dan Williams, Vinod Koul

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the dma dma_devclass code to use
the correct field.

Cc: Dan Williams <djbw@fb.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Dan and Vinod, feel free to apply this to your trees, or ACK it and I can take
it through mine.

 drivers/dma/dmaengine.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 9e56745f..99af4db5 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -87,7 +87,8 @@ static struct dma_chan *dev_to_dma_chan(struct device *dev)
 	return chan_dev->chan;
 }
 
-static ssize_t show_memcpy_count(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t memcpy_count_show(struct device *dev,
+				 struct device_attribute *attr, char *buf)
 {
 	struct dma_chan *chan;
 	unsigned long count = 0;
@@ -106,9 +107,10 @@ static ssize_t show_memcpy_count(struct device *dev, struct device_attribute *at
 
 	return err;
 }
+static DEVICE_ATTR_RO(memcpy_count);
 
-static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr,
-				      char *buf)
+static ssize_t bytes_transferred_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
 {
 	struct dma_chan *chan;
 	unsigned long count = 0;
@@ -127,8 +129,10 @@ static ssize_t show_bytes_transferred(struct device *dev, struct device_attribut
 
 	return err;
 }
+static DEVICE_ATTR_RO(bytes_transferred);
 
-static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t in_use_show(struct device *dev, struct device_attribute *attr,
+			   char *buf)
 {
 	struct dma_chan *chan;
 	int err;
@@ -143,13 +147,15 @@ static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, ch
 
 	return err;
 }
+static DEVICE_ATTR_RO(in_use);
 
-static struct device_attribute dma_attrs[] = {
-	__ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL),
-	__ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL),
-	__ATTR(in_use, S_IRUGO, show_in_use, NULL),
-	__ATTR_NULL
+static struct attribute *dma_dev_attrs[] = {
+	&dev_attr_memcpy_count.attr,
+	&dev_attr_bytes_transferred.attr,
+	&dev_attr_in_use.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(dma_dev);
 
 static void chan_dev_release(struct device *dev)
 {
@@ -167,7 +173,7 @@ static void chan_dev_release(struct device *dev)
 
 static struct class dma_devclass = {
 	.name		= "dma",
-	.dev_attrs	= dma_attrs,
+	.dev_groups	= dma_dev_groups,
 	.dev_release	= chan_dev_release,
 };
 
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 06/36] devfreq: convert devfreq_class to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 05/36] dma: convert dma_devclass " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 07/36] extcon: convert extcon_class " Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, MyungJoo Ham, Kyungmin Park

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the devfreq_class code to use the
correct field.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

MyungJoo, feel free to apply this to your tree, or ACK it and I can take it
through mine.

drivers/devfreq/devfreq.c | 78 ++++++++++++++++++++++++++---------------------
 1 file changed, 44 insertions(+), 34 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index e94e619f..c99c00d3 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -703,7 +703,7 @@ err_out:
 }
 EXPORT_SYMBOL(devfreq_remove_governor);
 
-static ssize_t show_governor(struct device *dev,
+static ssize_t governor_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
 {
 	if (!to_devfreq(dev)->governor)
@@ -712,7 +712,7 @@ static ssize_t show_governor(struct device *dev,
 	return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name);
 }
 
-static ssize_t store_governor(struct device *dev, struct device_attribute *attr,
+static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
 			      const char *buf, size_t count)
 {
 	struct devfreq *df = to_devfreq(dev);
@@ -754,9 +754,11 @@ out:
 		ret = count;
 	return ret;
 }
-static ssize_t show_available_governors(struct device *d,
-				    struct device_attribute *attr,
-				    char *buf)
+static DEVICE_ATTR_RW(governor);
+
+static ssize_t available_governors_show(struct device *d,
+					struct device_attribute *attr,
+					char *buf)
 {
 	struct devfreq_governor *tmp_governor;
 	ssize_t count = 0;
@@ -775,9 +777,10 @@ static ssize_t show_available_governors(struct device *d,
 
 	return count;
 }
+static DEVICE_ATTR_RO(available_governors);
 
-static ssize_t show_freq(struct device *dev,
-			 struct device_attribute *attr, char *buf)
+static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
 {
 	unsigned long freq;
 	struct devfreq *devfreq = to_devfreq(dev);
@@ -788,20 +791,22 @@ static ssize_t show_freq(struct device *dev,
 
 	return sprintf(buf, "%lu\n", devfreq->previous_freq);
 }
+static DEVICE_ATTR_RO(cur_freq);
 
-static ssize_t show_target_freq(struct device *dev,
-			struct device_attribute *attr, char *buf)
+static ssize_t target_freq_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq);
 }
+static DEVICE_ATTR_RO(target_freq);
 
-static ssize_t show_polling_interval(struct device *dev,
+static ssize_t polling_interval_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%d\n", to_devfreq(dev)->profile->polling_ms);
 }
 
-static ssize_t store_polling_interval(struct device *dev,
+static ssize_t polling_interval_store(struct device *dev,
 				      struct device_attribute *attr,
 				      const char *buf, size_t count)
 {
@@ -821,8 +826,9 @@ static ssize_t store_polling_interval(struct device *dev,
 
 	return ret;
 }
+static DEVICE_ATTR_RW(polling_interval);
 
-static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr,
+static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr,
 			      const char *buf, size_t count)
 {
 	struct devfreq *df = to_devfreq(dev);
@@ -849,13 +855,13 @@ unlock:
 	return ret;
 }
 
-static ssize_t show_min_freq(struct device *dev, struct device_attribute *attr,
+static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
 {
 	return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq);
 }
 
-static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr,
+static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
 			      const char *buf, size_t count)
 {
 	struct devfreq *df = to_devfreq(dev);
@@ -881,16 +887,18 @@ unlock:
 	mutex_unlock(&df->lock);
 	return ret;
 }
+static DEVICE_ATTR_RW(min_freq);
 
-static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr,
+static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
 {
 	return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq);
 }
+static DEVICE_ATTR_RW(max_freq);
 
-static ssize_t show_available_freqs(struct device *d,
-				    struct device_attribute *attr,
-				    char *buf)
+static ssize_t available_frequencies_show(struct device *d,
+					  struct device_attribute *attr,
+					  char *buf)
 {
 	struct devfreq *df = to_devfreq(d);
 	struct device *dev = df->dev.parent;
@@ -918,9 +926,10 @@ static ssize_t show_available_freqs(struct device *d,
 
 	return count;
 }
+static DEVICE_ATTR_RO(available_frequencies);
 
-static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr,
-				char *buf)
+static ssize_t trans_stat_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
 {
 	struct devfreq *devfreq = to_devfreq(dev);
 	ssize_t len;
@@ -959,20 +968,21 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att
 					devfreq->total_trans);
 	return len;
 }
-
-static struct device_attribute devfreq_attrs[] = {
-	__ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor),
-	__ATTR(available_governors, S_IRUGO, show_available_governors, NULL),
-	__ATTR(cur_freq, S_IRUGO, show_freq, NULL),
-	__ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL),
-	__ATTR(target_freq, S_IRUGO, show_target_freq, NULL),
-	__ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval,
-	       store_polling_interval),
-	__ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq),
-	__ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq),
-	__ATTR(trans_stat, S_IRUGO, show_trans_table, NULL),
-	{ },
+static DEVICE_ATTR_RO(trans_stat);
+
+static struct attribute *devfreq_attrs[] = {
+	&dev_attr_governor.attr,
+	&dev_attr_available_governors.attr,
+	&dev_attr_cur_freq.attr,
+	&dev_attr_available_frequencies.attr,
+	&dev_attr_target_freq.attr,
+	&dev_attr_polling_interval.attr,
+	&dev_attr_min_freq.attr,
+	&dev_attr_max_freq.attr,
+	&dev_attr_trans_stat.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(devfreq);
 
 static int __init devfreq_init(void)
 {
@@ -988,7 +998,7 @@ static int __init devfreq_init(void)
 		pr_err("%s: couldn't create workqueue\n", __FILE__);
 		return PTR_ERR(devfreq_wq);
 	}
-	devfreq_class->dev_attrs = devfreq_attrs;
+	devfreq_class->dev_groups = devfreq_groups;
 
 	return 0;
 }
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 07/36] extcon: convert extcon_class to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 06/36] devfreq: convert devfreq_class " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 23:53   ` Chanwoo Choi
  2013-07-24 22:05 ` [PATCH 08/36] HID: roccat: convert class code " Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, MyungJoo Ham, Chanwoo Choi

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the extcon_class code to use the
correct field.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
MyungJoo, feel free to apply this to your tree, or ACK it and I can take it
through mine.

 drivers/extcon/extcon-class.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 18ccadef..022ca369 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -148,6 +148,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
+static DEVICE_ATTR_RW(state);
 
 static ssize_t name_show(struct device *dev, struct device_attribute *attr,
 		char *buf)
@@ -163,6 +164,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
 
 	return sprintf(buf, "%s\n", dev_name(edev->dev));
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t cable_name_show(struct device *dev,
 			       struct device_attribute *attr, char *buf)
@@ -527,11 +529,12 @@ int extcon_unregister_notifier(struct extcon_dev *edev,
 }
 EXPORT_SYMBOL_GPL(extcon_unregister_notifier);
 
-static struct device_attribute extcon_attrs[] = {
-	__ATTR(state, S_IRUGO | S_IWUSR, state_show, state_store),
-	__ATTR_RO(name),
-	__ATTR_NULL,
+static struct attribute *extcon_attrs[] = {
+	&dev_attr_state.attr,
+	&dev_attr_name.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(extcon);
 
 static int create_extcon_class(void)
 {
@@ -539,7 +542,7 @@ static int create_extcon_class(void)
 		extcon_class = class_create(THIS_MODULE, "extcon");
 		if (IS_ERR(extcon_class))
 			return PTR_ERR(extcon_class);
-		extcon_class->dev_attrs = extcon_attrs;
+		extcon_class->dev_groups = extcon_groups;
 
 #if defined(CONFIG_ANDROID)
 		switch_class = class_compat_register("switch");
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 08/36] HID: roccat: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 07/36] extcon: convert extcon_class " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 09/36] ISDN: " Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Jiri Kosina

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the roccat class code to use the
correct field.

Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Jiri, feel free to apply this to your tree, or ACK it and I can take it
through mine.

 drivers/hid/hid-roccat-arvo.c     | 25 ++++++++++++++-----------
 drivers/hid/hid-roccat-isku.c     | 13 +++++++------
 drivers/hid/hid-roccat-kone.c     | 30 ++++++++++++++++++------------
 drivers/hid/hid-roccat-koneplus.c | 28 ++++++++++++++++------------
 drivers/hid/hid-roccat-kovaplus.c | 33 +++++++++++++++++++--------------
 drivers/hid/hid-roccat-pyra.c     | 24 ++++++++++++++----------
 6 files changed, 88 insertions(+), 65 deletions(-)

diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c
index 327f9b8e..98bb89e0 100644
--- a/drivers/hid/hid-roccat-arvo.c
+++ b/drivers/hid/hid-roccat-arvo.c
@@ -75,6 +75,8 @@ static ssize_t arvo_sysfs_set_mode_key(struct device *dev,
 
 	return size;
 }
+static DEVICE_ATTR(mode_key, 0660,
+		   arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key);
 
 static ssize_t arvo_sysfs_show_key_mask(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -123,6 +125,8 @@ static ssize_t arvo_sysfs_set_key_mask(struct device *dev,
 
 	return size;
 }
+static DEVICE_ATTR(key_mask, 0660,
+		   arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask);
 
 /* retval is 1-5 on success, < 0 on error */
 static int arvo_get_actual_profile(struct usb_device *usb_dev)
@@ -179,6 +183,9 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev,
 	mutex_unlock(&arvo->arvo_lock);
 	return retval;
 }
+static DEVICE_ATTR(actual_profile, 0660,
+		   arvo_sysfs_show_actual_profile,
+		   arvo_sysfs_set_actual_profile);
 
 static ssize_t arvo_sysfs_write(struct file *fp,
 		struct kobject *kobj, void const *buf,
@@ -239,17 +246,13 @@ static ssize_t arvo_sysfs_read_info(struct file *fp,
 			sizeof(struct arvo_info), ARVO_COMMAND_INFO);
 }
 
-
-static struct device_attribute arvo_attributes[] = {
-	__ATTR(mode_key, 0660,
-			arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key),
-	__ATTR(key_mask, 0660,
-			arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask),
-	__ATTR(actual_profile, 0660,
-			arvo_sysfs_show_actual_profile,
-			arvo_sysfs_set_actual_profile),
-	__ATTR_NULL
+static struct attribute *arvo_attrs[] = {
+	&dev_attr_mode_key.attr,
+	&dev_attr_key_mask.attr,
+	&dev_attr_actual_profile.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(arvo);
 
 static struct bin_attribute arvo_bin_attributes[] = {
 	{
@@ -430,7 +433,7 @@ static int __init arvo_init(void)
 	arvo_class = class_create(THIS_MODULE, "arvo");
 	if (IS_ERR(arvo_class))
 		return PTR_ERR(arvo_class);
-	arvo_class->dev_attrs = arvo_attributes;
+	arvo_class->dev_groups = arvo_groups;
 	arvo_class->dev_bin_attrs = arvo_bin_attributes;
 
 	retval = hid_register_driver(&arvo_driver);
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c
index 8023751d..3983dec0 100644
--- a/drivers/hid/hid-roccat-isku.c
+++ b/drivers/hid/hid-roccat-isku.c
@@ -109,13 +109,14 @@ static ssize_t isku_sysfs_set_actual_profile(struct device *dev,
 
 	return size;
 }
+static DEVICE_ATTR(actual_profile, 0660, isku_sysfs_show_actual_profile,
+		   isku_sysfs_set_actual_profile);
 
-static struct device_attribute isku_attributes[] = {
-	__ATTR(actual_profile, 0660,
-			isku_sysfs_show_actual_profile,
-			isku_sysfs_set_actual_profile),
-	__ATTR_NULL
+static struct attribute *isku_attrs[] = {
+	&dev_attr_actual_profile.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(isku);
 
 static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj,
 		char *buf, loff_t off, size_t count,
@@ -427,7 +428,7 @@ static int __init isku_init(void)
 	isku_class = class_create(THIS_MODULE, "isku");
 	if (IS_ERR(isku_class))
 		return PTR_ERR(isku_class);
-	isku_class->dev_attrs = isku_attributes;
+	isku_class->dev_groups = isku_groups;
 	isku_class->dev_bin_attrs = isku_bin_attributes;
 
 	retval = hid_register_driver(&isku_driver);
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index 7fae0707..d3626733 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -386,6 +386,7 @@ static ssize_t kone_sysfs_show_actual_profile(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile);
 }
+static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL);
 
 static ssize_t kone_sysfs_show_actual_dpi(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -394,6 +395,7 @@ static ssize_t kone_sysfs_show_actual_dpi(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi);
 }
+static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL);
 
 /* weight is read each time, since we don't get informed when it's changed */
 static ssize_t kone_sysfs_show_weight(struct device *dev,
@@ -416,6 +418,7 @@ static ssize_t kone_sysfs_show_weight(struct device *dev,
 		return retval;
 	return snprintf(buf, PAGE_SIZE, "%d\n", weight);
 }
+static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL);
 
 static ssize_t kone_sysfs_show_firmware_version(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -424,6 +427,8 @@ static ssize_t kone_sysfs_show_firmware_version(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version);
 }
+static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version,
+		   NULL);
 
 static ssize_t kone_sysfs_show_tcu(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -524,6 +529,7 @@ exit_unlock:
 	mutex_unlock(&kone->kone_lock);
 	return retval;
 }
+static DEVICE_ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu);
 
 static ssize_t kone_sysfs_show_startup_profile(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -570,15 +576,17 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
 	mutex_unlock(&kone->kone_lock);
 	return size;
 }
+static DEVICE_ATTR(startup_profile, 0660, kone_sysfs_show_startup_profile,
+		   kone_sysfs_set_startup_profile);
 
-static struct device_attribute kone_attributes[] = {
+static struct attribute *kone_attrs[] = {
 	/*
 	 * Read actual dpi settings.
 	 * Returns raw value for further processing. Refer to enum
 	 * kone_polling_rates to get real value.
 	 */
-	__ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL),
-	__ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL),
+	&dev_attr_actual_dpi.attr,
+	&dev_attr_actual_profile.attr,
 
 	/*
 	 * The mouse can be equipped with one of four supplied weights from 5
@@ -587,7 +595,7 @@ static struct device_attribute kone_attributes[] = {
 	 * by software. Refer to enum kone_weights to get corresponding real
 	 * weight.
 	 */
-	__ATTR(weight, 0440, kone_sysfs_show_weight, NULL),
+	&dev_attr_weight.attr,
 
 	/*
 	 * Prints firmware version stored in mouse as integer.
@@ -595,22 +603,20 @@ static struct device_attribute kone_attributes[] = {
 	 * to get the real version number the decimal point has to be shifted 2
 	 * positions to the left. E.g. a value of 138 means 1.38.
 	 */
-	__ATTR(firmware_version, 0440,
-			kone_sysfs_show_firmware_version, NULL),
+	&dev_attr_firmware_version.attr,
 
 	/*
 	 * Prints state of Tracking Control Unit as number where 0 = off and
 	 * 1 = on. Writing 0 deactivates tcu and writing 1 calibrates and
 	 * activates the tcu
 	 */
-	__ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu),
+	&dev_attr_tcu.attr,
 
 	/* Prints and takes the number of the profile the mouse starts with */
-	__ATTR(startup_profile, 0660,
-			kone_sysfs_show_startup_profile,
-			kone_sysfs_set_startup_profile),
-	__ATTR_NULL
+	&dev_attr_startup_profile.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(kone);
 
 static struct bin_attribute kone_bin_attributes[] = {
 	{
@@ -891,7 +897,7 @@ static int __init kone_init(void)
 	kone_class = class_create(THIS_MODULE, "kone");
 	if (IS_ERR(kone_class))
 		return PTR_ERR(kone_class);
-	kone_class->dev_attrs = kone_attributes;
+	kone_class->dev_groups = kone_groups;
 	kone_class->dev_bin_attrs = kone_bin_attributes;
 
 	retval = hid_register_driver(&kone_driver);
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 6a48fa3c..11906b4b 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -274,6 +274,12 @@ static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev,
 
 	return size;
 }
+static DEVICE_ATTR(actual_profile, 0660,
+		   koneplus_sysfs_show_actual_profile,
+		   koneplus_sysfs_set_actual_profile);
+static DEVICE_ATTR(startup_profile, 0660,
+		   koneplus_sysfs_show_actual_profile,
+		   koneplus_sysfs_set_actual_profile);
 
 static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -293,18 +299,16 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
 }
-
-static struct device_attribute koneplus_attributes[] = {
-	__ATTR(actual_profile, 0660,
-			koneplus_sysfs_show_actual_profile,
-			koneplus_sysfs_set_actual_profile),
-	__ATTR(startup_profile, 0660,
-			koneplus_sysfs_show_actual_profile,
-			koneplus_sysfs_set_actual_profile),
-	__ATTR(firmware_version, 0440,
-			koneplus_sysfs_show_firmware_version, NULL),
-	__ATTR_NULL
+static DEVICE_ATTR(firmware_version, 0440,
+		   koneplus_sysfs_show_firmware_version, NULL);
+
+static struct attribute *koneplus_attrs[] = {
+	&dev_attr_actual_profile.attr,
+	&dev_attr_startup_profile.attr,
+	&dev_attr_firmware_version.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(koneplus);
 
 static struct bin_attribute koneplus_bin_attributes[] = {
 	KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL),
@@ -572,7 +576,7 @@ static int __init koneplus_init(void)
 	koneplus_class = class_create(THIS_MODULE, "koneplus");
 	if (IS_ERR(koneplus_class))
 		return PTR_ERR(koneplus_class);
-	koneplus_class->dev_attrs = koneplus_attributes;
+	koneplus_class->dev_groups = koneplus_groups;
 	koneplus_class->dev_bin_attrs = koneplus_bin_attributes;
 
 	retval = hid_register_driver(&koneplus_driver);
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
index b8b37789..ae630221 100644
--- a/drivers/hid/hid-roccat-kovaplus.c
+++ b/drivers/hid/hid-roccat-kovaplus.c
@@ -310,6 +310,9 @@ static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev,
 
 	return size;
 }
+static DEVICE_ATTR(actual_profile, 0660,
+		   kovaplus_sysfs_show_actual_profile,
+		   kovaplus_sysfs_set_actual_profile);
 
 static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -318,6 +321,7 @@ static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
 }
+static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL);
 
 static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -326,6 +330,8 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
 }
+static DEVICE_ATTR(actual_sensitivity_x, 0440,
+		   kovaplus_sysfs_show_actual_sensitivity_x, NULL);
 
 static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -334,6 +340,8 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
 }
+static DEVICE_ATTR(actual_sensitivity_y, 0440,
+		   kovaplus_sysfs_show_actual_sensitivity_y, NULL);
 
 static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -353,21 +361,18 @@ static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
 }
+static DEVICE_ATTR(firmware_version, 0440,
+		   kovaplus_sysfs_show_firmware_version, NULL);
 
-static struct device_attribute kovaplus_attributes[] = {
-	__ATTR(actual_cpi, 0440,
-		kovaplus_sysfs_show_actual_cpi, NULL),
-	__ATTR(firmware_version, 0440,
-		kovaplus_sysfs_show_firmware_version, NULL),
-	__ATTR(actual_profile, 0660,
-		kovaplus_sysfs_show_actual_profile,
-		kovaplus_sysfs_set_actual_profile),
-	__ATTR(actual_sensitivity_x, 0440,
-		kovaplus_sysfs_show_actual_sensitivity_x, NULL),
-	__ATTR(actual_sensitivity_y, 0440,
-		kovaplus_sysfs_show_actual_sensitivity_y, NULL),
-	__ATTR_NULL
+static struct attribute *kovaplus_attrs[] = {
+	&dev_attr_actual_cpi.attr,
+	&dev_attr_firmware_version.attr,
+	&dev_attr_actual_profile.attr,
+	&dev_attr_actual_sensitivity_x.attr,
+	&dev_attr_actual_sensitivity_y.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(kovaplus);
 
 static struct bin_attribute kovaplus_bin_attributes[] = {
 	KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL),
@@ -662,7 +667,7 @@ static int __init kovaplus_init(void)
 	kovaplus_class = class_create(THIS_MODULE, "kovaplus");
 	if (IS_ERR(kovaplus_class))
 		return PTR_ERR(kovaplus_class);
-	kovaplus_class->dev_attrs = kovaplus_attributes;
+	kovaplus_class->dev_groups = kovaplus_groups;
 	kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes;
 
 	retval = hid_register_driver(&kovaplus_driver);
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index d4f1e3be..7960d507 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -266,6 +266,7 @@ static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev,
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 	return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi);
 }
+static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL);
 
 static ssize_t pyra_sysfs_show_actual_profile(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -282,6 +283,8 @@ static ssize_t pyra_sysfs_show_actual_profile(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile);
 }
+static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
+static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
 
 static ssize_t pyra_sysfs_show_firmware_version(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -301,16 +304,17 @@ static ssize_t pyra_sysfs_show_firmware_version(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
 }
-
-static struct device_attribute pyra_attributes[] = {
-	__ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL),
-	__ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL),
-	__ATTR(firmware_version, 0440,
-			pyra_sysfs_show_firmware_version, NULL),
-	__ATTR(startup_profile, 0440,
-			pyra_sysfs_show_actual_profile, NULL),
-	__ATTR_NULL
+static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version,
+		   NULL);
+
+static struct attribute *pyra_attrs[] = {
+	&dev_attr_actual_cpi.attr,
+	&dev_attr_actual_profile.attr,
+	&dev_attr_firmware_version.attr,
+	&dev_attr_startup_profile.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(pyra);
 
 static struct bin_attribute pyra_bin_attributes[] = {
 	PYRA_BIN_ATTRIBUTE_W(control, CONTROL),
@@ -600,7 +604,7 @@ static int __init pyra_init(void)
 	pyra_class = class_create(THIS_MODULE, "pyra");
 	if (IS_ERR(pyra_class))
 		return PTR_ERR(pyra_class);
-	pyra_class->dev_attrs = pyra_attributes;
+	pyra_class->dev_groups = pyra_groups;
 	pyra_class->dev_bin_attrs = pyra_bin_attributes;
 
 	retval = hid_register_driver(&pyra_driver);
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 09/36] ISDN: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 08/36] HID: roccat: convert class code " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26  9:38   ` Karsten Keil
  2013-07-24 22:05 ` [PATCH 10/36] leds: " Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Karsten Keil

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the mISDN class code to use the
correct field.

Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Karsten, feel free to apply this to your tree, or ACK it and I can take it
through mine.

 drivers/isdn/mISDN/core.c | 64 ++++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 28 deletions(-)

diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
index da30c5cb..faf50546 100644
--- a/drivers/isdn/mISDN/core.c
+++ b/drivers/isdn/mISDN/core.c
@@ -37,8 +37,8 @@ static void mISDN_dev_release(struct device *dev)
 	/* nothing to do: the device is part of its parent's data structure */
 }
 
-static ssize_t _show_id(struct device *dev,
-			struct device_attribute *attr, char *buf)
+static ssize_t id_show(struct device *dev,
+		       struct device_attribute *attr, char *buf)
 {
 	struct mISDNdevice *mdev = dev_to_mISDN(dev);
 
@@ -46,9 +46,10 @@ static ssize_t _show_id(struct device *dev,
 		return -ENODEV;
 	return sprintf(buf, "%d\n", mdev->id);
 }
+static DEVICE_ATTR_RO(id);
 
-static ssize_t _show_nrbchan(struct device *dev,
-			     struct device_attribute *attr, char *buf)
+static ssize_t nrbchan_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct mISDNdevice *mdev = dev_to_mISDN(dev);
 
@@ -56,9 +57,10 @@ static ssize_t _show_nrbchan(struct device *dev,
 		return -ENODEV;
 	return sprintf(buf, "%d\n", mdev->nrbchan);
 }
+static DEVICE_ATTR_RO(nrbchan);
 
-static ssize_t _show_d_protocols(struct device *dev,
-				 struct device_attribute *attr, char *buf)
+static ssize_t d_protocols_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	struct mISDNdevice *mdev = dev_to_mISDN(dev);
 
@@ -66,9 +68,10 @@ static ssize_t _show_d_protocols(struct device *dev,
 		return -ENODEV;
 	return sprintf(buf, "%d\n", mdev->Dprotocols);
 }
+static DEVICE_ATTR_RO(d_protocols);
 
-static ssize_t _show_b_protocols(struct device *dev,
-				 struct device_attribute *attr, char *buf)
+static ssize_t b_protocols_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	struct mISDNdevice *mdev = dev_to_mISDN(dev);
 
@@ -76,9 +79,10 @@ static ssize_t _show_b_protocols(struct device *dev,
 		return -ENODEV;
 	return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols());
 }
+static DEVICE_ATTR_RO(b_protocols);
 
-static ssize_t _show_protocol(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+static ssize_t protocol_show(struct device *dev,
+			     struct device_attribute *attr, char *buf)
 {
 	struct mISDNdevice *mdev = dev_to_mISDN(dev);
 
@@ -86,17 +90,19 @@ static ssize_t _show_protocol(struct device *dev,
 		return -ENODEV;
 	return sprintf(buf, "%d\n", mdev->D.protocol);
 }
+static DEVICE_ATTR_RO(protocol);
 
-static ssize_t _show_name(struct device *dev,
-			  struct device_attribute *attr, char *buf)
+static ssize_t name_show(struct device *dev,
+			 struct device_attribute *attr, char *buf)
 {
 	strcpy(buf, dev_name(dev));
 	return strlen(buf);
 }
+static DEVICE_ATTR_RO(name);
 
 #if 0 /* hangs */
-static ssize_t _set_name(struct device *dev, struct device_attribute *attr,
-			 const char *buf, size_t count)
+static ssize_t name_set(struct device *dev, struct device_attribute *attr,
+			const char *buf, size_t count)
 {
 	int err = 0;
 	char *out = kmalloc(count + 1, GFP_KERNEL);
@@ -113,10 +119,11 @@ static ssize_t _set_name(struct device *dev, struct device_attribute *attr,
 
 	return (err < 0) ? err : count;
 }
+static DEVICE_ATTR_RW(name);
 #endif
 
-static ssize_t _show_channelmap(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t channelmap_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
 {
 	struct mISDNdevice *mdev = dev_to_mISDN(dev);
 	char *bp = buf;
@@ -127,18 +134,19 @@ static ssize_t _show_channelmap(struct device *dev,
 
 	return bp - buf;
 }
-
-static struct device_attribute mISDN_dev_attrs[] = {
-	__ATTR(id,          S_IRUGO,         _show_id,          NULL),
-	__ATTR(d_protocols, S_IRUGO,         _show_d_protocols, NULL),
-	__ATTR(b_protocols, S_IRUGO,         _show_b_protocols, NULL),
-	__ATTR(protocol,    S_IRUGO,         _show_protocol,    NULL),
-	__ATTR(channelmap,  S_IRUGO,         _show_channelmap,  NULL),
-	__ATTR(nrbchan,     S_IRUGO,         _show_nrbchan,     NULL),
-	__ATTR(name,        S_IRUGO,         _show_name,        NULL),
-/*	__ATTR(name,        S_IRUGO | S_IWUSR, _show_name,      _set_name), */
-	{}
+static DEVICE_ATTR_RO(channelmap);
+
+static struct attribute *mISDN_attrs[] = {
+	&dev_attr_id.attr,
+	&dev_attr_d_protocols.attr,
+	&dev_attr_b_protocols.attr,
+	&dev_attr_protocol.attr,
+	&dev_attr_channelmap.attr,
+	&dev_attr_nrbchan.attr,
+	&dev_attr_name.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(mISDN);
 
 static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
@@ -162,7 +170,7 @@ static struct class mISDN_class = {
 	.name = "mISDN",
 	.owner = THIS_MODULE,
 	.dev_uevent = mISDN_uevent,
-	.dev_attrs = mISDN_dev_attrs,
+	.dev_groups = mISDN_groups,
 	.dev_release = mISDN_dev_release,
 	.class_release = mISDN_class_release,
 };
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 10/36] leds: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 09/36] ISDN: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26 19:18   ` Bryan Wu
  2013-07-24 22:05 ` [PATCH 11/36] v4l2: " Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bryan Wu, Richard Purdie

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the led class code to use the
correct field.

Cc: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Bryan and Richard, feel free to take this through your tree, or ACK it and I
can take it through mine.

 drivers/leds/led-class.c | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 4336e37a..f37d63cf 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -29,7 +29,7 @@ static void led_update_brightness(struct led_classdev *led_cdev)
 		led_cdev->brightness = led_cdev->brightness_get(led_cdev);
 }
 
-static ssize_t led_brightness_show(struct device *dev,
+static ssize_t brightness_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct led_classdev *led_cdev = dev_get_drvdata(dev);
@@ -40,7 +40,7 @@ static ssize_t led_brightness_show(struct device *dev,
 	return sprintf(buf, "%u\n", led_cdev->brightness);
 }
 
-static ssize_t led_brightness_store(struct device *dev,
+static ssize_t brightness_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t size)
 {
 	struct led_classdev *led_cdev = dev_get_drvdata(dev);
@@ -57,6 +57,7 @@ static ssize_t led_brightness_store(struct device *dev,
 
 	return size;
 }
+static DEVICE_ATTR_RW(brightness);
 
 static ssize_t led_max_brightness_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -65,14 +66,35 @@ static ssize_t led_max_brightness_show(struct device *dev,
 
 	return sprintf(buf, "%u\n", led_cdev->max_brightness);
 }
+static DEVICE_ATTR(max_brightness, 0444, led_max_brightness_show, NULL);
 
-static struct device_attribute led_class_attrs[] = {
-	__ATTR(brightness, 0644, led_brightness_show, led_brightness_store),
-	__ATTR(max_brightness, 0444, led_max_brightness_show, NULL),
 #ifdef CONFIG_LEDS_TRIGGERS
-	__ATTR(trigger, 0644, led_trigger_show, led_trigger_store),
+static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store);
+static struct attribute *led_trigger_attrs[] = {
+	&dev_attr_trigger.attr,
+	NULL,
+};
+static const struct attribute_group led_trigger_group = {
+	.attrs = led_trigger_attrs,
+};
+#endif
+
+static struct attribute *led_class_attrs[] = {
+	&dev_attr_brightness.attr,
+	&dev_attr_max_brightness.attr,
+	NULL,
+};
+
+static const struct attribute_group led_group = {
+	.attrs = led_class_attrs,
+};
+
+static const struct attribute_group *led_groups[] = {
+	&led_group,
+#ifdef CONFIG_LEDS_TRIGGERS
+	&led_trigger_group,
 #endif
-	__ATTR_NULL,
+	NULL,
 };
 
 static void led_timer_function(unsigned long data)
@@ -258,7 +280,7 @@ static int __init leds_init(void)
 	if (IS_ERR(leds_class))
 		return PTR_ERR(leds_class);
 	leds_class->pm = &leds_class_dev_pm_ops;
-	leds_class->dev_attrs = led_class_attrs;
+	leds_class->dev_groups = led_groups;
 	return 0;
 }
 
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 11/36] v4l2: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 10/36] leds: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 12/36] c2port: " Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Mauro Carvalho Chehab, Hans Verkuil

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the v4l2 class code to use the
correct field.

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Mauro, feel free to take this through your tree, or ACK it and I can take it
through mine.

 drivers/media/v4l2-core/v4l2-dev.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index c8859d6f..b0f49b01 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -38,24 +38,25 @@
  *	sysfs stuff
  */
 
-static ssize_t show_index(struct device *cd,
-			 struct device_attribute *attr, char *buf)
+static ssize_t index_show(struct device *cd,
+			  struct device_attribute *attr, char *buf)
 {
 	struct video_device *vdev = to_video_device(cd);
 
 	return sprintf(buf, "%i\n", vdev->index);
 }
+static DEVICE_ATTR_RO(index);
 
-static ssize_t show_debug(struct device *cd,
-			 struct device_attribute *attr, char *buf)
+static ssize_t debug_show(struct device *cd,
+			  struct device_attribute *attr, char *buf)
 {
 	struct video_device *vdev = to_video_device(cd);
 
 	return sprintf(buf, "%i\n", vdev->debug);
 }
 
-static ssize_t set_debug(struct device *cd, struct device_attribute *attr,
-		   const char *buf, size_t len)
+static ssize_t debug_store(struct device *cd, struct device_attribute *attr,
+			  const char *buf, size_t len)
 {
 	struct video_device *vdev = to_video_device(cd);
 	int res = 0;
@@ -68,21 +69,24 @@ static ssize_t set_debug(struct device *cd, struct device_attribute *attr,
 	vdev->debug = value;
 	return len;
 }
+static DEVICE_ATTR_RW(debug);
 
-static ssize_t show_name(struct device *cd,
+static ssize_t name_show(struct device *cd,
 			 struct device_attribute *attr, char *buf)
 {
 	struct video_device *vdev = to_video_device(cd);
 
 	return sprintf(buf, "%.*s\n", (int)sizeof(vdev->name), vdev->name);
 }
+static DEVICE_ATTR_RO(name);
 
-static struct device_attribute video_device_attrs[] = {
-	__ATTR(name, S_IRUGO, show_name, NULL),
-	__ATTR(debug, 0644, show_debug, set_debug),
-	__ATTR(index, S_IRUGO, show_index, NULL),
-	__ATTR_NULL
+static struct attribute *video_device_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_debug.attr,
+	&dev_attr_index.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(video_device);
 
 /*
  *	Active devices
@@ -217,7 +221,7 @@ static void v4l2_device_release(struct device *cd)
 
 static struct class video_class = {
 	.name = VIDEO_NAME,
-	.dev_attrs = video_device_attrs,
+	.dev_groups = video_device_groups,
 };
 
 struct video_device *video_devdata(struct file *file)
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 12/36] c2port: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 11/36] v4l2: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 13/36] enclosure: " Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rodolfo Giometti

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the c2port class code to use the
correct field.

Cc: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/c2port/core.c | 50 +++++++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index a3b8370c..abe6e251 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -311,6 +311,7 @@ static ssize_t c2port_show_name(struct device *dev,
 
 	return sprintf(buf, "%s\n", c2dev->name);
 }
+static DEVICE_ATTR(name, 0444, c2port_show_name, NULL);
 
 static ssize_t c2port_show_flash_blocks_num(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -320,6 +321,7 @@ static ssize_t c2port_show_flash_blocks_num(struct device *dev,
 
 	return sprintf(buf, "%d\n", ops->blocks_num);
 }
+static DEVICE_ATTR(flash_blocks_num, 0444, c2port_show_flash_blocks_num, NULL);
 
 static ssize_t c2port_show_flash_block_size(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -329,6 +331,7 @@ static ssize_t c2port_show_flash_block_size(struct device *dev,
 
 	return sprintf(buf, "%d\n", ops->block_size);
 }
+static DEVICE_ATTR(flash_block_size, 0444, c2port_show_flash_block_size, NULL);
 
 static ssize_t c2port_show_flash_size(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -338,18 +341,18 @@ static ssize_t c2port_show_flash_size(struct device *dev,
 
 	return sprintf(buf, "%d\n", ops->blocks_num * ops->block_size);
 }
+static DEVICE_ATTR(flash_size, 0444, c2port_show_flash_size, NULL);
 
-static ssize_t c2port_show_access(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t access_show(struct device *dev, struct device_attribute *attr,
+			   char *buf)
 {
 	struct c2port_device *c2dev = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%d\n", c2dev->access);
 }
 
-static ssize_t c2port_store_access(struct device *dev,
-				struct device_attribute *attr,
-				const char *buf, size_t count)
+static ssize_t access_store(struct device *dev, struct device_attribute *attr,
+			    const char *buf, size_t count)
 {
 	struct c2port_device *c2dev = dev_get_drvdata(dev);
 	struct c2port_ops *ops = c2dev->ops;
@@ -375,6 +378,7 @@ static ssize_t c2port_store_access(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR_RW(access);
 
 static ssize_t c2port_store_reset(struct device *dev,
 				struct device_attribute *attr,
@@ -395,6 +399,7 @@ static ssize_t c2port_store_reset(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR(reset, 0200, NULL, c2port_store_reset);
 
 static ssize_t __c2port_show_dev_id(struct c2port_device *dev, char *buf)
 {
@@ -431,6 +436,7 @@ static ssize_t c2port_show_dev_id(struct device *dev,
 
 	return ret;
 }
+static DEVICE_ATTR(dev_id, 0444, c2port_show_dev_id, NULL);
 
 static ssize_t __c2port_show_rev_id(struct c2port_device *dev, char *buf)
 {
@@ -467,6 +473,7 @@ static ssize_t c2port_show_rev_id(struct device *dev,
 
 	return ret;
 }
+static DEVICE_ATTR(rev_id, 0444, c2port_show_rev_id, NULL);
 
 static ssize_t c2port_show_flash_access(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -536,6 +543,8 @@ static ssize_t c2port_store_flash_access(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR(flash_access, 0644, c2port_show_flash_access,
+		   c2port_store_flash_access);
 
 static ssize_t __c2port_write_flash_erase(struct c2port_device *dev)
 {
@@ -616,6 +625,7 @@ static ssize_t c2port_store_flash_erase(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR(flash_erase, 0200, NULL, c2port_store_flash_erase);
 
 static ssize_t __c2port_read_flash_data(struct c2port_device *dev,
 				char *buffer, loff_t offset, size_t count)
@@ -850,22 +860,20 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
 /*
  * Class attributes
  */
-
-static struct device_attribute c2port_attrs[] = {
-	__ATTR(name, 0444, c2port_show_name, NULL),
-	__ATTR(flash_blocks_num, 0444, c2port_show_flash_blocks_num, NULL),
-	__ATTR(flash_block_size, 0444, c2port_show_flash_block_size, NULL),
-	__ATTR(flash_size, 0444, c2port_show_flash_size, NULL),
-	__ATTR(access, 0644, c2port_show_access, c2port_store_access),
-	__ATTR(reset, 0200, NULL, c2port_store_reset),
-	__ATTR(dev_id, 0444, c2port_show_dev_id, NULL),
-	__ATTR(rev_id, 0444, c2port_show_rev_id, NULL),
-
-	__ATTR(flash_access, 0644, c2port_show_flash_access,
-					c2port_store_flash_access),
-	__ATTR(flash_erase, 0200, NULL, c2port_store_flash_erase),
-	__ATTR_NULL,
+static struct attribute *c2port_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_flash_blocks_num.attr,
+	&dev_attr_flash_block_size.attr,
+	&dev_attr_flash_size.attr,
+	&dev_attr_access.attr,
+	&dev_attr_reset.attr,
+	&dev_attr_dev_id.attr,
+	&dev_attr_rev_id.attr,
+	&dev_attr_flash_access.attr,
+	&dev_attr_flash_erase.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(c2port);
 
 static struct bin_attribute c2port_bin_attrs[] = {
 	{
@@ -979,7 +987,7 @@ static int __init c2port_init(void)
 		printk(KERN_ERR "c2port: failed to allocate class\n");
 		return PTR_ERR(c2port_class);
 	}
-	c2port_class->dev_attrs = c2port_attrs;
+	c2port_class->dev_groups = c2port_groups;
 	c2port_class->dev_bin_attrs = c2port_bin_attrs;
 
 	return 0;
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 13/36] enclosure: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 12/36] c2port: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 14/36] PCI: " Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Arnd Bergmann

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the enclosure class code to use
the correct field.

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/enclosure.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 00e5fcac8..0e8df41a 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -239,7 +239,7 @@ static void enclosure_component_release(struct device *dev)
 	put_device(dev->parent);
 }
 
-static const struct attribute_group *enclosure_groups[];
+static const struct attribute_group *enclosure_component_groups[];
 
 /**
  * enclosure_component_register - add a particular component to an enclosure
@@ -282,7 +282,7 @@ enclosure_component_register(struct enclosure_device *edev,
 		dev_set_name(cdev, "%u", number);
 
 	cdev->release = enclosure_component_release;
-	cdev->groups = enclosure_groups;
+	cdev->groups = enclosure_component_groups;
 
 	err = device_register(cdev);
 	if (err) {
@@ -365,25 +365,26 @@ EXPORT_SYMBOL_GPL(enclosure_remove_device);
  * sysfs pieces below
  */
 
-static ssize_t enclosure_show_components(struct device *cdev,
-					 struct device_attribute *attr,
-					 char *buf)
+static ssize_t components_show(struct device *cdev,
+			       struct device_attribute *attr, char *buf)
 {
 	struct enclosure_device *edev = to_enclosure_device(cdev);
 
 	return snprintf(buf, 40, "%d\n", edev->components);
 }
+static DEVICE_ATTR_RO(components);
 
-static struct device_attribute enclosure_attrs[] = {
-	__ATTR(components, S_IRUGO, enclosure_show_components, NULL),
-	__ATTR_NULL
+static struct attribute *enclosure_class_attrs[] = {
+	&dev_attr_components.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(enclosure_class);
 
 static struct class enclosure_class = {
 	.name			= "enclosure",
 	.owner			= THIS_MODULE,
 	.dev_release		= enclosure_release,
-	.dev_attrs		= enclosure_attrs,
+	.dev_groups		= enclosure_class_groups,
 };
 
 static const char *const enclosure_status [] = {
@@ -536,15 +537,7 @@ static struct attribute *enclosure_component_attrs[] = {
 	&dev_attr_type.attr,
 	NULL
 };
-
-static struct attribute_group enclosure_group = {
-	.attrs = enclosure_component_attrs,
-};
-
-static const struct attribute_group *enclosure_groups[] = {
-	&enclosure_group,
-	NULL
-};
+ATTRIBUTE_GROUPS(enclosure_component);
 
 static int __init enclosure_init(void)
 {
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 14/36] PCI: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 13/36] enclosure: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25 18:09   ` Bjorn Helgaas
  2013-07-24 22:05 ` [PATCH 15/36] x86: wmi: " Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bjorn Helgaas

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the PCI class code to use the
correct field.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Bjorn, feel free to take this through your tree, or ACK it and I can take it
through mine.

 drivers/pci/pci-sysfs.c | 32 +++++++++++++++++++++-----------
 drivers/pci/pci.h       |  2 +-
 drivers/pci/probe.c     |  2 +-
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index c0dbe1f6..7128cfdd 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -131,19 +131,19 @@ static ssize_t pci_bus_show_cpuaffinity(struct device *dev,
 	return ret;
 }
 
-static inline ssize_t pci_bus_show_cpumaskaffinity(struct device *dev,
-					struct device_attribute *attr,
-					char *buf)
+static ssize_t cpuaffinity_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	return pci_bus_show_cpuaffinity(dev, 0, attr, buf);
 }
+static DEVICE_ATTR_RO(cpuaffinity);
 
-static inline ssize_t pci_bus_show_cpulistaffinity(struct device *dev,
-					struct device_attribute *attr,
-					char *buf)
+static ssize_t cpulistaffinity_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
 {
 	return pci_bus_show_cpuaffinity(dev, 1, attr, buf);
 }
+static DEVICE_ATTR_RO(cpulistaffinity);
 
 /* show resources */
 static ssize_t
@@ -379,6 +379,7 @@ dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
 	}
 	return count;
 }
+static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store);
 
 #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
 static ssize_t d3cold_allowed_store(struct device *dev,
@@ -514,11 +515,20 @@ struct device_attribute pci_dev_attrs[] = {
 	__ATTR_NULL,
 };
 
-struct device_attribute pcibus_dev_attrs[] = {
-	__ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store),
-	__ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpumaskaffinity, NULL),
-	__ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL),
-	__ATTR_NULL,
+static struct attribute *pcibus_attrs[] = {
+	&dev_attr_rescan.attr,
+	&dev_attr_cpuaffinity.attr,
+	&dev_attr_cpulistaffinity.attr,
+	NULL,
+};
+
+static const struct attribute_group pcibus_group = {
+	.attrs = pcibus_attrs,
+};
+
+const struct attribute_group *pcibus_groups[] = {
+	&pcibus_group,
+	NULL,
 };
 
 static ssize_t
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index d1182c4a..816c297f 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -151,7 +151,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
 
 }
 extern struct device_attribute pci_dev_attrs[];
-extern struct device_attribute pcibus_dev_attrs[];
+extern const struct attribute_group *pcibus_groups[];
 extern struct device_type pci_dev_type;
 extern struct bus_attribute pci_bus_attrs[];
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 46ada5c0..cf57fe79 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -96,7 +96,7 @@ static void release_pcibus_dev(struct device *dev)
 static struct class pcibus_class = {
 	.name		= "pci_bus",
 	.dev_release	= &release_pcibus_dev,
-	.dev_attrs	= pcibus_dev_attrs,
+	.dev_groups	= pcibus_groups,
 };
 
 static int __init pcibus_class_init(void)
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 15/36] x86: wmi: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 14/36] PCI: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 16/36] PPS: " Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Matthew Garrett

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the wmi class code to use the
correct field.

Cc: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Matthew, feel free to take this through your tree, or ACK it and I can take it
through mine.

 drivers/platform/x86/wmi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index b13344c5..6e02c953 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -693,11 +693,13 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 
 	return sprintf(buf, "wmi:%s\n", guid_string);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute wmi_dev_attrs[] = {
-	__ATTR_RO(modalias),
-	__ATTR_NULL
+static struct attribute *wmi_attrs[] = {
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(wmi);
 
 static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
@@ -732,7 +734,7 @@ static struct class wmi_class = {
 	.name = "wmi",
 	.dev_release = wmi_dev_free,
 	.dev_uevent = wmi_dev_uevent,
-	.dev_attrs = wmi_dev_attrs,
+	.dev_groups = wmi_groups,
 };
 
 static int wmi_create_device(const struct guid_block *gblock,
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 16/36] PPS: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 15/36] x86: wmi: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 17/36] PTP: " Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rodolfo Giometti

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the pps class code to use the
correct field.

Cc: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Rodolfo, feel free to take this through your tree, or ACK it and I can take it
through mine.

 drivers/pps/pps.c          |  2 +-
 drivers/pps/sysfs.c        | 55 +++++++++++++++++++++++++++++-----------------
 include/linux/pps_kernel.h |  2 +-
 3 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 7173e3ad..2f07cd61 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -406,7 +406,7 @@ static int __init pps_init(void)
 		pr_err("failed to allocate class\n");
 		return PTR_ERR(pps_class);
 	}
-	pps_class->dev_attrs = pps_attrs;
+	pps_class->dev_groups = pps_groups;
 
 	err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps");
 	if (err < 0) {
diff --git a/drivers/pps/sysfs.c b/drivers/pps/sysfs.c
index ef0978c7..aefb75d6 100644
--- a/drivers/pps/sysfs.c
+++ b/drivers/pps/sysfs.c
@@ -29,8 +29,8 @@
  * Attribute functions
  */
 
-static ssize_t pps_show_assert(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t assert_show(struct device *dev, struct device_attribute *attr,
+			   char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
 
@@ -41,9 +41,10 @@ static ssize_t pps_show_assert(struct device *dev,
 			(long long) pps->assert_tu.sec, pps->assert_tu.nsec,
 			pps->assert_sequence);
 }
+static DEVICE_ATTR_RO(assert);
 
-static ssize_t pps_show_clear(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t clear_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
 
@@ -54,45 +55,59 @@ static ssize_t pps_show_clear(struct device *dev,
 			(long long) pps->clear_tu.sec, pps->clear_tu.nsec,
 			pps->clear_sequence);
 }
+static DEVICE_ATTR_RO(clear);
 
-static ssize_t pps_show_mode(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t mode_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%4x\n", pps->info.mode);
 }
+static DEVICE_ATTR_RO(mode);
 
-static ssize_t pps_show_echo(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t echo_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%d\n", !!pps->info.echo);
 }
+static DEVICE_ATTR_RO(echo);
 
-static ssize_t pps_show_name(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%s\n", pps->info.name);
 }
+static DEVICE_ATTR_RO(name);
 
-static ssize_t pps_show_path(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t path_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%s\n", pps->info.path);
 }
+static DEVICE_ATTR_RO(path);
+
+static struct attribute *pps_attrs[] = {
+	&dev_attr_assert.attr,
+	&dev_attr_clear.attr,
+	&dev_attr_mode.attr,
+	&dev_attr_echo.attr,
+	&dev_attr_name.attr,
+	&dev_attr_path.attr,
+	NULL,
+};
+
+static const struct attribute_group pps_group = {
+	.attrs = pps_attrs,
+};
 
-struct device_attribute pps_attrs[] = {
-	__ATTR(assert, S_IRUGO, pps_show_assert, NULL),
-	__ATTR(clear, S_IRUGO, pps_show_clear, NULL),
-	__ATTR(mode, S_IRUGO, pps_show_mode, NULL),
-	__ATTR(echo, S_IRUGO, pps_show_echo, NULL),
-	__ATTR(name, S_IRUGO, pps_show_name, NULL),
-	__ATTR(path, S_IRUGO, pps_show_path, NULL),
-	__ATTR_NULL,
+const struct attribute_group *pps_groups[] = {
+	&pps_group,
+	NULL,
 };
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 7db3eb93..1d2cd212 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -80,7 +80,7 @@ struct pps_device {
  * Global variables
  */
 
-extern struct device_attribute pps_attrs[];
+extern const struct attribute_group *pps_groups[];
 
 /*
  * Internal functions.
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 17/36] PTP: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 16/36] PPS: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26  9:19   ` Richard Cochran
  2013-07-24 22:05 ` [PATCH 18/36] regulator: " Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Richard Cochran

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the ptp class code to use the
correct field.

Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Richard, feel free to take this through your tree, or ACK it and I can take it
through mine.

 drivers/ptp/ptp_clock.c   |  2 +-
 drivers/ptp/ptp_private.h |  2 +-
 drivers/ptp/ptp_sysfs.c   | 51 +++++++++++++++++++++++++++--------------------
 3 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 4a8c3883..a8319b26 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -330,7 +330,7 @@ static int __init ptp_init(void)
 		goto no_region;
 	}
 
-	ptp_class->dev_attrs = ptp_dev_attrs;
+	ptp_class->dev_groups = ptp_groups;
 	pr_info("PTP clock support registered\n");
 	return 0;
 
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index 69d32070..df03f2e3 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -84,7 +84,7 @@ uint ptp_poll(struct posix_clock *pc,
  * see ptp_sysfs.c
  */
 
-extern struct device_attribute ptp_dev_attrs[];
+extern const struct attribute_group *ptp_groups[];
 
 int ptp_cleanup_sysfs(struct ptp_clock *ptp);
 
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 2f93926a..13ec5311 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -27,36 +27,43 @@ static ssize_t clock_name_show(struct device *dev,
 	struct ptp_clock *ptp = dev_get_drvdata(dev);
 	return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name);
 }
+static DEVICE_ATTR(clock_name, 0444, clock_name_show, NULL);
 
-#define PTP_SHOW_INT(name)						\
-static ssize_t name##_show(struct device *dev,				\
+#define PTP_SHOW_INT(name, var)						\
+static ssize_t var##_show(struct device *dev,				\
 			   struct device_attribute *attr, char *page)	\
 {									\
 	struct ptp_clock *ptp = dev_get_drvdata(dev);			\
-	return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->name);	\
-}
-
-PTP_SHOW_INT(max_adj);
-PTP_SHOW_INT(n_alarm);
-PTP_SHOW_INT(n_ext_ts);
-PTP_SHOW_INT(n_per_out);
-PTP_SHOW_INT(pps);
+	return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->var);	\
+}									\
+static DEVICE_ATTR(name, 0444, var##_show, NULL);
+
+PTP_SHOW_INT(max_adjustment, max_adj);
+PTP_SHOW_INT(n_alarms, n_alarm);
+PTP_SHOW_INT(n_external_timestamps, n_ext_ts);
+PTP_SHOW_INT(n_periodic_outputs, n_per_out);
+PTP_SHOW_INT(pps_available, pps);
+
+static struct attribute *ptp_attrs[] = {
+	&dev_attr_clock_name.attr,
+	&dev_attr_max_adjustment.attr,
+	&dev_attr_n_alarms.attr,
+	&dev_attr_n_external_timestamps.attr,
+	&dev_attr_n_periodic_outputs.attr,
+	&dev_attr_pps_available.attr,
+	NULL,
+};
 
-#define PTP_RO_ATTR(_var, _name) {				\
-	.attr	= { .name = __stringify(_name), .mode = 0444 },	\
-	.show	= _var##_show,					\
-}
+static const struct attribute_group ptp_group = {
+	.attrs = ptp_attrs,
+};
 
-struct device_attribute ptp_dev_attrs[] = {
-	PTP_RO_ATTR(clock_name,	clock_name),
-	PTP_RO_ATTR(max_adj,	max_adjustment),
-	PTP_RO_ATTR(n_alarm,	n_alarms),
-	PTP_RO_ATTR(n_ext_ts,	n_external_timestamps),
-	PTP_RO_ATTR(n_per_out,	n_periodic_outputs),
-	PTP_RO_ATTR(pps,	pps_available),
-	__ATTR_NULL,
+const struct attribute_group *ptp_groups[] = {
+	&ptp_group,
+	NULL,
 };
 
+
 static ssize_t extts_enable_store(struct device *dev,
 				  struct device_attribute *attr,
 				  const char *buf, size_t count)
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 18/36] regulator: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 17/36] PTP: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  9:30   ` Mark Brown
  2013-07-24 22:05 ` [PATCH 19/36] rtc: " Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Liam Girdwood, Mark Brown

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the regulator class code to use
the correct field.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Mark, feel free to take this through your tree, or ACK it and I can take it
through mine.

 drivers/regulator/core.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 288c75ab..e75ed1ef 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -323,13 +323,14 @@ static ssize_t regulator_uA_show(struct device *dev,
 }
 static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL);
 
-static ssize_t regulator_name_show(struct device *dev,
-			     struct device_attribute *attr, char *buf)
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct regulator_dev *rdev = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%s\n", rdev_get_name(rdev));
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t regulator_print_opmode(char *buf, int mode)
 {
@@ -489,15 +490,16 @@ static ssize_t regulator_total_uA_show(struct device *dev,
 }
 static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL);
 
-static ssize_t regulator_num_users_show(struct device *dev,
-				      struct device_attribute *attr, char *buf)
+static ssize_t num_users_show(struct device *dev, struct device_attribute *attr,
+			      char *buf)
 {
 	struct regulator_dev *rdev = dev_get_drvdata(dev);
 	return sprintf(buf, "%d\n", rdev->use_count);
 }
+static DEVICE_ATTR_RO(num_users);
 
-static ssize_t regulator_type_show(struct device *dev,
-				  struct device_attribute *attr, char *buf)
+static ssize_t type_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct regulator_dev *rdev = dev_get_drvdata(dev);
 
@@ -509,6 +511,7 @@ static ssize_t regulator_type_show(struct device *dev,
 	}
 	return sprintf(buf, "unknown\n");
 }
+static DEVICE_ATTR_RO(type);
 
 static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -632,12 +635,13 @@ static DEVICE_ATTR(bypass, 0444,
  * These are the only attributes are present for all regulators.
  * Other attributes are a function of regulator functionality.
  */
-static struct device_attribute regulator_dev_attrs[] = {
-	__ATTR(name, 0444, regulator_name_show, NULL),
-	__ATTR(num_users, 0444, regulator_num_users_show, NULL),
-	__ATTR(type, 0444, regulator_type_show, NULL),
-	__ATTR_NULL,
+static struct attribute *regulator_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_num_users.attr,
+	&dev_attr_type.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(regulator_dev);
 
 static void regulator_dev_release(struct device *dev)
 {
@@ -648,7 +652,7 @@ static void regulator_dev_release(struct device *dev)
 static struct class regulator_class = {
 	.name = "regulator",
 	.dev_release = regulator_dev_release,
-	.dev_attrs = regulator_dev_attrs,
+	.dev_groups = regulator_dev_groups,
 };
 
 /* Calculate the new optimum regulator operating mode based on the new total
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 19/36] rtc: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 18/36] regulator: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-28 13:23   ` Alessandro Zummo
  2013-07-24 22:05 ` [PATCH 20/36] UIO: " Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Alessandro Zummo

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the rtc class code to use the
correct field.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Alessandro, feel free to take this through your tree, or ACK it and I
can take it through mine.

 drivers/rtc/rtc-sysfs.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 4b26f867..babd43bf 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -25,15 +25,14 @@
  */
 
 static ssize_t
-rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr,
-		char *buf)
+name_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%s\n", to_rtc_device(dev)->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t
-rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr,
-		char *buf)
+date_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	ssize_t retval;
 	struct rtc_time tm;
@@ -46,10 +45,10 @@ rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr,
 
 	return retval;
 }
+static DEVICE_ATTR_RO(date);
 
 static ssize_t
-rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr,
-		char *buf)
+time_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	ssize_t retval;
 	struct rtc_time tm;
@@ -62,10 +61,10 @@ rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr,
 
 	return retval;
 }
+static DEVICE_ATTR_RO(time);
 
 static ssize_t
-rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr,
-		char *buf)
+since_epoch_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	ssize_t retval;
 	struct rtc_time tm;
@@ -79,16 +78,16 @@ rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr,
 
 	return retval;
 }
+static DEVICE_ATTR_RO(since_epoch);
 
 static ssize_t
-rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr,
-		char *buf)
+max_user_freq_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%d\n", to_rtc_device(dev)->max_user_freq);
 }
 
 static ssize_t
-rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
+max_user_freq_store(struct device *dev, struct device_attribute *attr,
 		const char *buf, size_t n)
 {
 	struct rtc_device *rtc = to_rtc_device(dev);
@@ -101,6 +100,7 @@ rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
 
 	return n;
 }
+static DEVICE_ATTR_RW(max_user_freq);
 
 /**
  * rtc_sysfs_show_hctosys - indicate if the given RTC set the system time
@@ -109,8 +109,7 @@ rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
  * boot or resume event.
  */
 static ssize_t
-rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr,
-		char *buf)
+hctosys_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 #ifdef CONFIG_RTC_HCTOSYS_DEVICE
 	if (rtc_hctosys_ret == 0 &&
@@ -121,17 +120,18 @@ rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr,
 #endif
 		return sprintf(buf, "0\n");
 }
-
-static struct device_attribute rtc_attrs[] = {
-	__ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL),
-	__ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL),
-	__ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL),
-	__ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL),
-	__ATTR(max_user_freq, S_IRUGO | S_IWUSR, rtc_sysfs_show_max_user_freq,
-			rtc_sysfs_set_max_user_freq),
-	__ATTR(hctosys, S_IRUGO, rtc_sysfs_show_hctosys, NULL),
-	{ },
+static DEVICE_ATTR_RO(hctosys);
+
+static struct attribute *rtc_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_date.attr,
+	&dev_attr_time.attr,
+	&dev_attr_since_epoch.attr,
+	&dev_attr_max_user_freq.attr,
+	&dev_attr_hctosys.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(rtc);
 
 static ssize_t
 rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr,
@@ -261,5 +261,5 @@ void rtc_sysfs_del_device(struct rtc_device *rtc)
 
 void __init rtc_sysfs_init(struct class *rtc_class)
 {
-	rtc_class->dev_attrs = rtc_attrs;
+	rtc_class->dev_groups = rtc_groups;
 }
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 20/36] UIO: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 19/36] rtc: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 21/36] cuse: " Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Hans J. Koch

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the uio class code to use the
correct field.

Cc: Hans J. Koch <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/uio/uio.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 3b96f185..170a178d 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -224,38 +224,42 @@ static struct kobj_type portio_attr_type = {
 	.default_attrs	= portio_attrs,
 };
 
-static ssize_t show_name(struct device *dev,
+static ssize_t name_show(struct device *dev,
 			 struct device_attribute *attr, char *buf)
 {
 	struct uio_device *idev = dev_get_drvdata(dev);
 	return sprintf(buf, "%s\n", idev->info->name);
 }
+static DEVICE_ATTR_RO(name);
 
-static ssize_t show_version(struct device *dev,
+static ssize_t version_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
 	struct uio_device *idev = dev_get_drvdata(dev);
 	return sprintf(buf, "%s\n", idev->info->version);
 }
+static DEVICE_ATTR_RO(version);
 
-static ssize_t show_event(struct device *dev,
+static ssize_t event_show(struct device *dev,
 			  struct device_attribute *attr, char *buf)
 {
 	struct uio_device *idev = dev_get_drvdata(dev);
 	return sprintf(buf, "%u\n", (unsigned int)atomic_read(&idev->event));
 }
+static DEVICE_ATTR_RO(event);
 
-static struct device_attribute uio_class_attributes[] = {
-	__ATTR(name, S_IRUGO, show_name, NULL),
-	__ATTR(version, S_IRUGO, show_version, NULL),
-	__ATTR(event, S_IRUGO, show_event, NULL),
-	{}
+static struct attribute *uio_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_version.attr,
+	&dev_attr_event.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(uio);
 
 /* UIO class infrastructure */
 static struct class uio_class = {
 	.name = "uio",
-	.dev_attrs = uio_class_attributes,
+	.dev_groups = uio_groups,
 };
 
 /*
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 21/36] cuse: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 20/36] UIO: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26 10:11   ` Miklos Szeredi
  2013-07-24 22:05 ` [PATCH 22/36] staging: comedi: " Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Miklos Szeredi

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the cuse class code to use the
correct field.

Cc: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Miklos, feel free to take this through your tree, or ACK it and I can
take it through mine.

 fs/fuse/cuse.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index aef34b1e..adbfd66b 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -568,6 +568,7 @@ static ssize_t cuse_class_waiting_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting));
 }
+static DEVICE_ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL);
 
 static ssize_t cuse_class_abort_store(struct device *dev,
 				      struct device_attribute *attr,
@@ -578,12 +579,14 @@ static ssize_t cuse_class_abort_store(struct device *dev,
 	fuse_abort_conn(&cc->fc);
 	return count;
 }
+static DEVICE_ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store);
 
-static struct device_attribute cuse_class_dev_attrs[] = {
-	__ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL),
-	__ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store),
-	{ }
+static struct attribute *cuse_class_dev_attrs[] = {
+	&dev_attr_waiting.attr,
+	&dev_attr_abort.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(cuse_class_dev);
 
 static struct miscdevice cuse_miscdev = {
 	.minor		= MISC_DYNAMIC_MINOR,
@@ -609,7 +612,7 @@ static int __init cuse_init(void)
 	if (IS_ERR(cuse_class))
 		return PTR_ERR(cuse_class);
 
-	cuse_class->dev_attrs = cuse_class_dev_attrs;
+	cuse_class->dev_groups = cuse_class_dev_groups;
 
 	rc = misc_register(&cuse_miscdev);
 	if (rc) {
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 22/36] staging: comedi: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 21/36] cuse: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:11   ` H Hartley Sweeten
  2013-07-24 22:05 ` [PATCH 23/36] backing-dev: " Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the comedi class code to use the
correct field.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/comedi_fops.c | 39 ++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 86475182..2f2ff8f0 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -262,7 +262,7 @@ static int resize_async_buffer(struct comedi_device *dev,
 
 /* sysfs attribute files */
 
-static ssize_t show_max_read_buffer_kb(struct device *csdev,
+static ssize_t max_read_buffer_kb_show(struct device *csdev,
 				       struct device_attribute *attr, char *buf)
 {
 	unsigned int minor = MINOR(csdev->devt);
@@ -283,7 +283,7 @@ static ssize_t show_max_read_buffer_kb(struct device *csdev,
 	return snprintf(buf, PAGE_SIZE, "%i\n", size);
 }
 
-static ssize_t store_max_read_buffer_kb(struct device *csdev,
+static ssize_t max_read_buffer_kb_store(struct device *csdev,
 					struct device_attribute *attr,
 					const char *buf, size_t count)
 {
@@ -314,8 +314,9 @@ static ssize_t store_max_read_buffer_kb(struct device *csdev,
 
 	return err ? err : count;
 }
+static DEVICE_ATTR_RW(max_read_buffer_kb);
 
-static ssize_t show_read_buffer_kb(struct device *csdev,
+static ssize_t read_buffer_kb_show(struct device *csdev,
 				   struct device_attribute *attr, char *buf)
 {
 	unsigned int minor = MINOR(csdev->devt);
@@ -336,7 +337,7 @@ static ssize_t show_read_buffer_kb(struct device *csdev,
 	return snprintf(buf, PAGE_SIZE, "%i\n", size);
 }
 
-static ssize_t store_read_buffer_kb(struct device *csdev,
+static ssize_t read_buffer_kb_store(struct device *csdev,
 				    struct device_attribute *attr,
 				    const char *buf, size_t count)
 {
@@ -367,8 +368,9 @@ static ssize_t store_read_buffer_kb(struct device *csdev,
 
 	return err ? err : count;
 }
+static DEVICE_ATTR_RW(read_buffer_kb);
 
-static ssize_t show_max_write_buffer_kb(struct device *csdev,
+static ssize_t max_write_buffer_kb_show(struct device *csdev,
 					struct device_attribute *attr,
 					char *buf)
 {
@@ -390,7 +392,7 @@ static ssize_t show_max_write_buffer_kb(struct device *csdev,
 	return snprintf(buf, PAGE_SIZE, "%i\n", size);
 }
 
-static ssize_t store_max_write_buffer_kb(struct device *csdev,
+static ssize_t max_write_buffer_kb_store(struct device *csdev,
 					 struct device_attribute *attr,
 					 const char *buf, size_t count)
 {
@@ -421,8 +423,9 @@ static ssize_t store_max_write_buffer_kb(struct device *csdev,
 
 	return err ? err : count;
 }
+static DEVICE_ATTR_RW(max_write_buffer_kb);
 
-static ssize_t show_write_buffer_kb(struct device *csdev,
+static ssize_t write_buffer_kb_show(struct device *csdev,
 				    struct device_attribute *attr, char *buf)
 {
 	unsigned int minor = MINOR(csdev->devt);
@@ -443,7 +446,7 @@ static ssize_t show_write_buffer_kb(struct device *csdev,
 	return snprintf(buf, PAGE_SIZE, "%i\n", size);
 }
 
-static ssize_t store_write_buffer_kb(struct device *csdev,
+static ssize_t write_buffer_kb_store(struct device *csdev,
 				     struct device_attribute *attr,
 				     const char *buf, size_t count)
 {
@@ -474,18 +477,16 @@ static ssize_t store_write_buffer_kb(struct device *csdev,
 
 	return err ? err : count;
 }
+static DEVICE_ATTR_RW(write_buffer_kb);
 
-static struct device_attribute comedi_dev_attrs[] = {
-	__ATTR(max_read_buffer_kb, S_IRUGO | S_IWUSR,
-		show_max_read_buffer_kb, store_max_read_buffer_kb),
-	__ATTR(read_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP,
-		show_read_buffer_kb, store_read_buffer_kb),
-	__ATTR(max_write_buffer_kb, S_IRUGO | S_IWUSR,
-		show_max_write_buffer_kb, store_max_write_buffer_kb),
-	__ATTR(write_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP,
-		show_write_buffer_kb, store_write_buffer_kb),
-	__ATTR_NULL
+static struct attribute *comedi_dev_attrs[] = {
+	&dev_attr_max_read_buffer_kb.attr,
+	&dev_attr_read_buffer_kb.attr,
+	&dev_attr_max_write_buffer_kb.attr,
+	&dev_attr_write_buffer_kb.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(comedi_dev);
 
 static void comedi_set_subdevice_runflags(struct comedi_subdevice *s,
 					  unsigned mask, unsigned bits)
@@ -2554,7 +2555,7 @@ static int __init comedi_init(void)
 		return PTR_ERR(comedi_class);
 	}
 
-	comedi_class->dev_attrs = comedi_dev_attrs;
+	comedi_class->dev_groups = comedi_dev_groups;
 
 	/* XXX requires /proc interface */
 	comedi_proc_init();
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 23/36] backing-dev: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 22/36] staging: comedi: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 24/36] SCSI: OSD: " Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Andrew Morton, Jan Kara, Tejun Heo

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the backing device class code to
use the correct field.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Andres, feel free to take this through your tree, or ACK it and I can
take it through mine.

 mm/backing-dev.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index e04454cd..37d9edcd 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -180,7 +180,8 @@ static ssize_t name##_show(struct device *dev,				\
 	struct backing_dev_info *bdi = dev_get_drvdata(dev);		\
 									\
 	return snprintf(page, PAGE_SIZE-1, "%lld\n", (long long)expr);	\
-}
+}									\
+static DEVICE_ATTR_RW(name);
 
 BDI_SHOW(read_ahead_kb, K(bdi->ra_pages))
 
@@ -231,14 +232,16 @@ static ssize_t stable_pages_required_show(struct device *dev,
 	return snprintf(page, PAGE_SIZE-1, "%d\n",
 			bdi_cap_stable_pages_required(bdi) ? 1 : 0);
 }
+static DEVICE_ATTR_RO(stable_pages_required);
 
-static struct device_attribute bdi_dev_attrs[] = {
-	__ATTR_RW(read_ahead_kb),
-	__ATTR_RW(min_ratio),
-	__ATTR_RW(max_ratio),
-	__ATTR_RO(stable_pages_required),
-	__ATTR_NULL,
+static struct attribute *bdi_dev_attrs[] = {
+	&dev_attr_read_ahead_kb.attr,
+	&dev_attr_min_ratio.attr,
+	&dev_attr_max_ratio.attr,
+	&dev_attr_stable_pages_required.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(bdi_dev);
 
 static __init int bdi_class_init(void)
 {
@@ -246,7 +249,7 @@ static __init int bdi_class_init(void)
 	if (IS_ERR(bdi_class))
 		return PTR_ERR(bdi_class);
 
-	bdi_class->dev_attrs = bdi_dev_attrs;
+	bdi_class->dev_groups = bdi_dev_groups;
 	bdi_debug_init();
 	return 0;
 }
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 24/36] SCSI: OSD: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 23/36] backing-dev: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  8:38   ` Boaz Harrosh
  2013-07-24 22:05 ` [PATCH 25/36] SCSI: sd: " Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Boaz Harrosh, Benny Halevy, James E.J. Bottomley

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the scsi osd class code to use
the correct field.

Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Benny Halevy <bhalevy@tonian.com>
Cc: James E.J. Bottomley <JBottomley@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

James, feel free to take this through your tree, or ACK it and I can
take it through mine.

 drivers/scsi/osd/osd_uld.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index 9d86947d..e1d9a4c4 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -107,6 +107,7 @@ static ssize_t osdname_show(struct device *dev, struct device_attribute *attr,
 						   class_dev);
 	return sprintf(buf, "%s\n", ould->odi.osdname);
 }
+static DEVICE_ATTR_RO(osdname);
 
 static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
@@ -117,17 +118,19 @@ static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
 	memcpy(buf, ould->odi.systemid, ould->odi.systemid_len);
 	return ould->odi.systemid_len;
 }
+static DEVICE_ATTR_RO(systemid);
 
-static struct device_attribute osd_uld_attrs[] = {
-	__ATTR(osdname, S_IRUGO, osdname_show, NULL),
-	__ATTR(systemid, S_IRUGO, systemid_show, NULL),
-	__ATTR_NULL,
+static struct attribute *osd_uld_attrs[] = {
+	&dev_attr_osdname.attr,
+	&dev_attr_systemid.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(osd_uld);
 
 static struct class osd_uld_class = {
 	.owner		= THIS_MODULE,
 	.name		= "scsi_osd",
-	.dev_attrs	= osd_uld_attrs,
+	.dev_groups	= osd_uld_groups,
 };
 
 /*
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 25/36] SCSI: sd: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 24/36] SCSI: OSD: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-30 16:11   ` James Bottomley
  2013-07-24 22:05 ` [PATCH 26/36] SCSI: st: " Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, James E.J. Bottomley

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the scsi disk class code to use
the correct field.

It required some functions to be moved around to place the show and
store functions next to each other, the old order seemed to make no
sense at all.

Cc: James E.J. Bottomley <JBottomley@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

James, feel free to take this through your tree, or ACK it and I can
take it through mine.

 drivers/scsi/sd.c | 149 +++++++++++++++++++++++++++---------------------------
 1 file changed, 75 insertions(+), 74 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 80f39b8b..fdcbf567 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -132,8 +132,8 @@ static const char *sd_cache_types[] = {
 };
 
 static ssize_t
-sd_store_cache_type(struct device *dev, struct device_attribute *attr,
-		    const char *buf, size_t count)
+cache_type_store(struct device *dev, struct device_attribute *attr,
+		 const char *buf, size_t count)
 {
 	int i, ct = -1, rcd, wce, sp;
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
@@ -199,8 +199,18 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 }
 
 static ssize_t
-sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr,
-			   const char *buf, size_t count)
+manage_start_stop_show(struct device *dev, struct device_attribute *attr,
+		       char *buf)
+{
+	struct scsi_disk *sdkp = to_scsi_disk(dev);
+	struct scsi_device *sdp = sdkp->device;
+
+	return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
+}
+
+static ssize_t
+manage_start_stop_store(struct device *dev, struct device_attribute *attr,
+			const char *buf, size_t count)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
@@ -212,10 +222,19 @@ sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
+static DEVICE_ATTR_RW(manage_start_stop);
 
 static ssize_t
-sd_store_allow_restart(struct device *dev, struct device_attribute *attr,
-		       const char *buf, size_t count)
+allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct scsi_disk *sdkp = to_scsi_disk(dev);
+
+	return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart);
+}
+
+static ssize_t
+allow_restart_store(struct device *dev, struct device_attribute *attr,
+		    const char *buf, size_t count)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
@@ -230,47 +249,30 @@ sd_store_allow_restart(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
+static DEVICE_ATTR_RW(allow_restart);
 
 static ssize_t
-sd_show_cache_type(struct device *dev, struct device_attribute *attr,
-		   char *buf)
+cache_type_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	int ct = sdkp->RCD + 2*sdkp->WCE;
 
 	return snprintf(buf, 40, "%s\n", sd_cache_types[ct]);
 }
+static DEVICE_ATTR_RW(cache_type);
 
 static ssize_t
-sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf)
+FUA_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
 	return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
 }
+static DEVICE_ATTR_RO(FUA);
 
 static ssize_t
-sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr,
-			  char *buf)
-{
-	struct scsi_disk *sdkp = to_scsi_disk(dev);
-	struct scsi_device *sdp = sdkp->device;
-
-	return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
-}
-
-static ssize_t
-sd_show_allow_restart(struct device *dev, struct device_attribute *attr,
-		      char *buf)
-{
-	struct scsi_disk *sdkp = to_scsi_disk(dev);
-
-	return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart);
-}
-
-static ssize_t
-sd_show_protection_type(struct device *dev, struct device_attribute *attr,
-			char *buf)
+protection_type_show(struct device *dev, struct device_attribute *attr,
+		     char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
@@ -278,8 +280,8 @@ sd_show_protection_type(struct device *dev, struct device_attribute *attr,
 }
 
 static ssize_t
-sd_store_protection_type(struct device *dev, struct device_attribute *attr,
-			 const char *buf, size_t count)
+protection_type_store(struct device *dev, struct device_attribute *attr,
+		      const char *buf, size_t count)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	unsigned int val;
@@ -298,10 +300,11 @@ sd_store_protection_type(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
+static DEVICE_ATTR_RW(protection_type);
 
 static ssize_t
-sd_show_protection_mode(struct device *dev, struct device_attribute *attr,
-			char *buf)
+protection_mode_show(struct device *dev, struct device_attribute *attr,
+		     char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
@@ -320,24 +323,26 @@ sd_show_protection_mode(struct device *dev, struct device_attribute *attr,
 
 	return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif);
 }
+static DEVICE_ATTR_RO(protection_mode);
 
 static ssize_t
-sd_show_app_tag_own(struct device *dev, struct device_attribute *attr,
-		    char *buf)
+app_tag_own_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
 	return snprintf(buf, 20, "%u\n", sdkp->ATO);
 }
+static DEVICE_ATTR_RO(app_tag_own);
 
 static ssize_t
-sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr,
-			  char *buf)
+thin_provisioning_show(struct device *dev, struct device_attribute *attr,
+		       char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
 	return snprintf(buf, 20, "%u\n", sdkp->lbpme);
 }
+static DEVICE_ATTR_RO(thin_provisioning);
 
 static const char *lbp_mode[] = {
 	[SD_LBP_FULL]		= "full",
@@ -349,8 +354,8 @@ static const char *lbp_mode[] = {
 };
 
 static ssize_t
-sd_show_provisioning_mode(struct device *dev, struct device_attribute *attr,
-			  char *buf)
+provisioning_mode_show(struct device *dev, struct device_attribute *attr,
+		       char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
@@ -358,8 +363,8 @@ sd_show_provisioning_mode(struct device *dev, struct device_attribute *attr,
 }
 
 static ssize_t
-sd_store_provisioning_mode(struct device *dev, struct device_attribute *attr,
-			   const char *buf, size_t count)
+provisioning_mode_store(struct device *dev, struct device_attribute *attr,
+			const char *buf, size_t count)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
@@ -385,10 +390,11 @@ sd_store_provisioning_mode(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
+static DEVICE_ATTR_RW(provisioning_mode);
 
 static ssize_t
-sd_show_max_medium_access_timeouts(struct device *dev,
-				   struct device_attribute *attr, char *buf)
+max_medium_access_timeouts_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
@@ -396,9 +402,9 @@ sd_show_max_medium_access_timeouts(struct device *dev,
 }
 
 static ssize_t
-sd_store_max_medium_access_timeouts(struct device *dev,
-				    struct device_attribute *attr,
-				    const char *buf, size_t count)
+max_medium_access_timeouts_store(struct device *dev,
+				 struct device_attribute *attr, const char *buf,
+				 size_t count)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	int err;
@@ -410,10 +416,11 @@ sd_store_max_medium_access_timeouts(struct device *dev,
 
 	return err ? err : count;
 }
+static DEVICE_ATTR_RW(max_medium_access_timeouts);
 
 static ssize_t
-sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr,
-			  char *buf)
+max_write_same_blocks_show(struct device *dev, struct device_attribute *attr,
+			   char *buf)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 
@@ -421,8 +428,8 @@ sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr,
 }
 
 static ssize_t
-sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
-			   const char *buf, size_t count)
+max_write_same_blocks_store(struct device *dev, struct device_attribute *attr,
+			    const char *buf, size_t count)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct scsi_device *sdp = sdkp->device;
@@ -451,35 +458,29 @@ sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
-
-static struct device_attribute sd_disk_attrs[] = {
-	__ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type,
-	       sd_store_cache_type),
-	__ATTR(FUA, S_IRUGO, sd_show_fua, NULL),
-	__ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart,
-	       sd_store_allow_restart),
-	__ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop,
-	       sd_store_manage_start_stop),
-	__ATTR(protection_type, S_IRUGO|S_IWUSR, sd_show_protection_type,
-	       sd_store_protection_type),
-	__ATTR(protection_mode, S_IRUGO, sd_show_protection_mode, NULL),
-	__ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL),
-	__ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL),
-	__ATTR(provisioning_mode, S_IRUGO|S_IWUSR, sd_show_provisioning_mode,
-	       sd_store_provisioning_mode),
-	__ATTR(max_write_same_blocks, S_IRUGO|S_IWUSR,
-	       sd_show_write_same_blocks, sd_store_write_same_blocks),
-	__ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR,
-	       sd_show_max_medium_access_timeouts,
-	       sd_store_max_medium_access_timeouts),
-	__ATTR_NULL,
+static DEVICE_ATTR_RW(max_write_same_blocks);
+
+static struct attribute *sd_disk_attrs[] = {
+	&dev_attr_cache_type.attr,
+	&dev_attr_FUA.attr,
+	&dev_attr_allow_restart.attr,
+	&dev_attr_manage_start_stop.attr,
+	&dev_attr_protection_type.attr,
+	&dev_attr_protection_mode.attr,
+	&dev_attr_app_tag_own.attr,
+	&dev_attr_thin_provisioning.attr,
+	&dev_attr_provisioning_mode.attr,
+	&dev_attr_max_write_same_blocks.attr,
+	&dev_attr_max_medium_access_timeouts.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(sd_disk);
 
 static struct class sd_disk_class = {
 	.name		= "scsi_disk",
 	.owner		= THIS_MODULE,
 	.dev_release	= scsi_disk_release,
-	.dev_attrs	= sd_disk_attrs,
+	.dev_groups	= sd_disk_groups,
 };
 
 static const struct dev_pm_ops sd_pm_ops = {
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 26/36] SCSI: st: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 25/36] SCSI: sd: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-30 18:27     ` James Bottomley
  2013-07-31  6:03   ` Kai Mäkisara
  2013-07-24 22:05 ` [PATCH 27/36] video: backlight: " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  35 siblings, 2 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Kai Mäkisara, James E.J. Bottomley

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the scsi tape class code to use
the correct field.

Cc: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Cc: James E.J. Bottomley <JBottomley@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

James, feel free to take this through your tree, or ACK it and I can
take it through mine.

 drivers/scsi/st.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 2a32036a..ff44b3c2 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -82,7 +82,7 @@ static int try_rdio = 1;
 static int try_wdio = 1;
 
 static struct class st_sysfs_class;
-static struct device_attribute st_dev_attrs[];
+static const struct attribute_group *st_dev_groups[];
 
 MODULE_AUTHOR("Kai Makisara");
 MODULE_DESCRIPTION("SCSI tape (st) driver");
@@ -4274,7 +4274,7 @@ static void scsi_tape_release(struct kref *kref)
 
 static struct class st_sysfs_class = {
 	.name = "scsi_tape",
-	.dev_attrs = st_dev_attrs,
+	.dev_groups = st_dev_groups,
 };
 
 static int __init init_st(void)
@@ -4408,6 +4408,7 @@ defined_show(struct device *dev, struct device_attribute *attr, char *buf)
 	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined);
 	return l;
 }
+static DEVICE_ATTR_RO(defined);
 
 static ssize_t
 default_blksize_show(struct device *dev, struct device_attribute *attr,
@@ -4419,7 +4420,7 @@ default_blksize_show(struct device *dev, struct device_attribute *attr,
 	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize);
 	return l;
 }
-
+static DEVICE_ATTR_RO(default_blksize);
 
 static ssize_t
 default_density_show(struct device *dev, struct device_attribute *attr,
@@ -4433,6 +4434,7 @@ default_density_show(struct device *dev, struct device_attribute *attr,
 	l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density);
 	return l;
 }
+static DEVICE_ATTR_RO(default_density);
 
 static ssize_t
 default_compression_show(struct device *dev, struct device_attribute *attr,
@@ -4444,6 +4446,7 @@ default_compression_show(struct device *dev, struct device_attribute *attr,
 	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1);
 	return l;
 }
+static DEVICE_ATTR_RO(default_compression);
 
 static ssize_t
 options_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -4472,15 +4475,17 @@ options_show(struct device *dev, struct device_attribute *attr, char *buf)
 	l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
 	return l;
 }
-
-static struct device_attribute st_dev_attrs[] = {
-	__ATTR_RO(defined),
-	__ATTR_RO(default_blksize),
-	__ATTR_RO(default_density),
-	__ATTR_RO(default_compression),
-	__ATTR_RO(options),
-	__ATTR_NULL,
+static DEVICE_ATTR_RO(options);
+
+static struct attribute *st_dev_attrs[] = {
+	&dev_attr_defined.attr,
+	&dev_attr_default_blksize.attr,
+	&dev_attr_default_density.attr,
+	&dev_attr_default_compression.attr,
+	&dev_attr_options.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(st_dev);
 
 /* The following functions may be useful for a larger audience. */
 static int sgl_map_user_pages(struct st_buffer *STbp,
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 27/36] video: backlight: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 26/36] SCSI: st: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  1:51   ` Jingoo Han
  2013-07-24 22:05 ` [PATCH 28/36] video: backlight: lcd: " Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Richard Purdie, Jingoo Han

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the video backlight class code to
use the correct field.

Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Richard, feel free to take this through your tree, or ACK it and I can
take it through mine.

 drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 3fccb6d3..94a403a9 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -103,16 +103,16 @@ static void backlight_generate_event(struct backlight_device *bd,
 	sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness");
 }
 
-static ssize_t backlight_show_power(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t bl_power_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
 {
 	struct backlight_device *bd = to_backlight_device(dev);
 
 	return sprintf(buf, "%d\n", bd->props.power);
 }
 
-static ssize_t backlight_store_power(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t bl_power_store(struct device *dev, struct device_attribute *attr,
+		const char *buf, size_t count)
 {
 	int rc;
 	struct backlight_device *bd = to_backlight_device(dev);
@@ -136,8 +136,9 @@ static ssize_t backlight_store_power(struct device *dev,
 
 	return rc;
 }
+static DEVICE_ATTR_RW(bl_power);
 
-static ssize_t backlight_show_brightness(struct device *dev,
+static ssize_t brightness_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct backlight_device *bd = to_backlight_device(dev);
@@ -145,7 +146,7 @@ static ssize_t backlight_show_brightness(struct device *dev,
 	return sprintf(buf, "%d\n", bd->props.brightness);
 }
 
-static ssize_t backlight_store_brightness(struct device *dev,
+static ssize_t brightness_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	int rc;
@@ -175,24 +176,27 @@ static ssize_t backlight_store_brightness(struct device *dev,
 
 	return rc;
 }
+static DEVICE_ATTR_RW(brightness);
 
-static ssize_t backlight_show_type(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t type_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
 {
 	struct backlight_device *bd = to_backlight_device(dev);
 
 	return sprintf(buf, "%s\n", backlight_types[bd->props.type]);
 }
+static DEVICE_ATTR_RO(type);
 
-static ssize_t backlight_show_max_brightness(struct device *dev,
+static ssize_t max_brightness_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct backlight_device *bd = to_backlight_device(dev);
 
 	return sprintf(buf, "%d\n", bd->props.max_brightness);
 }
+static DEVICE_ATTR_RO(max_brightness);
 
-static ssize_t backlight_show_actual_brightness(struct device *dev,
+static ssize_t actual_brightness_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	int rc = -ENXIO;
@@ -205,6 +209,7 @@ static ssize_t backlight_show_actual_brightness(struct device *dev,
 
 	return rc;
 }
+static DEVICE_ATTR_RO(actual_brightness);
 
 static struct class *backlight_class;
 
@@ -247,16 +252,15 @@ static void bl_device_release(struct device *dev)
 	kfree(bd);
 }
 
-static struct device_attribute bl_device_attributes[] = {
-	__ATTR(bl_power, 0644, backlight_show_power, backlight_store_power),
-	__ATTR(brightness, 0644, backlight_show_brightness,
-		     backlight_store_brightness),
-	__ATTR(actual_brightness, 0444, backlight_show_actual_brightness,
-		     NULL),
-	__ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL),
-	__ATTR(type, 0444, backlight_show_type, NULL),
-	__ATTR_NULL,
+static struct attribute *bl_device_attrs[] = {
+	&dev_attr_bl_power.attr,
+	&dev_attr_brightness.attr,
+	&dev_attr_actual_brightness.attr,
+	&dev_attr_max_brightness.attr,
+	&dev_attr_type.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(bl_device);
 
 /**
  * backlight_force_update - tell the backlight subsystem that hardware state
@@ -493,7 +497,7 @@ static int __init backlight_class_init(void)
 		return PTR_ERR(backlight_class);
 	}
 
-	backlight_class->dev_attrs = bl_device_attributes;
+	backlight_class->dev_groups = bl_device_groups;
 	backlight_class->pm = &backlight_class_dev_pm_ops;
 	return 0;
 }
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 28/36] video: backlight: lcd: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 27/36] video: backlight: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  1:51   ` Jingoo Han
  2013-07-24 22:05 ` [PATCH 29/36] video: output: " Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Richard Purdie, Jingoo Han

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the video backlight lcd class
code to use the correct field.

Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Richard, feel free to take this through your tree, or ACK it and I can
take it through mine.

 drivers/video/backlight/lcd.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 41964a71..93cf15ef 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -89,7 +89,7 @@ static inline void lcd_unregister_fb(struct lcd_device *ld)
 }
 #endif /* CONFIG_FB */
 
-static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr,
+static ssize_t lcd_power_show(struct device *dev, struct device_attribute *attr,
 		char *buf)
 {
 	int rc;
@@ -105,7 +105,7 @@ static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr,
 	return rc;
 }
 
-static ssize_t lcd_store_power(struct device *dev,
+static ssize_t lcd_power_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	int rc;
@@ -128,8 +128,9 @@ static ssize_t lcd_store_power(struct device *dev,
 
 	return rc;
 }
+static DEVICE_ATTR_RW(lcd_power);
 
-static ssize_t lcd_show_contrast(struct device *dev,
+static ssize_t contrast_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	int rc = -ENXIO;
@@ -143,7 +144,7 @@ static ssize_t lcd_show_contrast(struct device *dev,
 	return rc;
 }
 
-static ssize_t lcd_store_contrast(struct device *dev,
+static ssize_t contrast_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	int rc;
@@ -166,14 +167,16 @@ static ssize_t lcd_store_contrast(struct device *dev,
 
 	return rc;
 }
+static DEVICE_ATTR_RW(contrast);
 
-static ssize_t lcd_show_max_contrast(struct device *dev,
+static ssize_t max_contrast_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct lcd_device *ld = to_lcd_device(dev);
 
 	return sprintf(buf, "%d\n", ld->props.max_contrast);
 }
+static DEVICE_ATTR_RO(max_contrast);
 
 static struct class *lcd_class;
 
@@ -183,12 +186,13 @@ static void lcd_device_release(struct device *dev)
 	kfree(ld);
 }
 
-static struct device_attribute lcd_device_attributes[] = {
-	__ATTR(lcd_power, 0644, lcd_show_power, lcd_store_power),
-	__ATTR(contrast, 0644, lcd_show_contrast, lcd_store_contrast),
-	__ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL),
-	__ATTR_NULL,
+static struct attribute *lcd_device_attrs[] = {
+	&dev_attr_lcd_power.attr,
+	&dev_attr_contrast.attr,
+	&dev_attr_max_contrast.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(lcd_device);
 
 /**
  * lcd_device_register - register a new object of lcd_device class.
@@ -344,7 +348,7 @@ static int __init lcd_class_init(void)
 		return PTR_ERR(lcd_class);
 	}
 
-	lcd_class->dev_attrs = lcd_device_attributes;
+	lcd_class->dev_groups = lcd_device_groups;
 	return 0;
 }
 
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 29/36] video: output: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 28/36] video: backlight: lcd: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26  7:38   ` Tomi Valkeinen
  2013-07-24 22:05 ` [PATCH 30/36] net: core: " Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Jean-Christophe Plagniol-Villard, Tomi Valkeinen

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the video output class code to
use the correct field.

Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Jean-Christophe and Tomi, feel free to take this through your tree, or
ACK it and I can take it through mine.

 drivers/video/output.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/video/output.c b/drivers/video/output.c
index 6285b971..1446c49f 100644
--- a/drivers/video/output.c
+++ b/drivers/video/output.c
@@ -32,8 +32,8 @@ MODULE_DESCRIPTION("Display Output Switcher Lowlevel Control Abstraction");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Luming Yu <luming.yu@intel.com>");
 
-static ssize_t video_output_show_state(struct device *dev,
-				       struct device_attribute *attr, char *buf)
+static ssize_t state_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	ssize_t ret_size = 0;
 	struct output_device *od = to_output_device(dev);
@@ -42,9 +42,8 @@ static ssize_t video_output_show_state(struct device *dev,
 	return ret_size;
 }
 
-static ssize_t video_output_store_state(struct device *dev,
-					struct device_attribute *attr,
-					const char *buf,size_t count)
+static ssize_t state_store(struct device *dev, struct device_attribute *attr,
+			   const char *buf,size_t count)
 {
 	char *endp;
 	struct output_device *od = to_output_device(dev);
@@ -62,6 +61,7 @@ static ssize_t video_output_store_state(struct device *dev,
 	}
 	return count;
 }
+static DEVICE_ATTR_RW(state);
 
 static void video_output_release(struct device *dev)
 {
@@ -69,16 +69,16 @@ static void video_output_release(struct device *dev)
 	kfree(od);
 }
 
-static struct device_attribute video_output_attributes[] = {
-	__ATTR(state, 0644, video_output_show_state, video_output_store_state),
-	__ATTR_NULL,
+static struct attribute *video_output_attrs[] = {
+	&dev_attr_state.attr,
+	NULL,
 };
-
+ATTRIBUTE_GROUPS(video_output);
 
 static struct class video_output_class = {
 	.name = "video_output",
 	.dev_release = video_output_release,
-	.dev_attrs = video_output_attributes,
+	.dev_groups = video_output_groups,
 };
 
 struct output_device *video_output_register(const char *name,
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 30/36] net: core: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 29/36] video: output: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26 22:40   ` David Miller
  2013-07-24 22:05 ` [PATCH 31/36] net: ieee802154: " Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, netdev

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the networking core class code to
use the correct field.

In order to do this in the "cleanest" way, some of the macros had to be
changed to reflect the driver core format of naming show/store
functions, which accounts for the majority of the churn in this file.

Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

netdev@ maintainers, feel free to take this through your tree, or ACK it
and I can take it through mine.

 net/core/net-sysfs.c | 136 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 75 insertions(+), 61 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 981fed39..707c3134 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -60,12 +60,19 @@ static ssize_t format_##field(const struct net_device *net, char *buf)	\
 {									\
 	return sprintf(buf, format_string, net->field);			\
 }									\
-static ssize_t show_##field(struct device *dev,				\
+static ssize_t field##_show(struct device *dev,				\
 			    struct device_attribute *attr, char *buf)	\
 {									\
 	return netdev_show(dev, attr, buf, format_##field);		\
-}
+}									\
+
+#define NETDEVICE_SHOW_RO(field, format_string)				\
+NETDEVICE_SHOW(field, format_string);					\
+static DEVICE_ATTR_RO(field)
 
+#define NETDEVICE_SHOW_RW(field, format_string)				\
+NETDEVICE_SHOW(field, format_string);					\
+static DEVICE_ATTR_RW(field)
 
 /* use same locking and permission rules as SIF* ioctl's */
 static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
@@ -96,16 +103,16 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
 	return ret;
 }
 
-NETDEVICE_SHOW(dev_id, fmt_hex);
-NETDEVICE_SHOW(addr_assign_type, fmt_dec);
-NETDEVICE_SHOW(addr_len, fmt_dec);
-NETDEVICE_SHOW(iflink, fmt_dec);
-NETDEVICE_SHOW(ifindex, fmt_dec);
-NETDEVICE_SHOW(type, fmt_dec);
-NETDEVICE_SHOW(link_mode, fmt_dec);
+NETDEVICE_SHOW_RO(dev_id, fmt_hex);
+NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec);
+NETDEVICE_SHOW_RO(addr_len, fmt_dec);
+NETDEVICE_SHOW_RO(iflink, fmt_dec);
+NETDEVICE_SHOW_RO(ifindex, fmt_dec);
+NETDEVICE_SHOW_RO(type, fmt_dec);
+NETDEVICE_SHOW_RO(link_mode, fmt_dec);
 
 /* use same locking rules as GIFHWADDR ioctl's */
-static ssize_t show_address(struct device *dev, struct device_attribute *attr,
+static ssize_t address_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
 	struct net_device *net = to_net_dev(dev);
@@ -117,15 +124,17 @@ static ssize_t show_address(struct device *dev, struct device_attribute *attr,
 	read_unlock(&dev_base_lock);
 	return ret;
 }
+static DEVICE_ATTR_RO(address);
 
-static ssize_t show_broadcast(struct device *dev,
-			    struct device_attribute *attr, char *buf)
+static ssize_t broadcast_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
 {
 	struct net_device *net = to_net_dev(dev);
 	if (dev_isalive(net))
 		return sysfs_format_mac(buf, net->broadcast, net->addr_len);
 	return -EINVAL;
 }
+static DEVICE_ATTR_RO(broadcast);
 
 static int change_carrier(struct net_device *net, unsigned long new_carrier)
 {
@@ -134,13 +143,13 @@ static int change_carrier(struct net_device *net, unsigned long new_carrier)
 	return dev_change_carrier(net, (bool) new_carrier);
 }
 
-static ssize_t store_carrier(struct device *dev, struct device_attribute *attr,
-			 const char *buf, size_t len)
+static ssize_t carrier_store(struct device *dev, struct device_attribute *attr,
+			     const char *buf, size_t len)
 {
 	return netdev_store(dev, attr, buf, len, change_carrier);
 }
 
-static ssize_t show_carrier(struct device *dev,
+static ssize_t carrier_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
 	struct net_device *netdev = to_net_dev(dev);
@@ -149,8 +158,9 @@ static ssize_t show_carrier(struct device *dev,
 	}
 	return -EINVAL;
 }
+static DEVICE_ATTR_RW(carrier);
 
-static ssize_t show_speed(struct device *dev,
+static ssize_t speed_show(struct device *dev,
 			  struct device_attribute *attr, char *buf)
 {
 	struct net_device *netdev = to_net_dev(dev);
@@ -167,8 +177,9 @@ static ssize_t show_speed(struct device *dev,
 	rtnl_unlock();
 	return ret;
 }
+static DEVICE_ATTR_RO(speed);
 
-static ssize_t show_duplex(struct device *dev,
+static ssize_t duplex_show(struct device *dev,
 			   struct device_attribute *attr, char *buf)
 {
 	struct net_device *netdev = to_net_dev(dev);
@@ -198,8 +209,9 @@ static ssize_t show_duplex(struct device *dev,
 	rtnl_unlock();
 	return ret;
 }
+static DEVICE_ATTR_RO(duplex);
 
-static ssize_t show_dormant(struct device *dev,
+static ssize_t dormant_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
 	struct net_device *netdev = to_net_dev(dev);
@@ -209,6 +221,7 @@ static ssize_t show_dormant(struct device *dev,
 
 	return -EINVAL;
 }
+static DEVICE_ATTR_RO(dormant);
 
 static const char *const operstates[] = {
 	"unknown",
@@ -220,7 +233,7 @@ static const char *const operstates[] = {
 	"up"
 };
 
-static ssize_t show_operstate(struct device *dev,
+static ssize_t operstate_show(struct device *dev,
 			      struct device_attribute *attr, char *buf)
 {
 	const struct net_device *netdev = to_net_dev(dev);
@@ -237,35 +250,33 @@ static ssize_t show_operstate(struct device *dev,
 
 	return sprintf(buf, "%s\n", operstates[operstate]);
 }
+static DEVICE_ATTR_RO(operstate);
 
 /* read-write attributes */
-NETDEVICE_SHOW(mtu, fmt_dec);
 
 static int change_mtu(struct net_device *net, unsigned long new_mtu)
 {
 	return dev_set_mtu(net, (int) new_mtu);
 }
 
-static ssize_t store_mtu(struct device *dev, struct device_attribute *attr,
+static ssize_t mtu_store(struct device *dev, struct device_attribute *attr,
 			 const char *buf, size_t len)
 {
 	return netdev_store(dev, attr, buf, len, change_mtu);
 }
-
-NETDEVICE_SHOW(flags, fmt_hex);
+NETDEVICE_SHOW_RW(mtu, fmt_dec);
 
 static int change_flags(struct net_device *net, unsigned long new_flags)
 {
 	return dev_change_flags(net, (unsigned int) new_flags);
 }
 
-static ssize_t store_flags(struct device *dev, struct device_attribute *attr,
+static ssize_t flags_store(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t len)
 {
 	return netdev_store(dev, attr, buf, len, change_flags);
 }
-
-NETDEVICE_SHOW(tx_queue_len, fmt_ulong);
+NETDEVICE_SHOW_RW(flags, fmt_hex);
 
 static int change_tx_queue_len(struct net_device *net, unsigned long new_len)
 {
@@ -273,7 +284,7 @@ static int change_tx_queue_len(struct net_device *net, unsigned long new_len)
 	return 0;
 }
 
-static ssize_t store_tx_queue_len(struct device *dev,
+static ssize_t tx_queue_len_store(struct device *dev,
 				  struct device_attribute *attr,
 				  const char *buf, size_t len)
 {
@@ -282,8 +293,9 @@ static ssize_t store_tx_queue_len(struct device *dev,
 
 	return netdev_store(dev, attr, buf, len, change_tx_queue_len);
 }
+NETDEVICE_SHOW_RW(tx_queue_len, fmt_ulong);
 
-static ssize_t store_ifalias(struct device *dev, struct device_attribute *attr,
+static ssize_t ifalias_store(struct device *dev, struct device_attribute *attr,
 			     const char *buf, size_t len)
 {
 	struct net_device *netdev = to_net_dev(dev);
@@ -306,7 +318,7 @@ static ssize_t store_ifalias(struct device *dev, struct device_attribute *attr,
 	return ret < 0 ? ret : len;
 }
 
-static ssize_t show_ifalias(struct device *dev,
+static ssize_t ifalias_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
 	const struct net_device *netdev = to_net_dev(dev);
@@ -319,8 +331,7 @@ static ssize_t show_ifalias(struct device *dev,
 	rtnl_unlock();
 	return ret;
 }
-
-NETDEVICE_SHOW(group, fmt_dec);
+static DEVICE_ATTR_RW(ifalias);
 
 static int change_group(struct net_device *net, unsigned long new_group)
 {
@@ -328,35 +339,37 @@ static int change_group(struct net_device *net, unsigned long new_group)
 	return 0;
 }
 
-static ssize_t store_group(struct device *dev, struct device_attribute *attr,
-			 const char *buf, size_t len)
+static ssize_t group_store(struct device *dev, struct device_attribute *attr,
+			   const char *buf, size_t len)
 {
 	return netdev_store(dev, attr, buf, len, change_group);
 }
-
-static struct device_attribute net_class_attributes[] = {
-	__ATTR(addr_assign_type, S_IRUGO, show_addr_assign_type, NULL),
-	__ATTR(addr_len, S_IRUGO, show_addr_len, NULL),
-	__ATTR(dev_id, S_IRUGO, show_dev_id, NULL),
-	__ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias),
-	__ATTR(iflink, S_IRUGO, show_iflink, NULL),
-	__ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
-	__ATTR(type, S_IRUGO, show_type, NULL),
-	__ATTR(link_mode, S_IRUGO, show_link_mode, NULL),
-	__ATTR(address, S_IRUGO, show_address, NULL),
-	__ATTR(broadcast, S_IRUGO, show_broadcast, NULL),
-	__ATTR(carrier, S_IRUGO | S_IWUSR, show_carrier, store_carrier),
-	__ATTR(speed, S_IRUGO, show_speed, NULL),
-	__ATTR(duplex, S_IRUGO, show_duplex, NULL),
-	__ATTR(dormant, S_IRUGO, show_dormant, NULL),
-	__ATTR(operstate, S_IRUGO, show_operstate, NULL),
-	__ATTR(mtu, S_IRUGO | S_IWUSR, show_mtu, store_mtu),
-	__ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags),
-	__ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len,
-	       store_tx_queue_len),
-	__ATTR(netdev_group, S_IRUGO | S_IWUSR, show_group, store_group),
-	{}
+NETDEVICE_SHOW(group, fmt_dec);
+static DEVICE_ATTR(netdev_group, S_IRUGO | S_IWUSR, group_show, group_store);
+
+static struct attribute *net_class_attrs[] = {
+	&dev_attr_netdev_group.attr,
+	&dev_attr_type.attr,
+	&dev_attr_dev_id.attr,
+	&dev_attr_iflink.attr,
+	&dev_attr_ifindex.attr,
+	&dev_attr_addr_assign_type.attr,
+	&dev_attr_addr_len.attr,
+	&dev_attr_link_mode.attr,
+	&dev_attr_address.attr,
+	&dev_attr_broadcast.attr,
+	&dev_attr_speed.attr,
+	&dev_attr_duplex.attr,
+	&dev_attr_dormant.attr,
+	&dev_attr_operstate.attr,
+	&dev_attr_ifalias.attr,
+	&dev_attr_carrier.attr,
+	&dev_attr_mtu.attr,
+	&dev_attr_flags.attr,
+	&dev_attr_tx_queue_len.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(net_class);
 
 /* Show a given an attribute in the statistics group */
 static ssize_t netstat_show(const struct device *d,
@@ -382,13 +395,13 @@ static ssize_t netstat_show(const struct device *d,
 
 /* generate a read-only statistics attribute */
 #define NETSTAT_ENTRY(name)						\
-static ssize_t show_##name(struct device *d,				\
+static ssize_t name##_show(struct device *d,				\
 			   struct device_attribute *attr, char *buf) 	\
 {									\
 	return netstat_show(d, attr, buf,				\
 			    offsetof(struct rtnl_link_stats64, name));	\
 }									\
-static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
+static DEVICE_ATTR_RO(name)
 
 NETSTAT_ENTRY(rx_packets);
 NETSTAT_ENTRY(tx_packets);
@@ -457,6 +470,9 @@ static struct attribute_group wireless_group = {
 	.attrs = wireless_attrs,
 };
 #endif
+
+#else /* CONFIG_SYSFS */
+#define net_class_groups	NULL
 #endif /* CONFIG_SYSFS */
 
 #ifdef CONFIG_RPS
@@ -1229,9 +1245,7 @@ static const void *net_namespace(struct device *d)
 static struct class net_class = {
 	.name = "net",
 	.dev_release = netdev_release,
-#ifdef CONFIG_SYSFS
-	.dev_attrs = net_class_attributes,
-#endif /* CONFIG_SYSFS */
+	.dev_groups = net_class_groups,
 	.dev_uevent = netdev_uevent,
 	.ns_type = &net_ns_type_operations,
 	.namespace = net_namespace,
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 31/36] net: ieee802154: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 30/36] net: core: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-26 22:40   ` David Miller
  2013-07-24 22:05 ` [PATCH 32/36] net: wireless: " Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Alexander Smirnov, Dmitry Eremin-Solenikov, netdev

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the ieee802154 class code to use
the correct field.

Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

netdev@ maintainers, feel free to take this through your tree, or ACK it
and I can take it through mine.

 net/ieee802154/wpan-class.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c
index 13571eae..ef56ab5b 100644
--- a/net/ieee802154/wpan-class.c
+++ b/net/ieee802154/wpan-class.c
@@ -36,7 +36,8 @@ static ssize_t name ## _show(struct device *dev,			\
 	ret = snprintf(buf, PAGE_SIZE, format_string "\n", args);	\
 	mutex_unlock(&phy->pib_lock);					\
 	return ret;							\
-}
+}									\
+static DEVICE_ATTR_RO(name);
 
 #define MASTER_SHOW(field, format_string)				\
 	MASTER_SHOW_COMPLEX(field, format_string, phy->field)
@@ -66,15 +67,17 @@ static ssize_t channels_supported_show(struct device *dev,
 	mutex_unlock(&phy->pib_lock);
 	return len;
 }
-
-static struct device_attribute pmib_attrs[] = {
-	__ATTR_RO(current_channel),
-	__ATTR_RO(current_page),
-	__ATTR_RO(channels_supported),
-	__ATTR_RO(transmit_power),
-	__ATTR_RO(cca_mode),
-	{},
+static DEVICE_ATTR_RO(channels_supported);
+
+static struct attribute *pmib_attrs[] = {
+	&dev_attr_current_channel.attr,
+	&dev_attr_current_page.attr,
+	&dev_attr_channels_supported.attr,
+	&dev_attr_transmit_power.attr,
+	&dev_attr_cca_mode.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(pmib);
 
 static void wpan_phy_release(struct device *d)
 {
@@ -85,7 +88,7 @@ static void wpan_phy_release(struct device *d)
 static struct class wpan_phy_class = {
 	.name = "ieee802154",
 	.dev_release = wpan_phy_release,
-	.dev_attrs = pmib_attrs,
+	.dev_groups = pmib_groups,
 };
 
 static DEFINE_MUTEX(wpan_phy_mutex);
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 32/36] net: wireless: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 31/36] net: ieee802154: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  7:50   ` Johannes Berg
  2013-07-24 22:05 ` [PATCH 33/36] net: rfkill: " Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Johannes Berg, John W. Linville,
	linux-wireless, netdev

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the networking wireless class
code to use the correct field.

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

John, feel free to take this through your tree, or ACK it and I can take
it through mine.

 net/wireless/sysfs.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index a23253e0..9ee6bc1a 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -30,7 +30,8 @@ static ssize_t name ## _show(struct device *dev,			\
 			      char *buf)				\
 {									\
 	return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member);	\
-}
+}									\
+static DEVICE_ATTR_RO(name)
 
 SHOW_FMT(index, "%d", wiphy_idx);
 SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
@@ -42,7 +43,7 @@ static ssize_t name_show(struct device *dev,
 	struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
 	return sprintf(buf, "%s\n", dev_name(&wiphy->dev));
 }
-
+static DEVICE_ATTR_RO(name);
 
 static ssize_t addresses_show(struct device *dev,
 			      struct device_attribute *attr,
@@ -60,15 +61,17 @@ static ssize_t addresses_show(struct device *dev,
 
 	return buf - start;
 }
-
-static struct device_attribute ieee80211_dev_attrs[] = {
-	__ATTR_RO(index),
-	__ATTR_RO(macaddress),
-	__ATTR_RO(address_mask),
-	__ATTR_RO(addresses),
-	__ATTR_RO(name),
-	{}
+static DEVICE_ATTR_RO(addresses);
+
+static struct attribute *ieee80211_attrs[] = {
+	&dev_attr_index.attr,
+	&dev_attr_macaddress.attr,
+	&dev_attr_address_mask.attr,
+	&dev_attr_addresses.attr,
+	&dev_attr_name.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(ieee80211);
 
 static void wiphy_dev_release(struct device *dev)
 {
@@ -146,7 +149,7 @@ struct class ieee80211_class = {
 	.name = "ieee80211",
 	.owner = THIS_MODULE,
 	.dev_release = wiphy_dev_release,
-	.dev_attrs = ieee80211_dev_attrs,
+	.dev_groups = ieee80211_groups,
 	.dev_uevent = wiphy_uevent,
 #ifdef CONFIG_PM
 	.suspend = wiphy_suspend,
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 33/36] net: rfkill: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 32/36] net: wireless: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-25  7:52     ` Johannes Berg
  2013-07-24 22:05 ` [PATCH 34/36] c2port: convert class code to use bin_attrs in groups Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Johannes Berg, John W. Linville,
	linux-wireless, netdev

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the rfkill class code to use the
correct field.

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Johnannes, feel free to take this through your tree, or ACK it and I can
take it through mine.

 net/rfkill/core.c | 90 +++++++++++++++++++++++++------------------------------
 1 file changed, 41 insertions(+), 49 deletions(-)

diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 1cec5e4f..1bacc107 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -576,14 +576,14 @@ void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
 }
 EXPORT_SYMBOL(rfkill_set_states);
 
-static ssize_t rfkill_name_show(struct device *dev,
-				struct device_attribute *attr,
-				char *buf)
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%s\n", rfkill->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static const char *rfkill_get_type_str(enum rfkill_type type)
 {
@@ -611,54 +611,52 @@ static const char *rfkill_get_type_str(enum rfkill_type type)
 	}
 }
 
-static ssize_t rfkill_type_show(struct device *dev,
-				struct device_attribute *attr,
-				char *buf)
+static ssize_t type_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%s\n", rfkill_get_type_str(rfkill->type));
 }
+static DEVICE_ATTR_RO(type);
 
-static ssize_t rfkill_idx_show(struct device *dev,
-			       struct device_attribute *attr,
-			       char *buf)
+static ssize_t index_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%d\n", rfkill->idx);
 }
+static DEVICE_ATTR_RO(index);
 
-static ssize_t rfkill_persistent_show(struct device *dev,
-			       struct device_attribute *attr,
-			       char *buf)
+static ssize_t persistent_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%d\n", rfkill->persistent);
 }
+static DEVICE_ATTR_RO(persistent);
 
-static ssize_t rfkill_hard_show(struct device *dev,
-				 struct device_attribute *attr,
-				 char *buf)
+static ssize_t hard_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 );
 }
+static DEVICE_ATTR_RO(hard);
 
-static ssize_t rfkill_soft_show(struct device *dev,
-				 struct device_attribute *attr,
-				 char *buf)
+static ssize_t soft_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0 );
 }
 
-static ssize_t rfkill_soft_store(struct device *dev,
-				  struct device_attribute *attr,
-				  const char *buf, size_t count)
+static ssize_t soft_store(struct device *dev, struct device_attribute *attr,
+			  const char *buf, size_t count)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 	unsigned long state;
@@ -680,6 +678,7 @@ static ssize_t rfkill_soft_store(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR_RW(soft);
 
 static u8 user_state_from_blocked(unsigned long state)
 {
@@ -691,18 +690,16 @@ static u8 user_state_from_blocked(unsigned long state)
 	return RFKILL_USER_STATE_UNBLOCKED;
 }
 
-static ssize_t rfkill_state_show(struct device *dev,
-				 struct device_attribute *attr,
-				 char *buf)
+static ssize_t state_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 
 	return sprintf(buf, "%d\n", user_state_from_blocked(rfkill->state));
 }
 
-static ssize_t rfkill_state_store(struct device *dev,
-				  struct device_attribute *attr,
-				  const char *buf, size_t count)
+static ssize_t state_store(struct device *dev, struct device_attribute *attr,
+			   const char *buf, size_t count)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
 	unsigned long state;
@@ -725,32 +722,27 @@ static ssize_t rfkill_state_store(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR_RW(state);
 
-static ssize_t rfkill_claim_show(struct device *dev,
-				 struct device_attribute *attr,
-				 char *buf)
+static ssize_t claim_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	return sprintf(buf, "%d\n", 0);
 }
-
-static ssize_t rfkill_claim_store(struct device *dev,
-				  struct device_attribute *attr,
-				  const char *buf, size_t count)
-{
-	return -EOPNOTSUPP;
-}
-
-static struct device_attribute rfkill_dev_attrs[] = {
-	__ATTR(name, S_IRUGO, rfkill_name_show, NULL),
-	__ATTR(type, S_IRUGO, rfkill_type_show, NULL),
-	__ATTR(index, S_IRUGO, rfkill_idx_show, NULL),
-	__ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL),
-	__ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store),
-	__ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store),
-	__ATTR(soft, S_IRUGO|S_IWUSR, rfkill_soft_show, rfkill_soft_store),
-	__ATTR(hard, S_IRUGO, rfkill_hard_show, NULL),
-	__ATTR_NULL
+static DEVICE_ATTR_RO(claim);
+
+static struct attribute *rfkill_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_type.attr,
+	&dev_attr_index.attr,
+	&dev_attr_persistent.attr,
+	&dev_attr_state.attr,
+	&dev_attr_claim.attr,
+	&dev_attr_soft.attr,
+	&dev_attr_hard.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(rfkill_dev);
 
 static void rfkill_release(struct device *dev)
 {
@@ -830,7 +822,7 @@ static int rfkill_resume(struct device *dev)
 static struct class rfkill_class = {
 	.name		= "rfkill",
 	.dev_release	= rfkill_release,
-	.dev_attrs	= rfkill_dev_attrs,
+	.dev_groups	= rfkill_dev_groups,
 	.dev_uevent	= rfkill_dev_uevent,
 	.suspend	= rfkill_suspend,
 	.resume		= rfkill_resume,
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 34/36] c2port: convert class code to use bin_attrs in groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 33/36] net: rfkill: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 35/36] hid: roccat: " Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 36/36] pwm: convert class code to use dev_groups Greg Kroah-Hartman
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rodolfo Giometti

Now that attribute groups support binary attributes, use them instead of
the dev_bin_attrs field in struct class, as that is going away soon.

Cc: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/c2port/core.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index abe6e251..464419b3 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -856,6 +856,9 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
 
 	return ret;
 }
+/* size is computed at run-time */
+static BIN_ATTR(flash_data, 0644, c2port_read_flash_data,
+		c2port_write_flash_data, 0);
 
 /*
  * Class attributes
@@ -873,19 +876,20 @@ static struct attribute *c2port_attrs[] = {
 	&dev_attr_flash_erase.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(c2port);
-
-static struct bin_attribute c2port_bin_attrs[] = {
-	{
-		.attr	= {
-			.name	= "flash_data",
-			.mode	= 0644
-		},
-		.read	= c2port_read_flash_data,
-		.write	= c2port_write_flash_data,
-		/* .size is computed at run-time */
-	},
-	__ATTR_NULL
+
+static struct bin_attribute *c2port_bin_attrs[] = {
+	&bin_attr_flash_data,
+	NULL,
+};
+
+static const struct attribute_group c2port_group = {
+	.attrs = c2port_attrs,
+	.bin_attrs = c2port_bin_attrs,
+};
+
+static const struct attribute_group *c2port_groups[] = {
+	&c2port_group,
+	NULL,
 };
 
 /*
@@ -918,7 +922,7 @@ struct c2port_device *c2port_device_register(char *name,
 		goto error_idr_alloc;
 	c2dev->id = ret;
 
-	c2port_bin_attrs[0].size = ops->blocks_num * ops->block_size;
+	bin_attr_flash_data.size = ops->blocks_num * ops->block_size;
 
 	c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
 				   "c2port%d", c2dev->id);
@@ -988,7 +992,6 @@ static int __init c2port_init(void)
 		return PTR_ERR(c2port_class);
 	}
 	c2port_class->dev_groups = c2port_groups;
-	c2port_class->dev_bin_attrs = c2port_bin_attrs;
 
 	return 0;
 }
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 35/36] hid: roccat: convert class code to use bin_attrs in groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 34/36] c2port: convert class code to use bin_attrs in groups Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-24 22:05 ` [PATCH 36/36] pwm: convert class code to use dev_groups Greg Kroah-Hartman
  35 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Jiri Kosina

Now that attribute groups support binary attributes, use them instead of
the dev_bin_attrs field in struct class, as that is going away soon.

Note, there is now a compiler warning about an unused function in the
hid-roccat-pyra.c file with this patch:
drivers/hid/hid-roccat-pyra.c:246:16: warning: ‘pyra_sysfs_write_settings’ defined but not used [-Wunused-function]

That is because the settings binary sysfs file was previously setting
the write field to be able to call this function on a write, yet the
sysfs file was always marked read-only, so it was never being called.  I
left the sysfs file the same permissions, but didn't hook up the write
function as that makes no sense.  If wanted, I can just delete the
function, but I'm not quite sure what is going on here with it.

Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Jiri, feel free to take this through your tree, or ACK it and I can take
it through mine.

 drivers/hid/hid-roccat-arvo.c     |  34 +++++----
 drivers/hid/hid-roccat-isku.c     |  87 ++++++++++++----------
 drivers/hid/hid-roccat-kone.c     |  80 +++++++++-----------
 drivers/hid/hid-roccat-koneplus.c | 153 ++++++++++++++++----------------------
 drivers/hid/hid-roccat-konepure.c |  67 ++++++++++-------
 drivers/hid/hid-roccat-kovaplus.c | 137 ++++++++++++++--------------------
 drivers/hid/hid-roccat-pyra.c     | 136 +++++++++++++++------------------
 drivers/hid/hid-roccat-savu.c     |  58 ++++++++-------
 8 files changed, 351 insertions(+), 401 deletions(-)

diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c
index 98bb89e0..eed7f520 100644
--- a/drivers/hid/hid-roccat-arvo.c
+++ b/drivers/hid/hid-roccat-arvo.c
@@ -237,6 +237,8 @@ static ssize_t arvo_sysfs_write_button(struct file *fp,
 	return arvo_sysfs_write(fp, kobj, buf, off, count,
 			sizeof(struct arvo_button), ARVO_COMMAND_BUTTON);
 }
+static BIN_ATTR(button, 0220, NULL, arvo_sysfs_write_button,
+		sizeof(struct arvo_button));
 
 static ssize_t arvo_sysfs_read_info(struct file *fp,
 		struct kobject *kobj, struct bin_attribute *attr, char *buf,
@@ -245,6 +247,8 @@ static ssize_t arvo_sysfs_read_info(struct file *fp,
 	return arvo_sysfs_read(fp, kobj, buf, off, count,
 			sizeof(struct arvo_info), ARVO_COMMAND_INFO);
 }
+static BIN_ATTR(info, 0440, arvo_sysfs_read_info, NULL,
+		sizeof(struct arvo_info));
 
 static struct attribute *arvo_attrs[] = {
 	&dev_attr_mode_key.attr,
@@ -252,20 +256,21 @@ static struct attribute *arvo_attrs[] = {
 	&dev_attr_actual_profile.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(arvo);
-
-static struct bin_attribute arvo_bin_attributes[] = {
-	{
-		.attr = { .name = "button", .mode = 0220 },
-		.size = sizeof(struct arvo_button),
-		.write = arvo_sysfs_write_button
-	},
-	{
-		.attr = { .name = "info", .mode = 0440 },
-		.size = sizeof(struct arvo_info),
-		.read = arvo_sysfs_read_info
-	},
-	__ATTR_NULL
+
+static struct bin_attribute *arvo_bin_attributes[] = {
+	&bin_attr_button,
+	&bin_attr_info,
+	NULL,
+};
+
+static const struct attribute_group arvo_group = {
+	.attrs = arvo_attrs,
+	.bin_attrs = arvo_bin_attributes,
+};
+
+static const struct attribute_group *arvo_groups[] = {
+	&arvo_group,
+	NULL,
 };
 
 static int arvo_init_arvo_device_struct(struct usb_device *usb_dev,
@@ -434,7 +439,6 @@ static int __init arvo_init(void)
 	if (IS_ERR(arvo_class))
 		return PTR_ERR(arvo_class);
 	arvo_class->dev_groups = arvo_groups;
-	arvo_class->dev_bin_attrs = arvo_bin_attributes;
 
 	retval = hid_register_driver(&arvo_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c
index 3983dec0..b7a4e10e 100644
--- a/drivers/hid/hid-roccat-isku.c
+++ b/drivers/hid/hid-roccat-isku.c
@@ -116,7 +116,6 @@ static struct attribute *isku_attrs[] = {
 	&dev_attr_actual_profile.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(isku);
 
 static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj,
 		char *buf, loff_t off, size_t count,
@@ -185,7 +184,8 @@ ISKU_SYSFS_R(thingy, THINGY) \
 ISKU_SYSFS_W(thingy, THINGY)
 
 #define ISKU_BIN_ATTR_RW(thingy, THINGY) \
-{ \
+ISKU_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0660 }, \
 	.size = ISKU_SIZE_ ## THINGY, \
 	.read = isku_sysfs_read_ ## thingy, \
@@ -193,52 +193,64 @@ ISKU_SYSFS_W(thingy, THINGY)
 }
 
 #define ISKU_BIN_ATTR_R(thingy, THINGY) \
-{ \
+ISKU_SYSFS_R(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0440 }, \
 	.size = ISKU_SIZE_ ## THINGY, \
 	.read = isku_sysfs_read_ ## thingy, \
 }
 
 #define ISKU_BIN_ATTR_W(thingy, THINGY) \
-{ \
+ISKU_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0220 }, \
 	.size = ISKU_SIZE_ ## THINGY, \
 	.write = isku_sysfs_write_ ## thingy \
 }
 
-ISKU_SYSFS_RW(macro, MACRO)
-ISKU_SYSFS_RW(keys_function, KEYS_FUNCTION)
-ISKU_SYSFS_RW(keys_easyzone, KEYS_EASYZONE)
-ISKU_SYSFS_RW(keys_media, KEYS_MEDIA)
-ISKU_SYSFS_RW(keys_thumbster, KEYS_THUMBSTER)
-ISKU_SYSFS_RW(keys_macro, KEYS_MACRO)
-ISKU_SYSFS_RW(keys_capslock, KEYS_CAPSLOCK)
-ISKU_SYSFS_RW(light, LIGHT)
-ISKU_SYSFS_RW(key_mask, KEY_MASK)
-ISKU_SYSFS_RW(last_set, LAST_SET)
-ISKU_SYSFS_W(talk, TALK)
-ISKU_SYSFS_W(talkfx, TALKFX)
-ISKU_SYSFS_R(info, INFO)
-ISKU_SYSFS_W(control, CONTROL)
-ISKU_SYSFS_W(reset, RESET)
-
-static struct bin_attribute isku_bin_attributes[] = {
-	ISKU_BIN_ATTR_RW(macro, MACRO),
-	ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION),
-	ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE),
-	ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA),
-	ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER),
-	ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO),
-	ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK),
-	ISKU_BIN_ATTR_RW(light, LIGHT),
-	ISKU_BIN_ATTR_RW(key_mask, KEY_MASK),
-	ISKU_BIN_ATTR_RW(last_set, LAST_SET),
-	ISKU_BIN_ATTR_W(talk, TALK),
-	ISKU_BIN_ATTR_W(talkfx, TALKFX),
-	ISKU_BIN_ATTR_R(info, INFO),
-	ISKU_BIN_ATTR_W(control, CONTROL),
-	ISKU_BIN_ATTR_W(reset, RESET),
-	__ATTR_NULL
+ISKU_BIN_ATTR_RW(macro, MACRO);
+ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION);
+ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE);
+ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA);
+ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER);
+ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO);
+ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK);
+ISKU_BIN_ATTR_RW(light, LIGHT);
+ISKU_BIN_ATTR_RW(key_mask, KEY_MASK);
+ISKU_BIN_ATTR_RW(last_set, LAST_SET);
+ISKU_BIN_ATTR_W(talk, TALK);
+ISKU_BIN_ATTR_W(talkfx, TALKFX);
+ISKU_BIN_ATTR_W(control, CONTROL);
+ISKU_BIN_ATTR_W(reset, RESET);
+ISKU_BIN_ATTR_R(info, INFO);
+
+static struct bin_attribute *isku_bin_attributes[] = {
+	&bin_attr_macro,
+	&bin_attr_keys_function,
+	&bin_attr_keys_easyzone,
+	&bin_attr_keys_media,
+	&bin_attr_keys_thumbster,
+	&bin_attr_keys_macro,
+	&bin_attr_keys_capslock,
+	&bin_attr_light,
+	&bin_attr_key_mask,
+	&bin_attr_last_set,
+	&bin_attr_talk,
+	&bin_attr_talkfx,
+	&bin_attr_control,
+	&bin_attr_reset,
+	&bin_attr_info,
+	NULL,
+};
+
+static const struct attribute_group isku_group = {
+	.attrs = isku_attrs,
+	.bin_attrs = isku_bin_attributes,
+};
+
+static const struct attribute_group *isku_groups[] = {
+	&isku_group,
+	NULL,
 };
 
 static int isku_init_isku_device_struct(struct usb_device *usb_dev,
@@ -429,7 +441,6 @@ static int __init isku_init(void)
 	if (IS_ERR(isku_class))
 		return PTR_ERR(isku_class);
 	isku_class->dev_groups = isku_groups;
-	isku_class->dev_bin_attrs = isku_bin_attributes;
 
 	retval = hid_register_driver(&isku_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index d3626733..5eddf834 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -324,6 +324,8 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj,
 
 	return sizeof(struct kone_settings);
 }
+static BIN_ATTR(settings, 0660, kone_sysfs_read_settings,
+		kone_sysfs_write_settings, sizeof(struct kone_settings));
 
 static ssize_t kone_sysfs_read_profilex(struct file *fp,
 		struct kobject *kobj, struct bin_attribute *attr,
@@ -378,6 +380,19 @@ static ssize_t kone_sysfs_write_profilex(struct file *fp,
 
 	return sizeof(struct kone_profile);
 }
+#define PROFILE_ATTR(number)					\
+static struct bin_attribute bin_attr_profile##number = {	\
+	.attr = { .name = "profile##number", .mode = 0660 },	\
+	.size = sizeof(struct kone_profile),			\
+	.read = kone_sysfs_read_profilex,			\
+	.write = kone_sysfs_write_profilex,			\
+	.private = &profile_numbers[number],			\
+};
+PROFILE_ATTR(1);
+PROFILE_ATTR(2);
+PROFILE_ATTR(3);
+PROFILE_ATTR(4);
+PROFILE_ATTR(5);
 
 static ssize_t kone_sysfs_show_actual_profile(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -616,51 +631,25 @@ static struct attribute *kone_attrs[] = {
 	&dev_attr_startup_profile.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(kone);
-
-static struct bin_attribute kone_bin_attributes[] = {
-	{
-		.attr = { .name = "settings", .mode = 0660 },
-		.size = sizeof(struct kone_settings),
-		.read = kone_sysfs_read_settings,
-		.write = kone_sysfs_write_settings
-	},
-	{
-		.attr = { .name = "profile1", .mode = 0660 },
-		.size = sizeof(struct kone_profile),
-		.read = kone_sysfs_read_profilex,
-		.write = kone_sysfs_write_profilex,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2", .mode = 0660 },
-		.size = sizeof(struct kone_profile),
-		.read = kone_sysfs_read_profilex,
-		.write = kone_sysfs_write_profilex,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3", .mode = 0660 },
-		.size = sizeof(struct kone_profile),
-		.read = kone_sysfs_read_profilex,
-		.write = kone_sysfs_write_profilex,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4", .mode = 0660 },
-		.size = sizeof(struct kone_profile),
-		.read = kone_sysfs_read_profilex,
-		.write = kone_sysfs_write_profilex,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5", .mode = 0660 },
-		.size = sizeof(struct kone_profile),
-		.read = kone_sysfs_read_profilex,
-		.write = kone_sysfs_write_profilex,
-		.private = &profile_numbers[4]
-	},
-	__ATTR_NULL
+
+static struct bin_attribute *kone_bin_attributes[] = {
+	&bin_attr_settings,
+	&bin_attr_profile1,
+	&bin_attr_profile2,
+	&bin_attr_profile3,
+	&bin_attr_profile4,
+	&bin_attr_profile5,
+	NULL,
+};
+
+static const struct attribute_group kone_group = {
+	.attrs = kone_attrs,
+	.bin_attrs = kone_bin_attributes,
+};
+
+static const struct attribute_group *kone_groups[] = {
+	&kone_group,
+	NULL,
 };
 
 static int kone_init_kone_device_struct(struct usb_device *usb_dev,
@@ -898,7 +887,6 @@ static int __init kone_init(void)
 	if (IS_ERR(kone_class))
 		return PTR_ERR(kone_class);
 	kone_class->dev_groups = kone_groups;
-	kone_class->dev_bin_attrs = kone_bin_attributes;
 
 	retval = hid_register_driver(&kone_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 11906b4b..db4d8b6a 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -156,7 +156,8 @@ KONEPLUS_SYSFS_W(thingy, THINGY) \
 KONEPLUS_SYSFS_R(thingy, THINGY)
 
 #define KONEPLUS_BIN_ATTRIBUTE_RW(thingy, THINGY) \
-{ \
+KONEPLUS_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0660 }, \
 	.size = KONEPLUS_SIZE_ ## THINGY, \
 	.read = koneplus_sysfs_read_ ## thingy, \
@@ -164,28 +165,29 @@ KONEPLUS_SYSFS_R(thingy, THINGY)
 }
 
 #define KONEPLUS_BIN_ATTRIBUTE_R(thingy, THINGY) \
-{ \
+KONEPLUS_SYSFS_R(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0440 }, \
 	.size = KONEPLUS_SIZE_ ## THINGY, \
 	.read = koneplus_sysfs_read_ ## thingy, \
 }
 
 #define KONEPLUS_BIN_ATTRIBUTE_W(thingy, THINGY) \
-{ \
+KONEPLUS_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0220 }, \
 	.size = KONEPLUS_SIZE_ ## THINGY, \
 	.write = koneplus_sysfs_write_ ## thingy \
 }
-
-KONEPLUS_SYSFS_W(control, CONTROL)
-KONEPLUS_SYSFS_RW(info, INFO)
-KONEPLUS_SYSFS_W(talk, TALK)
-KONEPLUS_SYSFS_W(macro, MACRO)
-KONEPLUS_SYSFS_RW(sensor, SENSOR)
-KONEPLUS_SYSFS_RW(tcu, TCU)
-KONEPLUS_SYSFS_R(tcu_image, TCU_IMAGE)
-KONEPLUS_SYSFS_RW(profile_settings, PROFILE_SETTINGS)
-KONEPLUS_SYSFS_RW(profile_buttons, PROFILE_BUTTONS)
+KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL);
+KONEPLUS_BIN_ATTRIBUTE_W(talk, TALK);
+KONEPLUS_BIN_ATTRIBUTE_W(macro, MACRO);
+KONEPLUS_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE);
+KONEPLUS_BIN_ATTRIBUTE_RW(info, INFO);
+KONEPLUS_BIN_ATTRIBUTE_RW(sensor, SENSOR);
+KONEPLUS_BIN_ATTRIBUTE_RW(tcu, TCU);
+KONEPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
+KONEPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS);
 
 static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp,
 		struct kobject *kobj, struct bin_attribute *attr, char *buf,
@@ -225,6 +227,25 @@ static ssize_t koneplus_sysfs_read_profilex_buttons(struct file *fp,
 			KONEPLUS_COMMAND_PROFILE_BUTTONS);
 }
 
+#define PROFILE_ATTR(number)						\
+static struct bin_attribute bin_attr_profile##number##_settings = {	\
+	.attr = { .name = "profile##number##_settings", .mode = 0440 },	\
+	.size = KONEPLUS_SIZE_PROFILE_SETTINGS,				\
+	.read = koneplus_sysfs_read_profilex_settings,			\
+	.private = &profile_numbers[number-1],				\
+};									\
+static struct bin_attribute bin_attr_profile##number##_buttons = {	\
+	.attr = { .name = "profile##number##_buttons", .mode = 0440 },	\
+	.size = KONEPLUS_SIZE_PROFILE_BUTTONS,				\
+	.read = koneplus_sysfs_read_profilex_buttons,			\
+	.private = &profile_numbers[number-1],				\
+};
+PROFILE_ATTR(1);
+PROFILE_ATTR(2);
+PROFILE_ATTR(3);
+PROFILE_ATTR(4);
+PROFILE_ATTR(5);
+
 static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -308,79 +329,38 @@ static struct attribute *koneplus_attrs[] = {
 	&dev_attr_firmware_version.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(koneplus);
-
-static struct bin_attribute koneplus_bin_attributes[] = {
-	KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL),
-	KONEPLUS_BIN_ATTRIBUTE_RW(info, INFO),
-	KONEPLUS_BIN_ATTRIBUTE_W(talk, TALK),
-	KONEPLUS_BIN_ATTRIBUTE_W(macro, MACRO),
-	KONEPLUS_BIN_ATTRIBUTE_RW(sensor, SENSOR),
-	KONEPLUS_BIN_ATTRIBUTE_RW(tcu, TCU),
-	KONEPLUS_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE),
-	KONEPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS),
-	KONEPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS),
-	{
-		.attr = { .name = "profile1_settings", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_SETTINGS,
-		.read = koneplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2_settings", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_SETTINGS,
-		.read = koneplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3_settings", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_SETTINGS,
-		.read = koneplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4_settings", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_SETTINGS,
-		.read = koneplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5_settings", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_SETTINGS,
-		.read = koneplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[4]
-	},
-	{
-		.attr = { .name = "profile1_buttons", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_BUTTONS,
-		.read = koneplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2_buttons", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_BUTTONS,
-		.read = koneplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3_buttons", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_BUTTONS,
-		.read = koneplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4_buttons", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_BUTTONS,
-		.read = koneplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5_buttons", .mode = 0440 },
-		.size = KONEPLUS_SIZE_PROFILE_BUTTONS,
-		.read = koneplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[4]
-	},
-	__ATTR_NULL
+
+static struct bin_attribute *koneplus_bin_attributes[] = {
+	&bin_attr_control,
+	&bin_attr_talk,
+	&bin_attr_macro,
+	&bin_attr_tcu_image,
+	&bin_attr_info,
+	&bin_attr_sensor,
+	&bin_attr_tcu,
+	&bin_attr_profile_settings,
+	&bin_attr_profile_buttons,
+	&bin_attr_profile1_settings,
+	&bin_attr_profile2_settings,
+	&bin_attr_profile3_settings,
+	&bin_attr_profile4_settings,
+	&bin_attr_profile5_settings,
+	&bin_attr_profile1_buttons,
+	&bin_attr_profile2_buttons,
+	&bin_attr_profile3_buttons,
+	&bin_attr_profile4_buttons,
+	&bin_attr_profile5_buttons,
+	NULL,
+};
+
+static const struct attribute_group koneplus_group = {
+	.attrs = koneplus_attrs,
+	.bin_attrs = koneplus_bin_attributes,
+};
+
+static const struct attribute_group *koneplus_groups[] = {
+	&koneplus_group,
+	NULL,
 };
 
 static int koneplus_init_koneplus_device_struct(struct usb_device *usb_dev,
@@ -577,7 +557,6 @@ static int __init koneplus_init(void)
 	if (IS_ERR(koneplus_class))
 		return PTR_ERR(koneplus_class);
 	koneplus_class->dev_groups = koneplus_groups;
-	koneplus_class->dev_bin_attrs = koneplus_bin_attributes;
 
 	retval = hid_register_driver(&koneplus_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-konepure.c b/drivers/hid/hid-roccat-konepure.c
index c79d0b06..fa02b1f4 100644
--- a/drivers/hid/hid-roccat-konepure.c
+++ b/drivers/hid/hid-roccat-konepure.c
@@ -94,7 +94,8 @@ KONEPURE_SYSFS_W(thingy, THINGY) \
 KONEPURE_SYSFS_R(thingy, THINGY)
 
 #define KONEPURE_BIN_ATTRIBUTE_RW(thingy, THINGY) \
-{ \
+KONEPURE_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0660 }, \
 	.size = KONEPURE_SIZE_ ## THINGY, \
 	.read = konepure_sysfs_read_ ## thingy, \
@@ -102,44 +103,56 @@ KONEPURE_SYSFS_R(thingy, THINGY)
 }
 
 #define KONEPURE_BIN_ATTRIBUTE_R(thingy, THINGY) \
-{ \
+KONEPURE_SYSFS_R(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0440 }, \
 	.size = KONEPURE_SIZE_ ## THINGY, \
 	.read = konepure_sysfs_read_ ## thingy, \
 }
 
 #define KONEPURE_BIN_ATTRIBUTE_W(thingy, THINGY) \
-{ \
+KONEPURE_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0220 }, \
 	.size = KONEPURE_SIZE_ ## THINGY, \
 	.write = konepure_sysfs_write_ ## thingy \
 }
 
-KONEPURE_SYSFS_RW(actual_profile, ACTUAL_PROFILE)
-KONEPURE_SYSFS_W(control, CONTROL)
-KONEPURE_SYSFS_RW(info, INFO)
-KONEPURE_SYSFS_W(talk, TALK)
-KONEPURE_SYSFS_W(macro, MACRO)
-KONEPURE_SYSFS_RW(sensor, SENSOR)
-KONEPURE_SYSFS_RW(tcu, TCU)
-KONEPURE_SYSFS_R(tcu_image, TCU_IMAGE)
-KONEPURE_SYSFS_RW(profile_settings, PROFILE_SETTINGS)
-KONEPURE_SYSFS_RW(profile_buttons, PROFILE_BUTTONS)
-
-static struct bin_attribute konepure_bin_attributes[] = {
-	KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE),
-	KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL),
-	KONEPURE_BIN_ATTRIBUTE_RW(info, INFO),
-	KONEPURE_BIN_ATTRIBUTE_W(talk, TALK),
-	KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO),
-	KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR),
-	KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU),
-	KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE),
-	KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS),
-	KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS),
-	__ATTR_NULL
+KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE);
+KONEPURE_BIN_ATTRIBUTE_RW(info, INFO);
+KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR);
+KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU);
+KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
+KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS);
+KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL);
+KONEPURE_BIN_ATTRIBUTE_W(talk, TALK);
+KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO);
+KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE);
+
+static struct bin_attribute *konepure_bin_attributes[] = {
+	&bin_attr_actual_profile,
+	&bin_attr_info,
+	&bin_attr_sensor,
+	&bin_attr_tcu,
+	&bin_attr_profile_settings,
+	&bin_attr_profile_buttons,
+	&bin_attr_control,
+	&bin_attr_talk,
+	&bin_attr_macro,
+	&bin_attr_tcu_image,
+	NULL,
+};
+
+static const struct attribute_group konepure_group = {
+	.bin_attrs = konepure_bin_attributes,
+};
+
+static const struct attribute_group *konepure_groups[] = {
+	&konepure_group,
+	NULL,
 };
 
+
 static int konepure_init_konepure_device_struct(struct usb_device *usb_dev,
 		struct konepure_device *konepure)
 {
@@ -282,7 +295,7 @@ static int __init konepure_init(void)
 	konepure_class = class_create(THIS_MODULE, "konepure");
 	if (IS_ERR(konepure_class))
 		return PTR_ERR(konepure_class);
-	konepure_class->dev_bin_attrs = konepure_bin_attributes;
+	konepure_class->dev_groups = konepure_groups;
 
 	retval = hid_register_driver(&konepure_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
index ae630221..8a0f2993 100644
--- a/drivers/hid/hid-roccat-kovaplus.c
+++ b/drivers/hid/hid-roccat-kovaplus.c
@@ -197,31 +197,25 @@ KOVAPLUS_SYSFS_W(thingy, THINGY) \
 KOVAPLUS_SYSFS_R(thingy, THINGY)
 
 #define KOVAPLUS_BIN_ATTRIBUTE_RW(thingy, THINGY) \
-{ \
+KOVAPLUS_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0660 }, \
 	.size = KOVAPLUS_SIZE_ ## THINGY, \
 	.read = kovaplus_sysfs_read_ ## thingy, \
 	.write = kovaplus_sysfs_write_ ## thingy \
 }
 
-#define KOVAPLUS_BIN_ATTRIBUTE_R(thingy, THINGY) \
-{ \
-	.attr = { .name = #thingy, .mode = 0440 }, \
-	.size = KOVAPLUS_SIZE_ ## THINGY, \
-	.read = kovaplus_sysfs_read_ ## thingy, \
-}
-
 #define KOVAPLUS_BIN_ATTRIBUTE_W(thingy, THINGY) \
-{ \
+KOVAPLUS_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0220 }, \
 	.size = KOVAPLUS_SIZE_ ## THINGY, \
 	.write = kovaplus_sysfs_write_ ## thingy \
 }
-
-KOVAPLUS_SYSFS_W(control, CONTROL)
-KOVAPLUS_SYSFS_RW(info, INFO)
-KOVAPLUS_SYSFS_RW(profile_settings, PROFILE_SETTINGS)
-KOVAPLUS_SYSFS_RW(profile_buttons, PROFILE_BUTTONS)
+KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL);
+KOVAPLUS_BIN_ATTRIBUTE_RW(info, INFO);
+KOVAPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
+KOVAPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS);
 
 static ssize_t kovaplus_sysfs_read_profilex_settings(struct file *fp,
 		struct kobject *kobj, struct bin_attribute *attr, char *buf,
@@ -261,6 +255,25 @@ static ssize_t kovaplus_sysfs_read_profilex_buttons(struct file *fp,
 			KOVAPLUS_COMMAND_PROFILE_BUTTONS);
 }
 
+#define PROFILE_ATTR(number)						\
+static struct bin_attribute bin_attr_profile##number##_settings = {	\
+	.attr = { .name = "profile##number##_settings", .mode = 0440 },	\
+	.size = KOVAPLUS_SIZE_PROFILE_SETTINGS,				\
+	.read = kovaplus_sysfs_read_profilex_settings,			\
+	.private = &profile_numbers[number-1],				\
+};									\
+static struct bin_attribute bin_attr_profile##number##_buttons = {	\
+	.attr = { .name = "profile##number##_buttons", .mode = 0440 },	\
+	.size = KOVAPLUS_SIZE_PROFILE_BUTTONS,				\
+	.read = kovaplus_sysfs_read_profilex_buttons,			\
+	.private = &profile_numbers[number-1],				\
+};
+PROFILE_ATTR(1);
+PROFILE_ATTR(2);
+PROFILE_ATTR(3);
+PROFILE_ATTR(4);
+PROFILE_ATTR(5);
+
 static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -372,74 +385,33 @@ static struct attribute *kovaplus_attrs[] = {
 	&dev_attr_actual_sensitivity_y.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(kovaplus);
-
-static struct bin_attribute kovaplus_bin_attributes[] = {
-	KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL),
-	KOVAPLUS_BIN_ATTRIBUTE_RW(info, INFO),
-	KOVAPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS),
-	KOVAPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS),
-	{
-		.attr = { .name = "profile1_settings", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_SETTINGS,
-		.read = kovaplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2_settings", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_SETTINGS,
-		.read = kovaplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3_settings", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_SETTINGS,
-		.read = kovaplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4_settings", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_SETTINGS,
-		.read = kovaplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5_settings", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_SETTINGS,
-		.read = kovaplus_sysfs_read_profilex_settings,
-		.private = &profile_numbers[4]
-	},
-	{
-		.attr = { .name = "profile1_buttons", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_BUTTONS,
-		.read = kovaplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2_buttons", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_BUTTONS,
-		.read = kovaplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3_buttons", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_BUTTONS,
-		.read = kovaplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4_buttons", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_BUTTONS,
-		.read = kovaplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5_buttons", .mode = 0440 },
-		.size = KOVAPLUS_SIZE_PROFILE_BUTTONS,
-		.read = kovaplus_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[4]
-	},
-	__ATTR_NULL
+
+static struct bin_attribute *kovaplus_bin_attributes[] = {
+	&bin_attr_control,
+	&bin_attr_info,
+	&bin_attr_profile_settings,
+	&bin_attr_profile_buttons,
+	&bin_attr_profile1_settings,
+	&bin_attr_profile2_settings,
+	&bin_attr_profile3_settings,
+	&bin_attr_profile4_settings,
+	&bin_attr_profile5_settings,
+	&bin_attr_profile1_buttons,
+	&bin_attr_profile2_buttons,
+	&bin_attr_profile3_buttons,
+	&bin_attr_profile4_buttons,
+	&bin_attr_profile5_buttons,
+	NULL,
+};
+
+static const struct attribute_group kovaplus_group = {
+	.attrs = kovaplus_attrs,
+	.bin_attrs = kovaplus_bin_attributes,
+};
+
+static const struct attribute_group *kovaplus_groups[] = {
+	&kovaplus_group,
+	NULL,
 };
 
 static int kovaplus_init_kovaplus_device_struct(struct usb_device *usb_dev,
@@ -668,7 +640,6 @@ static int __init kovaplus_init(void)
 	if (IS_ERR(kovaplus_class))
 		return PTR_ERR(kovaplus_class);
 	kovaplus_class->dev_groups = kovaplus_groups;
-	kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes;
 
 	retval = hid_register_driver(&kovaplus_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 7960d507..8d2a706e 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -156,7 +156,8 @@ PYRA_SYSFS_W(thingy, THINGY) \
 PYRA_SYSFS_R(thingy, THINGY)
 
 #define PYRA_BIN_ATTRIBUTE_RW(thingy, THINGY) \
-{ \
+PYRA_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0660 }, \
 	.size = PYRA_SIZE_ ## THINGY, \
 	.read = pyra_sysfs_read_ ## thingy, \
@@ -164,24 +165,26 @@ PYRA_SYSFS_R(thingy, THINGY)
 }
 
 #define PYRA_BIN_ATTRIBUTE_R(thingy, THINGY) \
-{ \
+PYRA_SYSFS_R(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0440 }, \
 	.size = PYRA_SIZE_ ## THINGY, \
 	.read = pyra_sysfs_read_ ## thingy, \
 }
 
 #define PYRA_BIN_ATTRIBUTE_W(thingy, THINGY) \
-{ \
+PYRA_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0220 }, \
 	.size = PYRA_SIZE_ ## THINGY, \
 	.write = pyra_sysfs_write_ ## thingy \
 }
 
-PYRA_SYSFS_W(control, CONTROL)
-PYRA_SYSFS_RW(info, INFO)
-PYRA_SYSFS_RW(profile_settings, PROFILE_SETTINGS)
-PYRA_SYSFS_RW(profile_buttons, PROFILE_BUTTONS)
-PYRA_SYSFS_R(settings, SETTINGS)
+PYRA_BIN_ATTRIBUTE_W(control, CONTROL);
+PYRA_BIN_ATTRIBUTE_RW(info, INFO);
+PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
+PYRA_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS);
+PYRA_BIN_ATTRIBUTE_R(settings, SETTINGS);
 
 static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp,
 		struct kobject *kobj, struct bin_attribute *attr, char *buf,
@@ -221,6 +224,25 @@ static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp,
 			PYRA_COMMAND_PROFILE_BUTTONS);
 }
 
+#define PROFILE_ATTR(number)						\
+static struct bin_attribute bin_attr_profile##number##_settings = {	\
+	.attr = { .name = "profile##number##_settings", .mode = 0440 },	\
+	.size = PYRA_SIZE_PROFILE_SETTINGS,				\
+	.read = pyra_sysfs_read_profilex_settings,			\
+	.private = &profile_numbers[number-1],				\
+};									\
+static struct bin_attribute bin_attr_profile##number##_buttons = {	\
+	.attr = { .name = "profile##number##_buttons", .mode = 0440 },	\
+	.size = PYRA_SIZE_PROFILE_BUTTONS,				\
+	.read = pyra_sysfs_read_profilex_buttons,			\
+	.private = &profile_numbers[number-1],				\
+};
+PROFILE_ATTR(1);
+PROFILE_ATTR(2);
+PROFILE_ATTR(3);
+PROFILE_ATTR(4);
+PROFILE_ATTR(5);
+
 static ssize_t pyra_sysfs_write_settings(struct file *fp,
 		struct kobject *kobj, struct bin_attribute *attr, char *buf,
 		loff_t off, size_t count)
@@ -314,75 +336,34 @@ static struct attribute *pyra_attrs[] = {
 	&dev_attr_startup_profile.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(pyra);
-
-static struct bin_attribute pyra_bin_attributes[] = {
-	PYRA_BIN_ATTRIBUTE_W(control, CONTROL),
-	PYRA_BIN_ATTRIBUTE_RW(info, INFO),
-	PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS),
-	PYRA_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS),
-	PYRA_BIN_ATTRIBUTE_RW(settings, SETTINGS),
-	{
-		.attr = { .name = "profile1_settings", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_SETTINGS,
-		.read = pyra_sysfs_read_profilex_settings,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2_settings", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_SETTINGS,
-		.read = pyra_sysfs_read_profilex_settings,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3_settings", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_SETTINGS,
-		.read = pyra_sysfs_read_profilex_settings,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4_settings", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_SETTINGS,
-		.read = pyra_sysfs_read_profilex_settings,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5_settings", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_SETTINGS,
-		.read = pyra_sysfs_read_profilex_settings,
-		.private = &profile_numbers[4]
-	},
-	{
-		.attr = { .name = "profile1_buttons", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_BUTTONS,
-		.read = pyra_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[0]
-	},
-	{
-		.attr = { .name = "profile2_buttons", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_BUTTONS,
-		.read = pyra_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[1]
-	},
-	{
-		.attr = { .name = "profile3_buttons", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_BUTTONS,
-		.read = pyra_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[2]
-	},
-	{
-		.attr = { .name = "profile4_buttons", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_BUTTONS,
-		.read = pyra_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[3]
-	},
-	{
-		.attr = { .name = "profile5_buttons", .mode = 0440 },
-		.size = PYRA_SIZE_PROFILE_BUTTONS,
-		.read = pyra_sysfs_read_profilex_buttons,
-		.private = &profile_numbers[4]
-	},
-	__ATTR_NULL
+
+static struct bin_attribute *pyra_bin_attributes[] = {
+	&bin_attr_control,
+	&bin_attr_info,
+	&bin_attr_profile_settings,
+	&bin_attr_profile_buttons,
+	&bin_attr_settings,
+	&bin_attr_profile1_settings,
+	&bin_attr_profile2_settings,
+	&bin_attr_profile3_settings,
+	&bin_attr_profile4_settings,
+	&bin_attr_profile5_settings,
+	&bin_attr_profile1_buttons,
+	&bin_attr_profile2_buttons,
+	&bin_attr_profile3_buttons,
+	&bin_attr_profile4_buttons,
+	&bin_attr_profile5_buttons,
+	NULL,
+};
+
+static const struct attribute_group pyra_group = {
+	.attrs = pyra_attrs,
+	.bin_attrs = pyra_bin_attributes,
+};
+
+static const struct attribute_group *pyra_groups[] = {
+	&pyra_group,
+	NULL,
 };
 
 static int pyra_init_pyra_device_struct(struct usb_device *usb_dev,
@@ -605,7 +586,6 @@ static int __init pyra_init(void)
 	if (IS_ERR(pyra_class))
 		return PTR_ERR(pyra_class);
 	pyra_class->dev_groups = pyra_groups;
-	pyra_class->dev_bin_attrs = pyra_bin_attributes;
 
 	retval = hid_register_driver(&pyra_driver);
 	if (retval)
diff --git a/drivers/hid/hid-roccat-savu.c b/drivers/hid/hid-roccat-savu.c
index 31747a29..03322671 100644
--- a/drivers/hid/hid-roccat-savu.c
+++ b/drivers/hid/hid-roccat-savu.c
@@ -94,44 +94,48 @@ SAVU_SYSFS_W(thingy, THINGY) \
 SAVU_SYSFS_R(thingy, THINGY)
 
 #define SAVU_BIN_ATTRIBUTE_RW(thingy, THINGY) \
-{ \
+SAVU_SYSFS_RW(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0660 }, \
 	.size = SAVU_SIZE_ ## THINGY, \
 	.read = savu_sysfs_read_ ## thingy, \
 	.write = savu_sysfs_write_ ## thingy \
 }
 
-#define SAVU_BIN_ATTRIBUTE_R(thingy, THINGY) \
-{ \
-	.attr = { .name = #thingy, .mode = 0440 }, \
-	.size = SAVU_SIZE_ ## THINGY, \
-	.read = savu_sysfs_read_ ## thingy, \
-}
-
 #define SAVU_BIN_ATTRIBUTE_W(thingy, THINGY) \
-{ \
+SAVU_SYSFS_W(thingy, THINGY); \
+static struct bin_attribute bin_attr_##thingy = { \
 	.attr = { .name = #thingy, .mode = 0220 }, \
 	.size = SAVU_SIZE_ ## THINGY, \
 	.write = savu_sysfs_write_ ## thingy \
 }
 
-SAVU_SYSFS_W(control, CONTROL)
-SAVU_SYSFS_RW(profile, PROFILE)
-SAVU_SYSFS_RW(general, GENERAL)
-SAVU_SYSFS_RW(buttons, BUTTONS)
-SAVU_SYSFS_RW(macro, MACRO)
-SAVU_SYSFS_RW(info, INFO)
-SAVU_SYSFS_RW(sensor, SENSOR)
-
-static struct bin_attribute savu_bin_attributes[] = {
-	SAVU_BIN_ATTRIBUTE_W(control, CONTROL),
-	SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE),
-	SAVU_BIN_ATTRIBUTE_RW(general, GENERAL),
-	SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS),
-	SAVU_BIN_ATTRIBUTE_RW(macro, MACRO),
-	SAVU_BIN_ATTRIBUTE_RW(info, INFO),
-	SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR),
-	__ATTR_NULL
+SAVU_BIN_ATTRIBUTE_W(control, CONTROL);
+SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE);
+SAVU_BIN_ATTRIBUTE_RW(general, GENERAL);
+SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS);
+SAVU_BIN_ATTRIBUTE_RW(macro, MACRO);
+SAVU_BIN_ATTRIBUTE_RW(info, INFO);
+SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR);
+
+static struct bin_attribute *savu_bin_attributes[] = {
+	&bin_attr_control,
+	&bin_attr_profile,
+	&bin_attr_general,
+	&bin_attr_buttons,
+	&bin_attr_macro,
+	&bin_attr_info,
+	&bin_attr_sensor,
+	NULL,
+};
+
+static const struct attribute_group savu_group = {
+	.bin_attrs = savu_bin_attributes,
+};
+
+static const struct attribute_group *savu_groups[] = {
+	&savu_group,
+	NULL,
 };
 
 static int savu_init_savu_device_struct(struct usb_device *usb_dev,
@@ -294,7 +298,7 @@ static int __init savu_init(void)
 	savu_class = class_create(THIS_MODULE, "savu");
 	if (IS_ERR(savu_class))
 		return PTR_ERR(savu_class);
-	savu_class->dev_bin_attrs = savu_bin_attributes;
+	savu_class->dev_groups = savu_groups;
 
 	retval = hid_register_driver(&savu_driver);
 	if (retval)
-- 
1.8.3.rc0.20.gb99dd2e


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

* [PATCH 36/36] pwm: convert class code to use dev_groups
  2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2013-07-24 22:05 ` [PATCH 35/36] hid: roccat: " Greg Kroah-Hartman
@ 2013-07-24 22:05 ` Greg Kroah-Hartman
  2013-07-29 11:40   ` Thierry Reding
  35 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Thierry Reding

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the pwm class code to use the
correct field.

Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Thierry, feel free to take this through your tree, or ACK it and I can
take it through mine.

 drivers/pwm/sysfs.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c
index 8ca5de31..8c20332d 100644
--- a/drivers/pwm/sysfs.c
+++ b/drivers/pwm/sysfs.c
@@ -268,6 +268,7 @@ static ssize_t pwm_export_store(struct device *parent,
 
 	return ret ? : len;
 }
+static DEVICE_ATTR(export, 0200, NULL, pwm_export_store);
 
 static ssize_t pwm_unexport_store(struct device *parent,
 				  struct device_attribute *attr,
@@ -288,27 +289,29 @@ static ssize_t pwm_unexport_store(struct device *parent,
 
 	return ret ? : len;
 }
+static DEVICE_ATTR(unexport, 0200, NULL, pwm_unexport_store);
 
-static ssize_t pwm_npwm_show(struct device *parent,
-			     struct device_attribute *attr,
-			     char *buf)
+static ssize_t npwm_show(struct device *parent, struct device_attribute *attr,
+			 char *buf)
 {
 	const struct pwm_chip *chip = dev_get_drvdata(parent);
 
 	return sprintf(buf, "%u\n", chip->npwm);
 }
+static DEVICE_ATTR_RO(npwm);
 
-static struct device_attribute pwm_chip_attrs[] = {
-	__ATTR(export, 0200, NULL, pwm_export_store),
-	__ATTR(unexport, 0200, NULL, pwm_unexport_store),
-	__ATTR(npwm, 0444, pwm_npwm_show, NULL),
-	__ATTR_NULL,
+static struct attribute *pwm_chip_attrs[] = {
+	&dev_attr_export.attr,
+	&dev_attr_unexport.attr,
+	&dev_attr_npwm.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(pwm_chip);
 
 static struct class pwm_class = {
 	.name		= "pwm",
 	.owner		= THIS_MODULE,
-	.dev_attrs	= pwm_chip_attrs,
+	.dev_groups	= pwm_chip_groups,
 };
 
 static int pwmchip_sysfs_match(struct device *parent, const void *data)
-- 
1.8.3.rc0.20.gb99dd2e


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

* RE: [PATCH 22/36] staging: comedi: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 22/36] staging: comedi: " Greg Kroah-Hartman
@ 2013-07-24 22:11   ` H Hartley Sweeten
  2013-07-24 22:26     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 66+ messages in thread
From: H Hartley Sweeten @ 2013-07-24 22:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: Ian Abbott

On Wednesday, July 24, 2013 3:05 PM, Greg Kroah-Hartman wrote:
>
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the comedi class code to use the
> correct field.
>
> Cc: Ian Abbott <abbotti@mev.co.uk>
> Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/staging/comedi/comedi_fops.c | 39 ++++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 19 deletions(-)

Looks good to me. Not sure what my sign off should be so take your pick.

Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>





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

* Re: [PATCH 22/36] staging: comedi: convert class code to use dev_groups
  2013-07-24 22:11   ` H Hartley Sweeten
@ 2013-07-24 22:26     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-24 22:26 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: linux-kernel, Ian Abbott

On Wed, Jul 24, 2013 at 05:11:25PM -0500, H Hartley Sweeten wrote:
> On Wednesday, July 24, 2013 3:05 PM, Greg Kroah-Hartman wrote:
> >
> > The dev_attrs field of struct class is going away soon, dev_groups
> > should be used instead.  This converts the comedi class code to use the
> > correct field.
> >
> > Cc: Ian Abbott <abbotti@mev.co.uk>
> > Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/staging/comedi/comedi_fops.c | 39 ++++++++++++++++++------------------
> >  1 file changed, 20 insertions(+), 19 deletions(-)
> 
> Looks good to me. Not sure what my sign off should be so take your pick.
> 
> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> 
> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Thanks, I'll take both :)

greg k-h

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

* Re: [PATCH 07/36] extcon: convert extcon_class to use dev_groups
  2013-07-24 22:05 ` [PATCH 07/36] extcon: convert extcon_class " Greg Kroah-Hartman
@ 2013-07-24 23:53   ` Chanwoo Choi
  0 siblings, 0 replies; 66+ messages in thread
From: Chanwoo Choi @ 2013-07-24 23:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, MyungJoo Ham

On 07/25/2013 07:05 AM, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the extcon_class code to use the
> correct field.
> 
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> MyungJoo, feel free to apply this to your tree, or ACK it and I can take it
> through mine.
> 
>  drivers/extcon/extcon-class.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
> index 18ccadef..022ca369 100644
> --- a/drivers/extcon/extcon-class.c
> +++ b/drivers/extcon/extcon-class.c
> @@ -148,6 +148,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
>  
>  	return count;
>  }
> +static DEVICE_ATTR_RW(state);
>  
>  static ssize_t name_show(struct device *dev, struct device_attribute *attr,
>  		char *buf)
> @@ -163,6 +164,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
>  
>  	return sprintf(buf, "%s\n", dev_name(edev->dev));
>  }
> +static DEVICE_ATTR_RO(name);
>  
>  static ssize_t cable_name_show(struct device *dev,
>  			       struct device_attribute *attr, char *buf)
> @@ -527,11 +529,12 @@ int extcon_unregister_notifier(struct extcon_dev *edev,
>  }
>  EXPORT_SYMBOL_GPL(extcon_unregister_notifier);
>  
> -static struct device_attribute extcon_attrs[] = {
> -	__ATTR(state, S_IRUGO | S_IWUSR, state_show, state_store),
> -	__ATTR_RO(name),
> -	__ATTR_NULL,
> +static struct attribute *extcon_attrs[] = {
> +	&dev_attr_state.attr,
> +	&dev_attr_name.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(extcon);
>  
>  static int create_extcon_class(void)
>  {
> @@ -539,7 +542,7 @@ static int create_extcon_class(void)
>  		extcon_class = class_create(THIS_MODULE, "extcon");
>  		if (IS_ERR(extcon_class))
>  			return PTR_ERR(extcon_class);
> -		extcon_class->dev_attrs = extcon_attrs;
> +		extcon_class->dev_groups = extcon_groups;
>  
>  #if defined(CONFIG_ANDROID)
>  		switch_class = class_compat_register("switch");
> 

Looks good to me. I tested this patch.

Acked-by: Chanwoo Choi<cw00.choi@samsung.com>

Thanks,
Chanwoo Choi

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

* Re: [PATCH 28/36] video: backlight: lcd: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 28/36] video: backlight: lcd: " Greg Kroah-Hartman
@ 2013-07-25  1:51   ` Jingoo Han
  0 siblings, 0 replies; 66+ messages in thread
From: Jingoo Han @ 2013-07-25  1:51 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman', linux-kernel
  Cc: 'Richard Purdie', Jingoo Han

On Thursday, July 25, 2013 7:06 AM, Greg Kroah-Hartman wrote:
> 
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the video backlight lcd class
> code to use the correct field.
> 
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Richard, feel free to take this through your tree, or ACK it and I can
> take it through mine.

Hi Greg Kroah-Hartman,

I hope that it will go through your tree with my Ack.

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
>  drivers/video/backlight/lcd.c | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
> index 41964a71..93cf15ef 100644
> --- a/drivers/video/backlight/lcd.c
> +++ b/drivers/video/backlight/lcd.c
> @@ -89,7 +89,7 @@ static inline void lcd_unregister_fb(struct lcd_device *ld)
>  }
>  #endif /* CONFIG_FB */
> 
> -static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr,
> +static ssize_t lcd_power_show(struct device *dev, struct device_attribute *attr,
>  		char *buf)
>  {
>  	int rc;
> @@ -105,7 +105,7 @@ static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr,
>  	return rc;
>  }
> 
> -static ssize_t lcd_store_power(struct device *dev,
> +static ssize_t lcd_power_store(struct device *dev,
>  		struct device_attribute *attr, const char *buf, size_t count)
>  {
>  	int rc;
> @@ -128,8 +128,9 @@ static ssize_t lcd_store_power(struct device *dev,
> 
>  	return rc;
>  }
> +static DEVICE_ATTR_RW(lcd_power);
> 
> -static ssize_t lcd_show_contrast(struct device *dev,
> +static ssize_t contrast_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	int rc = -ENXIO;
> @@ -143,7 +144,7 @@ static ssize_t lcd_show_contrast(struct device *dev,
>  	return rc;
>  }
> 
> -static ssize_t lcd_store_contrast(struct device *dev,
> +static ssize_t contrast_store(struct device *dev,
>  		struct device_attribute *attr, const char *buf, size_t count)
>  {
>  	int rc;
> @@ -166,14 +167,16 @@ static ssize_t lcd_store_contrast(struct device *dev,
> 
>  	return rc;
>  }
> +static DEVICE_ATTR_RW(contrast);
> 
> -static ssize_t lcd_show_max_contrast(struct device *dev,
> +static ssize_t max_contrast_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct lcd_device *ld = to_lcd_device(dev);
> 
>  	return sprintf(buf, "%d\n", ld->props.max_contrast);
>  }
> +static DEVICE_ATTR_RO(max_contrast);
> 
>  static struct class *lcd_class;
> 
> @@ -183,12 +186,13 @@ static void lcd_device_release(struct device *dev)
>  	kfree(ld);
>  }
> 
> -static struct device_attribute lcd_device_attributes[] = {
> -	__ATTR(lcd_power, 0644, lcd_show_power, lcd_store_power),
> -	__ATTR(contrast, 0644, lcd_show_contrast, lcd_store_contrast),
> -	__ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL),
> -	__ATTR_NULL,
> +static struct attribute *lcd_device_attrs[] = {
> +	&dev_attr_lcd_power.attr,
> +	&dev_attr_contrast.attr,
> +	&dev_attr_max_contrast.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(lcd_device);
> 
>  /**
>   * lcd_device_register - register a new object of lcd_device class.
> @@ -344,7 +348,7 @@ static int __init lcd_class_init(void)
>  		return PTR_ERR(lcd_class);
>  	}
> 
> -	lcd_class->dev_attrs = lcd_device_attributes;
> +	lcd_class->dev_groups = lcd_device_groups;
>  	return 0;
>  }
> 
> --
> 1.8.3.rc0.20.gb99dd2e


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

* Re: [PATCH 27/36] video: backlight: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 27/36] video: backlight: " Greg Kroah-Hartman
@ 2013-07-25  1:51   ` Jingoo Han
  0 siblings, 0 replies; 66+ messages in thread
From: Jingoo Han @ 2013-07-25  1:51 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman', linux-kernel
  Cc: 'Richard Purdie', Jingoo Han

On Thursday, July 25, 2013 7:06 AM, Greg Kroah-Hartman wrote:
> 
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the video backlight class code to
> use the correct field.
> 
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Richard, feel free to take this through your tree, or ACK it and I can
> take it through mine.

Hi Greg Kroah-Hartman,

I hope that it will go through your tree with my Ack.

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han


> 
>  drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++-----------------
>  1 file changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index 3fccb6d3..94a403a9 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -103,16 +103,16 @@ static void backlight_generate_event(struct backlight_device *bd,
>  	sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness");
>  }
> 
> -static ssize_t backlight_show_power(struct device *dev,
> -		struct device_attribute *attr, char *buf)
> +static ssize_t bl_power_show(struct device *dev, struct device_attribute *attr,
> +		char *buf)
>  {
>  	struct backlight_device *bd = to_backlight_device(dev);
> 
>  	return sprintf(buf, "%d\n", bd->props.power);
>  }
> 
> -static ssize_t backlight_store_power(struct device *dev,
> -		struct device_attribute *attr, const char *buf, size_t count)
> +static ssize_t bl_power_store(struct device *dev, struct device_attribute *attr,
> +		const char *buf, size_t count)
>  {
>  	int rc;
>  	struct backlight_device *bd = to_backlight_device(dev);
> @@ -136,8 +136,9 @@ static ssize_t backlight_store_power(struct device *dev,
> 
>  	return rc;
>  }
> +static DEVICE_ATTR_RW(bl_power);
> 
> -static ssize_t backlight_show_brightness(struct device *dev,
> +static ssize_t brightness_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct backlight_device *bd = to_backlight_device(dev);
> @@ -145,7 +146,7 @@ static ssize_t backlight_show_brightness(struct device *dev,
>  	return sprintf(buf, "%d\n", bd->props.brightness);
>  }
> 
> -static ssize_t backlight_store_brightness(struct device *dev,
> +static ssize_t brightness_store(struct device *dev,
>  		struct device_attribute *attr, const char *buf, size_t count)
>  {
>  	int rc;
> @@ -175,24 +176,27 @@ static ssize_t backlight_store_brightness(struct device *dev,
> 
>  	return rc;
>  }
> +static DEVICE_ATTR_RW(brightness);
> 
> -static ssize_t backlight_show_type(struct device *dev,
> -		struct device_attribute *attr, char *buf)
> +static ssize_t type_show(struct device *dev, struct device_attribute *attr,
> +		char *buf)
>  {
>  	struct backlight_device *bd = to_backlight_device(dev);
> 
>  	return sprintf(buf, "%s\n", backlight_types[bd->props.type]);
>  }
> +static DEVICE_ATTR_RO(type);
> 
> -static ssize_t backlight_show_max_brightness(struct device *dev,
> +static ssize_t max_brightness_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct backlight_device *bd = to_backlight_device(dev);
> 
>  	return sprintf(buf, "%d\n", bd->props.max_brightness);
>  }
> +static DEVICE_ATTR_RO(max_brightness);
> 
> -static ssize_t backlight_show_actual_brightness(struct device *dev,
> +static ssize_t actual_brightness_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	int rc = -ENXIO;
> @@ -205,6 +209,7 @@ static ssize_t backlight_show_actual_brightness(struct device *dev,
> 
>  	return rc;
>  }
> +static DEVICE_ATTR_RO(actual_brightness);
> 
>  static struct class *backlight_class;
> 
> @@ -247,16 +252,15 @@ static void bl_device_release(struct device *dev)
>  	kfree(bd);
>  }
> 
> -static struct device_attribute bl_device_attributes[] = {
> -	__ATTR(bl_power, 0644, backlight_show_power, backlight_store_power),
> -	__ATTR(brightness, 0644, backlight_show_brightness,
> -		     backlight_store_brightness),
> -	__ATTR(actual_brightness, 0444, backlight_show_actual_brightness,
> -		     NULL),
> -	__ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL),
> -	__ATTR(type, 0444, backlight_show_type, NULL),
> -	__ATTR_NULL,
> +static struct attribute *bl_device_attrs[] = {
> +	&dev_attr_bl_power.attr,
> +	&dev_attr_brightness.attr,
> +	&dev_attr_actual_brightness.attr,
> +	&dev_attr_max_brightness.attr,
> +	&dev_attr_type.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(bl_device);
> 
>  /**
>   * backlight_force_update - tell the backlight subsystem that hardware state
> @@ -493,7 +497,7 @@ static int __init backlight_class_init(void)
>  		return PTR_ERR(backlight_class);
>  	}
> 
> -	backlight_class->dev_attrs = bl_device_attributes;
> +	backlight_class->dev_groups = bl_device_groups;
>  	backlight_class->pm = &backlight_class_dev_pm_ops;
>  	return 0;
>  }
> --
> 1.8.3.rc0.20.gb99dd2e


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

* Re: [PATCH 32/36] net: wireless: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 32/36] net: wireless: " Greg Kroah-Hartman
@ 2013-07-25  7:50   ` Johannes Berg
  0 siblings, 0 replies; 66+ messages in thread
From: Johannes Berg @ 2013-07-25  7:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, John W. Linville, linux-wireless, netdev

On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the networking wireless class
> code to use the correct field.
> 
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: John W. Linville <linville@tuxdriver.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> John, feel free to take this through your tree, or ACK it and I can take
> it through mine.

It's cfg80211 so it should be me, but I don't expect any conflicts so
please take it.

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

johannes


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

* Re: [PATCH 33/36] net: rfkill: convert class code to use dev_groups
@ 2013-07-25  7:52     ` Johannes Berg
  0 siblings, 0 replies; 66+ messages in thread
From: Johannes Berg @ 2013-07-25  7:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, John W. Linville, linux-wireless, netdev

On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the rfkill class code to use the
> correct field.
> 
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: John W. Linville <linville@tuxdriver.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Johnannes, feel free to take this through your tree, or ACK it and I can
> take it through mine.

Looks good to me, go ahead and take it, we're not going to modify this
code.

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

johannes


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

* Re: [PATCH 33/36] net: rfkill: convert class code to use dev_groups
@ 2013-07-25  7:52     ` Johannes Berg
  0 siblings, 0 replies; 66+ messages in thread
From: Johannes Berg @ 2013-07-25  7:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the rfkill class code to use the
> correct field.
> 
> Cc: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
> Cc: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
> Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Signed-off-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
> ---
> 
> Johnannes, feel free to take this through your tree, or ACK it and I can
> take it through mine.

Looks good to me, go ahead and take it, we're not going to modify this
code.

Reviewed-by: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 24/36] SCSI: OSD: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 24/36] SCSI: OSD: " Greg Kroah-Hartman
@ 2013-07-25  8:38   ` Boaz Harrosh
  0 siblings, 0 replies; 66+ messages in thread
From: Boaz Harrosh @ 2013-07-25  8:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Benny Halevy, James E.J. Bottomley

On 07/25/2013 01:05 AM, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the scsi osd class code to use
> the correct field.
> 
> Cc: Boaz Harrosh <bharrosh@panasas.com>

ACK-by: Boaz Harrosh <bharrosh@panasas.com>

Cool Thanks
> Cc: Benny Halevy <bhalevy@tonian.com>
> Cc: James E.J. Bottomley <JBottomley@parallels.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> James, feel free to take this through your tree, or ACK it and I can
> take it through mine.
> 
>  drivers/scsi/osd/osd_uld.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
> index 9d86947d..e1d9a4c4 100644
> --- a/drivers/scsi/osd/osd_uld.c
> +++ b/drivers/scsi/osd/osd_uld.c
> @@ -107,6 +107,7 @@ static ssize_t osdname_show(struct device *dev, struct device_attribute *attr,
>  						   class_dev);
>  	return sprintf(buf, "%s\n", ould->odi.osdname);
>  }
> +static DEVICE_ATTR_RO(osdname);
>  
>  static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
>  			    char *buf)
> @@ -117,17 +118,19 @@ static ssize_t systemid_show(struct device *dev, struct device_attribute *attr,
>  	memcpy(buf, ould->odi.systemid, ould->odi.systemid_len);
>  	return ould->odi.systemid_len;
>  }
> +static DEVICE_ATTR_RO(systemid);
>  
> -static struct device_attribute osd_uld_attrs[] = {
> -	__ATTR(osdname, S_IRUGO, osdname_show, NULL),
> -	__ATTR(systemid, S_IRUGO, systemid_show, NULL),
> -	__ATTR_NULL,
> +static struct attribute *osd_uld_attrs[] = {
> +	&dev_attr_osdname.attr,
> +	&dev_attr_systemid.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(osd_uld);
>  
>  static struct class osd_uld_class = {
>  	.owner		= THIS_MODULE,
>  	.name		= "scsi_osd",
> -	.dev_attrs	= osd_uld_attrs,
> +	.dev_groups	= osd_uld_groups,
>  };
>  
>  /*
> 


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

* Re: [PATCH 05/36] dma: convert dma_devclass to use dev_groups
  2013-07-24 22:05 ` [PATCH 05/36] dma: convert dma_devclass " Greg Kroah-Hartman
@ 2013-07-25  8:40   ` Vinod Koul
  0 siblings, 0 replies; 66+ messages in thread
From: Vinod Koul @ 2013-07-25  8:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Dan Williams

On Wed, Jul 24, 2013 at 03:05:08PM -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the dma dma_devclass code to use
> the correct field.
> 
> Cc: Dan Williams <djbw@fb.com>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>

~Vinod

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

* Re: [PATCH 18/36] regulator: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 18/36] regulator: " Greg Kroah-Hartman
@ 2013-07-25  9:30   ` Mark Brown
  0 siblings, 0 replies; 66+ messages in thread
From: Mark Brown @ 2013-07-25  9:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

On Wed, Jul 24, 2013 at 03:05:21PM -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the regulator class code to use
> the correct field.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 14/36] PCI: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 14/36] PCI: " Greg Kroah-Hartman
@ 2013-07-25 18:09   ` Bjorn Helgaas
  0 siblings, 0 replies; 66+ messages in thread
From: Bjorn Helgaas @ 2013-07-25 18:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

On Wed, Jul 24, 2013 at 03:05:17PM -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the PCI class code to use the
> correct field.
> 
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Bjorn, feel free to take this through your tree, or ACK it and I can take it
> through mine.

Applied to my pci/misc branch for v3.12, thanks!

> 
>  drivers/pci/pci-sysfs.c | 32 +++++++++++++++++++++-----------
>  drivers/pci/pci.h       |  2 +-
>  drivers/pci/probe.c     |  2 +-
>  3 files changed, 23 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index c0dbe1f6..7128cfdd 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -131,19 +131,19 @@ static ssize_t pci_bus_show_cpuaffinity(struct device *dev,
>  	return ret;
>  }
>  
> -static inline ssize_t pci_bus_show_cpumaskaffinity(struct device *dev,
> -					struct device_attribute *attr,
> -					char *buf)
> +static ssize_t cpuaffinity_show(struct device *dev,
> +				struct device_attribute *attr, char *buf)
>  {
>  	return pci_bus_show_cpuaffinity(dev, 0, attr, buf);
>  }
> +static DEVICE_ATTR_RO(cpuaffinity);
>  
> -static inline ssize_t pci_bus_show_cpulistaffinity(struct device *dev,
> -					struct device_attribute *attr,
> -					char *buf)
> +static ssize_t cpulistaffinity_show(struct device *dev,
> +				    struct device_attribute *attr, char *buf)
>  {
>  	return pci_bus_show_cpuaffinity(dev, 1, attr, buf);
>  }
> +static DEVICE_ATTR_RO(cpulistaffinity);
>  
>  /* show resources */
>  static ssize_t
> @@ -379,6 +379,7 @@ dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
>  	}
>  	return count;
>  }
> +static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store);
>  
>  #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
>  static ssize_t d3cold_allowed_store(struct device *dev,
> @@ -514,11 +515,20 @@ struct device_attribute pci_dev_attrs[] = {
>  	__ATTR_NULL,
>  };
>  
> -struct device_attribute pcibus_dev_attrs[] = {
> -	__ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store),
> -	__ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpumaskaffinity, NULL),
> -	__ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL),
> -	__ATTR_NULL,
> +static struct attribute *pcibus_attrs[] = {
> +	&dev_attr_rescan.attr,
> +	&dev_attr_cpuaffinity.attr,
> +	&dev_attr_cpulistaffinity.attr,
> +	NULL,
> +};
> +
> +static const struct attribute_group pcibus_group = {
> +	.attrs = pcibus_attrs,
> +};
> +
> +const struct attribute_group *pcibus_groups[] = {
> +	&pcibus_group,
> +	NULL,
>  };
>  
>  static ssize_t
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index d1182c4a..816c297f 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -151,7 +151,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
>  
>  }
>  extern struct device_attribute pci_dev_attrs[];
> -extern struct device_attribute pcibus_dev_attrs[];
> +extern const struct attribute_group *pcibus_groups[];
>  extern struct device_type pci_dev_type;
>  extern struct bus_attribute pci_bus_attrs[];
>  
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 46ada5c0..cf57fe79 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -96,7 +96,7 @@ static void release_pcibus_dev(struct device *dev)
>  static struct class pcibus_class = {
>  	.name		= "pci_bus",
>  	.dev_release	= &release_pcibus_dev,
> -	.dev_attrs	= pcibus_dev_attrs,
> +	.dev_groups	= pcibus_groups,
>  };
>  
>  static int __init pcibus_class_init(void)
> -- 
> 1.8.3.rc0.20.gb99dd2e
> 

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

* Re: [PATCH 04/36] tile: srom: convert srom_class to use dev_groups
  2013-07-24 22:05 ` [PATCH 04/36] tile: srom: convert srom_class " Greg Kroah-Hartman
@ 2013-07-25 21:11   ` Chris Metcalf
  2013-07-25 21:18     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 66+ messages in thread
From: Chris Metcalf @ 2013-07-25 21:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Arnd Bergmann

On 7/24/2013 6:13 PM, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the tile srom_class code to use
> the correct field.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/char/tile-srom.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)

I just got a failed build email from the kisskb build server:

drivers/char/tile-srom.c:308:2: error: initializer element is not computable at load time
drivers/char/tile-srom.c:308:2: error: (near initialization for 'srom_dev_attrs[0].mode')

plus a bunch of warnings:

drivers/char/tile-srom.c:307:2: warning: missing braces around initializer [-Wmissing-braces]
drivers/char/tile-srom.c:307:2: warning: (near initialization for 'srom_dev_attrs[0]') [-Wmissing-braces]
drivers/char/tile-srom.c:307:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/char/tile-srom.c:307:2: warning: (near initialization for 'srom_dev_attrs[0].name') [enabled by default]
drivers/char/tile-srom.c:308:2: warning: initialization makes integer from pointer without a cast [enabled by default]
drivers/char/tile-srom.c:308:2: warning: (near initialization for 'srom_dev_attrs[0].mode') [enabled by default]
drivers/char/tile-srom.c:309:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/char/tile-srom.c:309:2: warning: (near initialization for 'srom_dev_attrs[1].name') [enabled by default]
drivers/char/tile-srom.c:310:2: warning: initialization makes integer from pointer without a cast [enabled by default]
drivers/char/tile-srom.c:310:2: warning: (near initialization for 'srom_dev_attrs[1].mode') [enabled by default]
drivers/char/tile-srom.c:312:1: warning: initialization from incompatible pointer type [enabled by default]
drivers/char/tile-srom.c:312:1: warning: (near initialization for 'srom_dev_group.attrs') [enabled by default]
-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com

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

* Re: [PATCH 04/36] tile: srom: convert srom_class to use dev_groups
  2013-07-25 21:11   ` Chris Metcalf
@ 2013-07-25 21:18     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-25 21:18 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: linux-kernel, Arnd Bergmann

On Thu, Jul 25, 2013 at 05:11:57PM -0400, Chris Metcalf wrote:
> On 7/24/2013 6:13 PM, Greg Kroah-Hartman wrote:
> > The dev_attrs field of struct class is going away soon, dev_groups
> > should be used instead.  This converts the tile srom_class code to use
> > the correct field.
> > 
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/char/tile-srom.c | 28 ++++++++++++++++------------
> >  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> I just got a failed build email from the kisskb build server:
> 
> drivers/char/tile-srom.c:308:2: error: initializer element is not computable at load time
> drivers/char/tile-srom.c:308:2: error: (near initialization for 'srom_dev_attrs[0].mode')
> 
> plus a bunch of warnings:

Yes, I just fixed that and pushed out my changes, I forgot a '*', sorry
about that.

greg k-h

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

* Re: [PATCH 29/36] video: output: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 29/36] video: output: " Greg Kroah-Hartman
@ 2013-07-26  7:38   ` Tomi Valkeinen
  0 siblings, 0 replies; 66+ messages in thread
From: Tomi Valkeinen @ 2013-07-26  7:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Jean-Christophe Plagniol-Villard

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

Hi,

On 25/07/13 01:05, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the video output class code to
> use the correct field.
> 
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Jean-Christophe and Tomi, feel free to take this through your tree, or
> ACK it and I can take it through mine.
> 
>  drivers/video/output.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)

I can take this.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

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

* Re: [PATCH 17/36] PTP: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 17/36] PTP: " Greg Kroah-Hartman
@ 2013-07-26  9:19   ` Richard Cochran
  0 siblings, 0 replies; 66+ messages in thread
From: Richard Cochran @ 2013-07-26  9:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

On Wed, Jul 24, 2013 at 03:05:20PM -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the ptp class code to use the
> correct field.
> 
> Cc: Richard Cochran <richardcochran@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Richard, feel free to take this through your tree, or ACK it and I can take it
> through mine.

Please take this through your tree, as the PHC stuff has no tree of
its own, apart from the networking tree. I did also test this patch
briefly.

Acked-by: Richard Cochran <richardcochran@gmail.com>

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

* Re: [PATCH 09/36] ISDN: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 09/36] ISDN: " Greg Kroah-Hartman
@ 2013-07-26  9:38   ` Karsten Keil
  0 siblings, 0 replies; 66+ messages in thread
From: Karsten Keil @ 2013-07-26  9:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Karsten Keil

Am 25.07.2013 00:05, schrieb Greg Kroah-Hartman:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the mISDN class code to use the
> correct field.
> 
> Cc: Karsten Keil <isdn@linux-pingi.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Karsten Keil <isdn@linux-pingi.de>

> ---
> 
> Karsten, feel free to apply this to your tree, or ACK it and I can take it
> through mine.
> 
>  drivers/isdn/mISDN/core.c | 64 ++++++++++++++++++++++++++---------------------
>  1 file changed, 36 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
> index da30c5cb..faf50546 100644
> --- a/drivers/isdn/mISDN/core.c
> +++ b/drivers/isdn/mISDN/core.c
> @@ -37,8 +37,8 @@ static void mISDN_dev_release(struct device *dev)
>  	/* nothing to do: the device is part of its parent's data structure */
>  }
>  
> -static ssize_t _show_id(struct device *dev,
> -			struct device_attribute *attr, char *buf)
> +static ssize_t id_show(struct device *dev,
> +		       struct device_attribute *attr, char *buf)
>  {
>  	struct mISDNdevice *mdev = dev_to_mISDN(dev);
>  
> @@ -46,9 +46,10 @@ static ssize_t _show_id(struct device *dev,
>  		return -ENODEV;
>  	return sprintf(buf, "%d\n", mdev->id);
>  }
> +static DEVICE_ATTR_RO(id);
>  
> -static ssize_t _show_nrbchan(struct device *dev,
> -			     struct device_attribute *attr, char *buf)
> +static ssize_t nrbchan_show(struct device *dev,
> +			    struct device_attribute *attr, char *buf)
>  {
>  	struct mISDNdevice *mdev = dev_to_mISDN(dev);
>  
> @@ -56,9 +57,10 @@ static ssize_t _show_nrbchan(struct device *dev,
>  		return -ENODEV;
>  	return sprintf(buf, "%d\n", mdev->nrbchan);
>  }
> +static DEVICE_ATTR_RO(nrbchan);
>  
> -static ssize_t _show_d_protocols(struct device *dev,
> -				 struct device_attribute *attr, char *buf)
> +static ssize_t d_protocols_show(struct device *dev,
> +				struct device_attribute *attr, char *buf)
>  {
>  	struct mISDNdevice *mdev = dev_to_mISDN(dev);
>  
> @@ -66,9 +68,10 @@ static ssize_t _show_d_protocols(struct device *dev,
>  		return -ENODEV;
>  	return sprintf(buf, "%d\n", mdev->Dprotocols);
>  }
> +static DEVICE_ATTR_RO(d_protocols);
>  
> -static ssize_t _show_b_protocols(struct device *dev,
> -				 struct device_attribute *attr, char *buf)
> +static ssize_t b_protocols_show(struct device *dev,
> +				struct device_attribute *attr, char *buf)
>  {
>  	struct mISDNdevice *mdev = dev_to_mISDN(dev);
>  
> @@ -76,9 +79,10 @@ static ssize_t _show_b_protocols(struct device *dev,
>  		return -ENODEV;
>  	return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols());
>  }
> +static DEVICE_ATTR_RO(b_protocols);
>  
> -static ssize_t _show_protocol(struct device *dev,
> -			      struct device_attribute *attr, char *buf)
> +static ssize_t protocol_show(struct device *dev,
> +			     struct device_attribute *attr, char *buf)
>  {
>  	struct mISDNdevice *mdev = dev_to_mISDN(dev);
>  
> @@ -86,17 +90,19 @@ static ssize_t _show_protocol(struct device *dev,
>  		return -ENODEV;
>  	return sprintf(buf, "%d\n", mdev->D.protocol);
>  }
> +static DEVICE_ATTR_RO(protocol);
>  
> -static ssize_t _show_name(struct device *dev,
> -			  struct device_attribute *attr, char *buf)
> +static ssize_t name_show(struct device *dev,
> +			 struct device_attribute *attr, char *buf)
>  {
>  	strcpy(buf, dev_name(dev));
>  	return strlen(buf);
>  }
> +static DEVICE_ATTR_RO(name);
>  
>  #if 0 /* hangs */
> -static ssize_t _set_name(struct device *dev, struct device_attribute *attr,
> -			 const char *buf, size_t count)
> +static ssize_t name_set(struct device *dev, struct device_attribute *attr,
> +			const char *buf, size_t count)
>  {
>  	int err = 0;
>  	char *out = kmalloc(count + 1, GFP_KERNEL);
> @@ -113,10 +119,11 @@ static ssize_t _set_name(struct device *dev, struct device_attribute *attr,
>  
>  	return (err < 0) ? err : count;
>  }
> +static DEVICE_ATTR_RW(name);
>  #endif
>  
> -static ssize_t _show_channelmap(struct device *dev,
> -				struct device_attribute *attr, char *buf)
> +static ssize_t channelmap_show(struct device *dev,
> +			       struct device_attribute *attr, char *buf)
>  {
>  	struct mISDNdevice *mdev = dev_to_mISDN(dev);
>  	char *bp = buf;
> @@ -127,18 +134,19 @@ static ssize_t _show_channelmap(struct device *dev,
>  
>  	return bp - buf;
>  }
> -
> -static struct device_attribute mISDN_dev_attrs[] = {
> -	__ATTR(id,          S_IRUGO,         _show_id,          NULL),
> -	__ATTR(d_protocols, S_IRUGO,         _show_d_protocols, NULL),
> -	__ATTR(b_protocols, S_IRUGO,         _show_b_protocols, NULL),
> -	__ATTR(protocol,    S_IRUGO,         _show_protocol,    NULL),
> -	__ATTR(channelmap,  S_IRUGO,         _show_channelmap,  NULL),
> -	__ATTR(nrbchan,     S_IRUGO,         _show_nrbchan,     NULL),
> -	__ATTR(name,        S_IRUGO,         _show_name,        NULL),
> -/*	__ATTR(name,        S_IRUGO | S_IWUSR, _show_name,      _set_name), */
> -	{}
> +static DEVICE_ATTR_RO(channelmap);
> +
> +static struct attribute *mISDN_attrs[] = {
> +	&dev_attr_id.attr,
> +	&dev_attr_d_protocols.attr,
> +	&dev_attr_b_protocols.attr,
> +	&dev_attr_protocol.attr,
> +	&dev_attr_channelmap.attr,
> +	&dev_attr_nrbchan.attr,
> +	&dev_attr_name.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(mISDN);
>  
>  static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
>  {
> @@ -162,7 +170,7 @@ static struct class mISDN_class = {
>  	.name = "mISDN",
>  	.owner = THIS_MODULE,
>  	.dev_uevent = mISDN_uevent,
> -	.dev_attrs = mISDN_dev_attrs,
> +	.dev_groups = mISDN_groups,
>  	.dev_release = mISDN_dev_release,
>  	.class_release = mISDN_class_release,
>  };
> 


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

* Re: [PATCH 21/36] cuse: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 21/36] cuse: " Greg Kroah-Hartman
@ 2013-07-26 10:11   ` Miklos Szeredi
  0 siblings, 0 replies; 66+ messages in thread
From: Miklos Szeredi @ 2013-07-26 10:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Kernel Mailing List

On Thu, Jul 25, 2013 at 12:05 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the cuse class code to use the
> correct field.
>
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> Miklos, feel free to take this through your tree, or ACK it and I can
> take it through mine.

Thanks, Greg.  Please take it through your tree.

Acked-by: Miklos Szeredi <mszeredi@suse.cz>

Thanks,
Miklos

>
>  fs/fuse/cuse.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
> index aef34b1e..adbfd66b 100644
> --- a/fs/fuse/cuse.c
> +++ b/fs/fuse/cuse.c
> @@ -568,6 +568,7 @@ static ssize_t cuse_class_waiting_show(struct device *dev,
>
>         return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting));
>  }
> +static DEVICE_ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL);
>
>  static ssize_t cuse_class_abort_store(struct device *dev,
>                                       struct device_attribute *attr,
> @@ -578,12 +579,14 @@ static ssize_t cuse_class_abort_store(struct device *dev,
>         fuse_abort_conn(&cc->fc);
>         return count;
>  }
> +static DEVICE_ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store);
>
> -static struct device_attribute cuse_class_dev_attrs[] = {
> -       __ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL),
> -       __ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store),
> -       { }
> +static struct attribute *cuse_class_dev_attrs[] = {
> +       &dev_attr_waiting.attr,
> +       &dev_attr_abort.attr,
> +       NULL,
>  };
> +ATTRIBUTE_GROUPS(cuse_class_dev);
>
>  static struct miscdevice cuse_miscdev = {
>         .minor          = MISC_DYNAMIC_MINOR,
> @@ -609,7 +612,7 @@ static int __init cuse_init(void)
>         if (IS_ERR(cuse_class))
>                 return PTR_ERR(cuse_class);
>
> -       cuse_class->dev_attrs = cuse_class_dev_attrs;
> +       cuse_class->dev_groups = cuse_class_dev_groups;
>
>         rc = misc_register(&cuse_miscdev);
>         if (rc) {
> --
> 1.8.3.rc0.20.gb99dd2e
>

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

* Re: [PATCH 10/36] leds: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 10/36] leds: " Greg Kroah-Hartman
@ 2013-07-26 19:18   ` Bryan Wu
  0 siblings, 0 replies; 66+ messages in thread
From: Bryan Wu @ 2013-07-26 19:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: lkml, Richard Purdie

On Wed, Jul 24, 2013 at 3:05 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the led class code to use the
> correct field.
>
> Cc: Bryan Wu <cooloney@gmail.com>
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> Bryan and Richard, feel free to take this through your tree, or ACK it and I
> can take it through mine.
>

Looks good to me, please take it through yours with my ACK.
Acked-by: Bryan Wu <cooloney@gmail.com>

Thanks,
-Bryan

>  drivers/leds/led-class.c | 38 ++++++++++++++++++++++++++++++--------
>  1 file changed, 30 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 4336e37a..f37d63cf 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -29,7 +29,7 @@ static void led_update_brightness(struct led_classdev *led_cdev)
>                 led_cdev->brightness = led_cdev->brightness_get(led_cdev);
>  }
>
> -static ssize_t led_brightness_show(struct device *dev,
> +static ssize_t brightness_show(struct device *dev,
>                 struct device_attribute *attr, char *buf)
>  {
>         struct led_classdev *led_cdev = dev_get_drvdata(dev);
> @@ -40,7 +40,7 @@ static ssize_t led_brightness_show(struct device *dev,
>         return sprintf(buf, "%u\n", led_cdev->brightness);
>  }
>
> -static ssize_t led_brightness_store(struct device *dev,
> +static ssize_t brightness_store(struct device *dev,
>                 struct device_attribute *attr, const char *buf, size_t size)
>  {
>         struct led_classdev *led_cdev = dev_get_drvdata(dev);
> @@ -57,6 +57,7 @@ static ssize_t led_brightness_store(struct device *dev,
>
>         return size;
>  }
> +static DEVICE_ATTR_RW(brightness);
>
>  static ssize_t led_max_brightness_show(struct device *dev,
>                 struct device_attribute *attr, char *buf)
> @@ -65,14 +66,35 @@ static ssize_t led_max_brightness_show(struct device *dev,
>
>         return sprintf(buf, "%u\n", led_cdev->max_brightness);
>  }
> +static DEVICE_ATTR(max_brightness, 0444, led_max_brightness_show, NULL);
>
> -static struct device_attribute led_class_attrs[] = {
> -       __ATTR(brightness, 0644, led_brightness_show, led_brightness_store),
> -       __ATTR(max_brightness, 0444, led_max_brightness_show, NULL),
>  #ifdef CONFIG_LEDS_TRIGGERS
> -       __ATTR(trigger, 0644, led_trigger_show, led_trigger_store),
> +static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store);
> +static struct attribute *led_trigger_attrs[] = {
> +       &dev_attr_trigger.attr,
> +       NULL,
> +};
> +static const struct attribute_group led_trigger_group = {
> +       .attrs = led_trigger_attrs,
> +};
> +#endif
> +
> +static struct attribute *led_class_attrs[] = {
> +       &dev_attr_brightness.attr,
> +       &dev_attr_max_brightness.attr,
> +       NULL,
> +};
> +
> +static const struct attribute_group led_group = {
> +       .attrs = led_class_attrs,
> +};
> +
> +static const struct attribute_group *led_groups[] = {
> +       &led_group,
> +#ifdef CONFIG_LEDS_TRIGGERS
> +       &led_trigger_group,
>  #endif
> -       __ATTR_NULL,
> +       NULL,
>  };
>
>  static void led_timer_function(unsigned long data)
> @@ -258,7 +280,7 @@ static int __init leds_init(void)
>         if (IS_ERR(leds_class))
>                 return PTR_ERR(leds_class);
>         leds_class->pm = &leds_class_dev_pm_ops;
> -       leds_class->dev_attrs = led_class_attrs;
> +       leds_class->dev_groups = led_groups;
>         return 0;
>  }
>
> --
> 1.8.3.rc0.20.gb99dd2e
>

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

* Re: [PATCH 31/36] net: ieee802154: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 31/36] net: ieee802154: " Greg Kroah-Hartman
@ 2013-07-26 22:40   ` David Miller
  0 siblings, 0 replies; 66+ messages in thread
From: David Miller @ 2013-07-26 22:40 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, alex.bluesman.smirnov, dbaryshkov, netdev

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed, 24 Jul 2013 15:05:34 -0700

> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the ieee802154 class code to use
> the correct field.
> 
> Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> netdev@ maintainers, feel free to take this through your tree, or ACK it
> and I can take it through mine.

You can take it directly I don't anticipate any conflicts:

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH 30/36] net: core: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 30/36] net: core: " Greg Kroah-Hartman
@ 2013-07-26 22:40   ` David Miller
  0 siblings, 0 replies; 66+ messages in thread
From: David Miller @ 2013-07-26 22:40 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, netdev

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed, 24 Jul 2013 15:05:33 -0700

> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the networking core class code to
> use the correct field.
> 
> In order to do this in the "cleanest" way, some of the macros had to be
> changed to reflect the driver core format of naming show/store
> functions, which accounts for the majority of the churn in this file.
> 
> Cc: netdev@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> netdev@ maintainers, feel free to take this through your tree, or ACK it
> and I can take it through mine.

Likewise please take this through your tree Greg, thanks!

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH 19/36] rtc: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 19/36] rtc: " Greg Kroah-Hartman
@ 2013-07-28 13:23   ` Alessandro Zummo
  0 siblings, 0 replies; 66+ messages in thread
From: Alessandro Zummo @ 2013-07-28 13:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

On Wed, 24 Jul 2013 15:05:22 -0700
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the rtc class code to use the
> correct field.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Alessandro, feel free to take this through your tree, or ACK it and I
> can take it through mine.

 I'd appreciate if you can carry it.

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


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

* Re: [PATCH 36/36] pwm: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 36/36] pwm: convert class code to use dev_groups Greg Kroah-Hartman
@ 2013-07-29 11:40   ` Thierry Reding
  0 siblings, 0 replies; 66+ messages in thread
From: Thierry Reding @ 2013-07-29 11:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

On Wed, Jul 24, 2013 at 03:05:39PM -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the pwm class code to use the
> correct field.
> 
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Thierry, feel free to take this through your tree, or ACK it and I can
> take it through mine.
> 
>  drivers/pwm/sysfs.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 25/36] SCSI: sd: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 25/36] SCSI: sd: " Greg Kroah-Hartman
@ 2013-07-30 16:11   ` James Bottomley
  2013-07-30 19:01     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 66+ messages in thread
From: James Bottomley @ 2013-07-30 16:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-scsi

On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the scsi disk class code to use
> the correct field.
> 
> It required some functions to be moved around to place the show and
> store functions next to each other, the old order seemed to make no
> sense at all.
> 
> Cc: James E.J. Bottomley <JBottomley@parallels.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> James, feel free to take this through your tree, or ACK it and I can
> take it through mine.

Just found this ... I have the stable folder rule be git-send-email and
from you, so it picks up your patches as well.

I'll take it through my tree, just in case we're mucking about with
attributes this cycle around.

Thanks,

James


>  drivers/scsi/sd.c | 149 +++++++++++++++++++++++++++---------------------------
>  1 file changed, 75 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 80f39b8b..fdcbf567 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -132,8 +132,8 @@ static const char *sd_cache_types[] = {
>  };
>  
>  static ssize_t
> -sd_store_cache_type(struct device *dev, struct device_attribute *attr,
> -		    const char *buf, size_t count)
> +cache_type_store(struct device *dev, struct device_attribute *attr,
> +		 const char *buf, size_t count)
>  {
>  	int i, ct = -1, rcd, wce, sp;
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
> @@ -199,8 +199,18 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
>  }
>  
>  static ssize_t
> -sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr,
> -			   const char *buf, size_t count)
> +manage_start_stop_show(struct device *dev, struct device_attribute *attr,
> +		       char *buf)
> +{
> +	struct scsi_disk *sdkp = to_scsi_disk(dev);
> +	struct scsi_device *sdp = sdkp->device;
> +
> +	return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
> +}
> +
> +static ssize_t
> +manage_start_stop_store(struct device *dev, struct device_attribute *attr,
> +			const char *buf, size_t count)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	struct scsi_device *sdp = sdkp->device;
> @@ -212,10 +222,19 @@ sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr,
>  
>  	return count;
>  }
> +static DEVICE_ATTR_RW(manage_start_stop);
>  
>  static ssize_t
> -sd_store_allow_restart(struct device *dev, struct device_attribute *attr,
> -		       const char *buf, size_t count)
> +allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct scsi_disk *sdkp = to_scsi_disk(dev);
> +
> +	return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart);
> +}
> +
> +static ssize_t
> +allow_restart_store(struct device *dev, struct device_attribute *attr,
> +		    const char *buf, size_t count)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	struct scsi_device *sdp = sdkp->device;
> @@ -230,47 +249,30 @@ sd_store_allow_restart(struct device *dev, struct device_attribute *attr,
>  
>  	return count;
>  }
> +static DEVICE_ATTR_RW(allow_restart);
>  
>  static ssize_t
> -sd_show_cache_type(struct device *dev, struct device_attribute *attr,
> -		   char *buf)
> +cache_type_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	int ct = sdkp->RCD + 2*sdkp->WCE;
>  
>  	return snprintf(buf, 40, "%s\n", sd_cache_types[ct]);
>  }
> +static DEVICE_ATTR_RW(cache_type);
>  
>  static ssize_t
> -sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf)
> +FUA_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
>  	return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
>  }
> +static DEVICE_ATTR_RO(FUA);
>  
>  static ssize_t
> -sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr,
> -			  char *buf)
> -{
> -	struct scsi_disk *sdkp = to_scsi_disk(dev);
> -	struct scsi_device *sdp = sdkp->device;
> -
> -	return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
> -}
> -
> -static ssize_t
> -sd_show_allow_restart(struct device *dev, struct device_attribute *attr,
> -		      char *buf)
> -{
> -	struct scsi_disk *sdkp = to_scsi_disk(dev);
> -
> -	return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart);
> -}
> -
> -static ssize_t
> -sd_show_protection_type(struct device *dev, struct device_attribute *attr,
> -			char *buf)
> +protection_type_show(struct device *dev, struct device_attribute *attr,
> +		     char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
> @@ -278,8 +280,8 @@ sd_show_protection_type(struct device *dev, struct device_attribute *attr,
>  }
>  
>  static ssize_t
> -sd_store_protection_type(struct device *dev, struct device_attribute *attr,
> -			 const char *buf, size_t count)
> +protection_type_store(struct device *dev, struct device_attribute *attr,
> +		      const char *buf, size_t count)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	unsigned int val;
> @@ -298,10 +300,11 @@ sd_store_protection_type(struct device *dev, struct device_attribute *attr,
>  
>  	return count;
>  }
> +static DEVICE_ATTR_RW(protection_type);
>  
>  static ssize_t
> -sd_show_protection_mode(struct device *dev, struct device_attribute *attr,
> -			char *buf)
> +protection_mode_show(struct device *dev, struct device_attribute *attr,
> +		     char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	struct scsi_device *sdp = sdkp->device;
> @@ -320,24 +323,26 @@ sd_show_protection_mode(struct device *dev, struct device_attribute *attr,
>  
>  	return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif);
>  }
> +static DEVICE_ATTR_RO(protection_mode);
>  
>  static ssize_t
> -sd_show_app_tag_own(struct device *dev, struct device_attribute *attr,
> -		    char *buf)
> +app_tag_own_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
>  	return snprintf(buf, 20, "%u\n", sdkp->ATO);
>  }
> +static DEVICE_ATTR_RO(app_tag_own);
>  
>  static ssize_t
> -sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr,
> -			  char *buf)
> +thin_provisioning_show(struct device *dev, struct device_attribute *attr,
> +		       char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
>  	return snprintf(buf, 20, "%u\n", sdkp->lbpme);
>  }
> +static DEVICE_ATTR_RO(thin_provisioning);
>  
>  static const char *lbp_mode[] = {
>  	[SD_LBP_FULL]		= "full",
> @@ -349,8 +354,8 @@ static const char *lbp_mode[] = {
>  };
>  
>  static ssize_t
> -sd_show_provisioning_mode(struct device *dev, struct device_attribute *attr,
> -			  char *buf)
> +provisioning_mode_show(struct device *dev, struct device_attribute *attr,
> +		       char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
> @@ -358,8 +363,8 @@ sd_show_provisioning_mode(struct device *dev, struct device_attribute *attr,
>  }
>  
>  static ssize_t
> -sd_store_provisioning_mode(struct device *dev, struct device_attribute *attr,
> -			   const char *buf, size_t count)
> +provisioning_mode_store(struct device *dev, struct device_attribute *attr,
> +			const char *buf, size_t count)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	struct scsi_device *sdp = sdkp->device;
> @@ -385,10 +390,11 @@ sd_store_provisioning_mode(struct device *dev, struct device_attribute *attr,
>  
>  	return count;
>  }
> +static DEVICE_ATTR_RW(provisioning_mode);
>  
>  static ssize_t
> -sd_show_max_medium_access_timeouts(struct device *dev,
> -				   struct device_attribute *attr, char *buf)
> +max_medium_access_timeouts_show(struct device *dev,
> +				struct device_attribute *attr, char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
> @@ -396,9 +402,9 @@ sd_show_max_medium_access_timeouts(struct device *dev,
>  }
>  
>  static ssize_t
> -sd_store_max_medium_access_timeouts(struct device *dev,
> -				    struct device_attribute *attr,
> -				    const char *buf, size_t count)
> +max_medium_access_timeouts_store(struct device *dev,
> +				 struct device_attribute *attr, const char *buf,
> +				 size_t count)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	int err;
> @@ -410,10 +416,11 @@ sd_store_max_medium_access_timeouts(struct device *dev,
>  
>  	return err ? err : count;
>  }
> +static DEVICE_ATTR_RW(max_medium_access_timeouts);
>  
>  static ssize_t
> -sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr,
> -			  char *buf)
> +max_write_same_blocks_show(struct device *dev, struct device_attribute *attr,
> +			   char *buf)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  
> @@ -421,8 +428,8 @@ sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr,
>  }
>  
>  static ssize_t
> -sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
> -			   const char *buf, size_t count)
> +max_write_same_blocks_store(struct device *dev, struct device_attribute *attr,
> +			    const char *buf, size_t count)
>  {
>  	struct scsi_disk *sdkp = to_scsi_disk(dev);
>  	struct scsi_device *sdp = sdkp->device;
> @@ -451,35 +458,29 @@ sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
>  
>  	return count;
>  }
> -
> -static struct device_attribute sd_disk_attrs[] = {
> -	__ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type,
> -	       sd_store_cache_type),
> -	__ATTR(FUA, S_IRUGO, sd_show_fua, NULL),
> -	__ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart,
> -	       sd_store_allow_restart),
> -	__ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop,
> -	       sd_store_manage_start_stop),
> -	__ATTR(protection_type, S_IRUGO|S_IWUSR, sd_show_protection_type,
> -	       sd_store_protection_type),
> -	__ATTR(protection_mode, S_IRUGO, sd_show_protection_mode, NULL),
> -	__ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL),
> -	__ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL),
> -	__ATTR(provisioning_mode, S_IRUGO|S_IWUSR, sd_show_provisioning_mode,
> -	       sd_store_provisioning_mode),
> -	__ATTR(max_write_same_blocks, S_IRUGO|S_IWUSR,
> -	       sd_show_write_same_blocks, sd_store_write_same_blocks),
> -	__ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR,
> -	       sd_show_max_medium_access_timeouts,
> -	       sd_store_max_medium_access_timeouts),
> -	__ATTR_NULL,
> +static DEVICE_ATTR_RW(max_write_same_blocks);
> +
> +static struct attribute *sd_disk_attrs[] = {
> +	&dev_attr_cache_type.attr,
> +	&dev_attr_FUA.attr,
> +	&dev_attr_allow_restart.attr,
> +	&dev_attr_manage_start_stop.attr,
> +	&dev_attr_protection_type.attr,
> +	&dev_attr_protection_mode.attr,
> +	&dev_attr_app_tag_own.attr,
> +	&dev_attr_thin_provisioning.attr,
> +	&dev_attr_provisioning_mode.attr,
> +	&dev_attr_max_write_same_blocks.attr,
> +	&dev_attr_max_medium_access_timeouts.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(sd_disk);
>  
>  static struct class sd_disk_class = {
>  	.name		= "scsi_disk",
>  	.owner		= THIS_MODULE,
>  	.dev_release	= scsi_disk_release,
> -	.dev_attrs	= sd_disk_attrs,
> +	.dev_groups	= sd_disk_groups,
>  };
>  
>  static const struct dev_pm_ops sd_pm_ops = {



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

* Re: [PATCH 26/36] SCSI: st: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 26/36] SCSI: st: " Greg Kroah-Hartman
@ 2013-07-30 18:27     ` James Bottomley
  2013-07-31  6:03   ` Kai Mäkisara
  1 sibling, 0 replies; 66+ messages in thread
From: James Bottomley @ 2013-07-30 18:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Kai Mäkisara, linux-scsi

Adding linux-scsi to cc.

James

On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the scsi tape class code to use
> the correct field.
> 
> Cc: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
> Cc: James E.J. Bottomley <JBottomley@parallels.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> James, feel free to take this through your tree, or ACK it and I can
> take it through mine.
> 
>  drivers/scsi/st.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index 2a32036a..ff44b3c2 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -82,7 +82,7 @@ static int try_rdio = 1;
>  static int try_wdio = 1;
>  
>  static struct class st_sysfs_class;
> -static struct device_attribute st_dev_attrs[];
> +static const struct attribute_group *st_dev_groups[];
>  
>  MODULE_AUTHOR("Kai Makisara");
>  MODULE_DESCRIPTION("SCSI tape (st) driver");
> @@ -4274,7 +4274,7 @@ static void scsi_tape_release(struct kref *kref)
>  
>  static struct class st_sysfs_class = {
>  	.name = "scsi_tape",
> -	.dev_attrs = st_dev_attrs,
> +	.dev_groups = st_dev_groups,
>  };
>  
>  static int __init init_st(void)
> @@ -4408,6 +4408,7 @@ defined_show(struct device *dev, struct device_attribute *attr, char *buf)
>  	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined);
>  	return l;
>  }
> +static DEVICE_ATTR_RO(defined);
>  
>  static ssize_t
>  default_blksize_show(struct device *dev, struct device_attribute *attr,
> @@ -4419,7 +4420,7 @@ default_blksize_show(struct device *dev, struct device_attribute *attr,
>  	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize);
>  	return l;
>  }
> -
> +static DEVICE_ATTR_RO(default_blksize);
>  
>  static ssize_t
>  default_density_show(struct device *dev, struct device_attribute *attr,
> @@ -4433,6 +4434,7 @@ default_density_show(struct device *dev, struct device_attribute *attr,
>  	l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density);
>  	return l;
>  }
> +static DEVICE_ATTR_RO(default_density);
>  
>  static ssize_t
>  default_compression_show(struct device *dev, struct device_attribute *attr,
> @@ -4444,6 +4446,7 @@ default_compression_show(struct device *dev, struct device_attribute *attr,
>  	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1);
>  	return l;
>  }
> +static DEVICE_ATTR_RO(default_compression);
>  
>  static ssize_t
>  options_show(struct device *dev, struct device_attribute *attr, char *buf)
> @@ -4472,15 +4475,17 @@ options_show(struct device *dev, struct device_attribute *attr, char *buf)
>  	l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
>  	return l;
>  }
> -
> -static struct device_attribute st_dev_attrs[] = {
> -	__ATTR_RO(defined),
> -	__ATTR_RO(default_blksize),
> -	__ATTR_RO(default_density),
> -	__ATTR_RO(default_compression),
> -	__ATTR_RO(options),
> -	__ATTR_NULL,
> +static DEVICE_ATTR_RO(options);
> +
> +static struct attribute *st_dev_attrs[] = {
> +	&dev_attr_defined.attr,
> +	&dev_attr_default_blksize.attr,
> +	&dev_attr_default_density.attr,
> +	&dev_attr_default_compression.attr,
> +	&dev_attr_options.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(st_dev);
>  
>  /* The following functions may be useful for a larger audience. */
>  static int sgl_map_user_pages(struct st_buffer *STbp,



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

* Re: [PATCH 26/36] SCSI: st: convert class code to use dev_groups
@ 2013-07-30 18:27     ` James Bottomley
  0 siblings, 0 replies; 66+ messages in thread
From: James Bottomley @ 2013-07-30 18:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Kai Mäkisara, linux-scsi

Adding linux-scsi to cc.

James

On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the scsi tape class code to use
> the correct field.
> 
> Cc: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
> Cc: James E.J. Bottomley <JBottomley@parallels.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> James, feel free to take this through your tree, or ACK it and I can
> take it through mine.
> 
>  drivers/scsi/st.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index 2a32036a..ff44b3c2 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -82,7 +82,7 @@ static int try_rdio = 1;
>  static int try_wdio = 1;
>  
>  static struct class st_sysfs_class;
> -static struct device_attribute st_dev_attrs[];
> +static const struct attribute_group *st_dev_groups[];
>  
>  MODULE_AUTHOR("Kai Makisara");
>  MODULE_DESCRIPTION("SCSI tape (st) driver");
> @@ -4274,7 +4274,7 @@ static void scsi_tape_release(struct kref *kref)
>  
>  static struct class st_sysfs_class = {
>  	.name = "scsi_tape",
> -	.dev_attrs = st_dev_attrs,
> +	.dev_groups = st_dev_groups,
>  };
>  
>  static int __init init_st(void)
> @@ -4408,6 +4408,7 @@ defined_show(struct device *dev, struct device_attribute *attr, char *buf)
>  	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined);
>  	return l;
>  }
> +static DEVICE_ATTR_RO(defined);
>  
>  static ssize_t
>  default_blksize_show(struct device *dev, struct device_attribute *attr,
> @@ -4419,7 +4420,7 @@ default_blksize_show(struct device *dev, struct device_attribute *attr,
>  	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize);
>  	return l;
>  }
> -
> +static DEVICE_ATTR_RO(default_blksize);
>  
>  static ssize_t
>  default_density_show(struct device *dev, struct device_attribute *attr,
> @@ -4433,6 +4434,7 @@ default_density_show(struct device *dev, struct device_attribute *attr,
>  	l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density);
>  	return l;
>  }
> +static DEVICE_ATTR_RO(default_density);
>  
>  static ssize_t
>  default_compression_show(struct device *dev, struct device_attribute *attr,
> @@ -4444,6 +4446,7 @@ default_compression_show(struct device *dev, struct device_attribute *attr,
>  	l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1);
>  	return l;
>  }
> +static DEVICE_ATTR_RO(default_compression);
>  
>  static ssize_t
>  options_show(struct device *dev, struct device_attribute *attr, char *buf)
> @@ -4472,15 +4475,17 @@ options_show(struct device *dev, struct device_attribute *attr, char *buf)
>  	l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
>  	return l;
>  }
> -
> -static struct device_attribute st_dev_attrs[] = {
> -	__ATTR_RO(defined),
> -	__ATTR_RO(default_blksize),
> -	__ATTR_RO(default_density),
> -	__ATTR_RO(default_compression),
> -	__ATTR_RO(options),
> -	__ATTR_NULL,
> +static DEVICE_ATTR_RO(options);
> +
> +static struct attribute *st_dev_attrs[] = {
> +	&dev_attr_defined.attr,
> +	&dev_attr_default_blksize.attr,
> +	&dev_attr_default_density.attr,
> +	&dev_attr_default_compression.attr,
> +	&dev_attr_options.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(st_dev);
>  
>  /* The following functions may be useful for a larger audience. */
>  static int sgl_map_user_pages(struct st_buffer *STbp,


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 25/36] SCSI: sd: convert class code to use dev_groups
  2013-07-30 16:11   ` James Bottomley
@ 2013-07-30 19:01     ` Greg Kroah-Hartman
  2013-07-30 19:22       ` James Bottomley
  0 siblings, 1 reply; 66+ messages in thread
From: Greg Kroah-Hartman @ 2013-07-30 19:01 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-kernel, linux-scsi

On Tue, Jul 30, 2013 at 04:11:52PM +0000, James Bottomley wrote:
> On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> > The dev_attrs field of struct class is going away soon, dev_groups
> > should be used instead.  This converts the scsi disk class code to use
> > the correct field.
> > 
> > It required some functions to be moved around to place the show and
> > store functions next to each other, the old order seemed to make no
> > sense at all.
> > 
> > Cc: James E.J. Bottomley <JBottomley@parallels.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > 
> > James, feel free to take this through your tree, or ACK it and I can
> > take it through mine.
> 
> Just found this ... I have the stable folder rule be git-send-email and
> from you, so it picks up your patches as well.

It seems you aren't the only one who has procmail rules for my emails :)

I wonder if I need to start sending my stable stuff out from a different
email address...

> I'll take it through my tree, just in case we're mucking about with
> attributes this cycle around.

That's fine with me, thanks.

greg k-h

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

* Re: [PATCH 25/36] SCSI: sd: convert class code to use dev_groups
  2013-07-30 19:01     ` Greg Kroah-Hartman
@ 2013-07-30 19:22       ` James Bottomley
  0 siblings, 0 replies; 66+ messages in thread
From: James Bottomley @ 2013-07-30 19:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-scsi

On Tue, 2013-07-30 at 12:01 -0700, Greg Kroah-Hartman wrote:
> On Tue, Jul 30, 2013 at 04:11:52PM +0000, James Bottomley wrote:
> > On Wed, 2013-07-24 at 15:05 -0700, Greg Kroah-Hartman wrote:
> > > The dev_attrs field of struct class is going away soon, dev_groups
> > > should be used instead.  This converts the scsi disk class code to use
> > > the correct field.
> > > 
> > > It required some functions to be moved around to place the show and
> > > store functions next to each other, the old order seemed to make no
> > > sense at all.
> > > 
> > > Cc: James E.J. Bottomley <JBottomley@parallels.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > > 
> > > James, feel free to take this through your tree, or ACK it and I can
> > > take it through mine.
> > 
> > Just found this ... I have the stable folder rule be git-send-email and
> > from you, so it picks up your patches as well.
> 
> It seems you aren't the only one who has procmail rules for my emails :)

It's not that I don't like you, I procmail it to a different folder
because of mobile phones: my inbox is about 50 deep and a stable patch
run can basically empty the cache ... this can be damn annoying if your
hotel reservation is number 51.

> I wonder if I need to start sending my stable stuff out from a different
> email address...

You don't need a different address, just use a different tag.  I tag all
SCSI git email with 

X-Git-Tree: SCSI

Ben Hutchings tags all his stable email with:

X-mailer: LinuxStableQueue (scripts by bwh)

and so on ... any header tag does ... I'm sure git-send-email can be
persuaded to add a more meaningful one.

> > I'll take it through my tree, just in case we're mucking about with
> > attributes this cycle around.
> 
> That's fine with me, thanks.

OK, adding it to the testing queue now.

James


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

* Re: [PATCH 26/36] SCSI: st: convert class code to use dev_groups
  2013-07-24 22:05 ` [PATCH 26/36] SCSI: st: " Greg Kroah-Hartman
  2013-07-30 18:27     ` James Bottomley
@ 2013-07-31  6:03   ` Kai Mäkisara
  1 sibling, 0 replies; 66+ messages in thread
From: Kai Mäkisara @ 2013-07-31  6:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, James E.J. Bottomley


On 25.7.2013, at 1.05, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> The dev_attrs field of struct class is going away soon, dev_groups
> should be used instead.  This converts the scsi tape class code to use
> the correct field.
> 
> Cc: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
> Cc: James E.J. Bottomley <JBottomley@parallels.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>

> 
> James, feel free to take this through your tree, or ACK it and I can
> take it through mine.
> 
> drivers/scsi/st.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index 2a32036a..ff44b3c2 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -82,7 +82,7 @@ static int try_rdio = 1;
> static int try_wdio = 1;
> 
…

Thanks,
Kai


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

end of thread, other threads:[~2013-07-31  6:10 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-24 22:05 [PATCH 00/36] remove dev_attrs usage in 'struct class' Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 01/36] misc: c2port: use dev_bin_attrs instead of hand-coding it Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 02/36] mips: convert vpe_class to use dev_groups Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 03/36] bsr: convert bsr_class " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 04/36] tile: srom: convert srom_class " Greg Kroah-Hartman
2013-07-25 21:11   ` Chris Metcalf
2013-07-25 21:18     ` Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 05/36] dma: convert dma_devclass " Greg Kroah-Hartman
2013-07-25  8:40   ` Vinod Koul
2013-07-24 22:05 ` [PATCH 06/36] devfreq: convert devfreq_class " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 07/36] extcon: convert extcon_class " Greg Kroah-Hartman
2013-07-24 23:53   ` Chanwoo Choi
2013-07-24 22:05 ` [PATCH 08/36] HID: roccat: convert class code " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 09/36] ISDN: " Greg Kroah-Hartman
2013-07-26  9:38   ` Karsten Keil
2013-07-24 22:05 ` [PATCH 10/36] leds: " Greg Kroah-Hartman
2013-07-26 19:18   ` Bryan Wu
2013-07-24 22:05 ` [PATCH 11/36] v4l2: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 12/36] c2port: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 13/36] enclosure: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 14/36] PCI: " Greg Kroah-Hartman
2013-07-25 18:09   ` Bjorn Helgaas
2013-07-24 22:05 ` [PATCH 15/36] x86: wmi: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 16/36] PPS: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 17/36] PTP: " Greg Kroah-Hartman
2013-07-26  9:19   ` Richard Cochran
2013-07-24 22:05 ` [PATCH 18/36] regulator: " Greg Kroah-Hartman
2013-07-25  9:30   ` Mark Brown
2013-07-24 22:05 ` [PATCH 19/36] rtc: " Greg Kroah-Hartman
2013-07-28 13:23   ` Alessandro Zummo
2013-07-24 22:05 ` [PATCH 20/36] UIO: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 21/36] cuse: " Greg Kroah-Hartman
2013-07-26 10:11   ` Miklos Szeredi
2013-07-24 22:05 ` [PATCH 22/36] staging: comedi: " Greg Kroah-Hartman
2013-07-24 22:11   ` H Hartley Sweeten
2013-07-24 22:26     ` Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 23/36] backing-dev: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 24/36] SCSI: OSD: " Greg Kroah-Hartman
2013-07-25  8:38   ` Boaz Harrosh
2013-07-24 22:05 ` [PATCH 25/36] SCSI: sd: " Greg Kroah-Hartman
2013-07-30 16:11   ` James Bottomley
2013-07-30 19:01     ` Greg Kroah-Hartman
2013-07-30 19:22       ` James Bottomley
2013-07-24 22:05 ` [PATCH 26/36] SCSI: st: " Greg Kroah-Hartman
2013-07-30 18:27   ` James Bottomley
2013-07-30 18:27     ` James Bottomley
2013-07-31  6:03   ` Kai Mäkisara
2013-07-24 22:05 ` [PATCH 27/36] video: backlight: " Greg Kroah-Hartman
2013-07-25  1:51   ` Jingoo Han
2013-07-24 22:05 ` [PATCH 28/36] video: backlight: lcd: " Greg Kroah-Hartman
2013-07-25  1:51   ` Jingoo Han
2013-07-24 22:05 ` [PATCH 29/36] video: output: " Greg Kroah-Hartman
2013-07-26  7:38   ` Tomi Valkeinen
2013-07-24 22:05 ` [PATCH 30/36] net: core: " Greg Kroah-Hartman
2013-07-26 22:40   ` David Miller
2013-07-24 22:05 ` [PATCH 31/36] net: ieee802154: " Greg Kroah-Hartman
2013-07-26 22:40   ` David Miller
2013-07-24 22:05 ` [PATCH 32/36] net: wireless: " Greg Kroah-Hartman
2013-07-25  7:50   ` Johannes Berg
2013-07-24 22:05 ` [PATCH 33/36] net: rfkill: " Greg Kroah-Hartman
2013-07-25  7:52   ` Johannes Berg
2013-07-25  7:52     ` Johannes Berg
2013-07-24 22:05 ` [PATCH 34/36] c2port: convert class code to use bin_attrs in groups Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 35/36] hid: roccat: " Greg Kroah-Hartman
2013-07-24 22:05 ` [PATCH 36/36] pwm: convert class code to use dev_groups Greg Kroah-Hartman
2013-07-29 11:40   ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.