First coarse run to fix coding style in locm3.

Added --terse and --mailback options to the make stylecheck target. It
also does continue even if it enounters a possible error.

We decided on two exceptions from the linux kernel coding standard:
- Empty wait while loops may end with ; on the same line.
- All blocks after while, if, for have to be in brackets even if they
  only contain one statement. Otherwise it is easy to introduce an
  error.

Checkpatch needs to be adapted to reflect those changes.
This commit is contained in:
Piotr Esden-Tempski
2013-06-12 17:44:07 -07:00
parent 48e0f3326b
commit 7df63fcae0
147 changed files with 3323 additions and 2565 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2012 Gareth McMullin <gareth@blacksphere.co.nz>
@@ -42,15 +42,17 @@ void gpio_init(u32 port, u32 pins, enum gpio_flags flags)
PIO_PDR(port) = pins;
}
if (flags & GPIO_FLAG_OPEN_DRAIN)
if (flags & GPIO_FLAG_OPEN_DRAIN) {
PIO_MDER(port) = pins;
else
} else {
PIO_MDDR(port) = pins;
}
if (flags & GPIO_FLAG_PULL_UP)
if (flags & GPIO_FLAG_PULL_UP) {
PIO_PUER(port) = pins;
else
} else {
PIO_PUDR(port) = pins;
}
}
void gpio_toggle(u32 gpioport, u32 gpios)

View File

@@ -44,18 +44,20 @@ void pmc_plla_config(u8 mul, u8 div)
void pmc_peripheral_clock_enable(u8 pid)
{
if (pid < 32)
if (pid < 32) {
PMC_PCER0 = 1 << pid;
else
} else {
PMC_PCER1 = 1 << (pid & 31);
}
}
void pmc_peripheral_clock_disable(u8 pid)
{
if (pid < 32)
if (pid < 32) {
PMC_PCDR0 = 1 << pid;
else
} else {
PMC_PCDR1 = 1 << (pid & 31);
}
}
void pmc_mck_set_source(enum mck_src src)

View File

@@ -28,13 +28,13 @@ void usart_set_baudrate(u32 usart, u32 baud)
void usart_set_databits(u32 usart, int bits)
{
USART_MR(usart) = (USART_MR(usart) & ~USART_MR_CHRL_MASK) |
((bits - 5) << 6);
((bits - 5) << 6);
}
void usart_set_stopbits(u32 usart, enum usart_stopbits sb)
{
USART_MR(usart) = (USART_MR(usart) & ~USART_MR_NBSTOP_MASK) |
(sb << 12);
(sb << 12);
}
void usart_set_parity(u32 usart, enum usart_parity par)
@@ -46,14 +46,14 @@ void usart_set_mode(u32 usart, enum usart_mode mode)
{
USART_CR(usart) =
(mode & USART_MODE_RX) ? USART_CR_RXEN : USART_CR_RXDIS;
USART_CR(usart) =
(mode & USART_MODE_TX) ? USART_CR_TXEN : USART_CR_TXDIS;
USART_CR(usart) = (mode & USART_MODE_TX) ? USART_CR_TXEN
: USART_CR_TXDIS;
}
void usart_set_flow_control(u32 usart, enum usart_flowcontrol fc)
{
USART_MR(usart) = (USART_MR(usart) & ~USART_MR_MODE_MASK) |
(fc ? USART_MR_MODE_HW_HANDSHAKING : 0);
(fc ? USART_MR_MODE_HW_HANDSHAKING : 0);
}
void usart_enable(u32 usart)