Skip to contentSkip to conversation

driver core: remove CLASS_ATTR usage

PATCH In review Greg KH 2 participants 3 messages Jun 6, 2017 – Jun 7, 2017

Subsystems (2)
lore
Share & tools
lore

Greg KH

author maintainer
#0 lore raw

PATCH 1/1 driver core: remove CLASS_ATTR usage

From: Greg Kroah-Hartman <[email protected]>

There was only 2 remaining users of CLASS_ATTR() so let's finally get rid of them and force everyone to use the correct RW/RO/WO versions instead.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>

---

PPC maintainers, can I take this in my driver core tree? I'm doing some cleanups of device.h and this was one of the simpler ones at the moment.

thanks,

greg k-h

 arch/powerpc/platforms/pseries/dlpar.c    |    2 +-
 arch/powerpc/platforms/pseries/mobility.c |    7 ++++---
 include/linux/device.h                    |    2 --
 3 files changed, 5 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/dlpar.c +1 -1
@@ -588,7 +588,7 @@ static ssize_t dlpar_show(struct class *
 	return sprintf(buf, "%s\n", "memory,cpu");
 }
 
-static CLASS_ATTR(dlpar, S_IWUSR | S_IRUSR, dlpar_show, dlpar_store);
+static CLASS_ATTR_RW(dlpar);
 
 static int __init pseries_dlpar_init(void)
 {
arch/powerpc/platforms/pseries/mobility.c +4 -3
@@ -349,8 +349,9 @@ void post_mobility_fixup(void)
 	return;
 }
 
-static ssize_t migrate_store(struct class *class, struct class_attribute *attr,
-			     const char *buf, size_t count)
+static ssize_t migration_store(struct class *class,
+			       struct class_attribute *attr, const char *buf,
+			       size_t count)
 {
 	u64 streamid;
 	int rc;
@@ -380,7 +381,7 @@ static ssize_t migrate_store(struct clas
  */
 #define MIGRATION_API_VERSION	1
 
-static CLASS_ATTR(migration, S_IWUSR, NULL, migrate_store);
+static CLASS_ATTR_WO(migration);
 static CLASS_ATTR_STRING(api_version, S_IRUGO, __stringify(MIGRATION_API_VERSION));
 
 static int __init mobility_sysfs_init(void)
include/linux/device.h +0 -2
@@ -465,8 +465,6 @@ struct class_attribute {
 			const char *buf, size_t count);
 };
 
-#define CLASS_ATTR(_name, _mode, _show, _store) \
-	struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
 #define CLASS_ATTR_RW(_name) \
 	struct class_attribute class_attr_##_name = __ATTR_RW(_name)
 #define CLASS_ATTR_RO(_name) \
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Greg KH

From: Greg Kroah-Hartman <[email protected]>

There was only 2 remaining users of CLASS_ATTR() so let's finally get rid of them and force everyone to use the correct RW/RO/WO versions instead.

Quoted 8 lines
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>

---

PPC maintainers, can I take this in my driver core tree? I'm doing some cleanups of device.h and this was one of the simpler ones at the moment.

Yeah looks good to me, I did a quick build test and it was OK.

cheers

author maintainer
#2 lore raw
Quoted 14 lines · Michael Ellerman
Quoted 12 lines · Greg KH

From: Greg Kroah-Hartman <[email protected]>

There was only 2 remaining users of CLASS_ATTR() so let's finally get rid of them and force everyone to use the correct RW/RO/WO versions instead.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>

---

Quoted 6 lines
Quoted 2 lines

PPC maintainers, can I take this in my driver core tree? I'm doing some cleanups of device.h and this was one of the simpler ones at the moment.

Yeah looks good to me, I did a quick build test and it was OK.

Wonderful, thanks for testing it out.

greg k-h