fix errors from running scripts/checkpatch.pl, including: - Added spaces before open braces and parentheses where required. - Resolved macro argument precedence issues by adding parentheses. - Corrected trailing whitespace and improper indentation. No functional changes introduced, just cleanups for better code quality. Signed-off-by: Sayyad Abid <sayyad.abid16@xxxxxxxxx> --- drivers/staging/greybus/loopback.c | 58 ++++++++++++++++-------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 1f19323b0e1a..3e39a90cf86c 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -163,35 +163,39 @@ static ssize_t name##_avg_show(struct device *dev, \ static DEVICE_ATTR_RO(name##_avg) #define gb_loopback_stats_attrs(field) \ - gb_loopback_ro_stats_attr(field, min, u); \ - gb_loopback_ro_stats_attr(field, max, u); \ - gb_loopback_ro_avg_attr(field) + do { \ + gb_loopback_ro_stats_attr(field, min, u); \ + gb_loopback_ro_stats_attr(field, max, u); \ + gb_loopback_ro_avg_attr(field) \ + } while (0) #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 sprintf(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) +do { \ + static ssize_t field##_show(struct device *dev \ + struct device_attribute *attr, \ + char *buf) \ + { \ + struct gb_loopback *gb = dev_get_drvdata(dev); \ + return sprintf(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 \ +} while (0) #define gb_dev_loopback_ro_attr(field, conn) \ static ssize_t field##_show(struct device *dev, \ -- 2.39.2 _______________________________________________ greybus-dev mailing list -- greybus-dev@xxxxxxxxxxxxxxxx To unsubscribe send an email to greybus-dev-leave@xxxxxxxxxxxxxxxx