Make sure that there is one space between if and condition

This commit is contained in:
Gregory Nutt 2014-04-12 12:53:19 -06:00
parent dc0211b218
commit 303cc1902b
19 changed files with 97 additions and 82 deletions

View file

@ -252,7 +252,7 @@ void up_disable_irq(int irq)
void up_enable_irq(int irq)
{
if((unsigned)irq < NR_IRQS)
if ((unsigned)irq < NR_IRQS)
{
_irq_enable(irq, 1);
}

View file

@ -619,7 +619,7 @@ static void kinetis_txdone(FAR struct kinetis_driver_s *priv)
* Three interrupt sources will vector this this function:
* 1. Ethernet MAC transmit interrupt handler
* 2. Ethernet MAC receive interrupt handler
* 3.
* 3.
*
* Parameters:
* irq - Number of the IRQ that generated the interrupt
@ -677,7 +677,7 @@ static int kinetis_interrupt(int irq, FAR void *context)
/* Reinitialize all buffers. */
kinetis_initbuffers(priv);
/* Indicate that there have been empty receive buffers produced */
putreg32(ENET_RDAR, KINETIS_ENET_RDAR);
@ -771,7 +771,7 @@ static void kinetis_polltimer(int argc, uint32_t arg, ...)
*
* Description:
* NuttX Callback: Bring up the Ethernet interface when an IP address is
* provided
* provided
*
* Parameters:
* dev - Reference to the NuttX driver state structure
@ -933,7 +933,7 @@ static int kinetis_ifdown(struct uip_driver_s *dev)
* Function: kinetis_txavail
*
* Description:
* Driver callback invoked when new TX data is available. This is a
* Driver callback invoked when new TX data is available. This is a
* stimulus perform an out-of-cycle poll and, thereby, reduce the TX
* latency.
*
@ -990,7 +990,7 @@ static int kinetis_txavail(struct uip_driver_s *dev)
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be added
* mac - The MAC address to be added
*
* Returned Value:
* None
@ -1019,7 +1019,7 @@ static int kinetis_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be removed
* mac - The MAC address to be removed
*
* Returned Value:
* None
@ -1070,7 +1070,7 @@ static void kinetis_initmii(struct kinetis_driver_s *priv)
* Function: kinetis_writemii
*
* Description:
* Write a 16-bit value to a PHY register.
* Write a 16-bit value to a PHY register.
*
* Parameters:
* priv - Reference to the private ENET driver state structure
@ -1114,7 +1114,7 @@ static int kinetis_writemii(struct kinetis_driver_s *priv, uint8_t phyaddr,
/* Check for a timeout */
if(timeout == MII_MAXPOLLS)
if (timeout == MII_MAXPOLLS)
{
return -ETIMEDOUT;
}
@ -1129,7 +1129,7 @@ static int kinetis_writemii(struct kinetis_driver_s *priv, uint8_t phyaddr,
* Function: kinetis_writemii
*
* Description:
* Read a 16-bit value from a PHY register.
* Read a 16-bit value from a PHY register.
*
* Parameters:
* priv - Reference to the private ENET driver state structure
@ -1152,7 +1152,7 @@ static int kinetis_readmii(struct kinetis_driver_s *priv, uint8_t phyaddr,
putreg32(ENET_INT_MII, KINETIS_ENET_EIR);
/* Initiatate the MII Management read */
putreg32(2 << ENET_MMFR_TA_SHIFT |
(uint32_t)regaddr << ENET_MMFR_PA_SHIFT |
(uint32_t)phyaddr << ENET_MMFR_PA_SHIFT |
@ -1172,7 +1172,7 @@ static int kinetis_readmii(struct kinetis_driver_s *priv, uint8_t phyaddr,
/* Check for a timeout */
if (timeout >= MII_MAXPOLLS)
if (timeout >= MII_MAXPOLLS)
{
return -ETIMEDOUT;
}
@ -1241,7 +1241,7 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
phydata = 0;
kinetis_readmii(priv, CONFIG_ENET_PHYADDR, PHY_STATUS, &phydata);
/* Set up the transmit and receive contrel registers based on the
/* Set up the transmit and receive contrel registers based on the
* configuration and the auto negotiation results.
*/
@ -1256,7 +1256,7 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
putreg32(rcr, KINETIS_ENET_RCR);
putreg32(tcr, KINETIS_ENET_TCR);
/* Setup half or full duplex */
if ((phydata & PHY_DUPLEX_STATUS) != 0)
@ -1271,7 +1271,7 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
rcr |= ENET_RCR_DRT;
}
if ((phydata & PHY_SPEED_STATUS) != 0)
{
/* 10Mbps */
@ -1463,7 +1463,7 @@ int kinetis_netinitialize(int intf)
kinetis_pinconfig(PIN_RMII0_TXD0);
kinetis_pinconfig(PIN_RMII0_TXD1);
kinetis_pinconfig(PIN_RMII0_TXEN);
#endif
#endif
/* Set interrupt priority levels */

View file

@ -289,11 +289,11 @@ static int i2c_start (struct lpc23xx_i2cdev_s *priv)
wd_cancel(priv->timeout);
sem_post(&priv->mutex);
if( priv-> state == 0x18 || priv->state == 0x28)
if (priv-> state == 0x18 || priv->state == 0x28)
{
ret=priv->wrcnt;
}
else if( priv-> state == 0x50 || priv->state == 0x58)
else if (priv-> state == 0x50 || priv->state == 0x58)
{
ret=priv->rdcnt;
}
@ -404,7 +404,7 @@ static int i2c_interrupt (int irq, FAR void *context)
case 0x28:
priv->wrcnt++;
if(priv->wrcnt<priv->msg.length)
if (priv->wrcnt<priv->msg.length)
{
putreg32(priv->msg.buffer[priv->wrcnt],priv->base+I2C_DAT_OFFSET);
}

View file

@ -165,21 +165,21 @@ static void adc_reset(FAR struct adc_dev_s *dev)
clkdiv&=0xff00;
putreg32(ADC_CR_PDN|ADC_CR_BURST|clkdiv|priv->mask,LPC43_ADC_CR);
if(priv->mask&0x01)
if (priv->mask&0x01)
lpc43_configgpio(GPIO_AD0p0);
else if(priv->mask&0x02)
else if (priv->mask&0x02)
lpc43_configgpio(GPIO_AD0p1);
else if(priv->mask&0x04)
else if (priv->mask&0x04)
lpc43_configgpio(GPIO_AD0p2);
else if(priv->mask&0x08)
else if (priv->mask&0x08)
lpc43_configgpio(GPIO_AD0p3);
else if(priv->mask&0x10)
else if (priv->mask&0x10)
lpc43_configgpio(GPIO_AD0p4);
else if(priv->mask&0x20)
else if (priv->mask&0x20)
lpc43_configgpio(GPIO_AD0p5);
else if(priv->mask&0x40)
else if (priv->mask&0x40)
lpc43_configgpio(GPIO_AD0p6);
else if(priv->mask&0x80)
else if (priv->mask&0x80)
lpc43_configgpio(GPIO_AD0p7);
irqrestore(flags);

View file

@ -1626,7 +1626,7 @@ FAR struct can_dev_s *stm32_caninitialize(int port)
*/
#ifdef CONFIG_STM32_CAN1
if( port == 1 )
if (port == 1)
{
/* Select the CAN1 device structure */
@ -1642,7 +1642,7 @@ FAR struct can_dev_s *stm32_caninitialize(int port)
else
#endif
#ifdef CONFIG_STM32_CAN2
if ( port ==2 )
if (port == 2)
{
/* Select the CAN2 device structure */

View file

@ -227,7 +227,7 @@ unsigned int tapdev_read(unsigned char *buf, unsigned int buflen)
FD_SET(gtapdevfd, &fdset);
ret = select(gtapdevfd + 1, &fdset, NULL, NULL, &tv);
if(ret == 0)
if (ret == 0)
{
return 0;
}
@ -250,7 +250,7 @@ void tapdev_send(unsigned char *buf, unsigned int buflen)
syslog("tapdev_send: sending %d bytes\n", buflen);
gdrop++;
if(gdrop % 8 == 7)
if (gdrop % 8 == 7)
{
syslog("Dropped a packet!\n");
return;

View file

@ -287,7 +287,7 @@ static int init_graph_vga(int width, int height,int chain4)
/* chain4 not available if mode takes over 64k */
/* if(chain4 && (long)width*(long)height>65536L) return -3; */
/* if (chain4 && (long)width*(long)height>65536L) return -3; */
/* here goes the actual modeswitch */
@ -306,7 +306,7 @@ static int init_graph_vga(int width, int height,int chain4)
outw(0x0008, 0x3d4); /* vert.panning = 0 */
if(chain4)
if (chain4)
{
outw(0x4014, 0x3d4);
outw(0xa317, 0x3d4);

View file

@ -203,7 +203,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
/* Get the total size of the section header table */
shdrsize = (size_t)loadinfo->ehdr.e_shentsize * (size_t)loadinfo->ehdr.e_shnum;
if(loadinfo->ehdr.e_shoff + shdrsize > loadinfo->filelen)
if (loadinfo->ehdr.e_shoff + shdrsize > loadinfo->filelen)
{
bdbg("Insufficent space in file for section header table\n");
return -ESPIPE;

View file

@ -206,8 +206,11 @@ static void fb_ssd1783_send_cmdlist(const struct ssd1783_cmdlist *p)
while(p->is_cmd != END)
{
uint16_t sendcmd = p->data;
if(p->is_cmd == DATA)
sendcmd |= 0x0100; /* 9th bit is cmd/data flag */
if (p->is_cmd == DATA)
{
sendcmd |= 0x0100; /* 9th bit is cmd/data flag */
}
uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &sendcmd, NULL);
p++;
i++;

View file

@ -380,9 +380,9 @@ static int readbyte(int fd, char *ch)
/* Read characters from the console, and echo them to the target tty */
ret = read(fd, ch, 1);
if(ret < 0)
if (ret < 0)
{
if(errno != EAGAIN)
if (errno != EAGAIN)
{
printconsole("ERROR: Failed to read from fd=%d: %s\n", fd, strerror(errno));
close_tty();
@ -390,7 +390,7 @@ static int readbyte(int fd, char *ch)
}
return -EAGAIN;
}
else if(ret > 1)
else if (ret > 1)
{
printconsole("ERROR: Unexpected number of bytes read(%d) from fd=%d\n", ret, fd);
close_tty();
@ -406,7 +406,7 @@ static int readbyte(int fd, char *ch)
static void writebyte(int fd, char byte)
{
int ret = write(fd, &byte, 1);
if(ret < 0)
if (ret < 0)
{
printconsole("ERROR: Failed to write to fd=%d: %s\n", fd, strerror(errno));
close_tty();
@ -520,13 +520,13 @@ int main(int argc, char **argv, char **envp)
}
}
if(optind < argc)
if (optind < argc)
{
fprintf(stderr, "ERROR: Unexpected arguments at end of line\n");
show_usage(argv[0], 3);
}
switch(g_baud)
switch (g_baud)
{
case 0: speed = B0; break;
case 50: speed = B50; break;
@ -568,14 +568,14 @@ int main(int argc, char **argv, char **envp)
/* Set the host stdin to O_NONBLOCK */
oflags = fcntl(0, F_GETFL, 0);
if(oflags == -1)
if (oflags == -1)
{
fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
return 6;
}
ret = fcntl(0, F_SETFL, oflags | O_NONBLOCK);
if(ret < 0)
if (ret < 0)
{
fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
return 7;
@ -584,7 +584,7 @@ int main(int argc, char **argv, char **envp)
/* Open the selected serial port (blocking)*/
g_fd = open(g_ttydev, O_RDWR);
if(g_fd < 0)
if (g_fd < 0)
{
printconsole("ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
return 8;
@ -595,7 +595,7 @@ int main(int argc, char **argv, char **envp)
*/
ret = tcgetattr(g_fd, &g_termios);
if(ret < 0)
if (ret < 0)
{
printconsole("ERROR: Failed to get termios for %s: %s\n", g_ttydev, strerror(errno));
close(g_fd);
@ -613,7 +613,7 @@ int main(int argc, char **argv, char **envp)
(void)cfsetospeed(&tty, speed);
ret = tcsetattr(g_fd, TCSANOW, &tty);
if(ret < 0)
if (ret < 0)
{
printconsole("ERROR: Failed to set termios for %s: %s\n", g_ttydev, strerror(errno));
close(g_fd);
@ -624,7 +624,7 @@ int main(int argc, char **argv, char **envp)
/* Open the selected serial port (non-blocking)*/
g_fdnb = open(g_ttydev, O_RDONLY | O_NONBLOCK);
if(g_fdnb < 0)
if (g_fdnb < 0)
{
printconsole("ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
return 11;
@ -641,7 +641,7 @@ int main(int argc, char **argv, char **envp)
}
oflags = fcntl(g_fdnb, F_GETFL, 0);
if(oflags == -1)
if (oflags == -1)
{
fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
close_tty();
@ -649,7 +649,7 @@ int main(int argc, char **argv, char **envp)
}
ret = fcntl(g_fdnb, F_SETFL, oflags | O_NONBLOCK);
if(ret < 0)
if (ret < 0)
{
fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
close_tty();

View file

@ -398,19 +398,19 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
fifo->af_buffer[fifo->af_tail].am_data=*(uint32_t *)&buffer[nsent];
fifo->af_buffer[fifo->af_tail].am_data&=0xffffff00;
}
else if(msglen == 3)
else if (msglen == 3)
{
fifo->af_buffer[fifo->af_tail].am_channel=buffer[nsent];
fifo->af_buffer[fifo->af_tail].am_data=(*(uint16_t *)&buffer[nsent+1]);
fifo->af_buffer[fifo->af_tail].am_data<<=16;
}
else if(msglen == 2)
else if (msglen == 2)
{
fifo->af_buffer[fifo->af_tail].am_channel=0;
fifo->af_buffer[fifo->af_tail].am_data=(*(uint16_t *)&buffer[nsent]);
fifo->af_buffer[fifo->af_tail].am_data<<=16;
}
else if(msglen == 1)
else if (msglen == 1)
{
fifo->af_buffer[fifo->af_tail].am_channel=0;
fifo->af_buffer[fifo->af_tail].am_data=buffer[nsent];

View file

@ -1351,6 +1351,8 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
/* Convert sector and nsectors to nbytes and byte offset */
nbytes = nsectors * SECTORSIZE(slot);
UNUSED(nbytes);
if (IS_BLOCK(slot->type))
{
offset = start_sector;

View file

@ -399,7 +399,7 @@ void uart_init(uint8_t uart, uint8_t interrupts)
if (uart == CONS_UART_NR)
{
cons_init();
if(interrupts)
if (interrupts)
{
irq_register_handler(irq, &uart_irq_handler_cons);
irq_config(irq, 0, 0, 0xff);
@ -409,7 +409,7 @@ void uart_init(uint8_t uart, uint8_t interrupts)
else
{
sercomm_init();
if(interrupts)
if (interrupts)
{
irq_register_handler(irq, &uart_irq_handler_sercomm);
irq_config(irq, 0, 0, 0xff);

View file

@ -471,7 +471,7 @@ static int nxffs_destsetup(FAR struct nxffs_volume_s *volume,
{
/* Is there room for an inode structure in this block? */
if(pack->iooffset + SIZEOF_NXFFS_INODE_HDR > volume->geo.blocksize)
if (pack->iooffset + SIZEOF_NXFFS_INODE_HDR > volume->geo.blocksize)
{
/* No.. that inode name will not fit in this block. Return an
* indication that we are at the end of the block and try again

View file

@ -141,13 +141,14 @@ static inline bool nxbe_poprectangle(struct nxbe_clipstack_s *stack,
FAR struct nxbe_window_s **wnd,
struct nxgl_rect_s *rect)
{
if(stack->npushed > 0)
if (stack->npushed > 0)
{
stack->npushed--;
*wnd = stack->stack[stack->npushed].wnd;
nxgl_rectcopy(rect, &stack->stack[stack->npushed].rect);
return true;
}
return false;
}

View file

@ -222,12 +222,14 @@ struct uip_driver_s
* code below.
*
* dev->d_len = devicedriver_poll();
* if(dev->d_len > 0) {
* uip_input(dev);
* if(dev->d_len > 0) {
* devicedriver_send();
* if (dev->d_len > 0)
* {
* uip_input(dev);
* if (dev->d_len > 0)
* {
* devicedriver_send();
* }
* }
* }
*
* Note: If you are writing a uIP device driver that needs ARP
* (Address Resolution Protocol), e.g., when running uIP over
@ -236,20 +238,26 @@ struct uip_driver_s
*
* #define BUF ((struct uip_eth_hdr *)&dev->d_buf[0])
* dev->d_len = ethernet_devicedrver_poll();
* if(dev->d_len > 0) {
* if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
* uip_arp_ipin();
* uip_input(dev);
* if(dev->d_len > 0) {
* uip_arp_out();
* devicedriver_send();
* }
* } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
* uip_arp_arpin();
* if(dev->d_len > 0) {
* devicedriver_send();
* }
* }
* if (dev->d_len > 0)
* {
* if (BUF->type == HTONS(UIP_ETHTYPE_IP))
* {
* uip_arp_ipin();
* uip_input(dev);
* if (dev->d_len > 0)
* {
* uip_arp_out();
* devicedriver_send();
* }
* }
* else if (BUF->type == HTONS(UIP_ETHTYPE_ARP))
* {
* uip_arp_arpin();
* if (dev->d_len > 0)
* {
* devicedriver_send();
* }
* }
*/
int uip_input(struct uip_driver_s *dev);

View file

@ -493,9 +493,10 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len);
* uip_ipaddr_t ipaddr1, ipaddr2;
*
* uip_ipaddr(&ipaddr1, 192,16,1,2);
* if(uip_ipaddr_cmp(ipaddr2, ipaddr1)) {
* printf("They are the same");
* }
* if (uip_ipaddr_cmp(ipaddr2, ipaddr1))
* {
* printf("They are the same");
* }
*
* addr1 The first IP address.
* addr2 The second IP address.
@ -521,7 +522,7 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len);
* uip_ipaddr(&mask, 255,255,255,0);
* uip_ipaddr(&ipaddr1, 192,16,1,2);
* uip_ipaddr(&ipaddr2, 192,16,1,3);
* if(uip_ipaddr_maskcmp(ipaddr1, ipaddr2, &mask))
* if (uip_ipaddr_maskcmp(ipaddr1, ipaddr2, &mask))
* {
* printf("They are the same");
* }

View file

@ -99,7 +99,7 @@ static inline char *med3(char *a, char *b, char *c,
static inline void swapfunc(char *a, char *b, int n, int swaptype)
{
if(swaptype <= 1)
if (swaptype <= 1)
{
swapcode(long, a, b, n)
}

View file

@ -156,7 +156,7 @@ void uip_icmpinput(struct uip_driver_s *dev)
* checksum for the change of type
*/
if( picmp->icmpchksum >= HTONS(0xffff - (ICMP_ECHO_REQUEST << 8)))
if (picmp->icmpchksum >= HTONS(0xffff - (ICMP_ECHO_REQUEST << 8)))
{
picmp->icmpchksum += HTONS(ICMP_ECHO_REQUEST << 8) + 1;
}