netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] isdn: hisax: clean up some indenting
@ 2014-05-03 20:20 Dan Carpenter
  2014-05-04 18:59 ` walter harms
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2014-05-03 20:20 UTC (permalink / raw)
  To: Karsten Keil
  Cc: Jiri Kosina, Randy Dunlap, Masanari Iida, netdev, kernel-janitors

The indenting is off the ifdefed code is intended to be a part of the
body of the if statement.  I have cleaned it up a bit.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 414dbf6..aaade90 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -738,12 +738,13 @@ rx_d_frame(struct hfc4s8s_l1 *l1p, int ech)
 					z1 -= 4;
 				}
 
-				while (z1--)
+				while (z1--) {
 #ifdef HISAX_HFC4S8S_PCIMEM
 					Read_hfc8(l1p->hw, A_FIFO_DATA0);
 #else
-				fRead_hfc8(l1p->hw);
+					fRead_hfc8(l1p->hw);
 #endif
+				}
 
 				Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);
 				wait_busy(l1p->hw);
@@ -768,12 +769,13 @@ rx_d_frame(struct hfc4s8s_l1 *l1p, int ech)
 			z1 -= 4;
 		}
 
-		while (z1--)
+		while (z1--) {
 #ifdef HISAX_HFC4S8S_PCIMEM
 			*cp++ = Read_hfc8(l1p->hw, A_FIFO_DATA0);
 #else
-		*cp++ = fRead_hfc8(l1p->hw);
+			*cp++ = fRead_hfc8(l1p->hw);
 #endif
+		}
 
 		Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);	/* increment f counter */
 		wait_busy(l1p->hw);
@@ -875,12 +877,13 @@ rx_b_frame(struct hfc4s8s_btype *bch)
 			z1 -= 4;
 		}
 
-		while (z1--)
+		while (z1--) {
 #ifdef HISAX_HFC4S8S_PCIMEM
 			*(bch->rx_ptr++) = Read_hfc8(l1->hw, A_FIFO_DATA0);
 #else
-		*(bch->rx_ptr++) = fRead_hfc8(l1->hw);
+			*(bch->rx_ptr++) = fRead_hfc8(l1->hw);
 #endif
+		}
 
 		if (hdlc_complete) {
 			/* increment f counter */
@@ -1051,12 +1054,13 @@ tx_b_frame(struct hfc4s8s_btype *bch)
 			cnt -= 4;
 		}
 
-		while (cnt--)
+		while (cnt--) {
 #ifdef HISAX_HFC4S8S_PCIMEM
 			fWrite_hfc8(l1->hw, A_FIFO_DATA0, *cp++);
 #else
-		fWrite_hfc8(l1->hw, *cp++);
+			fWrite_hfc8(l1->hw, *cp++);
 #endif
+		}
 
 		if (bch->tx_cnt >= skb->len) {
 			if (bch->mode == L1_MODE_HDLC) {

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

* Re: [patch] isdn: hisax: clean up some indenting
  2014-05-03 20:20 [patch] isdn: hisax: clean up some indenting Dan Carpenter
@ 2014-05-04 18:59 ` walter harms
  2014-05-05  7:44   ` Dan Carpenter
  2014-05-05  8:53   ` [patch v] isdn: hisax: remove some dead code Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: walter harms @ 2014-05-04 18:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Karsten Keil, Jiri Kosina, Randy Dunlap, Masanari Iida, netdev,
	kernel-janitors



Am 03.05.2014 22:20, schrieb Dan Carpenter:
> The indenting is off the ifdefed code is intended to be a part of the
> body of the if statement.  I have cleaned it up a bit.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
> index 414dbf6..aaade90 100644
> --- a/drivers/isdn/hisax/hfc4s8s_l1.c
> +++ b/drivers/isdn/hisax/hfc4s8s_l1.c
> @@ -738,12 +738,13 @@ rx_d_frame(struct hfc4s8s_l1 *l1p, int ech)
>  					z1 -= 4;
>  				}
>  
> -				while (z1--)
> +				while (z1--) {
>  #ifdef HISAX_HFC4S8S_PCIMEM
>  					Read_hfc8(l1p->hw, A_FIFO_DATA0);
>  #else
> -				fRead_hfc8(l1p->hw);
> +					fRead_hfc8(l1p->hw);
>  #endif
> +				}
>  
>  				Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);
>  				wait_busy(l1p->hw);
> @@ -768,12 +769,13 @@ rx_d_frame(struct hfc4s8s_l1 *l1p, int ech)
>  			z1 -= 4;
>  		}
>  
> -		while (z1--)
> +		while (z1--) {
>  #ifdef HISAX_HFC4S8S_PCIMEM
>  			*cp++ = Read_hfc8(l1p->hw, A_FIFO_DATA0);
>  #else
> -		*cp++ = fRead_hfc8(l1p->hw);
> +			*cp++ = fRead_hfc8(l1p->hw);
>  #endif
> +		}
>  
>  		Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);	/* increment f counter */
>  		wait_busy(l1p->hw);
> @@ -875,12 +877,13 @@ rx_b_frame(struct hfc4s8s_btype *bch)
>  			z1 -= 4;
>  		}
>  
> -		while (z1--)
> +		while (z1--) {
>  #ifdef HISAX_HFC4S8S_PCIMEM
>  			*(bch->rx_ptr++) = Read_hfc8(l1->hw, A_FIFO_DATA0);
>  #else
> -		*(bch->rx_ptr++) = fRead_hfc8(l1->hw);
> +			*(bch->rx_ptr++) = fRead_hfc8(l1->hw);
>  #endif
> +		}
>  
>  		if (hdlc_complete) {
>  			/* increment f counter */
> @@ -1051,12 +1054,13 @@ tx_b_frame(struct hfc4s8s_btype *bch)
>  			cnt -= 4;
>  		}
>  
> -		while (cnt--)
> +		while (cnt--) {
>  #ifdef HISAX_HFC4S8S_PCIMEM
>  			fWrite_hfc8(l1->hw, A_FIFO_DATA0, *cp++);
>  #else
> -		fWrite_hfc8(l1->hw, *cp++);
> +			fWrite_hfc8(l1->hw, *cp++);
>  #endif
> +		}

This looks wrong. The read above uses Read_hfc8/fRead_hfc8 (easy to confuse but i am not the maintainer ....)
here we have 2* fWrite_hfc8() ?
Does this compile with HISAX_HFC4S8S_PCIMEM ??

re,
 wh


>  
>  		if (bch->tx_cnt >= skb->len) {
>  			if (bch->mode == L1_MODE_HDLC) {
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [patch] isdn: hisax: clean up some indenting
  2014-05-04 18:59 ` walter harms
@ 2014-05-05  7:44   ` Dan Carpenter
  2014-05-05  8:53   ` [patch v] isdn: hisax: remove some dead code Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-05-05  7:44 UTC (permalink / raw)
  To: walter harms
  Cc: Karsten Keil, Jiri Kosina, Randy Dunlap, Masanari Iida, netdev,
	kernel-janitors

On Sun, May 04, 2014 at 08:59:08PM +0200, walter harms wrote:
> > @@ -1051,12 +1054,13 @@ tx_b_frame(struct hfc4s8s_btype *bch)
> >  			cnt -= 4;
> >  		}
> >  
> > -		while (cnt--)
> > +		while (cnt--) {
> >  #ifdef HISAX_HFC4S8S_PCIMEM
> >  			fWrite_hfc8(l1->hw, A_FIFO_DATA0, *cp++);
> >  #else
> > -		fWrite_hfc8(l1->hw, *cp++);
> > +			fWrite_hfc8(l1->hw, *cp++);
> >  #endif
> > +		}
> 
> This looks wrong. The read above uses Read_hfc8/fRead_hfc8 (easy to
> confuse but i am not the maintainer ....)
> here we have 2* fWrite_hfc8() ?
> Does this compile with HISAX_HFC4S8S_PCIMEM ??
> 

Yeah.  You're right.  The first fWrite_hfc8() should be Write_hfc8().
This same mistake is made two other places which prevents the driver
from compiling with HISAX_HFC4S8S_PCIMEM.

I will just delete this code since it has been broken since 2.6.12.
Let me resend.

regards,
dan carpenter


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

* [patch v] isdn: hisax: remove some dead code
  2014-05-04 18:59 ` walter harms
  2014-05-05  7:44   ` Dan Carpenter
@ 2014-05-05  8:53   ` Dan Carpenter
  2014-05-07 19:44     ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2014-05-05  8:53 UTC (permalink / raw)
  To: Karsten Keil
  Cc: Jiri Kosina, Randy Dunlap, Masanari Iida, netdev, kernel-janitors,
	walter harms

The HISAX_HFC4S8S_PCIMEM code hasn't been able to compile since before
the start of git history.  I have deleted it.

There are also a few indenting mistakes where one side of the ifdef
wasn't indented correctly which I fixed as well.

Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: delete the dead ifdefed code.

diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 414dbf6..fc9f9d0 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -197,25 +197,6 @@ typedef struct _hfc4s8s_hw {
 
 
 
-/***************************/
-/* inline function defines */
-/***************************/
-#ifdef HISAX_HFC4S8S_PCIMEM	/* inline functions memory mapped */
-
-/* memory write and dummy IO read to avoid PCI byte merge problems */
-#define Write_hfc8(a, b, c) {(*((volatile u_char *)(a->membase + b)) = c); inb(a->iobase + 4);}
-/* memory write without dummy IO access for fifo data access */
-#define fWrite_hfc8(a, b, c) (*((volatile u_char *)(a->membase + b)) = c)
-#define Read_hfc8(a, b) (*((volatile u_char *)(a->membase + b)))
-#define Write_hfc16(a, b, c) (*((volatile unsigned short *)(a->membase + b)) = c)
-#define Read_hfc16(a, b) (*((volatile unsigned short *)(a->membase + b)))
-#define Write_hfc32(a, b, c) (*((volatile unsigned long *)(a->membase + b)) = c)
-#define Read_hfc32(a, b) (*((volatile unsigned long *)(a->membase + b)))
-#define wait_busy(a) {while ((Read_hfc8(a, R_STATUS) & M_BUSY));}
-#define PCI_ENA_MEMIO	0x03
-
-#else
-
 /* inline functions io mapped */
 static inline void
 SetRegAddr(hfc4s8s_hw *a, u_char b)
@@ -306,8 +287,6 @@ wait_busy(hfc4s8s_hw *a)
 
 #define PCI_ENA_REGIO	0x01
 
-#endif				/* HISAX_HFC4S8S_PCIMEM */
-
 /******************************************************/
 /* function to read critical counter registers that   */
 /* may be updated by the chip during read             */
@@ -724,26 +703,15 @@ rx_d_frame(struct hfc4s8s_l1 *l1p, int ech)
 				return;
 			} else {
 				/* read errornous D frame */
-
-#ifndef HISAX_HFC4S8S_PCIMEM
 				SetRegAddr(l1p->hw, A_FIFO_DATA0);
-#endif
 
 				while (z1 >= 4) {
-#ifdef HISAX_HFC4S8S_PCIMEM
-					Read_hfc32(l1p->hw, A_FIFO_DATA0);
-#else
 					fRead_hfc32(l1p->hw);
-#endif
 					z1 -= 4;
 				}
 
 				while (z1--)
-#ifdef HISAX_HFC4S8S_PCIMEM
-					Read_hfc8(l1p->hw, A_FIFO_DATA0);
-#else
-				fRead_hfc8(l1p->hw);
-#endif
+					fRead_hfc8(l1p->hw);
 
 				Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);
 				wait_busy(l1p->hw);
@@ -753,27 +721,16 @@ rx_d_frame(struct hfc4s8s_l1 *l1p, int ech)
 
 		cp = skb->data;
 
-#ifndef HISAX_HFC4S8S_PCIMEM
 		SetRegAddr(l1p->hw, A_FIFO_DATA0);
-#endif
 
 		while (z1 >= 4) {
-#ifdef HISAX_HFC4S8S_PCIMEM
-			*((unsigned long *) cp) =
-				Read_hfc32(l1p->hw, A_FIFO_DATA0);
-#else
 			*((unsigned long *) cp) = fRead_hfc32(l1p->hw);
-#endif
 			cp += 4;
 			z1 -= 4;
 		}
 
 		while (z1--)
-#ifdef HISAX_HFC4S8S_PCIMEM
-			*cp++ = Read_hfc8(l1p->hw, A_FIFO_DATA0);
-#else
-		*cp++ = fRead_hfc8(l1p->hw);
-#endif
+			*cp++ = fRead_hfc8(l1p->hw);
 
 		Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);	/* increment f counter */
 		wait_busy(l1p->hw);
@@ -859,28 +816,17 @@ rx_b_frame(struct hfc4s8s_btype *bch)
 			wait_busy(l1->hw);
 			return;
 		}
-#ifndef HISAX_HFC4S8S_PCIMEM
 		SetRegAddr(l1->hw, A_FIFO_DATA0);
-#endif
 
 		while (z1 >= 4) {
-#ifdef HISAX_HFC4S8S_PCIMEM
-			*((unsigned long *) bch->rx_ptr) =
-				Read_hfc32(l1->hw, A_FIFO_DATA0);
-#else
 			*((unsigned long *) bch->rx_ptr) =
 				fRead_hfc32(l1->hw);
-#endif
 			bch->rx_ptr += 4;
 			z1 -= 4;
 		}
 
 		while (z1--)
-#ifdef HISAX_HFC4S8S_PCIMEM
-			*(bch->rx_ptr++) = Read_hfc8(l1->hw, A_FIFO_DATA0);
-#else
-		*(bch->rx_ptr++) = fRead_hfc8(l1->hw);
-#endif
+			*(bch->rx_ptr++) = fRead_hfc8(l1->hw);
 
 		if (hdlc_complete) {
 			/* increment f counter */
@@ -940,29 +886,17 @@ tx_d_frame(struct hfc4s8s_l1 *l1p)
 	if ((skb = skb_dequeue(&l1p->d_tx_queue))) {
 		cp = skb->data;
 		cnt = skb->len;
-#ifndef HISAX_HFC4S8S_PCIMEM
 		SetRegAddr(l1p->hw, A_FIFO_DATA0);
-#endif
 
 		while (cnt >= 4) {
-#ifdef HISAX_HFC4S8S_PCIMEM
-			fWrite_hfc32(l1p->hw, A_FIFO_DATA0,
-				     *(unsigned long *) cp);
-#else
 			SetRegAddr(l1p->hw, A_FIFO_DATA0);
 			fWrite_hfc32(l1p->hw, *(unsigned long *) cp);
-#endif
 			cp += 4;
 			cnt -= 4;
 		}
 
-#ifdef HISAX_HFC4S8S_PCIMEM
-		while (cnt--)
-			fWrite_hfc8(l1p->hw, A_FIFO_DATA0, *cp++);
-#else
 		while (cnt--)
 			fWrite_hfc8(l1p->hw, *cp++);
-#endif
 
 		l1p->tx_cnt = skb->truesize;
 		Write_hfc8(l1p->hw, A_INC_RES_FIFO, 1);	/* increment f counter */
@@ -1037,26 +971,15 @@ tx_b_frame(struct hfc4s8s_btype *bch)
 		cp = skb->data + bch->tx_cnt;
 		bch->tx_cnt += cnt;
 
-#ifndef HISAX_HFC4S8S_PCIMEM
 		SetRegAddr(l1->hw, A_FIFO_DATA0);
-#endif
 		while (cnt >= 4) {
-#ifdef HISAX_HFC4S8S_PCIMEM
-			fWrite_hfc32(l1->hw, A_FIFO_DATA0,
-				     *(unsigned long *) cp);
-#else
 			fWrite_hfc32(l1->hw, *(unsigned long *) cp);
-#endif
 			cp += 4;
 			cnt -= 4;
 		}
 
 		while (cnt--)
-#ifdef HISAX_HFC4S8S_PCIMEM
-			fWrite_hfc8(l1->hw, A_FIFO_DATA0, *cp++);
-#else
-		fWrite_hfc8(l1->hw, *cp++);
-#endif
+			fWrite_hfc8(l1->hw, *cp++);
 
 		if (bch->tx_cnt >= skb->len) {
 			if (bch->mode == L1_MODE_HDLC) {
@@ -1281,10 +1204,8 @@ hfc4s8s_interrupt(int intno, void *dev_id)
 	if (!hw || !(hw->mr.r_irq_ctrl & M_GLOB_IRQ_EN))
 		return IRQ_NONE;
 
-#ifndef	HISAX_HFC4S8S_PCIMEM
 	/* read current selected regsister */
 	old_ioreg = GetRegAddr(hw);
-#endif
 
 	/* Layer 1 State change */
 	hw->mr.r_irq_statech |=
@@ -1292,9 +1213,7 @@ hfc4s8s_interrupt(int intno, void *dev_id)
 	if (!
 	    (b = (Read_hfc8(hw, R_STATUS) & (M_MISC_IRQSTA | M_FR_IRQSTA)))
 	    && !hw->mr.r_irq_statech) {
-#ifndef	HISAX_HFC4S8S_PCIMEM
 		SetRegAddr(hw, old_ioreg);
-#endif
 		return IRQ_NONE;
 	}
 
@@ -1322,9 +1241,7 @@ hfc4s8s_interrupt(int intno, void *dev_id)
 	/* queue the request to allow other cards to interrupt */
 	schedule_work(&hw->tqueue);
 
-#ifndef	HISAX_HFC4S8S_PCIMEM
 	SetRegAddr(hw, old_ioreg);
-#endif
 	return IRQ_HANDLED;
 }				/* hfc4s8s_interrupt */
 
@@ -1471,13 +1388,8 @@ static void
 release_pci_ports(hfc4s8s_hw *hw)
 {
 	pci_write_config_word(hw->pdev, PCI_COMMAND, 0);
-#ifdef HISAX_HFC4S8S_PCIMEM
-	if (hw->membase)
-		iounmap((void *) hw->membase);
-#else
 	if (hw->iobase)
 		release_region(hw->iobase, 8);
-#endif
 }
 
 /*****************************************/
@@ -1486,11 +1398,7 @@ release_pci_ports(hfc4s8s_hw *hw)
 static void
 enable_pci_ports(hfc4s8s_hw *hw)
 {
-#ifdef HISAX_HFC4S8S_PCIMEM
-	pci_write_config_word(hw->pdev, PCI_COMMAND, PCI_ENA_MEMIO);
-#else
 	pci_write_config_word(hw->pdev, PCI_COMMAND, PCI_ENA_REGIO);
-#endif
 }
 
 /*************************************/
@@ -1561,15 +1469,9 @@ setup_instance(hfc4s8s_hw *hw)
 		       hw->irq);
 		goto out;
 	}
-#ifdef HISAX_HFC4S8S_PCIMEM
-	printk(KERN_INFO
-	       "HFC-4S/8S: found PCI card at membase 0x%p, irq %d\n",
-	       hw->hw_membase, hw->irq);
-#else
 	printk(KERN_INFO
 	       "HFC-4S/8S: found PCI card at iobase 0x%x, irq %d\n",
 	       hw->iobase, hw->irq);
-#endif
 
 	hfc_hardware_enable(hw, 1, 0);
 
@@ -1614,17 +1516,12 @@ hfc4s8s_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	hw->irq = pdev->irq;
 	hw->iobase = pci_resource_start(pdev, 0);
 
-#ifdef HISAX_HFC4S8S_PCIMEM
-	hw->hw_membase = (u_char *) pci_resource_start(pdev, 1);
-	hw->membase = ioremap((ulong) hw->hw_membase, 256);
-#else
 	if (!request_region(hw->iobase, 8, hw->card_name)) {
 		printk(KERN_INFO
 		       "HFC-4S/8S: failed to request address space at 0x%04x\n",
 		       hw->iobase);
 		goto out;
 	}
-#endif
 
 	pci_set_drvdata(pdev, hw);
 	err = setup_instance(hw);

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

* Re: [patch v] isdn: hisax: remove some dead code
  2014-05-05  8:53   ` [patch v] isdn: hisax: remove some dead code Dan Carpenter
@ 2014-05-07 19:44     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-05-07 19:44 UTC (permalink / raw)
  To: dan.carpenter
  Cc: isdn, jkosina, rdunlap, standby24x7, netdev, kernel-janitors,
	wharms

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 5 May 2014 11:53:05 +0300

> The HISAX_HFC4S8S_PCIMEM code hasn't been able to compile since before
> the start of git history.  I have deleted it.
> 
> There are also a few indenting mistakes where one side of the ifdef
> wasn't indented correctly which I fixed as well.
> 
> Reported-by: Walter Harms <wharms@bfs.de>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: delete the dead ifdefed code.

I'll apply this to net-next, thanks Dan.

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

end of thread, other threads:[~2014-05-07 19:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-03 20:20 [patch] isdn: hisax: clean up some indenting Dan Carpenter
2014-05-04 18:59 ` walter harms
2014-05-05  7:44   ` Dan Carpenter
2014-05-05  8:53   ` [patch v] isdn: hisax: remove some dead code Dan Carpenter
2014-05-07 19:44     ` David Miller

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).