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
+1 -1
View File
@@ -252,7 +252,7 @@ void up_disable_irq(int irq)
void up_enable_irq(int irq) void up_enable_irq(int irq)
{ {
if((unsigned)irq < NR_IRQS) if ((unsigned)irq < NR_IRQS)
{ {
_irq_enable(irq, 1); _irq_enable(irq, 1);
} }
+1 -1
View File
@@ -1114,7 +1114,7 @@ static int kinetis_writemii(struct kinetis_driver_s *priv, uint8_t phyaddr,
/* Check for a timeout */ /* Check for a timeout */
if(timeout == MII_MAXPOLLS) if (timeout == MII_MAXPOLLS)
{ {
return -ETIMEDOUT; return -ETIMEDOUT;
} }
+3 -3
View File
@@ -289,11 +289,11 @@ static int i2c_start (struct lpc23xx_i2cdev_s *priv)
wd_cancel(priv->timeout); wd_cancel(priv->timeout);
sem_post(&priv->mutex); sem_post(&priv->mutex);
if( priv-> state == 0x18 || priv->state == 0x28) if (priv-> state == 0x18 || priv->state == 0x28)
{ {
ret=priv->wrcnt; ret=priv->wrcnt;
} }
else if( priv-> state == 0x50 || priv->state == 0x58) else if (priv-> state == 0x50 || priv->state == 0x58)
{ {
ret=priv->rdcnt; ret=priv->rdcnt;
} }
@@ -404,7 +404,7 @@ static int i2c_interrupt (int irq, FAR void *context)
case 0x28: case 0x28:
priv->wrcnt++; 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); putreg32(priv->msg.buffer[priv->wrcnt],priv->base+I2C_DAT_OFFSET);
} }
+8 -8
View File
@@ -165,21 +165,21 @@ static void adc_reset(FAR struct adc_dev_s *dev)
clkdiv&=0xff00; clkdiv&=0xff00;
putreg32(ADC_CR_PDN|ADC_CR_BURST|clkdiv|priv->mask,LPC43_ADC_CR); 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); lpc43_configgpio(GPIO_AD0p0);
else if(priv->mask&0x02) else if (priv->mask&0x02)
lpc43_configgpio(GPIO_AD0p1); lpc43_configgpio(GPIO_AD0p1);
else if(priv->mask&0x04) else if (priv->mask&0x04)
lpc43_configgpio(GPIO_AD0p2); lpc43_configgpio(GPIO_AD0p2);
else if(priv->mask&0x08) else if (priv->mask&0x08)
lpc43_configgpio(GPIO_AD0p3); lpc43_configgpio(GPIO_AD0p3);
else if(priv->mask&0x10) else if (priv->mask&0x10)
lpc43_configgpio(GPIO_AD0p4); lpc43_configgpio(GPIO_AD0p4);
else if(priv->mask&0x20) else if (priv->mask&0x20)
lpc43_configgpio(GPIO_AD0p5); lpc43_configgpio(GPIO_AD0p5);
else if(priv->mask&0x40) else if (priv->mask&0x40)
lpc43_configgpio(GPIO_AD0p6); lpc43_configgpio(GPIO_AD0p6);
else if(priv->mask&0x80) else if (priv->mask&0x80)
lpc43_configgpio(GPIO_AD0p7); lpc43_configgpio(GPIO_AD0p7);
irqrestore(flags); irqrestore(flags);
+2 -2
View File
@@ -1626,7 +1626,7 @@ FAR struct can_dev_s *stm32_caninitialize(int port)
*/ */
#ifdef CONFIG_STM32_CAN1 #ifdef CONFIG_STM32_CAN1
if( port == 1 ) if (port == 1)
{ {
/* Select the CAN1 device structure */ /* Select the CAN1 device structure */
@@ -1642,7 +1642,7 @@ FAR struct can_dev_s *stm32_caninitialize(int port)
else else
#endif #endif
#ifdef CONFIG_STM32_CAN2 #ifdef CONFIG_STM32_CAN2
if ( port ==2 ) if (port == 2)
{ {
/* Select the CAN2 device structure */ /* Select the CAN2 device structure */
+2 -2
View File
@@ -227,7 +227,7 @@ unsigned int tapdev_read(unsigned char *buf, unsigned int buflen)
FD_SET(gtapdevfd, &fdset); FD_SET(gtapdevfd, &fdset);
ret = select(gtapdevfd + 1, &fdset, NULL, NULL, &tv); ret = select(gtapdevfd + 1, &fdset, NULL, NULL, &tv);
if(ret == 0) if (ret == 0)
{ {
return 0; return 0;
} }
@@ -250,7 +250,7 @@ void tapdev_send(unsigned char *buf, unsigned int buflen)
syslog("tapdev_send: sending %d bytes\n", buflen); syslog("tapdev_send: sending %d bytes\n", buflen);
gdrop++; gdrop++;
if(gdrop % 8 == 7) if (gdrop % 8 == 7)
{ {
syslog("Dropped a packet!\n"); syslog("Dropped a packet!\n");
return; return;
+2 -2
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 */ /* 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 */ /* 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 */ outw(0x0008, 0x3d4); /* vert.panning = 0 */
if(chain4) if (chain4)
{ {
outw(0x4014, 0x3d4); outw(0x4014, 0x3d4);
outw(0xa317, 0x3d4); outw(0xa317, 0x3d4);
+1 -1
View File
@@ -203,7 +203,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
/* Get the total size of the section header table */ /* Get the total size of the section header table */
shdrsize = (size_t)loadinfo->ehdr.e_shentsize * (size_t)loadinfo->ehdr.e_shnum; 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"); bdbg("Insufficent space in file for section header table\n");
return -ESPIPE; return -ESPIPE;
+5 -2
View File
@@ -206,8 +206,11 @@ static void fb_ssd1783_send_cmdlist(const struct ssd1783_cmdlist *p)
while(p->is_cmd != END) while(p->is_cmd != END)
{ {
uint16_t sendcmd = p->data; uint16_t sendcmd = p->data;
if(p->is_cmd == DATA) if (p->is_cmd == DATA)
sendcmd |= 0x0100; /* 9th bit is cmd/data flag */ {
sendcmd |= 0x0100; /* 9th bit is cmd/data flag */
}
uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &sendcmd, NULL); uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &sendcmd, NULL);
p++; p++;
i++; i++;
+14 -14
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 */ /* Read characters from the console, and echo them to the target tty */
ret = read(fd, ch, 1); 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)); printconsole("ERROR: Failed to read from fd=%d: %s\n", fd, strerror(errno));
close_tty(); close_tty();
@@ -390,7 +390,7 @@ static int readbyte(int fd, char *ch)
} }
return -EAGAIN; return -EAGAIN;
} }
else if(ret > 1) else if (ret > 1)
{ {
printconsole("ERROR: Unexpected number of bytes read(%d) from fd=%d\n", ret, fd); printconsole("ERROR: Unexpected number of bytes read(%d) from fd=%d\n", ret, fd);
close_tty(); close_tty();
@@ -406,7 +406,7 @@ static int readbyte(int fd, char *ch)
static void writebyte(int fd, char byte) static void writebyte(int fd, char byte)
{ {
int ret = write(fd, &byte, 1); 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)); printconsole("ERROR: Failed to write to fd=%d: %s\n", fd, strerror(errno));
close_tty(); 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"); fprintf(stderr, "ERROR: Unexpected arguments at end of line\n");
show_usage(argv[0], 3); show_usage(argv[0], 3);
} }
switch(g_baud) switch (g_baud)
{ {
case 0: speed = B0; break; case 0: speed = B0; break;
case 50: speed = B50; 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 */ /* Set the host stdin to O_NONBLOCK */
oflags = fcntl(0, F_GETFL, 0); oflags = fcntl(0, F_GETFL, 0);
if(oflags == -1) if (oflags == -1)
{ {
fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno)); fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
return 6; return 6;
} }
ret = fcntl(0, F_SETFL, oflags | O_NONBLOCK); 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)); fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
return 7; return 7;
@@ -584,7 +584,7 @@ int main(int argc, char **argv, char **envp)
/* Open the selected serial port (blocking)*/ /* Open the selected serial port (blocking)*/
g_fd = open(g_ttydev, O_RDWR); 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)); printconsole("ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
return 8; return 8;
@@ -595,7 +595,7 @@ int main(int argc, char **argv, char **envp)
*/ */
ret = tcgetattr(g_fd, &g_termios); 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)); printconsole("ERROR: Failed to get termios for %s: %s\n", g_ttydev, strerror(errno));
close(g_fd); close(g_fd);
@@ -613,7 +613,7 @@ int main(int argc, char **argv, char **envp)
(void)cfsetospeed(&tty, speed); (void)cfsetospeed(&tty, speed);
ret = tcsetattr(g_fd, TCSANOW, &tty); 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)); printconsole("ERROR: Failed to set termios for %s: %s\n", g_ttydev, strerror(errno));
close(g_fd); close(g_fd);
@@ -624,7 +624,7 @@ int main(int argc, char **argv, char **envp)
/* Open the selected serial port (non-blocking)*/ /* Open the selected serial port (non-blocking)*/
g_fdnb = open(g_ttydev, O_RDONLY | O_NONBLOCK); 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)); printconsole("ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno));
return 11; return 11;
@@ -641,7 +641,7 @@ int main(int argc, char **argv, char **envp)
} }
oflags = fcntl(g_fdnb, F_GETFL, 0); oflags = fcntl(g_fdnb, F_GETFL, 0);
if(oflags == -1) if (oflags == -1)
{ {
fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno)); fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
close_tty(); close_tty();
@@ -649,7 +649,7 @@ int main(int argc, char **argv, char **envp)
} }
ret = fcntl(g_fdnb, F_SETFL, oflags | O_NONBLOCK); 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)); fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
close_tty(); close_tty();
+3 -3
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=*(uint32_t *)&buffer[nsent];
fifo->af_buffer[fifo->af_tail].am_data&=0xffffff00; 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_channel=buffer[nsent];
fifo->af_buffer[fifo->af_tail].am_data=(*(uint16_t *)&buffer[nsent+1]); fifo->af_buffer[fifo->af_tail].am_data=(*(uint16_t *)&buffer[nsent+1]);
fifo->af_buffer[fifo->af_tail].am_data<<=16; 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_channel=0;
fifo->af_buffer[fifo->af_tail].am_data=(*(uint16_t *)&buffer[nsent]); fifo->af_buffer[fifo->af_tail].am_data=(*(uint16_t *)&buffer[nsent]);
fifo->af_buffer[fifo->af_tail].am_data<<=16; 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_channel=0;
fifo->af_buffer[fifo->af_tail].am_data=buffer[nsent]; fifo->af_buffer[fifo->af_tail].am_data=buffer[nsent];
+2
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 */ /* Convert sector and nsectors to nbytes and byte offset */
nbytes = nsectors * SECTORSIZE(slot); nbytes = nsectors * SECTORSIZE(slot);
UNUSED(nbytes);
if (IS_BLOCK(slot->type)) if (IS_BLOCK(slot->type))
{ {
offset = start_sector; offset = start_sector;
+2 -2
View File
@@ -399,7 +399,7 @@ void uart_init(uint8_t uart, uint8_t interrupts)
if (uart == CONS_UART_NR) if (uart == CONS_UART_NR)
{ {
cons_init(); cons_init();
if(interrupts) if (interrupts)
{ {
irq_register_handler(irq, &uart_irq_handler_cons); irq_register_handler(irq, &uart_irq_handler_cons);
irq_config(irq, 0, 0, 0xff); irq_config(irq, 0, 0, 0xff);
@@ -409,7 +409,7 @@ void uart_init(uint8_t uart, uint8_t interrupts)
else else
{ {
sercomm_init(); sercomm_init();
if(interrupts) if (interrupts)
{ {
irq_register_handler(irq, &uart_irq_handler_sercomm); irq_register_handler(irq, &uart_irq_handler_sercomm);
irq_config(irq, 0, 0, 0xff); irq_config(irq, 0, 0, 0xff);
+1 -1
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? */ /* 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 /* 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 * indication that we are at the end of the block and try again
+2 -1
View File
@@ -141,13 +141,14 @@ static inline bool nxbe_poprectangle(struct nxbe_clipstack_s *stack,
FAR struct nxbe_window_s **wnd, FAR struct nxbe_window_s **wnd,
struct nxgl_rect_s *rect) struct nxgl_rect_s *rect)
{ {
if(stack->npushed > 0) if (stack->npushed > 0)
{ {
stack->npushed--; stack->npushed--;
*wnd = stack->stack[stack->npushed].wnd; *wnd = stack->stack[stack->npushed].wnd;
nxgl_rectcopy(rect, &stack->stack[stack->npushed].rect); nxgl_rectcopy(rect, &stack->stack[stack->npushed].rect);
return true; return true;
} }
return false; return false;
} }
+27 -19
View File
@@ -222,12 +222,14 @@ struct uip_driver_s
* code below. * code below.
* *
* dev->d_len = devicedriver_poll(); * dev->d_len = devicedriver_poll();
* if(dev->d_len > 0) { * if (dev->d_len > 0)
* uip_input(dev); * {
* if(dev->d_len > 0) { * uip_input(dev);
* devicedriver_send(); * if (dev->d_len > 0)
* {
* devicedriver_send();
* }
* } * }
* }
* *
* Note: If you are writing a uIP device driver that needs ARP * Note: If you are writing a uIP device driver that needs ARP
* (Address Resolution Protocol), e.g., when running uIP over * (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]) * #define BUF ((struct uip_eth_hdr *)&dev->d_buf[0])
* dev->d_len = ethernet_devicedrver_poll(); * dev->d_len = ethernet_devicedrver_poll();
* if(dev->d_len > 0) { * if (dev->d_len > 0)
* if(BUF->type == HTONS(UIP_ETHTYPE_IP)) { * {
* uip_arp_ipin(); * if (BUF->type == HTONS(UIP_ETHTYPE_IP))
* uip_input(dev); * {
* if(dev->d_len > 0) { * uip_arp_ipin();
* uip_arp_out(); * uip_input(dev);
* devicedriver_send(); * if (dev->d_len > 0)
* } * {
* } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) { * uip_arp_out();
* uip_arp_arpin(); * devicedriver_send();
* if(dev->d_len > 0) { * }
* 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); int uip_input(struct uip_driver_s *dev);
+5 -4
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_t ipaddr1, ipaddr2;
* *
* uip_ipaddr(&ipaddr1, 192,16,1,2); * uip_ipaddr(&ipaddr1, 192,16,1,2);
* if(uip_ipaddr_cmp(ipaddr2, ipaddr1)) { * if (uip_ipaddr_cmp(ipaddr2, ipaddr1))
* printf("They are the same"); * {
* } * printf("They are the same");
* }
* *
* addr1 The first IP address. * addr1 The first IP address.
* addr2 The second 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(&mask, 255,255,255,0);
* uip_ipaddr(&ipaddr1, 192,16,1,2); * uip_ipaddr(&ipaddr1, 192,16,1,2);
* uip_ipaddr(&ipaddr2, 192,16,1,3); * 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"); * printf("They are the same");
* } * }
+1 -1
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) static inline void swapfunc(char *a, char *b, int n, int swaptype)
{ {
if(swaptype <= 1) if (swaptype <= 1)
{ {
swapcode(long, a, b, n) swapcode(long, a, b, n)
} }
+1 -1
View File
@@ -156,7 +156,7 @@ void uip_icmpinput(struct uip_driver_s *dev)
* checksum for the change of type * 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; picmp->icmpchksum += HTONS(ICMP_ECHO_REQUEST << 8) + 1;
} }