* [PATCH] staging: greybus: add declare_ to declaring macros
@ 2021-05-15 3:41 Shreyansh Chouhan
2021-05-15 5:33 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Shreyansh Chouhan @ 2021-05-15 3:41 UTC (permalink / raw)
To: pure.logic, johan, elder, gregkh
Cc: greybus-dev, linux-staging, linux-kernel, Shreyansh Chouhan
Prefixed the names of all the macros that were used for declaring things
with 'declare_'. This should help with clarifying about what these
macros do.
Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh630@gmail.com>
---
drivers/staging/greybus/loopback.c | 56 +++++++++++++++---------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 2471448ba42a..ddbeb33fa3c1 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -119,7 +119,7 @@ module_param(kfifo_depth, uint, 0444);
#define GB_LOOPBACK_US_WAIT_MAX 1000000
/* interface sysfs attributes */
-#define gb_loopback_ro_attr(field) \
+#define declare_gb_loopback_ro_attr(field) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -129,7 +129,7 @@ static ssize_t field##_show(struct device *dev, \
} \
static DEVICE_ATTR_RO(field)
-#define gb_loopback_ro_stats_attr(name, field, type) \
+#define declare_gb_loopback_ro_stats_attr(name, field, type) \
static ssize_t name##_##field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -142,7 +142,7 @@ static ssize_t name##_##field##_show(struct device *dev, \
} \
static DEVICE_ATTR_RO(name##_##field)
-#define gb_loopback_ro_avg_attr(name) \
+#define declare_gb_loopback_ro_avg_attr(name) \
static ssize_t name##_avg_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -162,12 +162,12 @@ 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)
+#define declare_gb_loopback_stats_attrs(field) \
+ declare_gb_loopback_ro_stats_attr(field, min, u); \
+ declare_gb_loopback_ro_stats_attr(field, max, u); \
+ declare_gb_loopback_ro_avg_attr(field)
-#define gb_loopback_attr(field, type) \
+#define declare_gb_loopback_attr(field, type) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -193,7 +193,7 @@ static ssize_t field##_store(struct device *dev, \
} \
static DEVICE_ATTR_RW(field)
-#define gb_dev_loopback_ro_attr(field, conn) \
+#define declare_gb_dev_loopback_ro_attr(field, conn) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -203,7 +203,7 @@ static ssize_t field##_show(struct device *dev, \
} \
static DEVICE_ATTR_RO(field)
-#define gb_dev_loopback_rw_attr(field, type) \
+#define declare_gb_dev_loopback_rw_attr(field, type) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -268,26 +268,26 @@ static void gb_loopback_check_attr(struct gb_loopback *gb)
}
/* Time to send and receive one message */
-gb_loopback_stats_attrs(latency);
+declare_gb_loopback_stats_attrs(latency);
/* Number of requests sent per second on this cport */
-gb_loopback_stats_attrs(requests_per_second);
+declare_gb_loopback_stats_attrs(requests_per_second);
/* Quantity of data sent and received on this cport */
-gb_loopback_stats_attrs(throughput);
+declare_gb_loopback_stats_attrs(throughput);
/* Latency across the UniPro link from APBridge's perspective */
-gb_loopback_stats_attrs(apbridge_unipro_latency);
+declare_gb_loopback_stats_attrs(apbridge_unipro_latency);
/* Firmware induced overhead in the GPBridge */
-gb_loopback_stats_attrs(gbphy_firmware_latency);
+declare_gb_loopback_stats_attrs(gbphy_firmware_latency);
/* Number of errors encountered during loop */
-gb_loopback_ro_attr(error);
+declare_gb_loopback_ro_attr(error);
/* Number of requests successfully completed async */
-gb_loopback_ro_attr(requests_completed);
+declare_gb_loopback_ro_attr(requests_completed);
/* Number of requests timed out async */
-gb_loopback_ro_attr(requests_timedout);
+declare_gb_loopback_ro_attr(requests_timedout);
/* Timeout minimum in useconds */
-gb_loopback_ro_attr(timeout_min);
+declare_gb_loopback_ro_attr(timeout_min);
/* Timeout minimum in useconds */
-gb_loopback_ro_attr(timeout_max);
+declare_gb_loopback_ro_attr(timeout_max);
/*
* Type of loopback message to send based on protocol type definitions
@@ -297,21 +297,21 @@ gb_loopback_ro_attr(timeout_max);
* payload returned in response)
* 4 => Send a sink message (message with payload, no payload in response)
*/
-gb_dev_loopback_rw_attr(type, d);
+declare_gb_dev_loopback_rw_attr(type, d);
/* Size of transfer message payload: 0-4096 bytes */
-gb_dev_loopback_rw_attr(size, u);
+declare_gb_dev_loopback_rw_attr(size, u);
/* Time to wait between two messages: 0-1000 ms */
-gb_dev_loopback_rw_attr(us_wait, d);
+declare_gb_dev_loopback_rw_attr(us_wait, d);
/* Maximum iterations for a given operation: 1-(2^32-1), 0 implies infinite */
-gb_dev_loopback_rw_attr(iteration_max, u);
+declare_gb_dev_loopback_rw_attr(iteration_max, u);
/* The current index of the for (i = 0; i < iteration_max; i++) loop */
-gb_dev_loopback_ro_attr(iteration_count, false);
+declare_gb_dev_loopback_ro_attr(iteration_count, false);
/* A flag to indicate synchronous or asynchronous operations */
-gb_dev_loopback_rw_attr(async, u);
+declare_gb_dev_loopback_rw_attr(async, u);
/* Timeout of an individual asynchronous request */
-gb_dev_loopback_rw_attr(timeout, u);
+declare_gb_dev_loopback_rw_attr(timeout, u);
/* Maximum number of in-flight operations before back-off */
-gb_dev_loopback_rw_attr(outstanding_operations_max, u);
+declare_gb_dev_loopback_rw_attr(outstanding_operations_max, u);
static struct attribute *loopback_attrs[] = {
&dev_attr_latency_min.attr,
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: greybus: add declare_ to declaring macros
2021-05-15 3:41 [PATCH] staging: greybus: add declare_ to declaring macros Shreyansh Chouhan
@ 2021-05-15 5:33 ` Greg KH
2021-05-15 5:58 ` Shreyansh Chouhan
2021-05-15 6:55 ` Joe Perches
0 siblings, 2 replies; 5+ messages in thread
From: Greg KH @ 2021-05-15 5:33 UTC (permalink / raw)
To: Shreyansh Chouhan
Cc: pure.logic, johan, elder, greybus-dev, linux-staging, linux-kernel
On Sat, May 15, 2021 at 09:11:16AM +0530, Shreyansh Chouhan wrote:
> Prefixed the names of all the macros that were used for declaring things
> with 'declare_'. This should help with clarifying about what these
> macros do.
Thanks, but I think I will leave the code as-is. It's a good "test" for
people who try to modify the code without actually building it :)
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: greybus: add declare_ to declaring macros
2021-05-15 5:33 ` Greg KH
@ 2021-05-15 5:58 ` Shreyansh Chouhan
2021-05-15 6:55 ` Joe Perches
1 sibling, 0 replies; 5+ messages in thread
From: Shreyansh Chouhan @ 2021-05-15 5:58 UTC (permalink / raw)
To: Greg KH
Cc: pure.logic, johan, elder, greybus-dev, linux-staging, linux-kernel
On Sat, May 15, 2021 at 07:33:03AM +0200, Greg KH wrote:
> On Sat, May 15, 2021 at 09:11:16AM +0530, Shreyansh Chouhan wrote:
> > Prefixed the names of all the macros that were used for declaring things
> > with 'declare_'. This should help with clarifying about what these
> > macros do.
>
> Thanks, but I think I will leave the code as-is. It's a good "test" for
> people who try to modify the code without actually building it :)
>
Oh. Okay, I will try fixing something that might actually be a coding
style issue this time then. :)
> greg k-h
Regards,
Shreyansh Chouhan.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: greybus: add declare_ to declaring macros
2021-05-15 5:33 ` Greg KH
@ 2021-05-15 6:55 ` Joe Perches
2021-05-15 6:55 ` Joe Perches
1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2021-05-15 6:55 UTC (permalink / raw)
To: Greg KH, Shreyansh Chouhan
Cc: pure.logic, johan, elder, greybus-dev, linux-staging, linux-kernel
On Sat, 2021-05-15 at 07:33 +0200, Greg KH wrote:
> On Sat, May 15, 2021 at 09:11:16AM +0530, Shreyansh Chouhan wrote:
> > Prefixed the names of all the macros that were used for declaring things
> > with 'declare_'. This should help with clarifying about what these
> > macros do.
>
> Thanks, but I think I will leave the code as-is. It's a good "test" for
> people who try to modify the code without actually building it :)
This improves the code for the human reader.
I think wherever reasonable, code should be improved.
In any case, it's a test as checkpatch will emit the same message.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: greybus: add declare_ to declaring macros
@ 2021-05-15 6:55 ` Joe Perches
0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2021-05-15 6:55 UTC (permalink / raw)
To: Greg KH, Shreyansh Chouhan
Cc: pure.logic, johan, elder, greybus-dev, linux-staging, linux-kernel
On Sat, 2021-05-15 at 07:33 +0200, Greg KH wrote:
> On Sat, May 15, 2021 at 09:11:16AM +0530, Shreyansh Chouhan wrote:
> > Prefixed the names of all the macros that were used for declaring things
> > with 'declare_'. This should help with clarifying about what these
> > macros do.
>
> Thanks, but I think I will leave the code as-is. It's a good "test" for
> people who try to modify the code without actually building it :)
This improves the code for the human reader.
I think wherever reasonable, code should be improved.
In any case, it's a test as checkpatch will emit the same message.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-15 7:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 3:41 [PATCH] staging: greybus: add declare_ to declaring macros Shreyansh Chouhan
2021-05-15 5:33 ` Greg KH
2021-05-15 5:58 ` Shreyansh Chouhan
2021-05-15 6:55 ` Joe Perches
2021-05-15 6:55 ` Joe Perches
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.