Skip to contentSkip to conversation

staging: greybus: Remove unused macro

PATCH In review Michail Tatas 2 participants 2 messages May 27 – Jun 15

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: Remove unused macro

Remove unused macro as indicated by the compiler
when building with make W=2

---
 drivers/staging/greybus/loopback.c | 26 --------------------------
 1 file changed, 26 deletions(-)
drivers/staging/greybus/loopback.c +0 -26
index 4d085d3cd471..7442b1c4e86c 100644
@@ -167,32 +167,6 @@ static DEVICE_ATTR_RO(name##_avg)
 	gb_loopback_ro_stats_attr(field, max, u);		\
 	gb_loopback_ro_avg_attr(field)
 
-#define gb_loopback_attr(field, type)					\
-static ssize_t field##_show(struct device *dev,				\
-			    struct device_attribute *attr,		\
-			    char *buf)					\
-{									\
-	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sysfs_emit(buf, "%" #type "\n", gb->field);			\
-}									\
-static ssize_t field##_store(struct device *dev,			\
-			    struct device_attribute *attr,		\
-			    const char *buf,				\
-			    size_t len)					\
-{									\
-	int ret;							\
-	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	mutex_lock(&gb->mutex);						\
-	ret = sscanf(buf, "%"#type, &gb->field);			\
-	if (ret != 1)							\
-		len = -EINVAL;						\
-	else								\
-		gb_loopback_check_attr(gb, bundle);			\
-	mutex_unlock(&gb->mutex);					\
-	return len;							\
-}									\
-static DEVICE_ATTR_RW(field)
-
 #define gb_dev_loopback_ro_attr(field)				\
 static ssize_t field##_show(struct device *dev,		\
 			    struct device_attribute *attr,		\
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 2 lines · Michail Tatas

Remove unused macro as indicated by the compiler
when building with make W=2

W=2 even works for staging drivers? I wouldn't worry about that at all :)

Quoted 28 lines
---
 drivers/staging/greybus/loopback.c | 26 --------------------------
 1 file changed, 26 deletions(-)
drivers/staging/greybus/loopback.c +0 -15
index 4d085d3cd471..7442b1c4e86c 100644
@@ -167,32 +167,6 @@ static DEVICE_ATTR_RO(name##_avg)
 	gb_loopback_ro_stats_attr(field, max, u);		\
 	gb_loopback_ro_avg_attr(field)
 
-#define gb_loopback_attr(field, type)					\
-static ssize_t field##_show(struct device *dev,				\
-			    struct device_attribute *attr,		\
-			    char *buf)					\
-{									\
-	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sysfs_emit(buf, "%" #type "\n", gb->field);			\
-}									\
-static ssize_t field##_store(struct device *dev,			\
-			    struct device_attribute *attr,		\
-			    const char *buf,				\
-			    size_t len)					\
-{									\
-	int ret;							\
-	struct gb_loopback *gb = dev_get_drvdata(dev);			\

drivers/staging/greybus/loopback.c static DEVICE_ATTR_RO(name##_avg) · line 194

Quoted 10 lines
drivers/staging/greybus/loopback.c +0 -10
-	mutex_lock(&gb->mutex);						\
-	ret = sscanf(buf, "%"#type, &gb->field);			\
-	if (ret != 1)							\
-		len = -EINVAL;						\
-	else								\
-		gb_loopback_check_attr(gb, bundle);			\
-	mutex_unlock(&gb->mutex);					\
-	return len;							\
-}									\
-static DEVICE_ATTR_RW(field)

I see why this is present, it makes it more uniform. That being said, as it's not being used anywhere, I can understand the confusion even if there is not any produced code difference at all.

I'll queue this up after -rc1 is out.

thanks,

greg k-h