Staging: dgnc: Remove redundant parentheses
PATCH 1/5 Staging: dgnc: Remove redundant parentheses
This patch removes the redundant parentheses inorder to make code simplified. While doing this, the precedence order of the operation is taken into consideration to keep the logic of the code intact.
--- drivers/staging/dgnc/dgnc_neo.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +17 -17
@@ -119,7 +119,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch)/* Turn on auto CTS flow control */ #if 1 - ier |= (UART_17158_IER_CTSDSR ); + ier |=UART_17158_IER_CTSDSR ;#else ier &= ~(UART_17158_IER_CTSDSR );#endif
@@ -127,7 +127,7 @@ static inline void neo_set_cts_flow_control(struct channel_t *ch) efr |= (UART_17158_EFR_ECB |UART_17158_EFR_CTSDSR );/* Turn off auto Xon flow control */ - efr &= ~(UART_17158_EFR_IXON ); + efr &= ~UART_17158_EFR_IXON ;/* Why? Becuz Exar's spec says we have to zero it out before setting it */ writeb (0 , &ch->ch_neo_uart->efr);
@@ -155,15 +155,15 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)/* Turn on auto RTS flow control */ #if 1 - ier |= (UART_17158_IER_RTSDTR ); + ier |=UART_17158_IER_RTSDTR ;#else ier &= ~(UART_17158_IER_RTSDTR );#endif efr |= (UART_17158_EFR_ECB |UART_17158_EFR_RTSDTR );/* Turn off auto Xoff flow control */ - ier &= ~(UART_17158_IER_XOFF ); - efr &= ~(UART_17158_EFR_IXOFF ); + ier &= ~UART_17158_IER_XOFF ; + efr &= ~UART_17158_EFR_IXOFF ;/* Why? Becuz Exar's spec says we have to zero it out before setting it */ writeb (0 , &ch->ch_neo_uart->efr);
@@ -185,7 +185,7 @@ static inline void neo_set_rts_flow_control(struct channel_t *ch)* RTS/DTR# output pin (MCR bit-0 or 1 to logic 1 after * it is enabled. */ - ch->ch_mostat |= (UART_MCR_RTS ); + ch->ch_mostat |=UART_MCR_RTS ;neo_pci_posting_flush (ch->ch_bd); }
@@ -197,8 +197,8 @@ static inline void neo_set_ixon_flow_control(struct channel_t *ch)unsigned char efr =readb (&ch->ch_neo_uart->efr);/* Turn off auto CTS flow control */ - ier &= ~(UART_17158_IER_CTSDSR ); - efr &= ~(UART_17158_EFR_CTSDSR ); + ier &= ~UART_17158_IER_CTSDSR ; + efr &= ~UART_17158_EFR_CTSDSR ;/* Turn on auto Xon flow control */ efr |= (UART_17158_EFR_ECB |UART_17158_EFR_IXON );
@@ -234,11 +234,11 @@ static inline void neo_set_ixoff_flow_control(struct channel_t *ch)unsigned char efr =readb (&ch->ch_neo_uart->efr);/* Turn off auto RTS flow control */ - ier &= ~(UART_17158_IER_RTSDTR ); - efr &= ~(UART_17158_EFR_RTSDTR ); + ier &= ~UART_17158_IER_RTSDTR ; + efr &= ~UART_17158_EFR_RTSDTR ;/* Turn on auto Xoff flow control */ - ier |= (UART_17158_IER_XOFF ); + ier |=UART_17158_IER_XOFF ; efr |= (UART_17158_EFR_ECB |UART_17158_EFR_IXOFF );/* Why? Becuz Exar's spec says we have to zero it out before setting it */
@@ -272,11 +272,11 @@ static inline void neo_set_no_input_flow_control(struct channel_t *ch)unsigned char efr =readb (&ch->ch_neo_uart->efr);/* Turn off auto RTS flow control */ - ier &= ~(UART_17158_IER_RTSDTR ); - efr &= ~(UART_17158_EFR_RTSDTR ); + ier &= ~UART_17158_IER_RTSDTR ; + efr &= ~UART_17158_EFR_RTSDTR ;/* Turn off auto Xoff flow control */ - ier &= ~(UART_17158_IER_XOFF ); + ier &= ~UART_17158_IER_XOFF ;if (ch->ch_c_iflag &IXON ) efr &= ~(UART_17158_EFR_IXOFF );else
@@ -312,12 +312,12 @@ static inline void neo_set_no_output_flow_control(struct channel_t *ch)unsigned char efr =readb (&ch->ch_neo_uart->efr);/* Turn off auto CTS flow control */ - ier &= ~(UART_17158_IER_CTSDSR ); - efr &= ~(UART_17158_EFR_CTSDSR ); + ier &= ~UART_17158_IER_CTSDSR ; + efr &= ~UART_17158_EFR_CTSDSR ;/* Turn off auto Xon flow control */ if (ch->ch_c_iflag &IXOFF ) - efr &= ~(UART_17158_EFR_IXON ); + efr &= ~UART_17158_EFR_IXON ;else efr &= ~(UART_17158_EFR_ECB |UART_17158_EFR_IXON );
Signature · 1 line
1.9.1
PATCH 2/5 Staging: comedi: Use function setup_timer for combining initialization
The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, NULL);
)
--- drivers/staging/comedi/drivers/das16.c | 5 ++--- drivers/staging/comedi/drivers/jr3_pci.c | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/staging/comedi/drivers/das16.c +2 -3
@@ -935,9 +935,8 @@ static void das16_alloc_dma(struct comedi_device *dev, unsigned int dma_chan) devpriv->dma =comedi_isadma_alloc (dev,2 , dma_chan, dma_chan,DAS16_DMA_SIZE ,COMEDI_ISADMA_READ );if (devpriv->dma) { -init_timer (&devpriv->timer); - devpriv->timer.function = das16_timer_interrupt; - devpriv->timer.data = (unsigned long )dev; +setup_timer (&devpriv->timer, das16_timer_interrupt, + (unsigned long )dev); } }
drivers/staging/comedi/drivers/jr3_pci.c +1 -4
@@ -706,8 +706,6 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,if (!devpriv)return -ENOMEM ; -init_timer (&devpriv->timer); - ret =comedi_pci_enable (dev);if (ret)return ret;
@@ -775,8 +773,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, spriv->next_time_max = jiffies +msecs_to_jiffies (2000 ); } - devpriv->timer.data = (unsigned long )dev; - devpriv->timer.function = jr3_pci_poll_dev; +setup_timer (&devpriv->timer, jr3_pci_poll_dev, (unsigned long )dev); devpriv->timer.expires = jiffies +msecs_to_jiffies (1000 );add_timer (&devpriv->timer);
Signature · 1 line
1.9.1
PATCH 3/5 Staging: dgap: Use setup_timer to combine initialization
In reply to Somya AnandThe function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, NULL);
)
--- drivers/staging/dgap/dgap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/dgap/dgap.c +1 -2
@@ -7041,8 +7041,7 @@ static int dgap_start(void)/* Start the poller */ spin_lock_irqsave (&dgap_poll_lock, flags); -init_timer (&dgap_poll_timer); - dgap_poll_timer.function = dgap_poll_handler; +setup_timer (&dgap_poll_timer, dgap_poll_handler,NULL ); dgap_poll_timer.data =0 ; dgap_poll_time = jiffies +dgap_jiffies_from_ms (dgap_poll_tick); dgap_poll_timer.expires = dgap_poll_time;
Signature · 1 line
1.9.1
Re: [Outreachy kernel] [PATCH 3/5] Staging: dgap: Use setup_timer to combine initialization
Quoted 37 lines · Somya Anand
The function
setup_timercombines the initialization of a timer with the initialization of the timer's function and data fields.So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.@@
expression E1, E2, E3;
type T;
@@
-init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+setup_timer(&E1, E2, NULL);
)Signed-off-by Somya Anand <[email protected]>--- drivers/staging/dgap/dgap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/dgap/dgap.c +0
-0
drivers/staging/dgap/dgap.c static int dgap_start(void) · line 7044
Quoted 6 lines
drivers/staging/dgap/dgap.c +1
-2@@ -7041,8 +7041,7 @@ static int dgap_start(void)/* Start the poller */ spin_lock_irqsave (&dgap_poll_lock, flags); -init_timer (&dgap_poll_timer); - dgap_poll_timer.function = dgap_poll_handler; +setup_timer (&dgap_poll_timer, dgap_poll_handler,NULL );
As shown by the other patches, the last argument of setup_timer is an unsigned long, not a pointer. So it would be better to put 0 or 0UL than NULL.
julia
Quoted 13 lines
drivers/staging/dgap/dgap.c +0
-1dgap_poll_timer.data =0 ; dgap_poll_time = jiffies +dgap_jiffies_from_ms (dgap_poll_tick); dgap_poll_timer.expires = dgap_poll_time; --1.9.1
--
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/1426068292-20348-3-git-send-email-somyaanand214%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 4/5 Staging: lustre: Use setup_timer to combine initialization
In reply to Somya AnandThe function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, NULL);
)
--- drivers/staging/lustre/lustre/llite/super25.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/super25.c +1 -3
@@ -152,9 +152,7 @@ static int __init init_lustre_lite(void)do_gettimeofday (&tv);cfs_srand (tv.tv_sec ^ seed[0 ], tv.tv_usec ^ seed[1 ]); - -init_timer (&ll_capa_timer); - ll_capa_timer.function = ll_capa_timer_callback; +setup_timer (&ll_capa_timer, ll_capa_timer_callback,NULL ); rc =ll_capa_thread_start ();if (rc !=0 ) goto out_proc;
Signature · 1 line
1.9.1
PATCH 5/5 Staging: rtl8192u: Combine initialization using setup_timer
In reply to Somya AnandThe function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, NULL);
)
--- .../staging/rtl8192u/ieee80211/ieee80211_module.c | 5 +- .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 55 +++++++--------------- drivers/staging/rtl8192u/r8192U_core.c | 5 +- drivers/staging/rtl8192u/r8192U_dm.c | 6 +-- 4 files changed, 24 insertions(+), 47 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +2 -3
@@ -133,9 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->ieee802_1x =1 ;/* Default to supporting 802.1x */ INIT_LIST_HEAD (&ieee->crypt_deinit_list); -init_timer (&ieee->crypt_deinit_timer); - ieee->crypt_deinit_timer.data = (unsigned long )ieee; - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; +setup_timer (&ieee->crypt_deinit_timer, + ieee80211_crypt_deinit_handler, (unsigned long )ieee);spin_lock_init (&ieee->lock);spin_lock_init (&ieee->wpax_suitlist_lock);
drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +18 -37
67 lines not on this page · raw message
drivers/staging/rtl8192u/r8192U_core.c +2 -3
@@ -2549,9 +2549,8 @@ static short rtl8192_init(struct net_device *dev)rtl8192_read_eeprom_info (dev);rtl8192_get_channel_map (dev);init_hal_dm (dev); -init_timer (&priv->watch_dog_timer); - priv->watch_dog_timer.data = (unsigned long )dev; - priv->watch_dog_timer.function = watch_dog_timer_callback; +setup_timer (&priv->watch_dog_timer, watch_dog_timer_callback, + (unsigned long )dev);if (rtl8192_usb_initendpoints (dev) !=0 ) {DMESG ("Endopoints initialization failed" );return -ENOMEM ;
drivers/staging/rtl8192u/r8192U_dm.c +2 -4
@@ -2681,10 +2681,8 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold =200 ; priv->ieee80211->fsync_state = Default_Fsync; priv->framesyncMonitor =1 ;/* current default 0xc38 monitor on */ - -init_timer (&priv->fsync_timer); - priv->fsync_timer.data = (unsigned long )dev; - priv->fsync_timer.function = dm_fsync_timer_callback; +setup_timer (&priv->fsync_timer, dm_fsync_timer_callback, + (unsigned long )dev); }static void dm_deInit_fsync (struct net_device *dev)
Signature · 1 line
1.9.1