Commit eeb90cb2 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman
Browse files

staging: octeon-usb: cvmx-usb: fix whitespace issues



Fix most of the whitespace issues reported by checkpatch:
	- use tabs for indentation
	- brace placement vs. newlines
	- (foo_t*) -> (foo_t *)
	- i=0 -> i = 0

Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95e67a7a
Loading
Loading
Loading
Loading
+2144 −2182
Original line number Diff line number Diff line
@@ -213,8 +213,7 @@ typedef struct {
		uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \
			octeon_get_clock_rate() / 1000000;		    \
		type c;							    \
        while (1)                                                       \
        {                                                               \
		while (1) {						    \
			c.u32 = __cvmx_usb_read_csr32(usb, address);	    \
			if (c.s.field op (value)) {			    \
				result = 0;				    \
@@ -470,13 +469,11 @@ static inline void __cvmx_usb_remove_pipe(cvmx_usb_pipe_list_t *list, cvmx_usb_p
			list->head->prev = NULL;
		else
			list->tail = NULL;
    }
    else if (list->tail == pipe) {
	} else if (list->tail == pipe) {
		list->tail = pipe->prev;
		list->tail->next = NULL;
		pipe->prev = NULL;
    }
    else {
	} else {
		pipe->prev->next = pipe->next;
		pipe->next->prev = pipe->prev;
		pipe->prev = NULL;
@@ -585,8 +582,7 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
		if (OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
			usbn_clk_ctl.cn31xx.p_rclk  = 1; /* From CN31XX,CN30XX manual */
			usbn_clk_ctl.cn31xx.p_xenbn = 0;
        }
        else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
		} else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
			usbn_clk_ctl.cn56xx.p_rtype = 2; /* From CN56XX,CN50XX manual */
		else
			usbn_clk_ctl.cn52xx.p_rtype = 1; /* From CN52XX manual */
@@ -602,15 +598,13 @@ int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
			usbn_clk_ctl.s.p_c_sel = 2;
			break;
		}
    }
    else {
	} else {
		/* The USB port uses a 12MHz crystal as clock source
		   at USB_XO and USB_XI */
		if (OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
			usbn_clk_ctl.cn31xx.p_rclk  = 1; /* From CN31XX,CN30XX manual */
			usbn_clk_ctl.cn31xx.p_xenbn = 1;
        }
        else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
		} else if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN50XX))
			usbn_clk_ctl.cn56xx.p_rtype = 0; /* From CN56XX,CN50XX manual */
		else
			usbn_clk_ctl.cn52xx.p_rtype = 0; /* From CN52XX manual */
@@ -1126,8 +1120,7 @@ int cvmx_usb_open_pipe(cvmx_usb_state_t *state, cvmx_usb_pipe_flags_t flags,
		pipe->interval = interval*8;
		/* Force start splits to be schedule on uFrame 0 */
		pipe->next_tx_frame = ((usb->frame_number+7)&~7) + pipe->interval;
    }
    else {
	} else {
		pipe->interval = interval;
		pipe->next_tx_frame = usb->frame_number + pipe->interval;
	}
@@ -1432,8 +1425,7 @@ static void __cvmx_usb_start_channel_control(cvmx_usb_internal_state_t *usb,
		   do multiple packets in a row */
		packets_to_transfer = 1;
		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
    }
    else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
	} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
		/* Limit the number of packet and data transferred to what the
		   hardware can handle */
		packets_to_transfer = MAX_TRANSFER_PACKETS;
@@ -1541,8 +1533,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
					pipe->split_sc_frame = (usb->frame_number + 1) & 0x7f;
				else
					pipe->split_sc_frame = (usb->frame_number + 2) & 0x7f;
            }
            else
			} else
				pipe->split_sc_frame = -1;

			usbc_hcsplt.s.spltena = 1;
@@ -1572,8 +1563,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
						usbc_hcsplt.s.xactpos = 3; /* Entire payload in one go */
					else
						usbc_hcsplt.s.xactpos = 2; /* First part of payload */
                }
                else {
				} else {
					/* Continuing the previous data, we must either be
					   in the middle or at the end */
					if (bytes_to_transfer <= 188)
@@ -1606,8 +1596,7 @@ static void __cvmx_usb_start_channel(cvmx_usb_internal_state_t *usb,
			   do multiple packets in a row */
			packets_to_transfer = 1;
			bytes_to_transfer = packets_to_transfer * pipe->max_packet;
        }
        else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
		} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
			/* Limit the number of packet and data transferred to what the
			   hardware can handle */
			packets_to_transfer = MAX_TRANSFER_PACKETS;
@@ -1977,8 +1966,7 @@ static int __cvmx_usb_submit_transaction(cvmx_usb_internal_state_t *usb,
	if (pipe->tail) {
		transaction->prev = pipe->tail;
		transaction->prev->next = transaction;
    }
    else {
	} else {
		if (pipe->next_tx_frame < usb->frame_number)
			pipe->next_tx_frame = usb->frame_number + pipe->interval -
				(usb->frame_number - pipe->next_tx_frame) % pipe->interval;
@@ -2499,17 +2487,14 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
				usbc_hcchar.s.chdis = 1;
				__cvmx_usb_write_csr32(usb, CVMX_USBCX_HCCHARX(channel, usb->index), usbc_hcchar.u32);
				return 0;
            }
            else if (usbc_hcint.s.xfercompl) {
			} else if (usbc_hcint.s.xfercompl) {
				/* Successful IN/OUT with transfer complete. Channel halt isn't needed */
            }
            else {
			} else {
				cvmx_dprintf("USB%d: Channel %d interrupt without halt\n", usb->index, channel);
				return 0;
			}
		}
    }
    else {
	} else {
		/* There is are no interrupts that we need to process when the channel is
		   still running */
		if (!usbc_hcint.s.chhltd)
@@ -2548,8 +2533,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
		   value of xfersize from its starting value and we know how many
		   bytes were written to the buffer */
		bytes_this_transfer = transaction->xfersize - usbc_hctsiz.s.xfersize;
    }
    else {
	} else {
		/* OUT transaction don't decrement xfersize. Instead pktcnt is
		   decremented on every successful packet send. The hardware does
		   this when it receives an ACK, or NYET. If it doesn't
@@ -2601,8 +2585,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
		   transferred */
		pipe->pid_toggle = 0;
		__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_STALL);
    }
    else if (usbc_hcint.s.xacterr) {
	} else if (usbc_hcint.s.xacterr) {
		/* We know at least one packet worked if we get a ACK or NAK. Reset the retry counter */
		if (usbc_hcint.s.nak || usbc_hcint.s.ack)
			transaction->retries = 0;
@@ -2611,8 +2594,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
			/* XactErr as a response means the device signaled something wrong with
			   the transfer. For example, PID toggle errors cause these */
			__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_XACTERR);
        }
        else {
		} else {
			/* If this was a split then clear our split in progress marker */
			if (usb->active_split == transaction)
				usb->active_split = NULL;
@@ -2625,18 +2607,13 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
				pipe->next_tx_frame = usb->frame_number + pipe->interval -
						      (usb->frame_number - pipe->next_tx_frame) % pipe->interval;
		}
    }
    else if (usbc_hcint.s.bblerr)
    {
	} else if (usbc_hcint.s.bblerr) {
		/* Babble Error (BblErr) */
		__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_BABBLEERR);
    }
    else if (usbc_hcint.s.datatglerr)
    {
	} else if (usbc_hcint.s.datatglerr) {
		/* We'll retry the exact same transaction again */
		transaction->retries++;
    }
    else if (usbc_hcint.s.nyet) {
	} else if (usbc_hcint.s.nyet) {
		/* NYET as a response is only allowed in three cases: as a response to
		   a ping, as a response to a split transaction, and as a response to
		   a bulk out. The ping case is handled by hardware, so we only have
@@ -2647,8 +2624,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
			   this transaction is complete */
			if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet))
				__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
        }
        else {
		} else {
			/* Split transactions retry the split complete 4 times then rewind
			   to the start split and do the entire transactions again */
			transaction->retries++;
@@ -2659,8 +2635,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
				pipe->split_sc_frame = -1;
			}
		}
    }
    else if (usbc_hcint.s.ack) {
	} else if (usbc_hcint.s.ack) {
		transaction->retries = 0;
		/* The ACK bit can only be checked after the other error bits. This is
		   because a multi packet transfer may succeed in a number of packets
@@ -2673,11 +2648,9 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
		   pipe */
		pipe->flags &= ~__CVMX_USB_PIPE_FLAGS_NEED_PING;

        switch (transaction->type)
        {
		switch (transaction->type) {
		case CVMX_USB_TRANSFER_CONTROL:
                switch (transaction->stage)
                {
			switch (transaction->stage) {
			case CVMX_USB_STAGE_NON_CONTROL:
			case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
				/* This should be impossible */
@@ -2716,8 +2689,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
						else
							transaction->actual_bytes += pipe->max_packet;
					}
                        }
                        else if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
				} else if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
					pipe->pid_toggle = 1;
					transaction->stage = CVMX_USB_STAGE_STATUS;
				}
@@ -2726,8 +2698,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
				if ((buffer_space_left == 0) || (bytes_in_last_packet < pipe->max_packet)) {
					pipe->pid_toggle = 1;
					transaction->stage = CVMX_USB_STAGE_STATUS;
                        }
                        else {
				} else {
					transaction->stage = CVMX_USB_STAGE_DATA;
				}
				break;
@@ -2760,8 +2731,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
							__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
					}
				}
                }
                else {
			} else {
				if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
				    (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
				    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
@@ -2788,8 +2758,7 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
						pipe->next_tx_frame += pipe->interval;
						__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
					}
                    }
                    else {
				} else {
					if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
						/* We are in the incoming data phase. Keep getting
						   data until we run out of space or get a small
@@ -2798,19 +2767,16 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
							pipe->next_tx_frame += pipe->interval;
							__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
						}
                        }
                        else
					} else
						transaction->stage = CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
				}
                }
                else {
			} else {
				pipe->next_tx_frame += pipe->interval;
				__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_SUCCESS);
			}
			break;
		}
    }
    else if (usbc_hcint.s.nak) {
	} else if (usbc_hcint.s.nak) {
		/* If this was a split then clear our split in progress marker */
		if (usb->active_split == transaction)
			usb->active_split = NULL;
@@ -2824,17 +2790,13 @@ static int __cvmx_usb_poll_channel(cvmx_usb_internal_state_t *usb, int channel)
		if (pipe->next_tx_frame < usb->frame_number)
			pipe->next_tx_frame = usb->frame_number + pipe->interval -
				(usb->frame_number - pipe->next_tx_frame) % pipe->interval;
    }
    else {
	} else {
		cvmx_usb_port_status_t port;
		port = cvmx_usb_get_status((cvmx_usb_state_t *)usb);
        if (port.port_enabled)
        {
		if (port.port_enabled) {
			/* We'll retry the exact same transaction again */
			transaction->retries++;
        }
        else
        {
		} else {
			/* We get channel halted interrupts with no result bits sets when the
			   cable is unplugged */
			__cvmx_usb_perform_complete(usb, pipe, transaction, CVMX_USB_COMPLETE_ERROR);