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