Fix checkpatch.pl warnings of adding braces around macro arguments to
prevent precedence issues by adding braces in qlge_dbg.c
Signed-off-by: Kaaira Gupta <[email protected]>
---
drivers/staging/qlge/qlge_dbg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
index 8cf39615c520..c7af2548d119 100644
--- a/drivers/staging/qlge/qlge_dbg.c
+++ b/drivers/staging/qlge/qlge_dbg.c
@@ -1525,7 +1525,7 @@ void ql_dump_regs(struct ql_adapter *qdev)
#ifdef QL_STAT_DUMP
#define DUMP_STAT(qdev, stat) \
- pr_err("%s = %ld\n", #stat, (unsigned long)qdev->nic_stats.stat)
+ pr_err("%s = %ld\n", #stat, (unsigned long)(qdev)->nic_stats.stat)
void ql_dump_stat(struct ql_adapter *qdev)
{
@@ -1578,12 +1578,12 @@ void ql_dump_stat(struct ql_adapter *qdev)
#ifdef QL_DEV_DUMP
#define DUMP_QDEV_FIELD(qdev, type, field) \
- pr_err("qdev->%-24s = " type "\n", #field, qdev->field)
+ pr_err("qdev->%-24s = " type "\n", #field, (qdev)->(field))
#define DUMP_QDEV_DMA_FIELD(qdev, field) \
pr_err("qdev->%-24s = %llx\n", #field, (unsigned long long)qdev->field)
#define DUMP_QDEV_ARRAY(qdev, type, array, index, field) \
pr_err("%s[%d].%s = " type "\n", \
- #array, index, #field, qdev->array[index].field);
+ #array, index, #field, (qdev)->array[index].field);
void ql_dump_qdev(struct ql_adapter *qdev)
{
int i;
--
2.17.1
On 2020/02/22 01:26 +0530, Kaaira Gupta wrote:
> Fix checkpatch.pl warnings of adding braces around macro arguments to
> prevent precedence issues by adding braces in qlge_dbg.c
>
> Signed-off-by: Kaaira Gupta <[email protected]>
> ---
> drivers/staging/qlge/qlge_dbg.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
> index 8cf39615c520..c7af2548d119 100644
> --- a/drivers/staging/qlge/qlge_dbg.c
> +++ b/drivers/staging/qlge/qlge_dbg.c
> @@ -1525,7 +1525,7 @@ void ql_dump_regs(struct ql_adapter *qdev)
> #ifdef QL_STAT_DUMP
>
> #define DUMP_STAT(qdev, stat) \
> - pr_err("%s = %ld\n", #stat, (unsigned long)qdev->nic_stats.stat)
> + pr_err("%s = %ld\n", #stat, (unsigned long)(qdev)->nic_stats.stat)
>
> void ql_dump_stat(struct ql_adapter *qdev)
> {
> @@ -1578,12 +1578,12 @@ void ql_dump_stat(struct ql_adapter *qdev)
> #ifdef QL_DEV_DUMP
>
> #define DUMP_QDEV_FIELD(qdev, type, field) \
> - pr_err("qdev->%-24s = " type "\n", #field, qdev->field)
> + pr_err("qdev->%-24s = " type "\n", #field, (qdev)->(field))
> #define DUMP_QDEV_DMA_FIELD(qdev, field) \
> pr_err("qdev->%-24s = %llx\n", #field, (unsigned long long)qdev->field)
^^^^
You missed one.
On Mon, Feb 24, 2020 at 02:32:25PM +0900, Benjamin Poirier wrote:
> On 2020/02/22 01:26 +0530, Kaaira Gupta wrote:
> > Fix checkpatch.pl warnings of adding braces around macro arguments to
> > prevent precedence issues by adding braces in qlge_dbg.c
> >
> > Signed-off-by: Kaaira Gupta <[email protected]>
> > ---
> > drivers/staging/qlge/qlge_dbg.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
> > index 8cf39615c520..c7af2548d119 100644
> > --- a/drivers/staging/qlge/qlge_dbg.c
> > +++ b/drivers/staging/qlge/qlge_dbg.c
> > @@ -1525,7 +1525,7 @@ void ql_dump_regs(struct ql_adapter *qdev)
> > #ifdef QL_STAT_DUMP
> >
> > #define DUMP_STAT(qdev, stat) \
> > - pr_err("%s = %ld\n", #stat, (unsigned long)qdev->nic_stats.stat)
> > + pr_err("%s = %ld\n", #stat, (unsigned long)(qdev)->nic_stats.stat)
> >
> > void ql_dump_stat(struct ql_adapter *qdev)
> > {
> > @@ -1578,12 +1578,12 @@ void ql_dump_stat(struct ql_adapter *qdev)
> > #ifdef QL_DEV_DUMP
> >
> > #define DUMP_QDEV_FIELD(qdev, type, field) \
> > - pr_err("qdev->%-24s = " type "\n", #field, qdev->field)
> > + pr_err("qdev->%-24s = " type "\n", #field, (qdev)->(field))
> > #define DUMP_QDEV_DMA_FIELD(qdev, field) \
> > pr_err("qdev->%-24s = %llx\n", #field, (unsigned long long)qdev->field)
> ^^^^
> You missed one.
It makes the line characaters greater than 80. Shall I still add braces?
I mean it's better that I add them to prevent precedence issues, but it
adds another warning, hence I wasn't sure.
On 2020/02/24 13:22 +0530, Kaaira Gupta wrote:
> On Mon, Feb 24, 2020 at 02:32:25PM +0900, Benjamin Poirier wrote:
> > On 2020/02/22 01:26 +0530, Kaaira Gupta wrote:
> > > Fix checkpatch.pl warnings of adding braces around macro arguments to
> > > prevent precedence issues by adding braces in qlge_dbg.c
> > >
> > > Signed-off-by: Kaaira Gupta <[email protected]>
> > > ---
> > > drivers/staging/qlge/qlge_dbg.c | 6 +++---
> > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
> > > index 8cf39615c520..c7af2548d119 100644
> > > --- a/drivers/staging/qlge/qlge_dbg.c
> > > +++ b/drivers/staging/qlge/qlge_dbg.c
> > > @@ -1525,7 +1525,7 @@ void ql_dump_regs(struct ql_adapter *qdev)
> > > #ifdef QL_STAT_DUMP
> > >
> > > #define DUMP_STAT(qdev, stat) \
> > > - pr_err("%s = %ld\n", #stat, (unsigned long)qdev->nic_stats.stat)
> > > + pr_err("%s = %ld\n", #stat, (unsigned long)(qdev)->nic_stats.stat)
> > >
> > > void ql_dump_stat(struct ql_adapter *qdev)
> > > {
> > > @@ -1578,12 +1578,12 @@ void ql_dump_stat(struct ql_adapter *qdev)
> > > #ifdef QL_DEV_DUMP
> > >
> > > #define DUMP_QDEV_FIELD(qdev, type, field) \
> > > - pr_err("qdev->%-24s = " type "\n", #field, qdev->field)
> > > + pr_err("qdev->%-24s = " type "\n", #field, (qdev)->(field))
> > > #define DUMP_QDEV_DMA_FIELD(qdev, field) \
> > > pr_err("qdev->%-24s = %llx\n", #field, (unsigned long long)qdev->field)
> > ^^^^
> > You missed one.
>
> It makes the line characaters greater than 80. Shall I still add braces?
> I mean it's better that I add them to prevent precedence issues, but it
> adds another warning, hence I wasn't sure.
Generally speaking, it's ok to spread the macro body onto multiple
lines.
In this case, it would be better to replace this printk format type with
"%pad". See Documentation/core-api/printk-formats.rst
On Tue, Feb 25, 2020 at 09:30:16AM +0900, Benjamin Poirier wrote:
> On 2020/02/24 13:22 +0530, Kaaira Gupta wrote:
> > On Mon, Feb 24, 2020 at 02:32:25PM +0900, Benjamin Poirier wrote:
> > > On 2020/02/22 01:26 +0530, Kaaira Gupta wrote:
> > > > Fix checkpatch.pl warnings of adding braces around macro arguments to
> > > > prevent precedence issues by adding braces in qlge_dbg.c
> > > >
> > > > Signed-off-by: Kaaira Gupta <[email protected]>
> > > > ---
> > > > drivers/staging/qlge/qlge_dbg.c | 6 +++---
> > > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
> > > > index 8cf39615c520..c7af2548d119 100644
> > > > --- a/drivers/staging/qlge/qlge_dbg.c
> > > > +++ b/drivers/staging/qlge/qlge_dbg.c
> > > > @@ -1525,7 +1525,7 @@ void ql_dump_regs(struct ql_adapter *qdev)
> > > > #ifdef QL_STAT_DUMP
> > > >
> > > > #define DUMP_STAT(qdev, stat) \
> > > > - pr_err("%s = %ld\n", #stat, (unsigned long)qdev->nic_stats.stat)
> > > > + pr_err("%s = %ld\n", #stat, (unsigned long)(qdev)->nic_stats.stat)
> > > >
> > > > void ql_dump_stat(struct ql_adapter *qdev)
> > > > {
> > > > @@ -1578,12 +1578,12 @@ void ql_dump_stat(struct ql_adapter *qdev)
> > > > #ifdef QL_DEV_DUMP
> > > >
> > > > #define DUMP_QDEV_FIELD(qdev, type, field) \
> > > > - pr_err("qdev->%-24s = " type "\n", #field, qdev->field)
> > > > + pr_err("qdev->%-24s = " type "\n", #field, (qdev)->(field))
> > > > #define DUMP_QDEV_DMA_FIELD(qdev, field) \
> > > > pr_err("qdev->%-24s = %llx\n", #field, (unsigned long long)qdev->field)
> > > ^^^^
> > > You missed one.
> >
> > It makes the line characaters greater than 80. Shall I still add braces?
> > I mean it's better that I add them to prevent precedence issues, but it
> > adds another warning, hence I wasn't sure.
>
> Generally speaking, it's ok to spread the macro body onto multiple
> lines.
> In this case, it would be better to replace this printk format type with
> "%pad". See Documentation/core-api/printk-formats.rst
Soryy for late reply, I have my college exams going on.
But yes, I'll make the required changes and submit a patch. Thanks!