Commit 15ffde4d authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Refactor et131x_isr() to remove indenting

By negating a 'status' variable check in et131x_isr(), we can remove
the indenting of a large block of code, increasing the readability.

This patch does exactly that.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0b5e4092
...@@ -4234,7 +4234,9 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4234,7 +4234,9 @@ static void et131x_isr_handler(struct work_struct *work)
status &= 0xffffffd7; status &= 0xffffffd7;
if (status) { if (!status)
goto out;
/* Handle the TXDMA Error interrupt */ /* Handle the TXDMA Error interrupt */
if (status & ET_INTR_TXDMA_ERR) { if (status & ET_INTR_TXDMA_ERR) {
u32 txdma_err; u32 txdma_err;
...@@ -4248,33 +4250,31 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4248,33 +4250,31 @@ static void et131x_isr_handler(struct work_struct *work)
} }
/* Handle Free Buffer Ring 0 and 1 Low interrupt */ /* Handle Free Buffer Ring 0 and 1 Low interrupt */
if (status & if (status & (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) {
(ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) { /*
* This indicates the number of unused buffers in RXDMA free
* buffer ring 0 is <= the limit you programmed. Free buffer
* resources need to be returned. Free buffers are consumed as
* packets are passed from the network to the host. The host
* becomes aware of the packets from the contents of the packet
* status ring. This ring is queried when the packet done
* interrupt occurs. Packets are then passed to the OS. When
* the OS is done with the packets the resources can be
* returned to the ET1310 for re-use. This interrupt is one
* method of returning resources.
*/
/* /*
* This indicates the number of unused buffers in * If the user has flow control on, then we will
* RXDMA free buffer ring 0 is <= the limit you
* programmed. Free buffer resources need to be
* returned. Free buffers are consumed as packets
* are passed from the network to the host. The host
* becomes aware of the packets from the contents of
* the packet status ring. This ring is queried when
* the packet done interrupt occurs. Packets are then
* passed to the OS. When the OS is done with the
* packets the resources can be returned to the
* ET1310 for re-use. This interrupt is one method of
* returning resources.
*/
/* If the user has flow control on, then we will
* send a pause packet, otherwise just exit * send a pause packet, otherwise just exit
*/ */
if (adapter->flowcontrol == FLOW_TXONLY || if (adapter->flowcontrol == FLOW_TXONLY ||
adapter->flowcontrol == FLOW_BOTH) { adapter->flowcontrol == FLOW_BOTH) {
u32 pm_csr; u32 pm_csr;
/* Tell the device to send a pause packet via /*
* the back pressure register (bp req and * Tell the device to send a pause packet via the back
* bp xon/xoff) * pressure register (bp req and bp xon/xoff)
*/ */
pm_csr = readl(&iomem->global.pm_csr); pm_csr = readl(&iomem->global.pm_csr);
if (!et1310_in_phy_coma(adapter)) if (!et1310_in_phy_coma(adapter))
...@@ -4284,14 +4284,12 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4284,14 +4284,12 @@ static void et131x_isr_handler(struct work_struct *work)
/* Handle Packet Status Ring Low Interrupt */ /* Handle Packet Status Ring Low Interrupt */
if (status & ET_INTR_RXDMA_STAT_LOW) { if (status & ET_INTR_RXDMA_STAT_LOW) {
/* /*
* Same idea as with the two Free Buffer Rings. * Same idea as with the two Free Buffer Rings. Packets going
* Packets going from the network to the host each * from the network to the host each consume a free buffer
* consume a free buffer resource and a packet status * resource and a packet status resource. These resoures are
* resource. These resoures are passed to the OS. * passed to the OS. When the OS is done with the resources,
* When the OS is done with the resources, they need * they need to be returned to the ET1310. This is one method
* to be returned to the ET1310. This is one method
* of returning the resources. * of returning the resources.
*/ */
} }
...@@ -4299,22 +4297,19 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4299,22 +4297,19 @@ static void et131x_isr_handler(struct work_struct *work)
/* Handle RXDMA Error Interrupt */ /* Handle RXDMA Error Interrupt */
if (status & ET_INTR_RXDMA_ERR) { if (status & ET_INTR_RXDMA_ERR) {
/* /*
* The rxdma_error interrupt is sent when a time-out * The rxdma_error interrupt is sent when a time-out on a
* on a request issued by the JAGCore has occurred or * request issued by the JAGCore has occurred or a completion is
* a completion is returned with an un-successful * returned with an un-successful status. In both cases the
* status. In both cases the request is considered * request is considered complete. The JAGCore will
* complete. The JAGCore will automatically re-try the * automatically re-try the request in question. Normally
* request in question. Normally information on events * information on events like these are sent to the host using
* like these are sent to the host using the "Advanced * the "Advanced Error Reporting" capability. This interrupt is
* Error Reporting" capability. This interrupt is * another way of getting similar information. The only thing
* another way of getting similar information. The * required is to clear the interrupt by reading the ISR in the
* only thing required is to clear the interrupt by * global resources. The JAGCore will do a re-try on the
* reading the ISR in the global resources. The * request. Normally you should never see this interrupt. If
* JAGCore will do a re-try on the request. Normally * you start to see this interrupt occurring frequently then
* you should never see this interrupt. If you start * something bad has occurred. A reset might be the thing to do.
* to see this interrupt occurring frequently then
* something bad has occurred. A reset might be the
* thing to do.
*/ */
/* TRAP();*/ /* TRAP();*/
...@@ -4326,11 +4321,10 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4326,11 +4321,10 @@ static void et131x_isr_handler(struct work_struct *work)
/* Handle the Wake on LAN Event */ /* Handle the Wake on LAN Event */
if (status & ET_INTR_WOL) { if (status & ET_INTR_WOL) {
/* /*
* This is a secondary interrupt for wake on LAN. * This is a secondary interrupt for wake on LAN. The driver
* The driver should never see this, if it does, * should never see this, if it does, something serious is
* something serious is wrong. We will TRAP the * wrong. We will TRAP the message when we are in DBG mode,
* message when we are in DBG mode, otherwise we * otherwise we will ignore it.
* will ignore it.
*/ */
dev_err(&adapter->pdev->dev, "WAKE_ON_LAN interrupt\n"); dev_err(&adapter->pdev->dev, "WAKE_ON_LAN interrupt\n");
} }
...@@ -4340,35 +4334,32 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4340,35 +4334,32 @@ static void et131x_isr_handler(struct work_struct *work)
u32 err = readl(&iomem->txmac.err); u32 err = readl(&iomem->txmac.err);
/* /*
* When any of the errors occur and TXMAC generates * When any of the errors occur and TXMAC generates an
* an interrupt to report these errors, it usually * interrupt to report these errors, it usually means that
* means that TXMAC has detected an error in the data * TXMAC has detected an error in the data stream retrieved
* stream retrieved from the on-chip Tx Q. All of * from the on-chip Tx Q. All of these errors are catastrophic
* these errors are catastrophic and TXMAC won't be * and TXMAC won't be able to recover data when these errors
* able to recover data when these errors occur. In * occur. In a nutshell, the whole Tx path will have to be reset
* a nutshell, the whole Tx path will have to be reset
* and re-configured afterwards. * and re-configured afterwards.
*/ */
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev,
"TXMAC interrupt, error 0x%08x\n", "TXMAC interrupt, error 0x%08x\n",
err); err);
/* If we are debugging, we want to see this error, /*
* otherwise we just want the device to be reset and * If we are debugging, we want to see this error, otherwise we
* continue * just want the device to be reset and continue
*/ */
} }
/* Handle RXMAC Interrupt */ /* Handle RXMAC Interrupt */
if (status & ET_INTR_RXMAC) { if (status & ET_INTR_RXMAC) {
/* /*
* These interrupts are catastrophic to the device, * These interrupts are catastrophic to the device, what we need
* what we need to do is disable the interrupts and * to do is disable the interrupts and set the flag to cause us
* set the flag to cause us to reset so we can solve * to reset so we can solve this issue.
* this issue.
*/ */
/* MP_SET_FLAG( adapter, /* MP_SET_FLAG( adapter, fMP_ADAPTER_HARDWARE_ERROR); */
fMP_ADAPTER_HARDWARE_ERROR); */
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev,
"RXMAC interrupt, error 0x%08x. Requesting reset\n", "RXMAC interrupt, error 0x%08x. Requesting reset\n",
...@@ -4380,19 +4371,17 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4380,19 +4371,17 @@ static void et131x_isr_handler(struct work_struct *work)
readl(&iomem->rxmac.rxq_diag)); readl(&iomem->rxmac.rxq_diag));
/* /*
* If we are debugging, we want to see this error, * If we are debugging, we want to see this error, otherwise we
* otherwise we just want the device to be reset and * just want the device to be reset and continue
* continue
*/ */
} }
/* Handle MAC_STAT Interrupt */ /* Handle MAC_STAT Interrupt */
if (status & ET_INTR_MAC_STAT) { if (status & ET_INTR_MAC_STAT) {
/* /*
* This means at least one of the un-masked counters * This means at least one of the un-masked counters in the
* in the MAC_STAT block has rolled over. Use this * MAC_STAT block has rolled over. Use this to maintain the top,
* to maintain the top, software managed bits of the * software managed bits of the counter(s).
* counter(s).
*/ */
et1310_handle_macstat_interrupt(adapter); et1310_handle_macstat_interrupt(adapter);
} }
...@@ -4400,16 +4389,14 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4400,16 +4389,14 @@ static void et131x_isr_handler(struct work_struct *work)
/* Handle SLV Timeout Interrupt */ /* Handle SLV Timeout Interrupt */
if (status & ET_INTR_SLV_TIMEOUT) { if (status & ET_INTR_SLV_TIMEOUT) {
/* /*
* This means a timeout has occurred on a read or * This means a timeout has occurred on a read or write request
* write request to one of the JAGCore registers. The * to one of the JAGCore registers. The Global Resources block
* Global Resources block has terminated the request * has terminated the request and on a read request, returned a
* and on a read request, returned a "fake" value. * "fake" value. The most likely reasons are: Bad Address or the
* The most likely reasons are: Bad Address or the * addressed module is in a power-down state and can't respond.
* addressed module is in a power-down state and
* can't respond.
*/ */
} }
} out:
et131x_enable_interrupts(adapter); et131x_enable_interrupts(adapter);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment