linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c
@ 2020-04-29  4:04 Rylan Dmello
  2020-04-29  4:04 ` [PATCH 2/3] staging: qlge: Fix suspect indentation warning in qlge_main.c Rylan Dmello
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rylan Dmello @ 2020-04-29  4:04 UTC (permalink / raw)
  To: Manish Chopra, GR-Linux-NIC-Dev, Greg Kroah-Hartman, netdev,
	devel, linux-kernel

Fix checkpatch.pl warnings:

  WARNING: Avoid multiple line dereference - prefer 'qdev->func'
  WARNING: Avoid multiple line dereference - prefer 'qdev->flags'

Signed-off-by: Rylan Dmello <mail@rylan.coffee>
---
 drivers/staging/qlge/qlge_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index d7e4dfafc1a3..10daae025790 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -396,8 +396,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
 			 * the route field to NIC core.
 			 */
 			cam_output = (CAM_OUT_ROUTE_NIC |
-				      (qdev->
-				       func << CAM_OUT_FUNC_SHIFT) |
+				      (qdev->func << CAM_OUT_FUNC_SHIFT) |
 					(0 << CAM_OUT_CQ_ID_SHIFT));
 			if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX)
 				cam_output |= CAM_OUT_RV;
@@ -3432,9 +3431,9 @@ static int ql_request_irq(struct ql_adapter *qdev)
 				     &qdev->rx_ring[0]);
 			status =
 			    request_irq(pdev->irq, qlge_isr,
-					test_bit(QL_MSI_ENABLED,
-						 &qdev->
-						 flags) ? 0 : IRQF_SHARED,
+					test_bit(QL_MSI_ENABLED, &qdev->flags)
+						? 0
+						: IRQF_SHARED,
 					intr_context->name, &qdev->rx_ring[0]);
 			if (status)
 				goto err_irq;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] staging: qlge: Fix suspect indentation warning in qlge_main.c
  2020-04-29  4:04 [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Rylan Dmello
@ 2020-04-29  4:04 ` Rylan Dmello
  2020-04-29  4:04 ` [PATCH 3/3] staging: qlge: Fix function argument alignment " Rylan Dmello
  2020-04-29  4:31 ` [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Joe Perches
  2 siblings, 0 replies; 5+ messages in thread
From: Rylan Dmello @ 2020-04-29  4:04 UTC (permalink / raw)
  To: Manish Chopra, GR-Linux-NIC-Dev, Greg Kroah-Hartman, netdev,
	devel, linux-kernel

Fix checkpatch.pl warning:

  WARNING: suspect code indent for conditional statements (16, 23)

Signed-off-by: Rylan Dmello <mail@rylan.coffee>
---
 drivers/staging/qlge/qlge_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 10daae025790..0edeea525fef 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4436,7 +4436,8 @@ static int ql_init_device(struct pci_dev *pdev, struct net_device *ndev,
 	} else {
 		err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
 		if (!err)
-		       err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+			err = dma_set_coherent_mask(&pdev->dev,
+						    DMA_BIT_MASK(32));
 	}
 
 	if (err) {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] staging: qlge: Fix function argument alignment warning in qlge_main.c
  2020-04-29  4:04 [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Rylan Dmello
  2020-04-29  4:04 ` [PATCH 2/3] staging: qlge: Fix suspect indentation warning in qlge_main.c Rylan Dmello
@ 2020-04-29  4:04 ` Rylan Dmello
  2020-04-29  4:31 ` [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Joe Perches
  2 siblings, 0 replies; 5+ messages in thread
From: Rylan Dmello @ 2020-04-29  4:04 UTC (permalink / raw)
  To: Manish Chopra, GR-Linux-NIC-Dev, Greg Kroah-Hartman, netdev,
	devel, linux-kernel

Fix checkpatch.pl check:

  CHECK: Alignment should match open parenthesis

Signed-off-by: Rylan Dmello <mail@rylan.coffee>
---
 drivers/staging/qlge/qlge_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 0edeea525fef..c493da03e45f 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -4450,7 +4450,7 @@ static int ql_init_device(struct pci_dev *pdev, struct net_device *ndev,
 	pci_save_state(pdev);
 	qdev->reg_base =
 	    ioremap(pci_resource_start(pdev, 1),
-			    pci_resource_len(pdev, 1));
+		    pci_resource_len(pdev, 1));
 	if (!qdev->reg_base) {
 		dev_err(&pdev->dev, "Register mapping failed.\n");
 		err = -ENOMEM;
@@ -4460,7 +4460,7 @@ static int ql_init_device(struct pci_dev *pdev, struct net_device *ndev,
 	qdev->doorbell_area_size = pci_resource_len(pdev, 3);
 	qdev->doorbell_area =
 	    ioremap(pci_resource_start(pdev, 3),
-			    pci_resource_len(pdev, 3));
+		    pci_resource_len(pdev, 3));
 	if (!qdev->doorbell_area) {
 		dev_err(&pdev->dev, "Doorbell register mapping failed.\n");
 		err = -ENOMEM;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c
  2020-04-29  4:04 [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Rylan Dmello
  2020-04-29  4:04 ` [PATCH 2/3] staging: qlge: Fix suspect indentation warning in qlge_main.c Rylan Dmello
  2020-04-29  4:04 ` [PATCH 3/3] staging: qlge: Fix function argument alignment " Rylan Dmello
@ 2020-04-29  4:31 ` Joe Perches
  2020-04-29  4:55   ` Rylan Dmello
  2 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-04-29  4:31 UTC (permalink / raw)
  To: Rylan Dmello, Manish Chopra, GR-Linux-NIC-Dev,
	Greg Kroah-Hartman, netdev, devel, linux-kernel

On Wed, 2020-04-29 at 00:04 -0400, Rylan Dmello wrote:
> Fix checkpatch.pl warnings:
> 
>   WARNING: Avoid multiple line dereference - prefer 'qdev->func'
>   WARNING: Avoid multiple line dereference - prefer 'qdev->flags'

Assuming you are doing this for exercise:

It'd be better to unindent all the switch/case
blocks for the entire function so more functions
fit on single lines

	switch (foo) {
	case bar:
		{
			...;

should be:

	switch (foo) {
	case bar: {
		...;

goto exit; might as well be break; and remove
the exit label too.

> Signed-off-by: Rylan Dmello <mail@rylan.coffee>
> ---
>  drivers/staging/qlge/qlge_main.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index d7e4dfafc1a3..10daae025790 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -396,8 +396,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
>  			 * the route field to NIC core.
>  			 */
>  			cam_output = (CAM_OUT_ROUTE_NIC |
> -				      (qdev->
> -				       func << CAM_OUT_FUNC_SHIFT) |
> +				      (qdev->func << CAM_OUT_FUNC_SHIFT) |
>  					(0 << CAM_OUT_CQ_ID_SHIFT));
>  			if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX)
>  				cam_output |= CAM_OUT_RV;
> @@ -3432,9 +3431,9 @@ static int ql_request_irq(struct ql_adapter *qdev)
>  				     &qdev->rx_ring[0]);
>  			status =
>  			    request_irq(pdev->irq, qlge_isr,
> -					test_bit(QL_MSI_ENABLED,
> -						 &qdev->
> -						 flags) ? 0 : IRQF_SHARED,
> +					test_bit(QL_MSI_ENABLED, &qdev->flags)
> +						? 0
> +						: IRQF_SHARED,
>  					intr_context->name, &qdev->rx_ring[0]);
>  			if (status)
>  				goto err_irq;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c
  2020-04-29  4:31 ` [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Joe Perches
@ 2020-04-29  4:55   ` Rylan Dmello
  0 siblings, 0 replies; 5+ messages in thread
From: Rylan Dmello @ 2020-04-29  4:55 UTC (permalink / raw)
  To: Joe Perches
  Cc: Manish Chopra, GR-Linux-NIC-Dev, Greg Kroah-Hartman, netdev,
	devel, linux-kernel

On Tue, Apr 28, 2020 at 09:31:10PM -0700, Joe Perches wrote:
> On Wed, 2020-04-29 at 00:04 -0400, Rylan Dmello wrote:
> > Fix checkpatch.pl warnings:
> > 
> >   WARNING: Avoid multiple line dereference - prefer 'qdev->func'
> >   WARNING: Avoid multiple line dereference - prefer 'qdev->flags'
> 
> Assuming you are doing this for exercise:
> 
> It'd be better to unindent all the switch/case
> blocks for the entire function so more functions
> fit on single lines
> 
> 	switch (foo) {
> 	case bar:
> 		{
> 			...;
> 
> should be:
> 
> 	switch (foo) {
> 	case bar: {
> 		...;
> 
> goto exit; might as well be break; and remove
> the exit label too.
>

Thank you - I noticed that clang-format unindented the switch-case blocks, but
wasn't sure whether to include that in this patch set or not.

I will send a V2 patch that unindents these switch-case blocks throughout
the two functions listed here, and also removes the exit label from this
function.

> > Signed-off-by: Rylan Dmello <mail@rylan.coffee>
> > ---
> >  drivers/staging/qlge/qlge_main.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> > index d7e4dfafc1a3..10daae025790 100644
> > --- a/drivers/staging/qlge/qlge_main.c
> > +++ b/drivers/staging/qlge/qlge_main.c
> > @@ -396,8 +396,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
> >  			 * the route field to NIC core.
> >  			 */
> >  			cam_output = (CAM_OUT_ROUTE_NIC |
> > -				      (qdev->
> > -				       func << CAM_OUT_FUNC_SHIFT) |
> > +				      (qdev->func << CAM_OUT_FUNC_SHIFT) |
> >  					(0 << CAM_OUT_CQ_ID_SHIFT));
> >  			if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX)
> >  				cam_output |= CAM_OUT_RV;
> > @@ -3432,9 +3431,9 @@ static int ql_request_irq(struct ql_adapter *qdev)
> >  				     &qdev->rx_ring[0]);
> >  			status =
> >  			    request_irq(pdev->irq, qlge_isr,
> > -					test_bit(QL_MSI_ENABLED,
> > -						 &qdev->
> > -						 flags) ? 0 : IRQF_SHARED,
> > +					test_bit(QL_MSI_ENABLED, &qdev->flags)
> > +						? 0
> > +						: IRQF_SHARED,
> >  					intr_context->name, &qdev->rx_ring[0]);
> >  			if (status)
> >  				goto err_irq;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-29  4:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29  4:04 [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Rylan Dmello
2020-04-29  4:04 ` [PATCH 2/3] staging: qlge: Fix suspect indentation warning in qlge_main.c Rylan Dmello
2020-04-29  4:04 ` [PATCH 3/3] staging: qlge: Fix function argument alignment " Rylan Dmello
2020-04-29  4:31 ` [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c Joe Perches
2020-04-29  4:55   ` Rylan Dmello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).