Skip to contentSkip to conversation

staging: cxt1e1: remove dead code in musycc.c

PATCH In review Daeseok Youn 2 participants 5 messages May 9, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 staging: cxt1e1: remove dead code in musycc.c

Removes "#if 0" blocks.

---
Dan,
I decided to leave musycc_dump_rxbuffer_ring(ch, 0) which is commented out and make a block as "RLD_DEBUG". Because i think this block need to debug with define "RLD_DEBUG". If I am wrong, let me know.

 drivers/staging/cxt1e1/musycc.c |  136 ++-------------------------------------
 1 files changed, 5 insertions(+), 131 deletions(-)
drivers/staging/cxt1e1/musycc.c +5 -131
index 2ddf889..91fab77 100644
@@ -64,7 +64,6 @@ void        musycc_update_timeslots(mpi_t *);
 
 /*******************************************************************/
 
-#if 1
 static int
 musycc_dump_rxbuffer_ring(mch_t *ch, int lockit)
 {
@@ -128,9 +127,7 @@ musycc_dump_rxbuffer_ring(mch_t *ch, int lockit)
 		spin_unlock_irqrestore(&ch->ch_rxlock, flags);
 	return 0;
 }
-#endif
 
-#if 1
 static int
 musycc_dump_txbuffer_ring(mch_t *ch, int lockit)
 {
@@ -188,8 +185,6 @@ musycc_dump_txbuffer_ring(mch_t *ch, int lockit)
 		spin_unlock_irqrestore(&ch->ch_txlock, flags);
 	return 0;
 }
-#endif
-
 
 /*
  * The following supports a backdoor debug facility which can be used to
@@ -340,9 +335,6 @@ musycc_wq_chan_restart(void *arg)      /* channel private structure */
 	mch_t      *ch;
 	mpi_t      *pi;
 	struct mdesc *md;
-#if 0
-	unsigned long flags;
-#endif
 
 	ch = container_of(arg, struct c4_chan_info, ch_work);
 	pi = ch->up;
@@ -391,22 +383,14 @@ musycc_wq_chan_restart(void *arg)      /* channel private structure */
 		/* find next unprocessed message, then set TX thp to it */
 		musycc_update_tx_thp(ch);
 
-#if 0
-		spin_lock_irqsave(&ch->ch_txlock, flags);
-#endif
 		md = ch->txd_irq_srv;
 		if (!md) {
 #ifdef RLD_TRANS_DEBUG
 			pr_info("-- musycc_wq_chan_restart[%d]: WARNING, starting NULL md\n", ch->channum);
 #endif
-#if 0
-			spin_unlock_irqrestore(&ch->ch_txlock, flags);
-#endif
 		} else if (md->data && ((le32_to_cpu(md->status)) & MUSYCC_TX_OWNED)) {
 			ch->ch_start_tx = 0;
-#if 0
-			spin_unlock_irqrestore(&ch->ch_txlock, flags);   /* allow interrupts for service request */
-#endif
+
 #ifdef RLD_TRANS_DEBUG
 			pr_info("++ musycc_wq_chan_restart() CHAN TX ACTIVATE: chan %d txd_irq_srv %p = sts %x, txpkt %lu\n",
 				ch->channum, ch->txd_irq_srv, ch->txd_irq_srv->status, ch->s.tx_packets);
@@ -421,9 +405,6 @@ musycc_wq_chan_restart(void *arg)      /* channel private structure */
 				le32_to_cpu(md->status),
 				le32_to_cpu(md->data), ch->ch_start_tx);
 			musycc_dump_txbuffer_ring(ch, 0);
-#if 0
-			spin_unlock_irqrestore(&ch->ch_txlock, flags);   /* allow interrupts for service request */
-#endif
 		}
 #endif
 	}
@@ -831,12 +812,6 @@ musycc_bh_tx_eom(mpi_t *pi, int gchan)
 	mch_t      *ch;
 	struct mdesc *md;
 
-#if 0
-#ifndef SBE_ISR_INLINE
-	unsigned long flags;
-
-#endif
-#endif
 	volatile u_int32_t status;
 
 	ch = pi->chan[gchan];
@@ -849,13 +824,6 @@ musycc_bh_tx_eom(mpi_t *pi, int gchan)
 		return;                     /* note: mdt==0 implies a malloc()
 					     * failure w/in chan_up() routine */
 
-#if 0
-#ifdef SBE_ISR_INLINE
-	spin_lock_irq(&ch->ch_txlock);
-#else
-	spin_lock_irqsave(&ch->ch_txlock, flags);
-#endif
-#endif
 	do {
 		FLUSH_MEM_READ();
 		md = ch->txd_irq_srv;
@@ -993,13 +961,6 @@ musycc_bh_tx_eom(mpi_t *pi, int gchan)
 #endif
 
 	FLUSH_MEM_WRITE();
-#if 0
-#ifdef SBE_ISR_INLINE
-	spin_unlock_irq(&ch->ch_txlock);
-#else
-	spin_unlock_irqrestore(&ch->ch_txlock, flags);
-#endif
-#endif
 }
 
 
@@ -1181,11 +1142,6 @@ musycc_intr_th_handler(void *devp)
 			 * walking the chain.  As the chain is walked, the interrupt will
 			 * eventually be serviced by the correct driver/handler.
 			 */
-#if 0
-			/* chained interrupt = not ours */
-			pr_info(">> %s: intCnt NULL, sts %x, possibly a chained interrupt!\n",
-					ci->devname, status);
-#endif
 			return IRQ_NONE;
 		}
 
@@ -1360,15 +1316,11 @@ musycc_intr_bh_tasklet(ci_t *ci)
 				musycc_bh_tx_eom(pi, gchan);
 			else
 				musycc_bh_rx_eom(pi, gchan);
-#if 0
-			break;
-#else
 			/*
 			 * MUSYCC Interrupt Descriptor section states that EOB and EOM
 			 * can be combined with the NONE error (as well as others).  So
 			 * drop thru to catch this...
 			 */
-#endif
 		case EVE_NONE:
 			if (err == ERR_SHT)
 				ch->s.rx_length_errors++;
@@ -1444,7 +1396,9 @@ musycc_intr_bh_tasklet(ci_t *ci)
 				if (cxt1e1_log_level >= LOG_WARN) {
 					pr_info("%s: RX buffer overflow [ONR] on channel %d, mode %x\n",
 						ci->devname, ch->channum, ch->p.chan_mode);
-					//musycc_dump_rxbuffer_ring (ch, 0);        /* RLD DEBUG */
+#ifdef RLD_DEBUG
+					musycc_dump_rxbuffer_ring(ch, 0);
+#endif
 				}
 			}
 			musycc_chan_restart(ch);
@@ -1511,35 +1465,6 @@ musycc_intr_bh_tasklet(ci_t *ci)
 	/* else, nothing returned */
 }
 
-#if 0
-	int         __init
-musycc_new_chan(ci_t *ci, int channum, void *user)
-{
-	mch_t      *ch;
-
-	ch = ci->port[channum / MUSYCC_NCHANS].chan[channum % MUSYCC_NCHANS];
-
-	if (ch->state != UNASSIGNED)
-		return EEXIST;
-	/* NOTE: mch_t already cleared during OS_kmalloc() */
-	ch->state = DOWN;
-	ch->user = user;
-#if 0
-	ch->status = 0;
-	ch->p.status = 0;
-	ch->p.intr_mask = 0;
-#endif
-	ch->p.chan_mode = CFG_CH_PROTO_HDLC_FCS16;
-	ch->p.idlecode = CFG_CH_FLAG_7E;
-	ch->p.pad_fill_count = 2;
-	spin_lock_init(&ch->ch_rxlock);
-	spin_lock_init(&ch->ch_txlock);
-
-	return 0;
-}
-#endif
-
-
 #ifdef SBE_PMCC4_ENABLE
 	status_t
 musycc_chan_down(ci_t *dummy, int channum)
@@ -1592,52 +1517,12 @@ musycc_chan_down(ci_t *dummy, int channum)
 }
 #endif
 
-
-#if 0
-/* TODO: determine if these functions will not be needed and can be removed */
-int
-musycc_del_chan(ci_t *ci, int channum)
-{
-	mch_t      *ch;
-
-	if ((channum < 0) || (channum >= (MUSYCC_NPORTS * MUSYCC_NCHANS)))  /* sanity chk param */
-		return ECHRNG;
-	ch = sd_find_chan(ci, channum);
-	if (!ch)
-		return ENOENT;
-	if (ch->state == UP)
-		musycc_chan_down(ci, channum);
-	ch->state = UNASSIGNED;
-	return 0;
-}
-
-
-int
-musycc_del_chan_stats(ci_t *ci, int channum)
-{
-	mch_t      *ch;
-
-	if (channum < 0 || channum >= (MUSYCC_NPORTS * MUSYCC_NCHANS))      /* sanity chk param */
-		return ECHRNG;
-	ch = sd_find_chan(ci, channum);
-	if (!ch)
-		return ENOENT;
-
-	memset(&ch->s, 0, sizeof(struct sbecom_chan_stats));
-	return 0;
-}
-#endif
-
-
 int
 musycc_start_xmit(ci_t *ci, int channum, void *mem_token)
 {
 	mch_t      *ch;
 	struct mdesc *md;
 	void       *m2;
-#if 0
-	unsigned long flags;
-#endif
 	int         txd_need_cnt;
 	u_int32_t   len;
 
@@ -1694,9 +1579,7 @@ musycc_start_xmit(ci_t *ci, int channum, void *mem_token)
 		OS_mem_token_free(mem_token);
 		return 0;
 	}
-#if 0
-	spin_lock_irqsave(&ch->ch_txlock, flags);
-#endif
+
 	/************************************************************/
 	/** flow control the line if not enough descriptors remain **/
 	/************************************************************/
@@ -1707,9 +1590,6 @@ musycc_start_xmit(ci_t *ci, int channum, void *mem_token)
 		ch->tx_full = 1;
 		ch->txd_required = txd_need_cnt;
 		sd_disable_xmit(ch->user);
-#if 0
-		spin_unlock_irqrestore(&ch->ch_txlock, flags);
-#endif
 		return -EBUSY;               /* tell user to try again later */
 	}
 	/**************************************************/
@@ -1748,12 +1628,6 @@ musycc_start_xmit(ci_t *ci, int channum, void *mem_token)
 		/* last chunk in hdlc mode */
 		u |= (ch->p.idlecode << IDLE_CODE);
 		if (ch->p.pad_fill_count) {
-#if 0
-			/* NOOP NOTE: u_int8_t cannot be > 0xFF */
-			/* sanitize pad_fill_count for maximums allowed by hardware */
-			if (ch->p.pad_fill_count > EXTRA_FLAGS_MASK)
-				ch->p.pad_fill_count = EXTRA_FLAGS_MASK;
-#endif
 			u |= (PADFILL_ENABLE | (ch->p.pad_fill_count << EXTRA_FLAGS));
 		}
 		md->mem_token = len ? NULL : mem_token;    /* Fill in mds on last
Signature · 1 line
1.7.1
#1 lore raw
Quoted 9 lines · Daeseok Youn

Removes "#if 0" blocks.

---
Dan,
I decided to leave musycc_dump_rxbuffer_ring(ch, 0) which is commented out and make a block as "RLD_DEBUG". Because i think this block need to debug with define "RLD_DEBUG". If I am wrong, let me know.

This change should maybe have been in a separate patch. It's a border line thing. But definitely, it should have been mentioned in the changelog.

Btw, you can use git citool to add or remove lines from a commit. Highlight and right click on the lines you want to add or remove.

I don't really care either way if you keep it or delete it.

regards,
dan carpenter

#2 lore raw

2014-05-09 19:51 GMT+09:00, Dan Carpenter <[email protected]>:

Quoted 12 lines · Daeseok Youn
Quoted 10 lines

Removes "#if 0" blocks.

---
Dan,
I decided to leave musycc_dump_rxbuffer_ring(ch, 0) which is commented out and make a block as "RLD_DEBUG". Because i think this block need to
debug
with define "RLD_DEBUG". If I am wrong, let me know.

Quoted 7 lines

This change should maybe have been in a separate patch. It's a border line thing. But definitely, it should have been mentioned in the changelog.

Btw, you can use git citool to add or remove lines from a commit. Highlight and right click on the lines you want to add or remove.

Thanks for the tip. I used "git add -p" after "git rebase" and "git reset HEAD" for
spliting a patch.
But I have a question, Do I have to resend rest of patches after spliting this patch?
In this case, 2/5 is splited to two, it doesn't need to rebase but numbering of patches are changed.

Quoted 2 lines

I don't really care either way if you keep it or delete it.

Ok. I will leave this.

Thanks for review.

Regards,
Daeseok Youn

Quoted 5 lines

regards,
dan carpenter

#3 lore raw
Quoted 20 lines · DaeSeok Youn

2014-05-09 19:51 GMT+09:00, Dan Carpenter <[email protected]>:

Quoted 12 lines · Daeseok Youn
Quoted 10 lines

Removes "#if 0" blocks.

---
Dan,
I decided to leave musycc_dump_rxbuffer_ring(ch, 0) which is commented out and make a block as "RLD_DEBUG". Because i think this block need to
debug
with define "RLD_DEBUG". If I am wrong, let me know.

Quoted 7 lines

This change should maybe have been in a separate patch. It's a border line thing. But definitely, it should have been mentioned in the changelog.

Btw, you can use git citool to add or remove lines from a commit. Highlight and right click on the lines you want to add or remove.

Quoted 7 lines

Thanks for the tip. I used "git add -p" after "git rebase" and "git reset HEAD" for
spliting a patch.
But I have a question, Do I have to resend rest of patches after spliting this patch?
In this case, 2/5 is splited to two, it doesn't need to rebase but numbering of patches are changed.

Probably it's simplest to just fixup the changelog and resend as-is. If you split a patch then normally it's easiest to just resend everything.

If you have to resend just one patch and it doesn't affect the later patches then you can just resend that one so long as you get the In-Reply-To email header correct. If you don't know what an In-Reply-To header is, then resend everything.

regards,
dan carpenter

#4 lore raw

2014-05-09 23:15 GMT+09:00, Dan Carpenter <[email protected]>:

Quoted 31 lines · DaeSeok Youn
Quoted 22 lines

2014-05-09 19:51 GMT+09:00, Dan Carpenter <[email protected]>:

Quoted 14 lines · Daeseok Youn
Quoted 12 lines

Removes "#if 0" blocks.

---
Dan,
I decided to leave musycc_dump_rxbuffer_ring(ch, 0) which is
commented
out and make a block as "RLD_DEBUG". Because i think this block need
to
debug
with define "RLD_DEBUG". If I am wrong, let me know.

Quoted 7 lines

This change should maybe have been in a separate patch. It's a border line thing. But definitely, it should have been mentioned in the changelog.

Btw, you can use git citool to add or remove lines from a commit. Highlight and right click on the lines you want to add or remove.

Quoted 7 lines

Thanks for the tip. I used "git add -p" after "git rebase" and "git reset HEAD" for
spliting a patch.
But I have a question, Do I have to resend rest of patches after spliting this patch?
In this case, 2/5 is splited to two, it doesn't need to rebase but numbering of patches are changed.

Quoted 9 lines

Probably it's simplest to just fixup the changelog and resend as-is. If you split a patch then normally it's easiest to just resend everything.

If you have to resend just one patch and it doesn't affect the later patches then you can just resend that one so long as you get the In-Reply-To email header correct. If you don't know what an In-Reply-To header is, then resend everything.

Thanks for kind explanation.
I will just change the changelog and send this again.

Regards,
Daeseok Youn

Quoted 4 lines

regards,
dan carpenter