staging: dgap: fix multiple checkpatch issues
cover staging: dgap: fix multiple checkpatch issues
This patchset fixes multpiple checkpatch issues.
Ioana Ciornei (5):
staging: dgap: remove unnecessary blank lines
staging: dgap: properly indent to match open paranthesis
staging: dgap: remove unnecessary space after cast
staging: dgap: remove unnecessary brackets
staging: dgap: add spaces around binary operator '|'
drivers/staging/dgap/dgap.c | 436 ++++++++++++++++++++------------------------ 1 file changed, 196 insertions(+), 240 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/5 staging: dgap: remove unnecessary blank lines
This patch removes the unnecessary blank lines before a closed bracket and after an open bracket.
--- drivers/staging/dgap/dgap.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-)
drivers/staging/dgap/dgap.c +0 -44
@@ -514,7 +514,6 @@ static uint dgap_config_get_num_prts(struct board_t *bd)return 0 ;for (p = bd->bd_config; p; p = p->next) { -switch (p->type) {case BNODE :/*
@@ -547,7 +546,6 @@ static char *dgap_create_config_string(struct board_t *bd, char *string) }for (p = bd->bd_config; p; p = p->next) { -switch (p->type) {case LNODE : *ptr ='\0' ;
@@ -1446,7 +1444,6 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, *cout++ = c;if (ch->pscan_savechar ==0x0 ) { -if (c ==0x0 ) { ch->ch_err_break++; *fout++ =TTY_BREAK ;
@@ -1536,7 +1533,6 @@ static void dgap_input(struct channel_t *ch) !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) { -writew (head, &(bs->rx_tail));writeb (1 , &(bs->idata));spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);
@@ -1618,7 +1614,6 @@ static void dgap_input(struct channel_t *ch)* of data the card actually has pending... */ while (n) { - s = ((head >= tail) ? head : ch->ch_rsize) - tail; s =min (s, n);
@@ -1668,7 +1663,6 @@ static void dgap_input(struct channel_t *ch)if (ld)tty_ldisc_deref (ld); - } static void dgap_write_wakeup(struct board_t *bd, struct channel_t *ch,
@@ -1739,7 +1733,6 @@ static void dgap_carrier(struct channel_t *ch)* Test for a VIRTUAL carrier transition to HIGH. */ if (((ch->ch_flags &CH_FCAR ) ==0 ) && (virt_carrier ==1 )) { -/* * When carrier rises, wake any threads waiting * for carrier in the open routine.
@@ -1753,7 +1746,6 @@ static void dgap_carrier(struct channel_t *ch)* Test for a PHYSICAL carrier transition to HIGH. */ if (((ch->ch_flags &CH_CD ) ==0 ) && (phys_carrier ==1 )) { -/* * When carrier rises, wake any threads waiting * for carrier in the open routine.
@@ -1775,7 +1767,6 @@ static void dgap_carrier(struct channel_t *ch)if ((virt_carrier ==0 ) && ((ch->ch_flags &CH_CD ) !=0 ) && (phys_carrier ==0 )) { -/* * When carrier drops: *
@@ -1867,7 +1858,6 @@ static int dgap_event(struct board_t *bd)* Loop to process all the events in the buffer. */ while (tail != head) { -/* * Get interrupt information. */
@@ -1910,7 +1900,6 @@ static int dgap_event(struct board_t *bd)* Process received data. */ if (reason &IFDATA ) { -/* * ALL LOCKS *MUST* BE DROPPED BEFORE CALLING INPUT! * input could send some data to ld, which in turn
@@ -1949,7 +1938,6 @@ static int dgap_event(struct board_t *bd)* Process break. */ if (reason &IFBREAK ) { -if (ch->ch_tun.un_tty) {/* A break has been indicated */ ch->ch_err_break++;
@@ -2025,7 +2013,6 @@ static void dgap_poll_tasklet(unsigned long data)* If board is ready, parse deeper to see if there is anything to do. */ if (bd->state ==BOARD_READY ) { -struct ev_t __iomem *eaddr;if (!bd->re_map_membase) {
@@ -2269,7 +2256,6 @@ static void dgap_poll_handler(ulong dummy)*/ if ((dgap_numboards ==1 ) || (num_online_cpus () <=1 )) {for (i =0 ; i < dgap_numboards; i++) { - brd = dgap_board[i];if (brd->state ==BOARD_FAILED )
@@ -2413,7 +2399,6 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); tail =readw (&(cm_addr->cm_tail));
@@ -2496,7 +2481,6 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); tail =readw (&(cm_addr->cm_tail));
@@ -2591,7 +2575,6 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); tail =readw (&(cm_addr->cm_tail));
@@ -2711,7 +2694,6 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)* If baud rate is zero, flush queues, and set mval to drop DTR. */ if ((ch->ch_c_cflag & (CBAUD )) ==0 ) { -/* flush rx */ head =readw (&(ch->ch_bs->rx_head));writew (head, &(ch->ch_bs->rx_tail));
@@ -3042,7 +3024,6 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file,/* Loop forever */ while (1 ) { - sleep_on_un_flags =0 ;/*
@@ -3069,7 +3050,6 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file,*/ if (!((ch->ch_tun.un_flags | ch->ch_pun.un_flags) &UN_CLOSING )) { -/* * Our conditions to leave cleanly and happily: * 1) NONBLOCKING on the tty is set.
@@ -3353,7 +3333,6 @@ static int dgap_wait_for_drain(struct tty_struct *tty)/* Loop until data is drained */ while (count !=0 ) { - count =dgap_tty_chars_in_buffer (tty);if (count ==0 )
@@ -3632,7 +3611,6 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, }if (n >0 ) { -/* * Move rest of data. */
@@ -3641,7 +3619,6 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,memcpy_toio (vaddr, (u8 *) buf, remain); head += remain; - }if (count) {
@@ -4227,7 +4204,6 @@ static int dgap_tty_digisetcustombaud(struct channel_t *ch, struct board_t *bd,return -EFAULT ;if (bd->bd_flags &BD_FEP5PLUS ) { -spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2);
@@ -4319,7 +4295,6 @@ static void dgap_tty_throttle(struct tty_struct *tty)spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags); - }static void dgap_tty_unthrottle (struct tty_struct *tty)
@@ -4478,7 +4453,6 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)* Initialize if neither terminal or printer is open. */ if (!((ch->ch_tun.un_flags | ch->ch_pun.un_flags) &UN_ISOPEN )) { - ch->ch_mforce =0 ; ch->ch_mval =0 ;
@@ -4595,7 +4569,6 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)*/ if ((ch->ch_open_count ==0 ) && !(ch->ch_digi.digi_flags &DIGI_PRINTER )) { - ch->ch_flags &= ~(CH_RXBLOCK );spin_unlock_irqrestore (&ch->ch_lock, lock_flags);
@@ -4635,7 +4608,6 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file) ch->pscan_state =0 ; ch->pscan_savechar =0 ; ch->ch_baud_info =0 ; - }/*
@@ -4814,9 +4786,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, }switch (cmd) { -/* Here are all the standard ioctl's that we MUST implement */ -case TCSBRK :/* * TCSBRK is SVID version: non-zero arg --> no break
@@ -5066,7 +5036,6 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, }switch (arg) { -case TCOON :spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);
@@ -5104,7 +5073,6 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,/* set information for ditty */ if (cmd == (DIGI_SETAW )) { -spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags); rc =dgap_wait_for_drain (tty);
@@ -5839,14 +5807,12 @@ static ssize_t dgap_tty_name_show(struct device *d, cn = ch->ch_portnum;for (cptr = bd->bd_config; cptr; cptr = cptr->next) { -if ((cptr->type ==BNODE ) && ((cptr->u.board.type ==APORT2_920P ) || (cptr->u.board.type ==APORT4_920P ) || (cptr->u.board.type ==APORT8_920P ) || (cptr->u.board.type ==PAPORT4 ) || (cptr->u.board.type ==PAPORT8 ))) { - found = TRUE;if (cptr->u.board.v_start) starto = cptr->u.board.start;
@@ -5875,7 +5841,6 @@ static ssize_t dgap_tty_name_show(struct device *d, }if (cptr->type ==CNODE ) { -for (i =0 ; i < cptr->u.conc.nport; i++) {if (cn != (i + ncount))continue ;
@@ -5892,7 +5857,6 @@ static ssize_t dgap_tty_name_show(struct device *d, }if (cptr->type ==MNODE ) { -for (i =0 ; i < cptr->u.module.nport; i++) {if (cn != (i + ncount))continue ;
@@ -6082,7 +6046,6 @@ static void dgap_do_fep_load(struct board_t *brd, const u8 *ufep, int len)writel (0xbfc01004 , (addr +0xc34 ));writel (0x3 , (addr +0xc30 )); - }/*
@@ -6157,7 +6120,6 @@ static void dgap_do_reset_board(struct board_t *brd)if (check ==FEPRST )break ;udelay (10 ); - }if (i >1000 ) { dev_warn(&brd->pdev->dev,
@@ -6254,7 +6216,6 @@ static void dgap_get_vpd(struct board_t *brd)* the first 2 bytes (header) should be 0x55, 0xAA */ if (byte1 ==0x55 && byte2 ==0xAA ) { - base_offset =0 ;/*
@@ -6262,7 +6223,6 @@ static void dgap_get_vpd(struct board_t *brd)* for the VPD offset. */ while (base_offset <=EXPANSION_ROM_SIZE ) { -/* * Lots of magic numbers here. *
@@ -6406,7 +6366,6 @@ static void dgap_create_tty_sysfs(struct un_t *un, struct device *c)return ;dev_set_drvdata (c, un); - }static void dgap_remove_tty_sysfs (struct device *c)
@@ -6442,7 +6401,6 @@ static int dgap_tty_register_ports(struct board_t *brd) ch = brd->channels[0 ];for (i =0 ; i < brd->nasync; i++, ch = brd->channels[i]) { -struct device *classp; classp = tty_port_register_device(&brd->serial_ports[i],
@@ -6546,7 +6504,6 @@ static int dgap_request_irq(struct board_t *brd)* Set up our interrupt handler if we are set to do interrupts. */ if (dgap_config_get_useintr (brd) && brd->irq) { - rc =request_irq (brd->irq, dgap_intr,IRQF_SHARED ,"DGAP" , brd);if (!rc)
@@ -6770,7 +6727,6 @@ static int dgap_tty_init(struct board_t *brd)/* Set up channel variables */ for (i =0 ; i < brd->nasync; i++, ch = brd->channels[i], bs++) { -spin_lock_init (&ch->ch_lock);/* Store all our magic numbers */
Signature · 1 line
2.1.4
PATCH 2/5 staging: dgap: properly indent to match open paranthesis
In reply to Ioana CiorneiIndent parameters and arguments passed to function calls to match open paranthesis
--- drivers/staging/dgap/dgap.c | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
drivers/staging/dgap/dgap.c +26 -26
@@ -932,7 +932,7 @@ static int dgap_parsefile(char **in) conc_type =dgap_gettok (in);if (conc_type ==0 || (conc_type !=CX && - conc_type !=EPC )) { + conc_type !=EPC )) {pr_err ("failed to set a type of concentratros" );return -1 ; }
@@ -973,7 +973,7 @@ static int dgap_parsefile(char **in) module_type =dgap_gettok (in);if (module_type ==0 || (module_type !=PORTS && - module_type !=MODEM )) { + module_type !=MODEM )) {pr_err ("failed to set a type of module" );return -1 ; }
@@ -1352,7 +1352,7 @@ static int dgap_remap(struct board_t *brd)return -ENOMEM ;if (!request_mem_region (brd->membase +PCI_IO_OFFSET ,0x200000 , -"dgap" )) +"dgap" )) goto err_req_mem; brd->re_map_membase =ioremap (brd->membase,0x200000 );
@@ -1390,7 +1390,7 @@ static void dgap_unmap(struct board_t *brd)* the Linux line discipline way. */ static void dgap_parity_scan (struct channel_t *ch,unsigned char *cbuf, -unsigned char *fbuf,int *len) +unsigned char *fbuf,int *len) {int l = *len;int count =0 ;
@@ -1649,7 +1649,7 @@ static void dgap_input(struct channel_t *ch) len =tty_buffer_request_room (tp->port, len);tty_insert_flip_string_flags (tp->port, ch->ch_bd->flipbuf, - ch->ch_bd->flipflagbuf, len); + ch->ch_bd->flipflagbuf, len); }else { len =tty_buffer_request_room (tp->port, len);tty_insert_flip_string (tp->port, ch->ch_bd->flipbuf, len);
@@ -2161,7 +2161,7 @@ static struct board_t *dgap_found_board(struct pci_dev *pdev, int id,/* init our poll helper tasklet */ tasklet_init (&brd->helper_tasklet, dgap_poll_tasklet, - (unsigned long ) brd); + (unsigned long )brd); ret =dgap_remap (brd);if (ret)
@@ -2342,7 +2342,7 @@ schedule_poller:* *=======================================================================*/ static void dgap_cmdb (struct channel_t *ch,u8 cmd,u8 byte1, -u8 byte2,uint ncmds) +u8 byte2,uint ncmds) {char __iomem *vaddr;struct __iomem cm_t *cm_addr;
@@ -3011,7 +3011,7 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file,int sleep_on_un_flags;if (!tty || tty->magic !=TTY_MAGIC || !file || !ch || - ch->magic !=DGAP_CHANNEL_MAGIC ) + ch->magic !=DGAP_CHANNEL_MAGIC )return -EIO ; un = tty->driver_data;
@@ -3509,7 +3509,7 @@ static int dgap_tty_write_room(struct tty_struct *tty)* In here exists all the Transparent Print magic as well. */ static int dgap_tty_write (struct tty_struct *tty,const unsigned char *buf, -int count) +int count) {struct channel_t *ch;struct un_t *un;
@@ -3538,10 +3538,10 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,return 0 ;spin_lock_irqsave (&ch->ch_lock, lock_flags); -/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; head =readw (&(bs->tx_head)) & tmask; + tail =readw (&(bs->tx_tail)) & tmask; bufcount = tail - head -1 ;
@@ -3575,7 +3575,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,*/ if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, - (int ) ch->ch_digi.digi_onlen); + (int )ch->ch_digi.digi_onlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags |=CH_PRON ; }
@@ -3586,7 +3586,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,*/ if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags &= ~CH_PRON ; }
@@ -3644,7 +3644,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,writeb (1 , &(bs->iempty)); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags &= ~CH_PRON ; }
@@ -3731,7 +3731,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)* Set modem signals, called by ld. */ static int dgap_tty_tiocmset (struct tty_struct *tty, -unsigned int set,unsigned int clear) +unsigned int set,unsigned int clear) {struct board_t *bd;struct channel_t *ch;
@@ -4222,7 +4222,7 @@ static int dgap_tty_digisetcustombaud(struct channel_t *ch, struct board_t *bd,* dgap_set_termios() */ static void dgap_tty_set_termios (struct tty_struct *tty, -struct ktermios *old_termios) +struct ktermios *old_termios) {struct board_t *bd;struct channel_t *ch;
@@ -4385,7 +4385,7 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)* sleep waiting for it to happen or they cancel the open. */ rc =wait_event_interruptible (brd->state_wait, - (brd->state &BOARD_READY )); + (brd->state &BOARD_READY ));if (rc)return rc;
@@ -4597,7 +4597,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* have been dropped for modems to see it. */ spin_unlock_irqrestore (&ch->ch_lock, - lock_flags); + lock_flags);/* .25 second delay for dropping RTS/DTR */ schedule_timeout_interruptible (msecs_to_jiffies (250 ));
@@ -4615,7 +4615,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)*/ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); ch->ch_flags &= ~CH_PRON ; }
@@ -4750,7 +4750,7 @@ static void dgap_tty_flush_chars(struct tty_struct *tty)* The usual assortment of ioctl's */ static int dgap_tty_ioctl (struct tty_struct *tty,unsigned int cmd, -unsigned long arg) +unsigned long arg) {struct board_t *bd;struct channel_t *ch;
@@ -5996,7 +5996,7 @@ static int dgap_test_bios(struct board_t *brd) err1 =readw (addr +SEQUENCE ); err2 =readw (addr +ERROR );dev_warn (&brd->pdev->dev,"%s failed diagnostics. Error #(%x,%x).\n" , - brd->name, err1, err2); + brd->name, err1, err2); brd->state =BOARD_FAILED ; brd->dpastatus =BD_NOBIOS ;
@@ -6531,7 +6531,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].conf_name) { ret =request_firmware (&fw, fw_info[card_type].conf_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"config file %s not found\n" , fw_info[card_type].conf_name);
@@ -6584,7 +6584,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].bios_name) { ret =request_firmware (&fw, fw_info[card_type].bios_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"bios file %s not found\n" , fw_info[card_type].bios_name);
@@ -6601,7 +6601,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].fep_name) { ret =request_firmware (&fw, fw_info[card_type].fep_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"dgap: fep file %s not found\n" , fw_info[card_type].fep_name);
@@ -6630,7 +6630,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].con_name && check && vaddr) { ret =request_firmware (&fw, fw_info[card_type].con_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"conc file %s not found\n" , fw_info[card_type].con_name);
@@ -6994,8 +6994,8 @@ static int dgap_start(void) } device =device_create (dgap_class,NULL , -MKDEV (DIGI_DGAP_MAJOR ,0 ), -NULL ,"dgap_mgmt" ); +MKDEV (DIGI_DGAP_MAJOR ,0 ), +NULL ,"dgap_mgmt" );if (IS_ERR (device)) { rc =PTR_ERR (device); goto failed_device;
Signature · 1 line
2.1.4
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
Quoted 4 lines · Ioana Ciornei
Indent parameters and arguments passed to function calls to match open paranthesis
Signed-off-by Ioana Ciornei <[email protected]>
Mostly looking good, two questions. See below:
Quoted 3 lines
--- drivers/staging/dgap/dgap.c | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
<snip>
drivers/staging/dgap/dgap.c static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, · line 3541
Quoted 5 lines
drivers/staging/dgap/dgap.c +0
-1@@ -3538,10 +3538,10 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,return 0 ;spin_lock_irqsave (&ch->ch_lock, lock_flags); -
Why remove this new line?
drivers/staging/dgap/dgap.c static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, · line 3544
Quoted 4 lines
drivers/staging/dgap/dgap.c +1
-0/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; head =readw (&(bs->tx_head)) & tmask; +
Why add this one here?
drivers/staging/dgap/dgap.c static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, · line 3546
Quoted 2 lines
drivers/staging/dgap/dgap.c +0
-0tail =readw (&(bs->tx_tail)) & tmask;
thanks Ioana!
Daniel.
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
Quoted 26 lines · Daniel Baluta
Quoted 4 lines · Ioana Ciornei
Indent parameters and arguments passed to function calls to match open paranthesis
Signed-off-by Ioana Ciornei <[email protected]>Mostly looking good, two questions. See below:
Quoted 3 lines
--- drivers/staging/dgap/dgap.c | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-)<snip>
drivers/staging/dgap/dgap.c static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, · line 3541
Quoted 5 lines
drivers/staging/dgap/dgap.c +0
-1@@ -3538,10 +3538,10 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,return 0 ;spin_lock_irqsave (&ch->ch_lock, lock_flags); -Why remove this new line?
drivers/staging/dgap/dgap.c static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, · line 3544
Quoted 4 lines
drivers/staging/dgap/dgap.c +1
-0/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; head =readw (&(bs->tx_head)) & tmask; +
Quoted 8 lines
Why add this one here?
drivers/staging/dgap/dgap.c static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, · line 3546
Quoted 2 lines
drivers/staging/dgap/dgap.c +0
-0tail =readw (&(bs->tx_tail)) & tmask;thanks Ioana!
Daniel.
I don not have the code in front of me but I think they are just my mistakes. I will take a look shortly.
Thanks,
Ioana
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
In reply to Ioana CiorneiQuoted 13 lines · Ioana Ciornei
Indent parameters and arguments passed to function calls to match open paranthesis
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-)drivers/staging/dgap/dgap.c +0
-0
drivers/staging/dgap/dgap.c static int dgap_parsefile(char **in) · line 935
Quoted 5 lines
drivers/staging/dgap/dgap.c +1
-1@@ -932,7 +932,7 @@ static int dgap_parsefile(char **in) conc_type =dgap_gettok (in);if (conc_type ==0 || (conc_type !=CX && - conc_type !=EPC )) { + conc_type !=EPC )) {
Maybe it would be nicer to put a newline after the ||, to have the whole conjunction on one line?
drivers/staging/dgap/dgap.c static int dgap_parsefile(char **in) · line 976
Quoted 9 lines
drivers/staging/dgap/dgap.c +1
-1pr_err ("failed to set a type of concentratros" );return -1 ; }@@ -973,7 +973,7 @@ static int dgap_parsefile(char **in) module_type =dgap_gettok (in);if (module_type ==0 || (module_type !=PORTS && - module_type !=MODEM )) { + module_type !=MODEM )) {
Same here.
drivers/staging/dgap/dgap.c static int dgap_remap(struct board_t *brd) · line 1355
Quoted 9 lines
drivers/staging/dgap/dgap.c +1
-1pr_err ("failed to set a type of module" );return -1 ; }@@ -1352,7 +1352,7 @@ static int dgap_remap(struct board_t *brd)return -ENOMEM ;if (!request_mem_region (brd->membase +PCI_IO_OFFSET ,0x200000 , -"dgap" )) +"dgap" ))
Does it not work just to put the string up on the line before with the function call?
drivers/staging/dgap/dgap.c static void dgap_unmap(struct board_t *brd) · line 1393
Quoted 9 lines
drivers/staging/dgap/dgap.c +1
-1goto err_req_mem; brd->re_map_membase =ioremap (brd->membase,0x200000 );@@ -1390,7 +1390,7 @@ static void dgap_unmap(struct board_t *brd)* the Linux line discipline way. */ static void dgap_parity_scan (struct channel_t *ch,unsigned char *cbuf, -unsigned char *fbuf,int *len) +unsigned char *fbuf,int *len)
Not sure why this is an improvement. It looks like it was already aligned with the right side of the (.
Quoted 22 lines
drivers/staging/dgap/dgap.c +2
-2{int l = *len;int count =0 ;@@ -1649,7 +1649,7 @@ static void dgap_input(struct channel_t *ch) len =tty_buffer_request_room (tp->port, len);tty_insert_flip_string_flags (tp->port, ch->ch_bd->flipbuf, - ch->ch_bd->flipflagbuf, len); + ch->ch_bd->flipflagbuf, len); }else { len =tty_buffer_request_room (tp->port, len);tty_insert_flip_string (tp->port, ch->ch_bd->flipbuf, len);@@ -2161,7 +2161,7 @@ static struct board_t *dgap_found_board(struct pci_dev *pdev, int id,/* init our poll helper tasklet */ tasklet_init (&brd->helper_tasklet, dgap_poll_tasklet, - (unsigned long ) brd); + (unsigned long )brd); ret =dgap_remap (brd);if (ret)
drivers/staging/dgap/dgap.c schedule_poller: · line 2345
Quoted 5 lines
drivers/staging/dgap/dgap.c +1
-1@@ -2342,7 +2342,7 @@ schedule_poller:* *=======================================================================*/ static void dgap_cmdb (struct channel_t *ch,u8 cmd,u8 byte1, -u8 byte2,uint ncmds) +u8 byte2,uint ncmds)
It doesn't look like this is aligned, but I didn't try applying the patch.
julia
Quoted 180 lines
drivers/staging/dgap/dgap.c +19
-20{char __iomem *vaddr;struct __iomem cm_t *cm_addr;@@ -3011,7 +3011,7 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file,int sleep_on_un_flags;if (!tty || tty->magic !=TTY_MAGIC || !file || !ch || - ch->magic !=DGAP_CHANNEL_MAGIC ) + ch->magic !=DGAP_CHANNEL_MAGIC )return -EIO ; un = tty->driver_data;@@ -3509,7 +3509,7 @@ static int dgap_tty_write_room(struct tty_struct *tty)* In here exists all the Transparent Print magic as well. */ static int dgap_tty_write (struct tty_struct *tty,const unsigned char *buf, -int count) +int count) {struct channel_t *ch;struct un_t *un;@@ -3538,10 +3538,10 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,return 0 ;spin_lock_irqsave (&ch->ch_lock, lock_flags); -/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; head =readw (&(bs->tx_head)) & tmask; + tail =readw (&(bs->tx_tail)) & tmask; bufcount = tail - head -1 ;@@ -3575,7 +3575,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,*/ if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, - (int ) ch->ch_digi.digi_onlen); + (int )ch->ch_digi.digi_onlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags |=CH_PRON ; }@@ -3586,7 +3586,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,*/ if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3644,7 +3644,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,writeb (1 , &(bs->iempty)); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3731,7 +3731,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)* Set modem signals, called by ld. */ static int dgap_tty_tiocmset (struct tty_struct *tty, -unsigned int set,unsigned int clear) +unsigned int set,unsigned int clear) {struct board_t *bd;struct channel_t *ch;@@ -4222,7 +4222,7 @@ static int dgap_tty_digisetcustombaud(struct channel_t *ch, struct board_t *bd,* dgap_set_termios() */ static void dgap_tty_set_termios (struct tty_struct *tty, -struct ktermios *old_termios) +struct ktermios *old_termios) {struct board_t *bd;struct channel_t *ch;@@ -4385,7 +4385,7 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)* sleep waiting for it to happen or they cancel the open. */ rc =wait_event_interruptible (brd->state_wait, - (brd->state &BOARD_READY )); + (brd->state &BOARD_READY ));if (rc)return rc;@@ -4597,7 +4597,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* have been dropped for modems to see it. */ spin_unlock_irqrestore (&ch->ch_lock, - lock_flags); + lock_flags);/* .25 second delay for dropping RTS/DTR */ schedule_timeout_interruptible (msecs_to_jiffies (250 ));@@ -4615,7 +4615,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)*/ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); ch->ch_flags &= ~CH_PRON ; }@@ -4750,7 +4750,7 @@ static void dgap_tty_flush_chars(struct tty_struct *tty)* The usual assortment of ioctl's */ static int dgap_tty_ioctl (struct tty_struct *tty,unsigned int cmd, -unsigned long arg) +unsigned long arg) {struct board_t *bd;struct channel_t *ch;@@ -5996,7 +5996,7 @@ static int dgap_test_bios(struct board_t *brd) err1 =readw (addr +SEQUENCE ); err2 =readw (addr +ERROR );dev_warn (&brd->pdev->dev,"%s failed diagnostics. Error #(%x,%x).\n" , - brd->name, err1, err2); + brd->name, err1, err2); brd->state =BOARD_FAILED ; brd->dpastatus =BD_NOBIOS ;@@ -6531,7 +6531,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].conf_name) { ret =request_firmware (&fw, fw_info[card_type].conf_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"config file %s not found\n" , fw_info[card_type].conf_name);@@ -6584,7 +6584,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].bios_name) { ret =request_firmware (&fw, fw_info[card_type].bios_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"bios file %s not found\n" , fw_info[card_type].bios_name);@@ -6601,7 +6601,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].fep_name) { ret =request_firmware (&fw, fw_info[card_type].fep_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"dgap: fep file %s not found\n" , fw_info[card_type].fep_name);@@ -6630,7 +6630,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].con_name && check && vaddr) { ret =request_firmware (&fw, fw_info[card_type].con_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"conc file %s not found\n" , fw_info[card_type].con_name);@@ -6994,8 +6994,8 @@ static int dgap_start(void) } device =device_create (dgap_class,NULL , -MKDEV (DIGI_DGAP_MAJOR ,0 ), -NULL ,"dgap_mgmt" ); +MKDEV (DIGI_DGAP_MAJOR ,0 ), +NULL ,"dgap_mgmt" );if (IS_ERR (device)) { rc =PTR_ERR (device); goto failed_device; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/6a5c7c89e9bc61382ab763935b0f9b9442f67cb9.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
Quoted 16 lines · Julia Lawall
Quoted 14 lines · Ioana Ciornei
Indent parameters and arguments passed to function calls to match open paranthesis
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 52 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-)drivers/staging/dgap/dgap.c +0
-0@@ -932,7 +932,7 @@ static int dgap_parsefile(char **in)
Quoted 7 lines
drivers/staging/dgap/dgap.c static int dgap_parsefile(char **in) · line 935
Quoted 4 lines
drivers/staging/dgap/dgap.c +1
-1conc_type =dgap_gettok (in);if (conc_type ==0 || (conc_type !=CX && - conc_type !=EPC )) { + conc_type !=EPC )) {Maybe it would be nicer to put a newline after the ||, to have the whole conjunction on one line?
Good point. I will rework it.
Quoted 6 lines
Quoted 6 lines
drivers/staging/dgap/dgap.c +0
-0pr_err ("failed to set a type of concentratros" );return -1 ; }@@ -973,7 +973,7 @@ static int dgap_parsefile(char **in)
Quoted 6 lines
drivers/staging/dgap/dgap.c static int dgap_parsefile(char **in) · line 976
Quoted 4 lines
drivers/staging/dgap/dgap.c +1
-1module_type =dgap_gettok (in);if (module_type ==0 || (module_type !=PORTS && - module_type !=MODEM )) { + module_type !=MODEM )) {Same here.
Ok.
Quoted 7 lines
Quoted 7 lines
drivers/staging/dgap/dgap.c +0
-0pr_err ("failed to set a type of module" );return -1 ; }@@ -1352,7 +1352,7 @@ static int dgap_remap(struct board_t *brd)return -ENOMEM ;
Quoted 6 lines
drivers/staging/dgap/dgap.c static int dgap_remap(struct board_t *brd) · line 1355
Quoted 3 lines
drivers/staging/dgap/dgap.c +1
-1if (!request_mem_region (brd->membase +PCI_IO_OFFSET ,0x200000 , -"dgap" )) +"dgap" ))Does it not work just to put the string up on the line before with the function call?
I think it breaks the 80 columns rules. But I do not have the code in front of me.
I will try it soon.
Quoted 33 lines
drivers/staging/dgap/dgap.c static void dgap_unmap(struct board_t *brd) · line 1393
Quoted 10 lines
drivers/staging/dgap/dgap.c +1
-1goto err_req_mem; brd->re_map_membase =ioremap (brd->membase,0x200000 );@@ -1390,7 +1390,7 @@ static void dgap_unmap(struct board_t *brd)* the Linux line discipline way. */ static void dgap_parity_scan (struct channel_t *ch,unsigned char *cbuf, -unsigned char *fbuf,int *len) +unsigned char *fbuf,int *len)Not sure why this is an improvement. It looks like it was already aligned with the right side of the (.
Quoted 19 lines
drivers/staging/dgap/dgap.c +2
-2{int l = *len;int count =0 ;@@ -1649,7 +1649,7 @@ static void dgap_input(struct channel_t *ch) len =tty_buffer_request_room (tp->port, len);tty_insert_flip_string_flags (tp->port, ch->ch_bd->flipbuf, - ch->ch_bd->flipflagbuf, len); + ch->ch_bd->flipflagbuf, len); }else { len =tty_buffer_request_room (tp->port, len);tty_insert_flip_string (tp->port, ch->ch_bd->flipbuf, len);@@ -2161,7 +2161,7 @@ static struct board_t *dgap_found_board(struct pci_dev *pdev, int id,/* init our poll helper tasklet */ tasklet_init (&brd->helper_tasklet, dgap_poll_tasklet, - (unsigned long ) brd); + (unsigned long )brd);
Quoted 10 lines
drivers/staging/dgap/dgap.c schedule_poller: · line 2345
Quoted 8 lines
drivers/staging/dgap/dgap.c +1
-1ret =dgap_remap (brd);if (ret)@@ -2342,7 +2342,7 @@ schedule_poller:* *=======================================================================*/ static void dgap_cmdb (struct channel_t *ch,u8 cmd,u8 byte1, -u8 byte2,uint ncmds) +u8 byte2,uint ncmds)It doesn't look like this is aligned, but I didn't try applying the patch.
I think that the email format or the patch does not show the tabs in the proper way.
I remember that there were some off by one alignments and this and the previous one belong to them.
Nevertheless, I will take a look.
Thanks,
Ioana
Quoted 183 lines
julia
Quoted 180 lines
drivers/staging/dgap/dgap.c +19
-20{char __iomem *vaddr;struct __iomem cm_t *cm_addr;@@ -3011,7 +3011,7 @@ static int dgap_block_til_ready(struct tty_struct *tty, struct file *file,int sleep_on_un_flags;if (!tty || tty->magic !=TTY_MAGIC || !file || !ch || - ch->magic !=DGAP_CHANNEL_MAGIC ) + ch->magic !=DGAP_CHANNEL_MAGIC )return -EIO ; un = tty->driver_data;@@ -3509,7 +3509,7 @@ static int dgap_tty_write_room(struct tty_struct *tty)* In here exists all the Transparent Print magic as well. */ static int dgap_tty_write (struct tty_struct *tty,const unsigned char *buf, -int count) +int count) {struct channel_t *ch;struct un_t *un;@@ -3538,10 +3538,10 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,return 0 ;spin_lock_irqsave (&ch->ch_lock, lock_flags); -/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; head =readw (&(bs->tx_head)) & tmask; + tail =readw (&(bs->tx_tail)) & tmask; bufcount = tail - head -1 ;@@ -3575,7 +3575,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,*/ if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, - (int ) ch->ch_digi.digi_onlen); + (int )ch->ch_digi.digi_onlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags |=CH_PRON ; }@@ -3586,7 +3586,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,*/ if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3644,7 +3644,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,writeb (1 , &(bs->iempty)); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); head =readw (&(bs->tx_head)) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3731,7 +3731,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)* Set modem signals, called by ld. */ static int dgap_tty_tiocmset (struct tty_struct *tty, -unsigned int set,unsigned int clear) +unsigned int set,unsigned int clear) {struct board_t *bd;struct channel_t *ch;@@ -4222,7 +4222,7 @@ static int dgap_tty_digisetcustombaud(struct channel_t *ch, struct board_t *bd,* dgap_set_termios() */ static void dgap_tty_set_termios (struct tty_struct *tty, -struct ktermios *old_termios) +struct ktermios *old_termios) {struct board_t *bd;struct channel_t *ch;@@ -4385,7 +4385,7 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)* sleep waiting for it to happen or they cancel the open. */ rc =wait_event_interruptible (brd->state_wait, - (brd->state &BOARD_READY )); + (brd->state &BOARD_READY ));if (rc)return rc;@@ -4597,7 +4597,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* have been dropped for modems to see it. */ spin_unlock_irqrestore (&ch->ch_lock, - lock_flags); + lock_flags);/* .25 second delay for dropping RTS/DTR */ schedule_timeout_interruptible (msecs_to_jiffies (250 ));@@ -4615,7 +4615,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)*/ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, - (int ) ch->ch_digi.digi_offlen); + (int )ch->ch_digi.digi_offlen); ch->ch_flags &= ~CH_PRON ; }@@ -4750,7 +4750,7 @@ static void dgap_tty_flush_chars(struct tty_struct *tty)* The usual assortment of ioctl's */ static int dgap_tty_ioctl (struct tty_struct *tty,unsigned int cmd, -unsigned long arg) +unsigned long arg) {struct board_t *bd;struct channel_t *ch;@@ -5996,7 +5996,7 @@ static int dgap_test_bios(struct board_t *brd) err1 =readw (addr +SEQUENCE ); err2 =readw (addr +ERROR );dev_warn (&brd->pdev->dev,"%s failed diagnostics. Error #(%x,%x).\n" , - brd->name, err1, err2); + brd->name, err1, err2); brd->state =BOARD_FAILED ; brd->dpastatus =BD_NOBIOS ;@@ -6531,7 +6531,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].conf_name) { ret =request_firmware (&fw, fw_info[card_type].conf_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"config file %s not found\n" , fw_info[card_type].conf_name);@@ -6584,7 +6584,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].bios_name) { ret =request_firmware (&fw, fw_info[card_type].bios_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"bios file %s not found\n" , fw_info[card_type].bios_name);@@ -6601,7 +6601,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].fep_name) { ret =request_firmware (&fw, fw_info[card_type].fep_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"dgap: fep file %s not found\n" , fw_info[card_type].fep_name);@@ -6630,7 +6630,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,if (fw_info[card_type].con_name && check && vaddr) { ret =request_firmware (&fw, fw_info[card_type].con_name, - &pdev->dev); + &pdev->dev);if (ret) {dev_err (&pdev->dev,"conc file %s not found\n" , fw_info[card_type].con_name);@@ -6994,8 +6994,8 @@ static int dgap_start(void) } device =device_create (dgap_class,NULL , -MKDEV (DIGI_DGAP_MAJOR ,0 ), -NULL ,"dgap_mgmt" ); +MKDEV (DIGI_DGAP_MAJOR ,0 ), +NULL ,"dgap_mgmt" );if (IS_ERR (device)) { rc =PTR_ERR (device); goto failed_device; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/6a5c7c89e9bc61382ab763935b0f9b9442f67cb9.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
Quoted 11 lines
Quoted 5 lines
drivers/staging/dgap/dgap.c schedule_poller: · line 2345
Quoted 3 lines
static void dgap_cmdb(struct
channel_t*ch, u8 cmd, u8 byte1,drivers/staging/dgap/dgap.c +1
-1- u8 byte2, uint ncmds) + u8 byte2, uint ncmds)It doesn't look like this is aligned, but I didn't try applying the patch.
I think that the email format or the patch does not show the tabs in the proper way.
I remember that there were some off by one alignments and this and the previous one belong to them.
Nevertheless, I will take a look.
OK, quite possible. But it is strange that all of the function calls look fine with their added and removed lines, and all of the function headers look wrong.
julia
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
Quoted 12 lines · Julia Lawall
Quoted 11 lines
Quoted 5 lines
drivers/staging/dgap/dgap.c schedule_poller: · line 2345
Quoted 3 lines
static void dgap_cmdb(struct
channel_t*ch, u8 cmd, u8 byte1,drivers/staging/dgap/dgap.c +1
-1- u8 byte2, uint ncmds) + u8 byte2, uint ncmds)It doesn't look like this is aligned, but I didn't try applying the patch.
I think that the email format or the patch does not show the tabs in the proper way.
I remember that there were some off by one alignments and this and the previous one belong to them.
Nevertheless, I will take a look.
Quoted 5 lines
OK, quite possible. But it is strange that all of the function calls look fine with their added and removed lines, and all of the function headers look wrong.
julia
It's very strange but the alignment seems proper when the patch is applied. I really do not have an explanation for the email format. I verified it, made the other changes suggested and resent it.
Thanks,
Ioana
Re: [Outreachy kernel] [PATCH 2/5] staging: dgap: properly indent to match open paranthesis
Quoted 17 lines · Ioana Ciornei
Quoted 16 lines · Julia Lawall
Quoted 11 lines
Quoted 5 lines
drivers/staging/dgap/dgap.c schedule_poller: · line 2345
Quoted 3 lines
static void dgap_cmdb(struct
channel_t*ch, u8 cmd, u8 byte1,drivers/staging/dgap/dgap.c +1
-1- u8 byte2, uint ncmds) + u8 byte2, uint ncmds)It doesn't look like this is aligned, but I didn't try applying the patch.
I think that the email format or the patch does not show the tabs in the proper way.
I remember that there were some off by one alignments and this and the previous one belong to them.
Nevertheless, I will take a look.OK, quite possible. But it is strange that all of the function calls look fine with their added and removed lines, and all of the function headers look wrong.
Quoted 5 lines
Quoted 1 line
julia
It's very strange but the alignment seems proper when the patch is applied. I really do not have an explanation for the email format. I verified it, made the other changes suggested and resent it.
Yes, it looks good.
PATCH 3/5 staging: dgap: remove unnecessary space after cast
In reply to Ioana CiorneiThis patch removes unnecessary spaces after the cast. Patch done with coccinelle semantic patch:
@rule0@
type t;
identifier e;
constant c;
expression expr;
@@
(
- (t) e
+ (t)e
|
- (t) c
+ (t)c
|
- (t) expr
+ (t)expr
)
--- drivers/staging/dgap/dgap.c | 88 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-)
drivers/staging/dgap/dgap.c +44 -44
@@ -1413,7 +1413,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 0 :/* No FF seen yet */ -if (c == (unsigned char )'\377' ) +if (c == (unsigned char )'\377' )/* delete this character from stream */ ch->pscan_state =1 ;else {
@@ -1425,7 +1425,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 1 :/* first FF seen */ -if (c == (unsigned char )'\377' ) { +if (c == (unsigned char )'\377' ) {/* doubled ff, transform to single ff */ *cout++ = c; *fout++ =TTY_NORMAL ;
@@ -1837,7 +1837,7 @@ static int dgap_event(struct board_t *bd)return -EIO ; } - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));
@@ -1994,7 +1994,7 @@ next:*/ static void dgap_poll_tasklet (unsigned long data) { -struct board_t *bd = (struct board_t *) data; +struct board_t *bd = (struct board_t *)data;ulong lock_flags;char __iomem *vaddr;u16 head, tail;
@@ -2027,7 +2027,7 @@ static void dgap_poll_tasklet(unsigned long data)if (!bd->nasync) goto out; - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));
@@ -2262,7 +2262,7 @@ static void dgap_poll_handler(ulong dummy)continue ;if (!brd->intr_running)/* Call the real board poller directly */ -dgap_poll_tasklet ((unsigned long ) brd); +dgap_poll_tasklet ((unsigned long )brd); } }else {/*
@@ -2315,7 +2315,7 @@ schedule_poller: new_time = dgap_poll_time - jiffies; -if ((ulong ) new_time >=2 * dgap_poll_tick) { +if ((ulong )new_time >=2 * dgap_poll_tick) { dgap_poll_time = jiffies +dgap_jiffies_from_ms (dgap_poll_tick); }
@@ -2369,7 +2369,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/*
@@ -2384,7 +2384,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 ));writeb (byte1, (vaddr + head +CMDSTART +2 ));writeb (byte2, (vaddr + head +CMDSTART +3 ));
@@ -2452,7 +2452,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/*
@@ -2467,8 +2467,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) word, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )word, (vaddr + head +CMDSTART +2 )); head = (head +4 ) & (CMDMAX -CMDSTART -4 );
@@ -2534,7 +2534,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/*
@@ -2550,19 +2550,19 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)*/ /* Write an FF to tell the FEP that we want an extended command */ -writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); +writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) cmd, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )cmd, (vaddr + head +CMDSTART +2 ));/* * If the second part of the command won't fit, * put it at the beginning of the circular buffer. */ if (((head +4 ) >= ((CMDMAX -CMDSTART )) || (head &03 ))) -writew ((u16 ) word, (vaddr +CMDSTART )); +writew ((u16 )word, (vaddr +CMDSTART ));else -writew ((u16 ) word, (vaddr + head +CMDSTART +4 )); +writew ((u16 )word, (vaddr + head +CMDSTART +4 )); head = (head +8 ) & (CMDMAX -CMDSTART -4 );
@@ -2860,13 +2860,13 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) cflag &=0xffff ;if (cflag != ch->ch_fepcflag) { - ch->ch_fepcflag = (u16) (cflag &0xffff ); + ch->ch_fepcflag = (u16)(cflag &0xffff );/* * Okay to have channel and board * locks held calling this */ -dgap_cmdw (ch,SCFLAG , (u16 ) cflag,0 ); +dgap_cmdw (ch,SCFLAG , (u16 )cflag,0 ); }/* Handle transition from B0 */
@@ -2907,7 +2907,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_fepiflag = iflag;/* Okay to have channel and board locks held calling this */ -dgap_cmdw (ch,SIFLAG , (u16 ) ch->ch_fepiflag,0 ); +dgap_cmdw (ch,SIFLAG , (u16 )ch->ch_fepiflag,0 ); }/*
@@ -2932,7 +2932,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_hflow = hflow;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SHFLOW , (u8 ) hflow,0xff ,0 ); +dgap_cmdb (ch,SHFLOW , (u8 )hflow,0xff ,0 ); }/*
@@ -2960,7 +2960,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_mostat = mval;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SMODEM , (u8 ) mval,D_RTS (ch)|D_DTR (ch),0 ); +dgap_cmdb (ch,SMODEM , (u8 )mval,D_RTS (ch) |D_DTR (ch),0 ); }/*
@@ -3159,7 +3159,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );
@@ -3604,7 +3604,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, n -= remain; vaddr = ch->ch_taddr + head; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head = ch->ch_tstart; buf += remain;
@@ -3617,7 +3617,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, vaddr = ch->ch_taddr + head; remain = n; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head += remain; }
@@ -3830,7 +3830,7 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)#if 0 dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );#endif -dgap_cmdw (ch,SBREAK , (u16 ) msec,0 ); +dgap_cmdw (ch,SBREAK , (u16 )msec,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);
@@ -4152,7 +4152,7 @@ static int dgap_tty_digisetedelay(struct channel_t *ch, struct board_t *bd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -writew ((u16 ) new_digi, &(ch->ch_bs->edelay)); +writew ((u16 )new_digi, &ch->ch_bs->edelay);dgap_param (ch, bd, un->un_type);
@@ -4759,7 +4759,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,u16 head;ulong lock_flags =0 ;ulong lock_flags2 =0 ; -void __user *uarg = (void __user *) arg; +void __user *uarg = (void __user *)arg;if (!tty || tty->magic !=TTY_MAGIC )return -ENODEV ;
@@ -4811,7 +4811,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&ch->ch_lock, lock_flags2);if (((cmd ==TCSBRK ) && (!arg)) || (cmd ==TCSBRKP )) -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);
@@ -4838,7 +4838,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);
@@ -4865,7 +4865,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);
@@ -4889,13 +4889,13 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return put_user (C_CLOCAL (tty) ?1 :0 , - (unsigned long __user *) arg); + (unsigned long __user *)arg);case TIOCSSOFTCAR :spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags); - rc =get_user (arg, (unsigned long __user *) arg); + rc =get_user (arg, (unsigned long __user *)arg);if (rc)return rc;
@@ -4960,7 +4960,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );
@@ -5985,7 +5985,7 @@ static int dgap_test_bios(struct board_t *brd) brd->wait_for_bios =0 ;while (brd->wait_for_bios <1000 ) {/* Check to see if BIOS thinks board is good. (GD). */ -if (word == *(u16 *)"GD" ) +if (word == *(u16 *)"GD" )return 0 ;msleep_interruptible (10 ); brd->wait_for_bios++;
@@ -6071,12 +6071,12 @@ static int dgap_test_fep(struct board_t *brd) brd->wait_for_fep =0 ;while (brd->wait_for_fep <500 ) {/* Check to see if FEP is up and running now. */ -if (word == *(u16 *)"OS" ) { +if (word == *(u16 *)"OS" ) {/* * Check to see if the board can support FEP5+ commands. */ word =readw (addr +FEP5_PLUS ); -if (word == *(u16 *)"5A" ) +if (word == *(u16 *)"5A" ) brd->bd_flags |=BD_FEP5PLUS ;return 0 ;
@@ -6162,8 +6162,8 @@ static void dgap_do_conc_load(struct board_t *brd, u8 *uaddr, int len) vaddr = brd->re_map_membase; - offset =readw ((u16 *) (vaddr +DOWNREQ )); - to_dp = (struct downld_t *) (vaddr + (int ) offset); + offset =readw ((u16 *)(vaddr +DOWNREQ )); + to_dp = (struct downld_t *)(vaddr + (int )offset);memcpy_toio (to_dp, uaddr, len);/* Tell card we have data for it */
@@ -6622,7 +6622,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,* is requesting a concentrator image from us. */ if ((bd->type ==PCX ) || (bd->type ==PEPC )) { - chk_addr = (u16 *) (vaddr +DOWNREQ ); + chk_addr = (u16 *)(vaddr +DOWNREQ );/* Nonzero if FEP is requesting concentrator image. */ check =readw (chk_addr); vaddr = brd->re_map_membase;
@@ -6637,7 +6637,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,return ret; }/* Put concentrator firmware loading code here */ - offset =readw ((u16 *) (vaddr +DOWNREQ )); + offset =readw ((u16 *)(vaddr +DOWNREQ ));memcpy_toio (offset, fw->data, fw->size);dgap_do_conc_load (brd, (char *)fw->data, fw->size)
@@ -6720,8 +6720,8 @@ static int dgap_tty_init(struct board_t *brd) ch = brd->channels[0 ]; vaddr = brd->re_map_membase; - bs = (struct bs_t __iomem *) ((ulong ) vaddr +CHANBUF ); - cm = (struct cm_t __iomem *) ((ulong ) vaddr +CMDBUF ); + bs = (struct bs_t __iomem *)((ulong )vaddr +CHANBUF ); + cm = (struct cm_t __iomem *)((ulong )vaddr +CMDBUF ); brd->bd_bs = bs;
Signature · 1 line
2.1.4
Re: [Outreachy kernel] [PATCH 3/5] staging: dgap: remove unnecessary space after cast
Quoted 10 lines · Ioana Ciornei
This patch removes unnecessary spaces after the cast. Patch done with coccinelle semantic patch:
@rule0@
type t;
identifier e;
constant c;
expression expr;
@@
Quoted 9 lines
(
- (t) e
+ (t)e
|
- (t) c
+ (t)c
|
- (t) expr
+ (t)expr
Again, you are actually just removing all expressions with casts, regardless of spacing, and then adding them back with the default Coccinelle pretty printing strategy. But it is true that the semantic patch does represent clearly what you are intending to do.
julia
Quoted 369 lines
)
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 88 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-)drivers/staging/dgap/dgap.c +44
-45@@ -1413,7 +1413,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 0 :/* No FF seen yet */ -if (c == (unsigned char )'\377' ) +if (c == (unsigned char )'\377' )/* delete this character from stream */ ch->pscan_state =1 ;else {@@ -1425,7 +1425,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 1 :/* first FF seen */ -if (c == (unsigned char )'\377' ) { +if (c == (unsigned char )'\377' ) {/* doubled ff, transform to single ff */ *cout++ = c; *fout++ =TTY_NORMAL ;@@ -1837,7 +1837,7 @@ static int dgap_event(struct board_t *bd)return -EIO ; } - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));@@ -1994,7 +1994,7 @@ next:*/ static void dgap_poll_tasklet (unsigned long data) { -struct board_t *bd = (struct board_t *) data; +struct board_t *bd = (struct board_t *)data;ulong lock_flags;char __iomem *vaddr;u16 head, tail;@@ -2027,7 +2027,7 @@ static void dgap_poll_tasklet(unsigned long data)if (!bd->nasync) goto out; - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));@@ -2262,7 +2262,7 @@ static void dgap_poll_handler(ulong dummy)continue ;if (!brd->intr_running)/* Call the real board poller directly */ -dgap_poll_tasklet ((unsigned long ) brd); +dgap_poll_tasklet ((unsigned long )brd); } }else {/* @@ -2315,7 +2315,7 @@ schedule_poller: new_time = dgap_poll_time - jiffies; -if ((ulong ) new_time >=2 * dgap_poll_tick) { +if ((ulong )new_time >=2 * dgap_poll_tick) { dgap_poll_time = jiffies +dgap_jiffies_from_ms (dgap_poll_tick); }@@ -2369,7 +2369,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2384,7 +2384,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 ));writeb (byte1, (vaddr + head +CMDSTART +2 ));writeb (byte2, (vaddr + head +CMDSTART +3 ));@@ -2452,7 +2452,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2467,8 +2467,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) word, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )word, (vaddr + head +CMDSTART +2 )); head = (head +4 ) & (CMDMAX -CMDSTART -4 );@@ -2534,7 +2534,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2550,19 +2550,19 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)*/ /* Write an FF to tell the FEP that we want an extended command */ -writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); +writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) cmd, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )cmd, (vaddr + head +CMDSTART +2 ));/* * If the second part of the command won't fit, * put it at the beginning of the circular buffer. */ if (((head +4 ) >= ((CMDMAX -CMDSTART )) || (head &03 ))) -writew ((u16 ) word, (vaddr +CMDSTART )); +writew ((u16 )word, (vaddr +CMDSTART ));else -writew ((u16 ) word, (vaddr + head +CMDSTART +4 )); +writew ((u16 )word, (vaddr + head +CMDSTART +4 )); head = (head +8 ) & (CMDMAX -CMDSTART -4 );@@ -2860,13 +2860,13 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) cflag &=0xffff ;if (cflag != ch->ch_fepcflag) { - ch->ch_fepcflag = (u16) (cflag &0xffff ); + ch->ch_fepcflag = (u16)(cflag &0xffff );/* * Okay to have channel and board * locks held calling this */ -dgap_cmdw (ch,SCFLAG , (u16 ) cflag,0 ); +dgap_cmdw (ch,SCFLAG , (u16 )cflag,0 ); }/* Handle transition from B0 */ @@ -2907,7 +2907,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_fepiflag = iflag;/* Okay to have channel and board locks held calling this */ -dgap_cmdw (ch,SIFLAG , (u16 ) ch->ch_fepiflag,0 ); +dgap_cmdw (ch,SIFLAG , (u16 )ch->ch_fepiflag,0 ); }/* @@ -2932,7 +2932,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_hflow = hflow;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SHFLOW , (u8 ) hflow,0xff ,0 ); +dgap_cmdb (ch,SHFLOW , (u8 )hflow,0xff ,0 ); }/* @@ -2960,7 +2960,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_mostat = mval;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SMODEM , (u8 ) mval,D_RTS (ch)|D_DTR (ch),0 ); +dgap_cmdb (ch,SMODEM , (u8 )mval,D_RTS (ch) |D_DTR (ch),0 ); }/* @@ -3159,7 +3159,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );@@ -3604,7 +3604,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, n -= remain; vaddr = ch->ch_taddr + head; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head = ch->ch_tstart; buf += remain;@@ -3617,7 +3617,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, vaddr = ch->ch_taddr + head; remain = n; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head += remain; }@@ -3830,7 +3830,7 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)#if 0 dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );#endif -dgap_cmdw (ch,SBREAK , (u16 ) msec,0 ); +dgap_cmdw (ch,SBREAK , (u16 )msec,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4152,7 +4152,7 @@ static int dgap_tty_digisetedelay(struct channel_t *ch, struct board_t *bd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -writew ((u16 ) new_digi, &(ch->ch_bs->edelay)); +writew ((u16 )new_digi, &ch->ch_bs->edelay);dgap_param (ch, bd, un->un_type);@@ -4759,7 +4759,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,u16 head;ulong lock_flags =0 ;ulong lock_flags2 =0 ; -void __user *uarg = (void __user *) arg; +void __user *uarg = (void __user *)arg;if (!tty || tty->magic !=TTY_MAGIC )return -ENODEV ;@@ -4811,7 +4811,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&ch->ch_lock, lock_flags2);if (((cmd ==TCSBRK ) && (!arg)) || (cmd ==TCSBRKP )) -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4838,7 +4838,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4865,7 +4865,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4889,13 +4889,13 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return put_user (C_CLOCAL (tty) ?1 :0 , - (unsigned long __user *) arg); + (unsigned long __user *)arg);case TIOCSSOFTCAR :spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags); - rc =get_user (arg, (unsigned long __user *) arg); + rc =get_user (arg, (unsigned long __user *)arg);if (rc)return rc;@@ -4960,7 +4960,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );@@ -5985,7 +5985,7 @@ static int dgap_test_bios(struct board_t *brd) brd->wait_for_bios =0 ;while (brd->wait_for_bios <1000 ) {/* Check to see if BIOS thinks board is good. (GD). */ -if (word == *(u16 *)"GD" ) +if (word == *(u16 *)"GD" )return 0 ;msleep_interruptible (10 ); brd->wait_for_bios++;@@ -6071,12 +6071,12 @@ static int dgap_test_fep(struct board_t *brd) brd->wait_for_fep =0 ;while (brd->wait_for_fep <500 ) {/* Check to see if FEP is up and running now. */ -if (word == *(u16 *)"OS" ) { +if (word == *(u16 *)"OS" ) {/* * Check to see if the board can support FEP5+ commands. */ word =readw (addr +FEP5_PLUS ); -if (word == *(u16 *)"5A" ) +if (word == *(u16 *)"5A" ) brd->bd_flags |=BD_FEP5PLUS ;return 0 ;@@ -6162,8 +6162,8 @@ static void dgap_do_conc_load(struct board_t *brd, u8 *uaddr, int len) vaddr = brd->re_map_membase; - offset =readw ((u16 *) (vaddr +DOWNREQ )); - to_dp = (struct downld_t *) (vaddr + (int ) offset); + offset =readw ((u16 *)(vaddr +DOWNREQ )); + to_dp = (struct downld_t *)(vaddr + (int )offset);memcpy_toio (to_dp, uaddr, len);/* Tell card we have data for it */ @@ -6622,7 +6622,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,* is requesting a concentrator image from us. */ if ((bd->type ==PCX ) || (bd->type ==PEPC )) { - chk_addr = (u16 *) (vaddr +DOWNREQ ); + chk_addr = (u16 *)(vaddr +DOWNREQ );/* Nonzero if FEP is requesting concentrator image. */ check =readw (chk_addr); vaddr = brd->re_map_membase;@@ -6637,7 +6637,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,return ret; }/* Put concentrator firmware loading code here */ - offset =readw ((u16 *) (vaddr +DOWNREQ )); + offset =readw ((u16 *)(vaddr +DOWNREQ ));memcpy_toio (offset, fw->data, fw->size);dgap_do_conc_load (brd, (char *)fw->data, fw->size)@@ -6720,8 +6720,8 @@ static int dgap_tty_init(struct board_t *brd) ch = brd->channels[0 ]; vaddr = brd->re_map_membase; - bs = (struct bs_t __iomem *) ((ulong ) vaddr +CHANBUF ); - cm = (struct cm_t __iomem *) ((ulong ) vaddr +CMDBUF ); + bs = (struct bs_t __iomem *)((ulong )vaddr +CHANBUF ); + cm = (struct cm_t __iomem *)((ulong )vaddr +CMDBUF ); brd->bd_bs = bs; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d884ca2435043329459e463d282995002ab72e6f.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/5] staging: dgap: remove unnecessary space after cast
Quoted 22 lines · Julia Lawall
Quoted 10 lines · Ioana Ciornei
This patch removes unnecessary spaces after the cast. Patch done with coccinelle semantic patch:
@rule0@
type t;
identifier e;
constant c;
expression expr;
@@Quoted 9 lines
(
- (t) e
+ (t)e
|
- (t) c
+ (t)c
|
- (t) expr
+ (t)expr
Quoted 6 lines
Again, you are actually just removing all expressions with casts, regardless of spacing, and then adding them back with the default Coccinelle pretty printing strategy. But it is true that the semantic patch does represent clearly what you are intending to do.
julia
Now I understand why after applying some coccinelle patches like this one there were also other changes made to the code alongside the ones that I explicitly requested.
Was there any better way of doing this or I should leave it as it is?
Thanks,
Ioana
Quoted 370 lines
Quoted 370 lines
)
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 88 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-)drivers/staging/dgap/dgap.c +44
-45@@ -1413,7 +1413,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 0 :/* No FF seen yet */ -if (c == (unsigned char )'\377' ) +if (c == (unsigned char )'\377' )/* delete this character from stream */ ch->pscan_state =1 ;else {@@ -1425,7 +1425,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 1 :/* first FF seen */ -if (c == (unsigned char )'\377' ) { +if (c == (unsigned char )'\377' ) {/* doubled ff, transform to single ff */ *cout++ = c; *fout++ =TTY_NORMAL ;@@ -1837,7 +1837,7 @@ static int dgap_event(struct board_t *bd)return -EIO ; } - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));@@ -1994,7 +1994,7 @@ next:*/ static void dgap_poll_tasklet (unsigned long data) { -struct board_t *bd = (struct board_t *) data; +struct board_t *bd = (struct board_t *)data;ulong lock_flags;char __iomem *vaddr;u16 head, tail;@@ -2027,7 +2027,7 @@ static void dgap_poll_tasklet(unsigned long data)if (!bd->nasync) goto out; - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));@@ -2262,7 +2262,7 @@ static void dgap_poll_handler(ulong dummy)continue ;if (!brd->intr_running)/* Call the real board poller directly */ -dgap_poll_tasklet ((unsigned long ) brd); +dgap_poll_tasklet ((unsigned long )brd); } }else {/* @@ -2315,7 +2315,7 @@ schedule_poller: new_time = dgap_poll_time - jiffies; -if ((ulong ) new_time >=2 * dgap_poll_tick) { +if ((ulong )new_time >=2 * dgap_poll_tick) { dgap_poll_time = jiffies +dgap_jiffies_from_ms (dgap_poll_tick); }@@ -2369,7 +2369,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2384,7 +2384,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 ));writeb (byte1, (vaddr + head +CMDSTART +2 ));writeb (byte2, (vaddr + head +CMDSTART +3 ));@@ -2452,7 +2452,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2467,8 +2467,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) word, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )word, (vaddr + head +CMDSTART +2 )); head = (head +4 ) & (CMDMAX -CMDSTART -4 );@@ -2534,7 +2534,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2550,19 +2550,19 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)*/ /* Write an FF to tell the FEP that we want an extended command */ -writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); +writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) cmd, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )cmd, (vaddr + head +CMDSTART +2 ));/* * If the second part of the command won't fit, * put it at the beginning of the circular buffer. */ if (((head +4 ) >= ((CMDMAX -CMDSTART )) || (head &03 ))) -writew ((u16 ) word, (vaddr +CMDSTART )); +writew ((u16 )word, (vaddr +CMDSTART ));else -writew ((u16 ) word, (vaddr + head +CMDSTART +4 )); +writew ((u16 )word, (vaddr + head +CMDSTART +4 )); head = (head +8 ) & (CMDMAX -CMDSTART -4 );@@ -2860,13 +2860,13 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) cflag &=0xffff ;if (cflag != ch->ch_fepcflag) { - ch->ch_fepcflag = (u16) (cflag &0xffff ); + ch->ch_fepcflag = (u16)(cflag &0xffff );/* * Okay to have channel and board * locks held calling this */ -dgap_cmdw (ch,SCFLAG , (u16 ) cflag,0 ); +dgap_cmdw (ch,SCFLAG , (u16 )cflag,0 ); }/* Handle transition from B0 */ @@ -2907,7 +2907,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_fepiflag = iflag;/* Okay to have channel and board locks held calling this */ -dgap_cmdw (ch,SIFLAG , (u16 ) ch->ch_fepiflag,0 ); +dgap_cmdw (ch,SIFLAG , (u16 )ch->ch_fepiflag,0 ); }/* @@ -2932,7 +2932,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_hflow = hflow;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SHFLOW , (u8 ) hflow,0xff ,0 ); +dgap_cmdb (ch,SHFLOW , (u8 )hflow,0xff ,0 ); }/* @@ -2960,7 +2960,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_mostat = mval;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SMODEM , (u8 ) mval,D_RTS (ch)|D_DTR (ch),0 ); +dgap_cmdb (ch,SMODEM , (u8 )mval,D_RTS (ch) |D_DTR (ch),0 ); }/* @@ -3159,7 +3159,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );@@ -3604,7 +3604,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, n -= remain; vaddr = ch->ch_taddr + head; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head = ch->ch_tstart; buf += remain;@@ -3617,7 +3617,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, vaddr = ch->ch_taddr + head; remain = n; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head += remain; }@@ -3830,7 +3830,7 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)#if 0 dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );#endif -dgap_cmdw (ch,SBREAK , (u16 ) msec,0 ); +dgap_cmdw (ch,SBREAK , (u16 )msec,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4152,7 +4152,7 @@ static int dgap_tty_digisetedelay(struct channel_t *ch, struct board_t *bd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -writew ((u16 ) new_digi, &(ch->ch_bs->edelay)); +writew ((u16 )new_digi, &ch->ch_bs->edelay);dgap_param (ch, bd, un->un_type);@@ -4759,7 +4759,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,u16 head;ulong lock_flags =0 ;ulong lock_flags2 =0 ; -void __user *uarg = (void __user *) arg; +void __user *uarg = (void __user *)arg;if (!tty || tty->magic !=TTY_MAGIC )return -ENODEV ;@@ -4811,7 +4811,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&ch->ch_lock, lock_flags2);if (((cmd ==TCSBRK ) && (!arg)) || (cmd ==TCSBRKP )) -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4838,7 +4838,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4865,7 +4865,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4889,13 +4889,13 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return put_user (C_CLOCAL (tty) ?1 :0 , - (unsigned long __user *) arg); + (unsigned long __user *)arg);case TIOCSSOFTCAR :spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags); - rc =get_user (arg, (unsigned long __user *) arg); + rc =get_user (arg, (unsigned long __user *)arg);if (rc)return rc;@@ -4960,7 +4960,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );@@ -5985,7 +5985,7 @@ static int dgap_test_bios(struct board_t *brd) brd->wait_for_bios =0 ;while (brd->wait_for_bios <1000 ) {/* Check to see if BIOS thinks board is good. (GD). */ -if (word == *(u16 *)"GD" ) +if (word == *(u16 *)"GD" )return 0 ;msleep_interruptible (10 ); brd->wait_for_bios++;@@ -6071,12 +6071,12 @@ static int dgap_test_fep(struct board_t *brd) brd->wait_for_fep =0 ;while (brd->wait_for_fep <500 ) {/* Check to see if FEP is up and running now. */ -if (word == *(u16 *)"OS" ) { +if (word == *(u16 *)"OS" ) {/* * Check to see if the board can support FEP5+ commands. */ word =readw (addr +FEP5_PLUS ); -if (word == *(u16 *)"5A" ) +if (word == *(u16 *)"5A" ) brd->bd_flags |=BD_FEP5PLUS ;return 0 ;@@ -6162,8 +6162,8 @@ static void dgap_do_conc_load(struct board_t *brd, u8 *uaddr, int len) vaddr = brd->re_map_membase; - offset =readw ((u16 *) (vaddr +DOWNREQ )); - to_dp = (struct downld_t *) (vaddr + (int ) offset); + offset =readw ((u16 *)(vaddr +DOWNREQ )); + to_dp = (struct downld_t *)(vaddr + (int )offset);memcpy_toio (to_dp, uaddr, len);/* Tell card we have data for it */ @@ -6622,7 +6622,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,* is requesting a concentrator image from us. */ if ((bd->type ==PCX ) || (bd->type ==PEPC )) { - chk_addr = (u16 *) (vaddr +DOWNREQ ); + chk_addr = (u16 *)(vaddr +DOWNREQ );/* Nonzero if FEP is requesting concentrator image. */ check =readw (chk_addr); vaddr = brd->re_map_membase;@@ -6637,7 +6637,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,return ret; }/* Put concentrator firmware loading code here */ - offset =readw ((u16 *) (vaddr +DOWNREQ )); + offset =readw ((u16 *)(vaddr +DOWNREQ ));memcpy_toio (offset, fw->data, fw->size);dgap_do_conc_load (brd, (char *)fw->data, fw->size)@@ -6720,8 +6720,8 @@ static int dgap_tty_init(struct board_t *brd) ch = brd->channels[0 ]; vaddr = brd->re_map_membase; - bs = (struct bs_t __iomem *) ((ulong ) vaddr +CHANBUF ); - cm = (struct cm_t __iomem *) ((ulong ) vaddr +CMDBUF ); + bs = (struct bs_t __iomem *)((ulong )vaddr +CHANBUF ); + cm = (struct cm_t __iomem *)((ulong )vaddr +CMDBUF ); brd->bd_bs = bs; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d884ca2435043329459e463d282995002ab72e6f.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/5] staging: dgap: remove unnecessary space after cast
Quoted 28 lines · Ioana Ciornei
Quoted 27 lines · Julia Lawall
Quoted 10 lines · Ioana Ciornei
This patch removes unnecessary spaces after the cast. Patch done with coccinelle semantic patch:
@rule0@
type t;
identifier e;
constant c;
expression expr;
@@Quoted 9 lines
(
- (t) e
+ (t)e
|
- (t) c
+ (t)c
|
- (t) expr
+ (t)exprAgain, you are actually just removing all expressions with casts, regardless of spacing, and then adding them back with the default Coccinelle pretty printing strategy. But it is true that the semantic patch does represent clearly what you are intending to do.
Quoted 5 lines
Quoted 1 line
julia
Now I understand why after applying some coccinelle patches like this one there were also other changes made to the code alongside the ones that I explicitly requested.
Yes :)
Quoted 1 line
Was there any better way of doing this or I should leave it as it is?
If you have removed the undesired changes, then I think you can just leave the patch as is. Actually, Coccinelle isn't really designed for doing whitespace changes, because it knows nothing about the whitespace in the original code. It is just sort of a hack that it can actually be helpful.
julia
Quoted 376 lines
Thanks,
Ioana
Quoted 370 lines
Quoted 370 lines
)
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 88 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-)drivers/staging/dgap/dgap.c +44
-45@@ -1413,7 +1413,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 0 :/* No FF seen yet */ -if (c == (unsigned char )'\377' ) +if (c == (unsigned char )'\377' )/* delete this character from stream */ ch->pscan_state =1 ;else {@@ -1425,7 +1425,7 @@ static void dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf,case 1 :/* first FF seen */ -if (c == (unsigned char )'\377' ) { +if (c == (unsigned char )'\377' ) {/* doubled ff, transform to single ff */ *cout++ = c; *fout++ =TTY_NORMAL ;@@ -1837,7 +1837,7 @@ static int dgap_event(struct board_t *bd)return -EIO ; } - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));@@ -1994,7 +1994,7 @@ next:*/ static void dgap_poll_tasklet (unsigned long data) { -struct board_t *bd = (struct board_t *) data; +struct board_t *bd = (struct board_t *)data;ulong lock_flags;char __iomem *vaddr;u16 head, tail;@@ -2027,7 +2027,7 @@ static void dgap_poll_tasklet(unsigned long data)if (!bd->nasync) goto out; - eaddr = (struct ev_t __iomem *) (vaddr +EVBUF ); + eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ head =readw (&(eaddr->ev_head));@@ -2262,7 +2262,7 @@ static void dgap_poll_handler(ulong dummy)continue ;if (!brd->intr_running)/* Call the real board poller directly */ -dgap_poll_tasklet ((unsigned long ) brd); +dgap_poll_tasklet ((unsigned long )brd); } }else {/* @@ -2315,7 +2315,7 @@ schedule_poller: new_time = dgap_poll_time - jiffies; -if ((ulong ) new_time >=2 * dgap_poll_tick) { +if ((ulong )new_time >=2 * dgap_poll_tick) { dgap_poll_time = jiffies +dgap_jiffies_from_ms (dgap_poll_tick); }@@ -2369,7 +2369,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2384,7 +2384,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 ));writeb (byte1, (vaddr + head +CMDSTART +2 ));writeb (byte2, (vaddr + head +CMDSTART +3 ));@@ -2452,7 +2452,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2467,8 +2467,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* Put the data in the circular command buffer. */ writeb (cmd, (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) word, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )word, (vaddr + head +CMDSTART +2 )); head = (head +4 ) & (CMDMAX -CMDSTART -4 );@@ -2534,7 +2534,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)if (!vaddr)return ; - cm_addr = (struct cm_t __iomem *) (vaddr +CMDBUF ); + cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); head =readw (&(cm_addr->cm_head));/* @@ -2550,19 +2550,19 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)*/ /* Write an FF to tell the FEP that we want an extended command */ -writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); +writeb ((u8 )0xff , (vaddr + head +CMDSTART +0 )); -writeb ((u8 ) ch->ch_portnum, (vaddr + head +CMDSTART +1 )); -writew ((u16 ) cmd, (vaddr + head +CMDSTART +2 )); +writeb ((u8 )ch->ch_portnum, (vaddr + head +CMDSTART +1 )); +writew ((u16 )cmd, (vaddr + head +CMDSTART +2 ));/* * If the second part of the command won't fit, * put it at the beginning of the circular buffer. */ if (((head +4 ) >= ((CMDMAX -CMDSTART )) || (head &03 ))) -writew ((u16 ) word, (vaddr +CMDSTART )); +writew ((u16 )word, (vaddr +CMDSTART ));else -writew ((u16 ) word, (vaddr + head +CMDSTART +4 )); +writew ((u16 )word, (vaddr + head +CMDSTART +4 )); head = (head +8 ) & (CMDMAX -CMDSTART -4 );@@ -2860,13 +2860,13 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) cflag &=0xffff ;if (cflag != ch->ch_fepcflag) { - ch->ch_fepcflag = (u16) (cflag &0xffff ); + ch->ch_fepcflag = (u16)(cflag &0xffff );/* * Okay to have channel and board * locks held calling this */ -dgap_cmdw (ch,SCFLAG , (u16 ) cflag,0 ); +dgap_cmdw (ch,SCFLAG , (u16 )cflag,0 ); }/* Handle transition from B0 */ @@ -2907,7 +2907,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_fepiflag = iflag;/* Okay to have channel and board locks held calling this */ -dgap_cmdw (ch,SIFLAG , (u16 ) ch->ch_fepiflag,0 ); +dgap_cmdw (ch,SIFLAG , (u16 )ch->ch_fepiflag,0 ); }/* @@ -2932,7 +2932,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_hflow = hflow;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SHFLOW , (u8 ) hflow,0xff ,0 ); +dgap_cmdb (ch,SHFLOW , (u8 )hflow,0xff ,0 ); }/* @@ -2960,7 +2960,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_mostat = mval;/* Okay to have channel and board locks held calling this */ -dgap_cmdb (ch,SMODEM , (u8 ) mval,D_RTS (ch)|D_DTR (ch),0 ); +dgap_cmdb (ch,SMODEM , (u8 )mval,D_RTS (ch) |D_DTR (ch),0 ); }/* @@ -3159,7 +3159,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );@@ -3604,7 +3604,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, n -= remain; vaddr = ch->ch_taddr + head; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head = ch->ch_tstart; buf += remain;@@ -3617,7 +3617,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, vaddr = ch->ch_taddr + head; remain = n; -memcpy_toio (vaddr, (u8 *) buf, remain); +memcpy_toio (vaddr, (u8 *)buf, remain); head += remain; }@@ -3830,7 +3830,7 @@ static int dgap_tty_send_break(struct tty_struct *tty, int msec)#if 0 dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );#endif -dgap_cmdw (ch,SBREAK , (u16 ) msec,0 ); +dgap_cmdw (ch,SBREAK , (u16 )msec,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4152,7 +4152,7 @@ static int dgap_tty_digisetedelay(struct channel_t *ch, struct board_t *bd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -writew ((u16 ) new_digi, &(ch->ch_bs->edelay)); +writew ((u16 )new_digi, &ch->ch_bs->edelay);dgap_param (ch, bd, un->un_type);@@ -4759,7 +4759,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,u16 head;ulong lock_flags =0 ;ulong lock_flags2 =0 ; -void __user *uarg = (void __user *) arg; +void __user *uarg = (void __user *)arg;if (!tty || tty->magic !=TTY_MAGIC )return -ENODEV ;@@ -4811,7 +4811,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&ch->ch_lock, lock_flags2);if (((cmd ==TCSBRK ) && (!arg)) || (cmd ==TCSBRKP )) -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4838,7 +4838,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4865,7 +4865,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&bd->bd_lock, lock_flags);spin_lock_irqsave (&ch->ch_lock, lock_flags2); -dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 ); +dgap_cmdw (ch,SBREAK , (u16 )SBREAK_TIME ,0 );spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -4889,13 +4889,13 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return put_user (C_CLOCAL (tty) ?1 :0 , - (unsigned long __user *) arg); + (unsigned long __user *)arg);case TIOCSSOFTCAR :spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags); - rc =get_user (arg, (unsigned long __user *) arg); + rc =get_user (arg, (unsigned long __user *)arg);if (rc)return rc;@@ -4960,7 +4960,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, ch->ch_flags &= ~CH_STOP ; head =readw (&(ch->ch_bs->tx_head)); -dgap_cmdw (ch,FLUSHTX , (u16 ) head,0 ); +dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );@@ -5985,7 +5985,7 @@ static int dgap_test_bios(struct board_t *brd) brd->wait_for_bios =0 ;while (brd->wait_for_bios <1000 ) {/* Check to see if BIOS thinks board is good. (GD). */ -if (word == *(u16 *)"GD" ) +if (word == *(u16 *)"GD" )return 0 ;msleep_interruptible (10 ); brd->wait_for_bios++;@@ -6071,12 +6071,12 @@ static int dgap_test_fep(struct board_t *brd) brd->wait_for_fep =0 ;while (brd->wait_for_fep <500 ) {/* Check to see if FEP is up and running now. */ -if (word == *(u16 *)"OS" ) { +if (word == *(u16 *)"OS" ) {/* * Check to see if the board can support FEP5+ commands. */ word =readw (addr +FEP5_PLUS ); -if (word == *(u16 *)"5A" ) +if (word == *(u16 *)"5A" ) brd->bd_flags |=BD_FEP5PLUS ;return 0 ;@@ -6162,8 +6162,8 @@ static void dgap_do_conc_load(struct board_t *brd, u8 *uaddr, int len) vaddr = brd->re_map_membase; - offset =readw ((u16 *) (vaddr +DOWNREQ )); - to_dp = (struct downld_t *) (vaddr + (int ) offset); + offset =readw ((u16 *)(vaddr +DOWNREQ )); + to_dp = (struct downld_t *)(vaddr + (int )offset);memcpy_toio (to_dp, uaddr, len);/* Tell card we have data for it */ @@ -6622,7 +6622,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,* is requesting a concentrator image from us. */ if ((bd->type ==PCX ) || (bd->type ==PEPC )) { - chk_addr = (u16 *) (vaddr +DOWNREQ ); + chk_addr = (u16 *)(vaddr +DOWNREQ );/* Nonzero if FEP is requesting concentrator image. */ check =readw (chk_addr); vaddr = brd->re_map_membase;@@ -6637,7 +6637,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,return ret; }/* Put concentrator firmware loading code here */ - offset =readw ((u16 *) (vaddr +DOWNREQ )); + offset =readw ((u16 *)(vaddr +DOWNREQ ));memcpy_toio (offset, fw->data, fw->size);dgap_do_conc_load (brd, (char *)fw->data, fw->size)@@ -6720,8 +6720,8 @@ static int dgap_tty_init(struct board_t *brd) ch = brd->channels[0 ]; vaddr = brd->re_map_membase; - bs = (struct bs_t __iomem *) ((ulong ) vaddr +CHANBUF ); - cm = (struct cm_t __iomem *) ((ulong ) vaddr +CMDBUF ); + bs = (struct bs_t __iomem *)((ulong )vaddr +CHANBUF ); + cm = (struct cm_t __iomem *)((ulong )vaddr +CMDBUF ); brd->bd_bs = bs; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d884ca2435043329459e463d282995002ab72e6f.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 4/5 staging: dgap: remove unnecessary brackets
In reply to Ioana CiorneiThis patch removes unnecessary brackets when dealing with unary operators like '&'.
Done with coccinelle semantic patch:
@@
expression e;
@@
(
- &(e)
+ &e
)
--- drivers/staging/dgap/dgap.c | 194 ++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 97 deletions(-)
drivers/staging/dgap/dgap.c +97 -97
@@ -1510,15 +1510,15 @@ static void dgap_input(struct channel_t *ch) rmask = ch->ch_rsize -1 ; - head =readw (&(bs->rx_head)); + head =readw (&bs->rx_head); head &= rmask; - tail =readw (&(bs->rx_tail)); + tail =readw (&bs->rx_tail); tail &= rmask; data_len = (head - tail) & rmask;if (data_len ==0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;
@@ -1533,8 +1533,8 @@ static void dgap_input(struct channel_t *ch) !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) { -writew (head, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (head, &bs->rx_tail); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;
@@ -1544,7 +1544,7 @@ static void dgap_input(struct channel_t *ch)* If we are throttled, simply don't read any data. */ if (ch->ch_flags &CH_RXBLOCK ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;
@@ -1553,10 +1553,10 @@ static void dgap_input(struct channel_t *ch)/* * Ignore oruns. */ - tmpchar =readb (&(bs->orun)); + tmpchar =readb (&bs->orun);if (tmpchar) { ch->ch_err_overrun++; -writeb (0 , &(bs->orun)); +writeb (0 , &bs->orun); }/* Decide how much data we can send into the tty layer */
@@ -1591,13 +1591,13 @@ static void dgap_input(struct channel_t *ch)* space to put the data right now. */ if (!ld->ops->receive_buf) { -writew (head, &(bs->rx_tail)); +writew (head, &bs->rx_tail); len =0 ; } }if (len <=0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);if (ld)
@@ -1630,8 +1630,8 @@ static void dgap_input(struct channel_t *ch) tail &= rmask; } -writew (tail, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (tail, &bs->rx_tail); +writeb (1 , &bs->idata); ch->ch_rxcount += len;/*
@@ -1840,8 +1840,8 @@ static int dgap_event(struct board_t *bd) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * Forget it if pointers out of range.
@@ -1916,7 +1916,7 @@ static int dgap_event(struct board_t *bd)if (ch->ch_flags &CH_RACTIVE ) ch->ch_flags |=CH_RENABLE ;else -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);if (ch->ch_flags &CH_RWAIT ) { ch->ch_flags &= ~CH_RWAIT ;
@@ -1983,7 +1983,7 @@ next: tail = (tail +4 ) & (EVMAX -EVSTART -4 ); } -writew (tail, &(eaddr->ev_tail)); +writew (tail, &eaddr->ev_tail);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return 0 ;
@@ -2030,8 +2030,8 @@ static void dgap_poll_tasklet(unsigned long data) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * If there is an event pending. Go service it.
@@ -2370,7 +2370,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range.
@@ -2390,7 +2390,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1, head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head
@@ -2399,8 +2399,8 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );
@@ -2453,7 +2453,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range.
@@ -2472,7 +2472,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds) head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head
@@ -2481,8 +2481,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );
@@ -2535,7 +2535,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range.
@@ -2566,7 +2566,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds) head = (head +8 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head
@@ -2575,8 +2575,8 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );
@@ -2614,7 +2614,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)* Check parameters. */ bs = ch->ch_bs; - head =readw (&(bs->tx_head)); + head =readw (&bs->tx_head);/* * If pointers are out of range, just return.
@@ -2646,7 +2646,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)memcpy_toio (taddr, buf, n); head += cnt; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }/*
@@ -2695,12 +2695,12 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)*/ if ((ch->ch_c_cflag & (CBAUD )) ==0 ) {/* flush rx */ - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail);/* flush tx */ - head =readw (&(ch->ch_bs->tx_head)); -writew (head, &(ch->ch_bs->tx_tail)); + head =readw (&ch->ch_bs->tx_head); +writew (head, &ch->ch_bs->tx_tail); ch->ch_flags |= (CH_BAUD0 );
@@ -2966,7 +2966,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* * Read modem signals, and then call carrier function. */ - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);dgap_carrier (ch);/*
@@ -3158,7 +3158,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags2); ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {
@@ -3252,15 +3252,15 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty) tmask = (ch->ch_tsize -1 );/* Get Transmit queue pointers */ - thead =readw (&(bs->tx_head)) & tmask; - ttail =readw (&(bs->tx_tail)) & tmask; + thead =readw (&bs->tx_head) & tmask; + ttail =readw (&bs->tx_tail) & tmask;/* Get tbusy flag */ - tbusy =readb (&(bs->tbusy)); + tbusy =readb (&bs->tbusy);/* Get Command queue pointers */ - chead =readw (&(ch->ch_cm->cm_head)); - ctail =readw (&(ch->ch_cm->cm_tail)); + chead =readw (&ch->ch_cm->cm_head); + ctail =readw (&ch->ch_cm->cm_tail);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);
@@ -3296,7 +3296,7 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)if (tbusy !=0 ) {spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags); }
@@ -3341,7 +3341,7 @@ static int dgap_wait_for_drain(struct tty_struct *tty)/* Set flag waiting for drain */ spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);/* Go to sleep till we get woken up */
@@ -3420,13 +3420,13 @@ static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_LOW ) ==0 ) { un->un_flags |=UN_LOW ; -writeb (1 , &(bs->ilow)); +writeb (1 , &bs->ilow); } }if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_EMPTY ) ==0 ) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); } } }
@@ -3463,8 +3463,8 @@ static int dgap_tty_write_room(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + head =readw (&bs->tx_head) & tmask; + tail =readw (&bs->tx_tail) & tmask; ret = tail - head -1 ;if (ret <0 )
@@ -3540,9 +3540,9 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,spin_lock_irqsave (&ch->ch_lock, lock_flags);/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask; bufcount = tail - head -1 ;if (bufcount <0 )
@@ -3576,7 +3576,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, (int )ch->ch_digi.digi_onlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags |=CH_PRON ; }
@@ -3587,7 +3587,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; }
@@ -3624,7 +3624,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if (count) { ch->ch_txcount += count; head &= tmask; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }dgap_set_firmware_event (un,UN_LOW |UN_EMPTY );
@@ -3637,15 +3637,15 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,* Otherwise turn it off right now. */ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) { - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask;if (tail != head) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; } }
@@ -3701,7 +3701,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;
@@ -3912,7 +3912,7 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;
@@ -4124,7 +4124,7 @@ static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo)memset (&tmp,0 ,sizeof (tmp));spin_lock_irqsave (&ch->ch_lock, lock_flags); - tmp =readw (&(ch->ch_bs->edelay)); + tmp =readw (&ch->ch_bs->edelay);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);if (copy_to_user (retinfo, &tmp,sizeof (*retinfo)))
@@ -4459,8 +4459,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)/* * Flush input queue. */ - head =readw (&(bs->rx_head)); -writew (head, &(bs->rx_tail)); + head =readw (&bs->rx_head); +writew (head, &bs->rx_tail); ch->ch_flags =0 ; ch->pscan_state =0 ;
@@ -4944,9 +4944,9 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if ((arg ==TCIFLUSH ) || (arg ==TCIOFLUSH )) {if (!(un->un_type ==DGAP_PRINT )) { - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); -writeb (0 , &(ch->ch_bs->orun)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); +writeb (0 , &ch->ch_bs->orun); } }
@@ -4959,7 +4959,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, } ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {
@@ -4995,8 +4995,8 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if (cmd ==TCSETSF ) {/* flush rx */ ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); }/* now wait for all the output to drain */
@@ -5900,31 +5900,31 @@ static struct attribute *dgap_sysfs_tty_entries[] = {static void dgap_create_ports_sysfiles (struct board_t *bd) {dev_set_drvdata (&bd->pdev->dev, bd); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_state); +device_create_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_create_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_create_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* removes all the sys files created for that port */ static void dgap_remove_ports_sysfiles (struct board_t *bd) { -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_state); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/*
@@ -6760,12 +6760,12 @@ static int dgap_tty_init(struct board_t *brd) ch->ch_dsr =DM_DSR ; } - ch->ch_taddr = vaddr + (ioread16 (&(ch->ch_bs->tx_seg)) <<4 ); - ch->ch_raddr = vaddr + (ioread16 (&(ch->ch_bs->rx_seg)) <<4 ); + ch->ch_taddr = vaddr + (ioread16 (&ch->ch_bs->tx_seg) <<4 ); + ch->ch_raddr = vaddr + (ioread16 (&ch->ch_bs->rx_seg) <<4 ); ch->ch_tx_win =0 ; ch->ch_rx_win =0 ; - ch->ch_tsize =readw (&(ch->ch_bs->tx_max)) +1 ; - ch->ch_rsize =readw (&(ch->ch_bs->rx_max)) +1 ; + ch->ch_tsize =readw (&ch->ch_bs->tx_max) +1 ; + ch->ch_rsize =readw (&ch->ch_bs->rx_max) +1 ; ch->ch_tstart =0 ; ch->ch_rstart =0 ;
@@ -6783,7 +6783,7 @@ static int dgap_tty_init(struct board_t *brd)dgap_cmdw (ch,SRHIGH ,7 * ch->ch_rsize /8 ,0 ); - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);init_waitqueue_head (&ch->ch_flags_wait);init_waitqueue_head (&ch->ch_tun.un_flags_wait);
@@ -6791,18 +6791,18 @@ static int dgap_tty_init(struct board_t *brd)/* Turn on all modem interrupts for now */ modem = (DM_CD |DM_DSR |DM_CTS |DM_RI ); -writeb (modem, &(ch->ch_bs->m_int)); +writeb (modem, &ch->ch_bs->m_int);/* * Set edelay to 0 if interrupts are turned on, * otherwise set edelay to the usual 100. */ if (brd->intr_used) -writew (0 , &(ch->ch_bs->edelay)); +writew (0 , &ch->ch_bs->edelay);else -writew (100 , &(ch->ch_bs->edelay)); +writew (100 , &ch->ch_bs->edelay); -writeb (1 , &(ch->ch_bs->idata)); +writeb (1 , &ch->ch_bs->idata); }return 0 ;
Signature · 1 line
2.1.4
Re: [Outreachy kernel] [PATCH 4/5] staging: dgap: remove unnecessary brackets
Quoted 4 lines · Ioana Ciornei
This patch removes unnecessary brackets when dealing with unary operators like '&'.
Done with coccinelle semantic patch:
Quoted 8 lines
@@
expression e;
@@(
- &(e)
+ &e
)
The outer parentheses are not necessary. Parentheses in column 0 are for the case where one wants to consider a collection of possible options, but that is not your case here.
Also, with your rule, you remove the expression e and add it back. When you do that, Coccinelle decides how to format e. In this case it probably doesn't matter, because there is not much choice about the formatting, but if you wanted to only remove the parentheses, the rule would be:
&
- (
e
- )
julia
Quoted 575 lines
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 194 ++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 97 deletions(-)drivers/staging/dgap/dgap.c +97
-98@@ -1510,15 +1510,15 @@ static void dgap_input(struct channel_t *ch) rmask = ch->ch_rsize -1 ; - head =readw (&(bs->rx_head)); + head =readw (&bs->rx_head); head &= rmask; - tail =readw (&(bs->rx_tail)); + tail =readw (&bs->rx_tail); tail &= rmask; data_len = (head - tail) & rmask;if (data_len ==0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1533,8 +1533,8 @@ static void dgap_input(struct channel_t *ch) !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) { -writew (head, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (head, &bs->rx_tail); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1544,7 +1544,7 @@ static void dgap_input(struct channel_t *ch)* If we are throttled, simply don't read any data. */ if (ch->ch_flags &CH_RXBLOCK ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1553,10 +1553,10 @@ static void dgap_input(struct channel_t *ch)/* * Ignore oruns. */ - tmpchar =readb (&(bs->orun)); + tmpchar =readb (&bs->orun);if (tmpchar) { ch->ch_err_overrun++; -writeb (0 , &(bs->orun)); +writeb (0 , &bs->orun); }/* Decide how much data we can send into the tty layer */ @@ -1591,13 +1591,13 @@ static void dgap_input(struct channel_t *ch)* space to put the data right now. */ if (!ld->ops->receive_buf) { -writew (head, &(bs->rx_tail)); +writew (head, &bs->rx_tail); len =0 ; } }if (len <=0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);if (ld)@@ -1630,8 +1630,8 @@ static void dgap_input(struct channel_t *ch) tail &= rmask; } -writew (tail, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (tail, &bs->rx_tail); +writeb (1 , &bs->idata); ch->ch_rxcount += len;/* @@ -1840,8 +1840,8 @@ static int dgap_event(struct board_t *bd) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * Forget it if pointers out of range. @@ -1916,7 +1916,7 @@ static int dgap_event(struct board_t *bd)if (ch->ch_flags &CH_RACTIVE ) ch->ch_flags |=CH_RENABLE ;else -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);if (ch->ch_flags &CH_RWAIT ) { ch->ch_flags &= ~CH_RWAIT ;@@ -1983,7 +1983,7 @@ next: tail = (tail +4 ) & (EVMAX -EVSTART -4 ); } -writew (tail, &(eaddr->ev_tail)); +writew (tail, &eaddr->ev_tail);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return 0 ;@@ -2030,8 +2030,8 @@ static void dgap_poll_tasklet(unsigned long data) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * If there is an event pending. Go service it. @@ -2370,7 +2370,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2390,7 +2390,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1, head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2399,8 +2399,8 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2453,7 +2453,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2472,7 +2472,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds) head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2481,8 +2481,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2535,7 +2535,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2566,7 +2566,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds) head = (head +8 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2575,8 +2575,8 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2614,7 +2614,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)* Check parameters. */ bs = ch->ch_bs; - head =readw (&(bs->tx_head)); + head =readw (&bs->tx_head);/* * If pointers are out of range, just return. @@ -2646,7 +2646,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)memcpy_toio (taddr, buf, n); head += cnt; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }/* @@ -2695,12 +2695,12 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)*/ if ((ch->ch_c_cflag & (CBAUD )) ==0 ) {/* flush rx */ - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail);/* flush tx */ - head =readw (&(ch->ch_bs->tx_head)); -writew (head, &(ch->ch_bs->tx_tail)); + head =readw (&ch->ch_bs->tx_head); +writew (head, &ch->ch_bs->tx_tail); ch->ch_flags |= (CH_BAUD0 );@@ -2966,7 +2966,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* * Read modem signals, and then call carrier function. */ - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);dgap_carrier (ch);/* @@ -3158,7 +3158,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags2); ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {@@ -3252,15 +3252,15 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty) tmask = (ch->ch_tsize -1 );/* Get Transmit queue pointers */ - thead =readw (&(bs->tx_head)) & tmask; - ttail =readw (&(bs->tx_tail)) & tmask; + thead =readw (&bs->tx_head) & tmask; + ttail =readw (&bs->tx_tail) & tmask;/* Get tbusy flag */ - tbusy =readb (&(bs->tbusy)); + tbusy =readb (&bs->tbusy);/* Get Command queue pointers */ - chead =readw (&(ch->ch_cm->cm_head)); - ctail =readw (&(ch->ch_cm->cm_tail)); + chead =readw (&ch->ch_cm->cm_head); + ctail =readw (&ch->ch_cm->cm_tail);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -3296,7 +3296,7 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)if (tbusy !=0 ) {spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags); }@@ -3341,7 +3341,7 @@ static int dgap_wait_for_drain(struct tty_struct *tty)/* Set flag waiting for drain */ spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);/* Go to sleep till we get woken up */ @@ -3420,13 +3420,13 @@ static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_LOW ) ==0 ) { un->un_flags |=UN_LOW ; -writeb (1 , &(bs->ilow)); +writeb (1 , &bs->ilow); } }if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_EMPTY ) ==0 ) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); } } }@@ -3463,8 +3463,8 @@ static int dgap_tty_write_room(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + head =readw (&bs->tx_head) & tmask; + tail =readw (&bs->tx_tail) & tmask; ret = tail - head -1 ;if (ret <0 )@@ -3540,9 +3540,9 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,spin_lock_irqsave (&ch->ch_lock, lock_flags);/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask; bufcount = tail - head -1 ;if (bufcount <0 )@@ -3576,7 +3576,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, (int )ch->ch_digi.digi_onlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags |=CH_PRON ; }@@ -3587,7 +3587,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3624,7 +3624,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if (count) { ch->ch_txcount += count; head &= tmask; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }dgap_set_firmware_event (un,UN_LOW |UN_EMPTY );@@ -3637,15 +3637,15 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,* Otherwise turn it off right now. */ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) { - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask;if (tail != head) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; } }@@ -3701,7 +3701,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;@@ -3912,7 +3912,7 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;@@ -4124,7 +4124,7 @@ static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo)memset (&tmp,0 ,sizeof (tmp));spin_lock_irqsave (&ch->ch_lock, lock_flags); - tmp =readw (&(ch->ch_bs->edelay)); + tmp =readw (&ch->ch_bs->edelay);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);if (copy_to_user (retinfo, &tmp,sizeof (*retinfo)))@@ -4459,8 +4459,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)/* * Flush input queue. */ - head =readw (&(bs->rx_head)); -writew (head, &(bs->rx_tail)); + head =readw (&bs->rx_head); +writew (head, &bs->rx_tail); ch->ch_flags =0 ; ch->pscan_state =0 ;@@ -4944,9 +4944,9 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if ((arg ==TCIFLUSH ) || (arg ==TCIOFLUSH )) {if (!(un->un_type ==DGAP_PRINT )) { - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); -writeb (0 , &(ch->ch_bs->orun)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); +writeb (0 , &ch->ch_bs->orun); } }@@ -4959,7 +4959,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, } ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {@@ -4995,8 +4995,8 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if (cmd ==TCSETSF ) {/* flush rx */ ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); }/* now wait for all the output to drain */ @@ -5900,31 +5900,31 @@ static struct attribute *dgap_sysfs_tty_entries[] = {static void dgap_create_ports_sysfiles (struct board_t *bd) {dev_set_drvdata (&bd->pdev->dev, bd); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_state); +device_create_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_create_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_create_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* removes all the sys files created for that port */ static void dgap_remove_ports_sysfiles (struct board_t *bd) { -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_state); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* @@ -6760,12 +6760,12 @@ static int dgap_tty_init(struct board_t *brd) ch->ch_dsr =DM_DSR ; } - ch->ch_taddr = vaddr + (ioread16 (&(ch->ch_bs->tx_seg)) <<4 ); - ch->ch_raddr = vaddr + (ioread16 (&(ch->ch_bs->rx_seg)) <<4 ); + ch->ch_taddr = vaddr + (ioread16 (&ch->ch_bs->tx_seg) <<4 ); + ch->ch_raddr = vaddr + (ioread16 (&ch->ch_bs->rx_seg) <<4 ); ch->ch_tx_win =0 ; ch->ch_rx_win =0 ; - ch->ch_tsize =readw (&(ch->ch_bs->tx_max)) +1 ; - ch->ch_rsize =readw (&(ch->ch_bs->rx_max)) +1 ; + ch->ch_tsize =readw (&ch->ch_bs->tx_max) +1 ; + ch->ch_rsize =readw (&ch->ch_bs->rx_max) +1 ; ch->ch_tstart =0 ; ch->ch_rstart =0 ;@@ -6783,7 +6783,7 @@ static int dgap_tty_init(struct board_t *brd)dgap_cmdw (ch,SRHIGH ,7 * ch->ch_rsize /8 ,0 ); - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);init_waitqueue_head (&ch->ch_flags_wait);init_waitqueue_head (&ch->ch_tun.un_flags_wait);@@ -6791,18 +6791,18 @@ static int dgap_tty_init(struct board_t *brd)/* Turn on all modem interrupts for now */ modem = (DM_CD |DM_DSR |DM_CTS |DM_RI ); -writeb (modem, &(ch->ch_bs->m_int)); +writeb (modem, &ch->ch_bs->m_int);/* * Set edelay to 0 if interrupts are turned on, * otherwise set edelay to the usual 100. */ if (brd->intr_used) -writew (0 , &(ch->ch_bs->edelay)); +writew (0 , &ch->ch_bs->edelay);else -writew (100 , &(ch->ch_bs->edelay)); +writew (100 , &ch->ch_bs->edelay); -writeb (1 , &(ch->ch_bs->idata)); +writeb (1 , &ch->ch_bs->idata); }return 0 ; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/297a5e7fdf9061882469fc3af732a51e033c426c.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 4/5] staging: dgap: remove unnecessary brackets
Quoted 10 lines · Julia Lawall
Quoted 8 lines · Ioana Ciornei
This patch removes unnecessary brackets when dealing with unary operators like '&'.
Done with coccinelle semantic patch:@@
expression e;
@@
Quoted 8 lines
Quoted 4 lines
(
- &(e)
+ &e
)The outer parentheses are not necessary. Parentheses in column 0 are for the case where one wants to consider a collection of possible options, but that is not your case here.
The outer parentheses were just forgotten there because I tried multiple versions of the semantic patch and one of them had multiple cases.
Sorry about that.
Quoted 6 lines
Also, with your rule, you remove the expression e and add it back. When you do that, Coccinelle decides how to format e. In this case it probably doesn't matter, because there is not much choice about the formatting, but if you wanted to only remove the parentheses, the rule would be:
Quoted 6 lines
&
- (
e
- )julia
Should I rework the patch with the new semantic patch and resubmit?
Thanks,
Ioana
Quoted 576 lines
Quoted 576 lines
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 194 ++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 97 deletions(-)drivers/staging/dgap/dgap.c +97
-98@@ -1510,15 +1510,15 @@ static void dgap_input(struct channel_t *ch) rmask = ch->ch_rsize -1 ; - head =readw (&(bs->rx_head)); + head =readw (&bs->rx_head); head &= rmask; - tail =readw (&(bs->rx_tail)); + tail =readw (&bs->rx_tail); tail &= rmask; data_len = (head - tail) & rmask;if (data_len ==0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1533,8 +1533,8 @@ static void dgap_input(struct channel_t *ch) !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) { -writew (head, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (head, &bs->rx_tail); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1544,7 +1544,7 @@ static void dgap_input(struct channel_t *ch)* If we are throttled, simply don't read any data. */ if (ch->ch_flags &CH_RXBLOCK ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1553,10 +1553,10 @@ static void dgap_input(struct channel_t *ch)/* * Ignore oruns. */ - tmpchar =readb (&(bs->orun)); + tmpchar =readb (&bs->orun);if (tmpchar) { ch->ch_err_overrun++; -writeb (0 , &(bs->orun)); +writeb (0 , &bs->orun); }/* Decide how much data we can send into the tty layer */ @@ -1591,13 +1591,13 @@ static void dgap_input(struct channel_t *ch)* space to put the data right now. */ if (!ld->ops->receive_buf) { -writew (head, &(bs->rx_tail)); +writew (head, &bs->rx_tail); len =0 ; } }if (len <=0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);if (ld)@@ -1630,8 +1630,8 @@ static void dgap_input(struct channel_t *ch) tail &= rmask; } -writew (tail, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (tail, &bs->rx_tail); +writeb (1 , &bs->idata); ch->ch_rxcount += len;/* @@ -1840,8 +1840,8 @@ static int dgap_event(struct board_t *bd) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * Forget it if pointers out of range. @@ -1916,7 +1916,7 @@ static int dgap_event(struct board_t *bd)if (ch->ch_flags &CH_RACTIVE ) ch->ch_flags |=CH_RENABLE ;else -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);if (ch->ch_flags &CH_RWAIT ) { ch->ch_flags &= ~CH_RWAIT ;@@ -1983,7 +1983,7 @@ next: tail = (tail +4 ) & (EVMAX -EVSTART -4 ); } -writew (tail, &(eaddr->ev_tail)); +writew (tail, &eaddr->ev_tail);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return 0 ;@@ -2030,8 +2030,8 @@ static void dgap_poll_tasklet(unsigned long data) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * If there is an event pending. Go service it. @@ -2370,7 +2370,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2390,7 +2390,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1, head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2399,8 +2399,8 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2453,7 +2453,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2472,7 +2472,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds) head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2481,8 +2481,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2535,7 +2535,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2566,7 +2566,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds) head = (head +8 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2575,8 +2575,8 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2614,7 +2614,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)* Check parameters. */ bs = ch->ch_bs; - head =readw (&(bs->tx_head)); + head =readw (&bs->tx_head);/* * If pointers are out of range, just return. @@ -2646,7 +2646,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)memcpy_toio (taddr, buf, n); head += cnt; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }/* @@ -2695,12 +2695,12 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)*/ if ((ch->ch_c_cflag & (CBAUD )) ==0 ) {/* flush rx */ - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail);/* flush tx */ - head =readw (&(ch->ch_bs->tx_head)); -writew (head, &(ch->ch_bs->tx_tail)); + head =readw (&ch->ch_bs->tx_head); +writew (head, &ch->ch_bs->tx_tail); ch->ch_flags |= (CH_BAUD0 );@@ -2966,7 +2966,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* * Read modem signals, and then call carrier function. */ - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);dgap_carrier (ch);/* @@ -3158,7 +3158,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags2); ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {@@ -3252,15 +3252,15 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty) tmask = (ch->ch_tsize -1 );/* Get Transmit queue pointers */ - thead =readw (&(bs->tx_head)) & tmask; - ttail =readw (&(bs->tx_tail)) & tmask; + thead =readw (&bs->tx_head) & tmask; + ttail =readw (&bs->tx_tail) & tmask;/* Get tbusy flag */ - tbusy =readb (&(bs->tbusy)); + tbusy =readb (&bs->tbusy);/* Get Command queue pointers */ - chead =readw (&(ch->ch_cm->cm_head)); - ctail =readw (&(ch->ch_cm->cm_tail)); + chead =readw (&ch->ch_cm->cm_head); + ctail =readw (&ch->ch_cm->cm_tail);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -3296,7 +3296,7 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)if (tbusy !=0 ) {spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags); }@@ -3341,7 +3341,7 @@ static int dgap_wait_for_drain(struct tty_struct *tty)/* Set flag waiting for drain */ spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);/* Go to sleep till we get woken up */ @@ -3420,13 +3420,13 @@ static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_LOW ) ==0 ) { un->un_flags |=UN_LOW ; -writeb (1 , &(bs->ilow)); +writeb (1 , &bs->ilow); } }if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_EMPTY ) ==0 ) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); } } }@@ -3463,8 +3463,8 @@ static int dgap_tty_write_room(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + head =readw (&bs->tx_head) & tmask; + tail =readw (&bs->tx_tail) & tmask; ret = tail - head -1 ;if (ret <0 )@@ -3540,9 +3540,9 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,spin_lock_irqsave (&ch->ch_lock, lock_flags);/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask; bufcount = tail - head -1 ;if (bufcount <0 )@@ -3576,7 +3576,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, (int )ch->ch_digi.digi_onlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags |=CH_PRON ; }@@ -3587,7 +3587,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3624,7 +3624,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if (count) { ch->ch_txcount += count; head &= tmask; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }dgap_set_firmware_event (un,UN_LOW |UN_EMPTY );@@ -3637,15 +3637,15 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,* Otherwise turn it off right now. */ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) { - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask;if (tail != head) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; } }@@ -3701,7 +3701,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;@@ -3912,7 +3912,7 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;@@ -4124,7 +4124,7 @@ static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo)memset (&tmp,0 ,sizeof (tmp));spin_lock_irqsave (&ch->ch_lock, lock_flags); - tmp =readw (&(ch->ch_bs->edelay)); + tmp =readw (&ch->ch_bs->edelay);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);if (copy_to_user (retinfo, &tmp,sizeof (*retinfo)))@@ -4459,8 +4459,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)/* * Flush input queue. */ - head =readw (&(bs->rx_head)); -writew (head, &(bs->rx_tail)); + head =readw (&bs->rx_head); +writew (head, &bs->rx_tail); ch->ch_flags =0 ; ch->pscan_state =0 ;@@ -4944,9 +4944,9 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if ((arg ==TCIFLUSH ) || (arg ==TCIOFLUSH )) {if (!(un->un_type ==DGAP_PRINT )) { - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); -writeb (0 , &(ch->ch_bs->orun)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); +writeb (0 , &ch->ch_bs->orun); } }@@ -4959,7 +4959,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, } ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {@@ -4995,8 +4995,8 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if (cmd ==TCSETSF ) {/* flush rx */ ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); }/* now wait for all the output to drain */ @@ -5900,31 +5900,31 @@ static struct attribute *dgap_sysfs_tty_entries[] = {static void dgap_create_ports_sysfiles (struct board_t *bd) {dev_set_drvdata (&bd->pdev->dev, bd); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_state); +device_create_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_create_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_create_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* removes all the sys files created for that port */ static void dgap_remove_ports_sysfiles (struct board_t *bd) { -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_state); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* @@ -6760,12 +6760,12 @@ static int dgap_tty_init(struct board_t *brd) ch->ch_dsr =DM_DSR ; } - ch->ch_taddr = vaddr + (ioread16 (&(ch->ch_bs->tx_seg)) <<4 ); - ch->ch_raddr = vaddr + (ioread16 (&(ch->ch_bs->rx_seg)) <<4 ); + ch->ch_taddr = vaddr + (ioread16 (&ch->ch_bs->tx_seg) <<4 ); + ch->ch_raddr = vaddr + (ioread16 (&ch->ch_bs->rx_seg) <<4 ); ch->ch_tx_win =0 ; ch->ch_rx_win =0 ; - ch->ch_tsize =readw (&(ch->ch_bs->tx_max)) +1 ; - ch->ch_rsize =readw (&(ch->ch_bs->rx_max)) +1 ; + ch->ch_tsize =readw (&ch->ch_bs->tx_max) +1 ; + ch->ch_rsize =readw (&ch->ch_bs->rx_max) +1 ; ch->ch_tstart =0 ; ch->ch_rstart =0 ;@@ -6783,7 +6783,7 @@ static int dgap_tty_init(struct board_t *brd)dgap_cmdw (ch,SRHIGH ,7 * ch->ch_rsize /8 ,0 ); - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);init_waitqueue_head (&ch->ch_flags_wait);init_waitqueue_head (&ch->ch_tun.un_flags_wait);@@ -6791,18 +6791,18 @@ static int dgap_tty_init(struct board_t *brd)/* Turn on all modem interrupts for now */ modem = (DM_CD |DM_DSR |DM_CTS |DM_RI ); -writeb (modem, &(ch->ch_bs->m_int)); +writeb (modem, &ch->ch_bs->m_int);/* * Set edelay to 0 if interrupts are turned on, * otherwise set edelay to the usual 100. */ if (brd->intr_used) -writew (0 , &(ch->ch_bs->edelay)); +writew (0 , &ch->ch_bs->edelay);else -writew (100 , &(ch->ch_bs->edelay)); +writew (100 , &ch->ch_bs->edelay); -writeb (1 , &(ch->ch_bs->idata)); +writeb (1 , &ch->ch_bs->idata); }return 0 ; --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/297a5e7fdf9061882469fc3af732a51e033c426c.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 4/5] staging: dgap: remove unnecessary brackets
Quoted 31 lines · Ioana Ciornei
Quoted 10 lines · Julia Lawall
Quoted 8 lines · Ioana Ciornei
This patch removes unnecessary brackets when dealing with unary operators like '&'.
Done with coccinelle semantic patch:@@
expression e;
@@Quoted 8 lines
Quoted 4 lines
(
- &(e)
+ &e
)The outer parentheses are not necessary. Parentheses in column 0 are for the case where one wants to consider a collection of possible options, but that is not your case here.
The outer parentheses were just forgotten there because I tried multiple versions of the semantic patch and one of them had multiple cases.
Sorry about that.Quoted 6 lines
Also, with your rule, you remove the expression e and add it back. When you do that, Coccinelle decides how to format e. In this case it probably doesn't matter, because there is not much choice about the formatting, but if you wanted to only remove the parentheses, the rule would be:
Quoted 8 lines
Quoted 6 lines
&
- (
e
- )julia
Should I rework the patch with the new semantic patch and resubmit?
No, I think it's OK as is. In your particular case, it has no impact on the output, and the semantic patch you give is understandable. It's just something to remember for the future. Also, it's really a tradeoff. Sometimes it is good to not remove things and put them back, because the developer already made good choices about the spacing. But other times, when your semantic patches makes big changes around some code, the code will have to be reformatted anyway, and it can be easier to just let Coccinelle do the whole thing. So it may be useful to try both ways, and see what makes the largest amount of code look best.
julia
Quoted 590 lines
Thanks,
Ioana
Quoted 569 lines
Quoted 569 lines
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 194 ++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 97 deletions(-)drivers/staging/dgap/dgap.c +97
-98@@ -1510,15 +1510,15 @@ static void dgap_input(struct channel_t *ch) rmask = ch->ch_rsize -1 ; - head =readw (&(bs->rx_head)); + head =readw (&bs->rx_head); head &= rmask; - tail =readw (&(bs->rx_tail)); + tail =readw (&bs->rx_tail); tail &= rmask; data_len = (head - tail) & rmask;if (data_len ==0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1533,8 +1533,8 @@ static void dgap_input(struct channel_t *ch) !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) { -writew (head, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (head, &bs->rx_tail); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1544,7 +1544,7 @@ static void dgap_input(struct channel_t *ch)* If we are throttled, simply don't read any data. */ if (ch->ch_flags &CH_RXBLOCK ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return ;@@ -1553,10 +1553,10 @@ static void dgap_input(struct channel_t *ch)/* * Ignore oruns. */ - tmpchar =readb (&(bs->orun)); + tmpchar =readb (&bs->orun);if (tmpchar) { ch->ch_err_overrun++; -writeb (0 , &(bs->orun)); +writeb (0 , &bs->orun); }/* Decide how much data we can send into the tty layer */ @@ -1591,13 +1591,13 @@ static void dgap_input(struct channel_t *ch)* space to put the data right now. */ if (!ld->ops->receive_buf) { -writew (head, &(bs->rx_tail)); +writew (head, &bs->rx_tail); len =0 ; } }if (len <=0 ) { -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);if (ld)@@ -1630,8 +1630,8 @@ static void dgap_input(struct channel_t *ch) tail &= rmask; } -writew (tail, &(bs->rx_tail)); -writeb (1 , &(bs->idata)); +writew (tail, &bs->rx_tail); +writeb (1 , &bs->idata); ch->ch_rxcount += len;/* @@ -1840,8 +1840,8 @@ static int dgap_event(struct board_t *bd) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * Forget it if pointers out of range. @@ -1916,7 +1916,7 @@ static int dgap_event(struct board_t *bd)if (ch->ch_flags &CH_RACTIVE ) ch->ch_flags |=CH_RENABLE ;else -writeb (1 , &(bs->idata)); +writeb (1 , &bs->idata);if (ch->ch_flags &CH_RWAIT ) { ch->ch_flags &= ~CH_RWAIT ;@@ -1983,7 +1983,7 @@ next: tail = (tail +4 ) & (EVMAX -EVSTART -4 ); } -writew (tail, &(eaddr->ev_tail)); +writew (tail, &eaddr->ev_tail);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);return 0 ;@@ -2030,8 +2030,8 @@ static void dgap_poll_tasklet(unsigned long data) eaddr = (struct ev_t __iomem *)(vaddr +EVBUF );/* Get our head and tail */ - head =readw (&(eaddr->ev_head)); - tail =readw (&(eaddr->ev_tail)); + head =readw (&eaddr->ev_head); + tail =readw (&eaddr->ev_tail);/* * If there is an event pending. Go service it. @@ -2370,7 +2370,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2390,7 +2390,7 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1, head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2399,8 +2399,8 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 byte1,* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2453,7 +2453,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2472,7 +2472,7 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds) head = (head +4 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2481,8 +2481,8 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2535,7 +2535,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)return ; cm_addr = (struct cm_t __iomem *)(vaddr +CMDBUF ); - head =readw (&(cm_addr->cm_head)); + head =readw (&cm_addr->cm_head);/* * Forget it if pointers out of range. @@ -2566,7 +2566,7 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds) head = (head +8 ) & (CMDMAX -CMDSTART -4 ); -writew (head, &(cm_addr->cm_head)); +writew (head, &cm_addr->cm_head);/* * Wait if necessary before updating the head @@ -2575,8 +2575,8 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, u16 word, uint ncmds)* is outlandish, declare the FEP dead. */ for (count = dgap_count ;;) { - head =readw (&(cm_addr->cm_head)); - tail =readw (&(cm_addr->cm_tail)); + head =readw (&cm_addr->cm_head); + tail =readw (&cm_addr->cm_tail); n = (head - tail) & (CMDMAX -CMDSTART -4 );@@ -2614,7 +2614,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)* Check parameters. */ bs = ch->ch_bs; - head =readw (&(bs->tx_head)); + head =readw (&bs->tx_head);/* * If pointers are out of range, just return. @@ -2646,7 +2646,7 @@ static void dgap_wmove(struct channel_t *ch, char *buf, uint cnt)memcpy_toio (taddr, buf, n); head += cnt; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }/* @@ -2695,12 +2695,12 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)*/ if ((ch->ch_c_cflag & (CBAUD )) ==0 ) {/* flush rx */ - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail);/* flush tx */ - head =readw (&(ch->ch_bs->tx_head)); -writew (head, &(ch->ch_bs->tx_tail)); + head =readw (&ch->ch_bs->tx_head); +writew (head, &ch->ch_bs->tx_tail); ch->ch_flags |= (CH_BAUD0 );@@ -2966,7 +2966,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* * Read modem signals, and then call carrier function. */ - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);dgap_carrier (ch);/* @@ -3158,7 +3158,7 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags2); ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {@@ -3252,15 +3252,15 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty) tmask = (ch->ch_tsize -1 );/* Get Transmit queue pointers */ - thead =readw (&(bs->tx_head)) & tmask; - ttail =readw (&(bs->tx_tail)) & tmask; + thead =readw (&bs->tx_head) & tmask; + ttail =readw (&bs->tx_tail) & tmask;/* Get tbusy flag */ - tbusy =readb (&(bs->tbusy)); + tbusy =readb (&bs->tbusy);/* Get Command queue pointers */ - chead =readw (&(ch->ch_cm->cm_head)); - ctail =readw (&(ch->ch_cm->cm_tail)); + chead =readw (&ch->ch_cm->cm_head); + ctail =readw (&ch->ch_cm->cm_tail);spin_unlock_irqrestore (&ch->ch_lock, lock_flags2);spin_unlock_irqrestore (&bd->bd_lock, lock_flags);@@ -3296,7 +3296,7 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)if (tbusy !=0 ) {spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags); }@@ -3341,7 +3341,7 @@ static int dgap_wait_for_drain(struct tty_struct *tty)/* Set flag waiting for drain */ spin_lock_irqsave (&ch->ch_lock, lock_flags); un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);/* Go to sleep till we get woken up */ @@ -3420,13 +3420,13 @@ static inline void dgap_set_firmware_event(struct un_t *un, unsigned int event)if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_LOW ) ==0 ) { un->un_flags |=UN_LOW ; -writeb (1 , &(bs->ilow)); +writeb (1 , &bs->ilow); } }if ((event &UN_LOW ) !=0 ) {if ((un->un_flags &UN_EMPTY ) ==0 ) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); } } }@@ -3463,8 +3463,8 @@ static int dgap_tty_write_room(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + head =readw (&bs->tx_head) & tmask; + tail =readw (&bs->tx_tail) & tmask; ret = tail - head -1 ;if (ret <0 )@@ -3540,9 +3540,9 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,spin_lock_irqsave (&ch->ch_lock, lock_flags);/* Get our space available for the channel from the board */ tmask = ch->ch_tsize -1 ; - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask; bufcount = tail - head -1 ;if (bufcount <0 )@@ -3576,7 +3576,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type ==DGAP_PRINT ) && !(ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_onstr, (int )ch->ch_digi.digi_onlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags |=CH_PRON ; }@@ -3587,7 +3587,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if ((un->un_type !=DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; }@@ -3624,7 +3624,7 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,if (count) { ch->ch_txcount += count; head &= tmask; -writew (head, &(bs->tx_head)); +writew (head, &bs->tx_head); }dgap_set_firmware_event (un,UN_LOW |UN_EMPTY );@@ -3637,15 +3637,15 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf,* Otherwise turn it off right now. */ if ((un->un_type ==DGAP_PRINT ) && (ch->ch_flags &CH_PRON )) { - tail =readw (&(bs->tx_tail)) & tmask; + tail =readw (&bs->tx_tail) & tmask;if (tail != head) { un->un_flags |=UN_EMPTY ; -writeb (1 , &(bs->iempty)); +writeb (1 , &bs->iempty); }else {dgap_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); - head =readw (&(bs->tx_head)) & tmask; + head =readw (&bs->tx_head) & tmask; ch->ch_flags &= ~CH_PRON ; } }@@ -3701,7 +3701,7 @@ static int dgap_tty_tiocmget(struct tty_struct *tty)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;@@ -3912,7 +3912,7 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)spin_lock_irqsave (&ch->ch_lock, lock_flags); - mstat =readb (&(ch->ch_bs->m_stat)); + mstat =readb (&ch->ch_bs->m_stat);/* Append any outbound signals that might be pending... */ mstat |= ch->ch_mostat;@@ -4124,7 +4124,7 @@ static int dgap_tty_digigetedelay(struct tty_struct *tty, int __user *retinfo)memset (&tmp,0 ,sizeof (tmp));spin_lock_irqsave (&ch->ch_lock, lock_flags); - tmp =readw (&(ch->ch_bs->edelay)); + tmp =readw (&ch->ch_bs->edelay);spin_unlock_irqrestore (&ch->ch_lock, lock_flags);if (copy_to_user (retinfo, &tmp,sizeof (*retinfo)))@@ -4459,8 +4459,8 @@ static int dgap_tty_open(struct tty_struct *tty, struct file *file)/* * Flush input queue. */ - head =readw (&(bs->rx_head)); -writew (head, &(bs->rx_tail)); + head =readw (&bs->rx_head); +writew (head, &bs->rx_tail); ch->ch_flags =0 ; ch->pscan_state =0 ;@@ -4944,9 +4944,9 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if ((arg ==TCIFLUSH ) || (arg ==TCIOFLUSH )) {if (!(un->un_type ==DGAP_PRINT )) { - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); -writeb (0 , &(ch->ch_bs->orun)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); +writeb (0 , &ch->ch_bs->orun); } }@@ -4959,7 +4959,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, } ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->tx_head)); + head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 );if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) {@@ -4995,8 +4995,8 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if (cmd ==TCSETSF ) {/* flush rx */ ch->ch_flags &= ~CH_STOP ; - head =readw (&(ch->ch_bs->rx_head)); -writew (head, &(ch->ch_bs->rx_tail)); + head =readw (&ch->ch_bs->rx_head); +writew (head, &ch->ch_bs->rx_tail); }/* now wait for all the output to drain */ @@ -5900,31 +5900,31 @@ static struct attribute *dgap_sysfs_tty_entries[] = {static void dgap_create_ports_sysfiles (struct board_t *bd) {dev_set_drvdata (&bd->pdev->dev, bd); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_create_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_state); +device_create_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_create_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_create_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_create_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_create_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* removes all the sys files created for that port */ static void dgap_remove_ports_sysfiles (struct board_t *bd) { -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_state); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_baud); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_msignals); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_iflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_cflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_oflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_lflag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_digi_flag); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_rxcount); -device_remove_file (&(bd->pdev->dev), &dev_attr_ports_txcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_state); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_baud); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_msignals); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_iflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_cflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_oflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_lflag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_digi_flag); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_rxcount); +device_remove_file (&bd->pdev->dev, &dev_attr_ports_txcount); }/* @@ -6760,12 +6760,12 @@ static int dgap_tty_init(struct board_t *brd) ch->ch_dsr =DM_DSR ; } - ch->ch_taddr = vaddr + (ioread16 (&(ch->ch_bs->tx_seg)) <<4 ); - ch->ch_raddr = vaddr + (ioread16 (&(ch->ch_bs->rx_seg)) <<4 ); + ch->ch_taddr = vaddr + (ioread16 (&ch->ch_bs->tx_seg) <<4 ); + ch->ch_raddr = vaddr + (ioread16 (&ch->ch_bs->rx_seg) <<4 ); ch->ch_tx_win =0 ; ch->ch_rx_win =0 ; - ch->ch_tsize =readw (&(ch->ch_bs->tx_max)) +1 ; - ch->ch_rsize =readw (&(ch->ch_bs->rx_max)) +1 ; + ch->ch_tsize =readw (&ch->ch_bs->tx_max) +1 ; + ch->ch_rsize =readw (&ch->ch_bs->rx_max) +1 ; ch->ch_tstart =0 ; ch->ch_rstart =0 ;@@ -6783,7 +6783,7 @@ static int dgap_tty_init(struct board_t *brd)dgap_cmdw (ch,SRHIGH ,7 * ch->ch_rsize /8 ,0 ); - ch->ch_mistat =readb (&(ch->ch_bs->m_stat)); + ch->ch_mistat =readb (&ch->ch_bs->m_stat);init_waitqueue_head (&ch->ch_flags_wait);init_waitqueue_head (&ch->ch_tun.un_flags_wait);@@ -6791,18 +6791,18 @@ static int dgap_tty_init(struct board_t *brd)/* Turn on all modem interrupts for now */ modem = (DM_CD |DM_DSR |DM_CTS |DM_RI ); -writeb (modem, &(ch->ch_bs->m_int)); +writeb (modem, &ch->ch_bs->m_int);/* * Set edelay to 0 if interrupts are turned on, * otherwise set edelay to the usual 100. */ if (brd->intr_used) -writew (0 , &(ch->ch_bs->edelay)); +writew (0 , &ch->ch_bs->edelay);else -writew (100 , &(ch->ch_bs->edelay)); +writew (100 , &ch->ch_bs->edelay); -writeb (1 , &(ch->ch_bs->idata)); +writeb (1 , &ch->ch_bs->idata); }return 0 ; --2.1.4
Quoted 7 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/297a5e7fdf9061882469fc3af732a51e033c426c.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAHWJYFm87YacGDpaEmjYQvDBzcD6OtZ0desHaTBCxL36fH_dTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 5/5 staging: dgap: add spaces around binary operator '|'
In reply to Ioana CiorneiThis patch adds spaces around binary operator '|'. Done with coccinelle semantic patch:
@@
identifier x, y, z;
@@
(
- x|y|z
+ x | y | z
|
- x|y
+ x | y
)
--- drivers/staging/dgap/dgap.c | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/staging/dgap/dgap.c +29 -29
@@ -140,21 +140,21 @@ struct board_id { };static struct board_id dgap_ids[] = { - {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, - {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, + {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, + {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, + {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, {0 ,}/* 0 terminated list. */ };
@@ -2705,7 +2705,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_flags |= (CH_BAUD0 );/* Drop RTS and DTR */ - ch->ch_mval &= ~(D_RTS (ch)|D_DTR (ch)); + ch->ch_mval &= ~(D_RTS (ch) |D_DTR (ch)); mval =D_DTR (ch) |D_RTS (ch); ch->ch_baud_info =0 ;
@@ -2726,7 +2726,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch);
@@ -2872,7 +2872,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch); }
@@ -3161,12 +3161,12 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }
@@ -3982,7 +3982,7 @@ static int dgap_set_modem_info(struct channel_t *ch, struct board_t *bd,break ;case TIOCMSET : - ch->ch_mforce =D_DTR (ch)|D_RTS (ch); + ch->ch_mforce =D_DTR (ch) |D_RTS (ch);if (arg &TIOCM_RTS ) ch->ch_mval |=D_RTS (ch);
@@ -4589,8 +4589,8 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* If we have HUPCL set, lower DTR and RTS */ if (ch->ch_c_cflag &HUPCL ) { - ch->ch_mostat &= ~(D_RTS (ch)|D_DTR (ch)); -dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch)|D_RTS (ch),0 ); + ch->ch_mostat &= ~(D_RTS (ch) |D_DTR (ch)); +dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch) |D_RTS (ch),0 );/* * Go to sleep to ensure RTS/DTR
@@ -4962,12 +4962,12 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }if (waitqueue_active (&tty->write_wait))
Signature · 1 line
2.1.4
Re: [Outreachy kernel] [PATCH 5/5] staging: dgap: add spaces around binary operator '|'
Quoted 12 lines · Ioana Ciornei
This patch adds spaces around binary operator '|'. Done with coccinelle semantic patch:
@@
identifier x, y, z;
@@
(
- x|y|z
+ x | y | z
|
- x|y
+ x | y
Actually, Coccinelle doesn't care about the spacing that you put in the semantic patch. So your - lines match all | operations, not just the ones that are missing spaces. If you give the argument --smpl-spacing, then Coccinelle will follow the spacing that you specify for the added code. Without this option, it just does what it considers to be best, which turns out to be what you want anyway.
julia
Quoted 139 lines
)
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-)drivers/staging/dgap/dgap.c +29
-30@@ -140,21 +140,21 @@ struct board_id { };static struct board_id dgap_ids[] = { - {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, - {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, + {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, + {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, + {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, {0 ,}/* 0 terminated list. */ };@@ -2705,7 +2705,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_flags |= (CH_BAUD0 );/* Drop RTS and DTR */ - ch->ch_mval &= ~(D_RTS (ch)|D_DTR (ch)); + ch->ch_mval &= ~(D_RTS (ch) |D_DTR (ch)); mval =D_DTR (ch) |D_RTS (ch); ch->ch_baud_info =0 ;@@ -2726,7 +2726,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch);@@ -2872,7 +2872,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch); }@@ -3161,12 +3161,12 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }@@ -3982,7 +3982,7 @@ static int dgap_set_modem_info(struct channel_t *ch, struct board_t *bd,break ;case TIOCMSET : - ch->ch_mforce =D_DTR (ch)|D_RTS (ch); + ch->ch_mforce =D_DTR (ch) |D_RTS (ch);if (arg &TIOCM_RTS ) ch->ch_mval |=D_RTS (ch);@@ -4589,8 +4589,8 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* If we have HUPCL set, lower DTR and RTS */ if (ch->ch_c_cflag &HUPCL ) { - ch->ch_mostat &= ~(D_RTS (ch)|D_DTR (ch)); -dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch)|D_RTS (ch),0 ); + ch->ch_mostat &= ~(D_RTS (ch) |D_DTR (ch)); +dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch) |D_RTS (ch),0 );/* * Go to sleep to ensure RTS/DTR @@ -4962,12 +4962,12 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }if (waitqueue_active (&tty->write_wait)) --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e20a6f69d9b2c8bb11f7e5448a87fa3f2d7974aa.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 5/5] staging: dgap: add spaces around binary operator '|'
Quoted 15 lines · Julia Lawall
Quoted 12 lines · Ioana Ciornei
This patch adds spaces around binary operator '|'. Done with coccinelle semantic patch:
@@
identifier x, y, z;
@@
(
- x|y|z
+ x | y | z
|
- x|y
+ x | y
Quoted 8 lines
Actually, Coccinelle doesn't care about the spacing that you put in the semantic patch. So your - lines match all | operations, not just the ones that are missing spaces. If you give the argument --smpl-spacing, then Coccinelle will follow the spacing that you specify for the added code. Without this option, it just does what it considers to be best, which turns out to be what you want anyway.
julia
I will remember that (--smpl-spacing). Thanks.
Are there any other problems that I should consider regarding this patch or it is ok?
Thanks,
Ioana
Quoted 140 lines
Quoted 140 lines
)
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-)drivers/staging/dgap/dgap.c +29
-30@@ -140,21 +140,21 @@ struct board_id { };static struct board_id dgap_ids[] = { - {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, - {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, + {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, + {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, + {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, {0 ,}/* 0 terminated list. */ };@@ -2705,7 +2705,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_flags |= (CH_BAUD0 );/* Drop RTS and DTR */ - ch->ch_mval &= ~(D_RTS (ch)|D_DTR (ch)); + ch->ch_mval &= ~(D_RTS (ch) |D_DTR (ch)); mval =D_DTR (ch) |D_RTS (ch); ch->ch_baud_info =0 ;@@ -2726,7 +2726,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch);@@ -2872,7 +2872,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch); }@@ -3161,12 +3161,12 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }@@ -3982,7 +3982,7 @@ static int dgap_set_modem_info(struct channel_t *ch, struct board_t *bd,break ;case TIOCMSET : - ch->ch_mforce =D_DTR (ch)|D_RTS (ch); + ch->ch_mforce =D_DTR (ch) |D_RTS (ch);if (arg &TIOCM_RTS ) ch->ch_mval |=D_RTS (ch);@@ -4589,8 +4589,8 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* If we have HUPCL set, lower DTR and RTS */ if (ch->ch_c_cflag &HUPCL ) { - ch->ch_mostat &= ~(D_RTS (ch)|D_DTR (ch)); -dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch)|D_RTS (ch),0 ); + ch->ch_mostat &= ~(D_RTS (ch) |D_DTR (ch)); +dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch) |D_RTS (ch),0 );/* * Go to sleep to ensure RTS/DTR @@ -4962,12 +4962,12 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }if (waitqueue_active (&tty->write_wait)) --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e20a6f69d9b2c8bb11f7e5448a87fa3f2d7974aa.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Signature · 3 lines
Ioana Ciornei Facultatea de Automatica si Calculatoare, UPB Tel. 0753 861 668
Re: [Outreachy kernel] [PATCH 5/5] staging: dgap: add spaces around binary operator '|'
Quoted 23 lines · Ioana Ciornei
Quoted 22 lines · Julia Lawall
Quoted 12 lines · Ioana Ciornei
This patch adds spaces around binary operator '|'. Done with coccinelle semantic patch:
@@
identifier x, y, z;
@@
(
- x|y|z
+ x | y | z
|
- x|y
+ x | yActually, Coccinelle doesn't care about the spacing that you put in the semantic patch. So your - lines match all | operations, not just the ones that are missing spaces. If you give the argument --smpl-spacing, then Coccinelle will follow the spacing that you specify for the added code. Without this option, it just does what it considers to be best, which turns out to be what you want anyway.
Quoted 5 lines
Quoted 1 line
julia
I will remember that (--smpl-spacing). Thanks.
Are there any other problems that I should consider regarding this patch or it is ok?
The rest looks fine.
julia
Quoted 154 lines
Thanks,
Ioana
Quoted 133 lines
Quoted 133 lines
)
Signed-off-by Ioana Ciornei <[email protected]>--- drivers/staging/dgap/dgap.c | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-)drivers/staging/dgap/dgap.c +29
-30@@ -140,21 +140,21 @@ struct board_id { };static struct board_id dgap_ids[] = { - {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, - {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, - {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS ) }, - {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS ) }, + {PPCM ,PCI_DEV_XEM_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, + {PCX ,PCI_DEV_CX_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PCX ,PCI_DEV_CX_IBM_NAME ,128 , (T_CX |T_PCIBUS ) }, + {PEPC ,PCI_DEV_EPCJ_NAME ,224 , (T_EPC |T_PCIBUS ) }, + {APORT2_920P ,PCI_DEV_920_2_NAME ,2 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT4_920P ,PCI_DEV_920_4_NAME ,4 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XRJ_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_422_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_IBM_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_SAIP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PAPORT8 ,PCI_DEV_XR_BULL_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {APORT8_920P ,PCI_DEV_920_8_HP_NAME ,8 , (T_PCXR |T_PCLITE |T_PCIBUS )}, + {PPCM ,PCI_DEV_XEM_HP_NAME ,64 , (T_PCXM |T_PCLITE |T_PCIBUS )}, {0 ,}/* 0 terminated list. */ };@@ -2705,7 +2705,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type) ch->ch_flags |= (CH_BAUD0 );/* Drop RTS and DTR */ - ch->ch_mval &= ~(D_RTS (ch)|D_DTR (ch)); + ch->ch_mval &= ~(D_RTS (ch) |D_DTR (ch)); mval =D_DTR (ch) |D_RTS (ch); ch->ch_baud_info =0 ;@@ -2726,7 +2726,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch);@@ -2872,7 +2872,7 @@ static int dgap_param(struct channel_t *ch, struct board_t *bd, u32 un_type)/* Handle transition from B0 */ if (ch->ch_flags &CH_BAUD0 ) { ch->ch_flags &= ~(CH_BAUD0 ); - ch->ch_mval |= (D_RTS (ch)|D_DTR (ch)); + ch->ch_mval |= (D_RTS (ch) |D_DTR (ch)); } mval =D_DTR (ch) |D_RTS (ch); }@@ -3161,12 +3161,12 @@ static void dgap_tty_flush_buffer(struct tty_struct *tty) head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }@@ -3982,7 +3982,7 @@ static int dgap_set_modem_info(struct channel_t *ch, struct board_t *bd,break ;case TIOCMSET : - ch->ch_mforce =D_DTR (ch)|D_RTS (ch); + ch->ch_mforce =D_DTR (ch) |D_RTS (ch);if (arg &TIOCM_RTS ) ch->ch_mval |=D_RTS (ch);@@ -4589,8 +4589,8 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)* If we have HUPCL set, lower DTR and RTS */ if (ch->ch_c_cflag &HUPCL ) { - ch->ch_mostat &= ~(D_RTS (ch)|D_DTR (ch)); -dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch)|D_RTS (ch),0 ); + ch->ch_mostat &= ~(D_RTS (ch) |D_DTR (ch)); +dgap_cmdb (ch,SMODEM ,0 ,D_DTR (ch) |D_RTS (ch),0 );/* * Go to sleep to ensure RTS/DTR @@ -4962,12 +4962,12 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd, head =readw (&ch->ch_bs->tx_head);dgap_cmdw (ch,FLUSHTX , (u16 )head,0 );dgap_cmdw (ch,RESUMETX ,0 ,0 ); -if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_tun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_tun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_tun.un_flags_wait); } -if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { - ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY ); +if (ch->ch_pun.un_flags & (UN_LOW |UN_EMPTY )) { + ch->ch_pun.un_flags &= ~(UN_LOW |UN_EMPTY );wake_up_interruptible (&ch->ch_pun.un_flags_wait); }if (waitqueue_active (&tty->write_wait)) --2.1.4
Quoted 7 lines
Quoted 7 lines
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e20a6f69d9b2c8bb11f7e5448a87fa3f2d7974aa.1445382697.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.--
Ioana Ciornei
Facultatea de Automatica si Calculatoare, UPB
Tel. 0753 861 668