* [PATCH 1/3] Staging: rdma: Remove wrapper function add_rcvctrl
2016-02-25 11:55 [PATCH 0/3] Staging: rdma: Remove wrapper functions Bhumika Goyal
@ 2016-02-25 11:55 ` Bhumika Goyal
2016-02-25 11:55 ` [PATCH 2/3] Staging: rdma: Remove wrapper clear_rcvctrl Bhumika Goyal
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Bhumika Goyal @ 2016-02-25 11:55 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Bhumika Goyal
The function add_rcvctrl can be replaced with direct call to
adjuct_rcvtrl. Thus, drop the wrapper function.
Done using coccinelle:
@@
expression e,f;
@@
- add_rcvctrl(e,f);
+ adjust_rcvctrl(e,f, 0);
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/staging/rdma/hfi1/chip.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index 02ba78f..371f948 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -6371,11 +6371,6 @@ static void adjust_rcvctrl(struct hfi1_devdata *dd, u64 add, u64 clear)
spin_unlock_irqrestore(&dd->rcvctrl_lock, flags);
}
-static inline void add_rcvctrl(struct hfi1_devdata *dd, u64 add)
-{
- adjust_rcvctrl(dd, add, 0);
-}
-
static inline void clear_rcvctrl(struct hfi1_devdata *dd, u64 clear)
{
adjust_rcvctrl(dd, 0, clear);
@@ -6485,7 +6480,7 @@ static void rxe_kernel_unfreeze(struct hfi1_devdata *dd)
hfi1_rcvctrl(dd, HFI1_RCVCTRL_CTXT_ENB, i);
/* enable port */
- add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
+ adjust_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK, 0);
}
/*
@@ -9119,7 +9114,7 @@ int bringup_serdes(struct hfi1_pportdata *ppd)
int ret;
if (HFI1_CAP_IS_KSET(EXTENDED_PSN))
- add_rcvctrl(dd, RCV_CTRL_RCV_EXTENDED_PSN_ENABLE_SMASK);
+ adjust_rcvctrl(dd, RCV_CTRL_RCV_EXTENDED_PSN_ENABLE_SMASK, 0);
guid = ppd->guid;
if (!guid) {
@@ -9814,7 +9809,7 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)
OPA_LINKINIT_REASON_LINKUP;
/* enable the port */
- add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
+ adjust_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK, 0);
handle_linkup_change(dd, 1);
}
@@ -12568,7 +12563,7 @@ static void set_partition_keys(struct hfi1_pportdata *ppd)
}
/* Always enable HW pkeys check when pkeys table is set */
- add_rcvctrl(dd, RCV_CTRL_RCV_PARTITION_KEY_ENABLE_SMASK);
+ adjust_rcvctrl(dd, RCV_CTRL_RCV_PARTITION_KEY_ENABLE_SMASK, 0);
}
/*
@@ -13304,8 +13299,8 @@ static void init_qpmap_table(struct hfi1_devdata *dd,
if (i % 8)
write_csr(dd, regno, reg);
- add_rcvctrl(dd, RCV_CTRL_RCV_QP_MAP_ENABLE_SMASK
- | RCV_CTRL_RCV_BYPASS_ENABLE_SMASK);
+ adjust_rcvctrl(dd, RCV_CTRL_RCV_QP_MAP_ENABLE_SMASK
+ | RCV_CTRL_RCV_BYPASS_ENABLE_SMASK, 0);
}
/**
@@ -13402,7 +13397,7 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt)
LRH_SC_MASK << RCV_RSM_MATCH_MASK2_SHIFT |
LRH_SC_VALUE << RCV_RSM_MATCH_VALUE2_SHIFT);
/* Enable RSM */
- add_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK);
+ adjust_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK, 0);
kfree(rsmmap);
/* map everything else to first context */
init_qpmap_table(dd, FIRST_KERNEL_KCTXT, MIN_KERNEL_KCTXTS - 1);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] Staging: rdma: Remove wrapper clear_rcvctrl
2016-02-25 11:55 [PATCH 0/3] Staging: rdma: Remove wrapper functions Bhumika Goyal
2016-02-25 11:55 ` [PATCH 1/3] Staging: rdma: Remove wrapper function add_rcvctrl Bhumika Goyal
@ 2016-02-25 11:55 ` Bhumika Goyal
2016-02-25 11:55 ` [PATCH 3/3] Staging: rdma: Remove wrapper sdma_start_hw_clean_up Bhumika Goyal
2016-02-25 14:19 ` [Outreachy kernel] [PATCH 0/3] Staging: rdma: Remove wrapper functions Arnd Bergmann
3 siblings, 0 replies; 7+ messages in thread
From: Bhumika Goyal @ 2016-02-25 11:55 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Bhumika Goyal
The function clear_rcvctrl can be replaced by direct call to
adjust_rcvctrl. So drop the wrapper function.
Done using coccinelle:
@@
expression dd,clear;
@@
- clear_rcvctrl(dd,clear);
+ adjust_rcvctrl(dd, 0, clear);
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/staging/rdma/hfi1/chip.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index 371f948..7969dcb 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -6371,11 +6371,6 @@ static void adjust_rcvctrl(struct hfi1_devdata *dd, u64 add, u64 clear)
spin_unlock_irqrestore(&dd->rcvctrl_lock, flags);
}
-static inline void clear_rcvctrl(struct hfi1_devdata *dd, u64 clear)
-{
- adjust_rcvctrl(dd, 0, clear);
-}
-
/*
* Called from all interrupt handlers to start handling an SPC freeze.
*/
@@ -6458,7 +6453,7 @@ static void rxe_freeze(struct hfi1_devdata *dd)
int i;
/* disable port */
- clear_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
+ adjust_rcvctrl(dd, 0, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
/* disable all receive contexts */
for (i = 0; i < dd->num_rcv_contexts; i++)
@@ -6629,7 +6624,7 @@ void handle_link_down(struct work_struct *work)
reset_neighbor_info(ppd);
/* disable the port */
- clear_rcvctrl(ppd->dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
+ adjust_rcvctrl(ppd->dd, 0, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
/* If there is no cable attached, turn the DC off. Otherwise,
* start the link bring up. */
@@ -9159,7 +9154,7 @@ void hfi1_quiet_serdes(struct hfi1_pportdata *ppd)
set_link_state(ppd, HLS_DN_OFFLINE);
/* disable the port */
- clear_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
+ adjust_rcvctrl(dd, 0, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
}
static inline int init_cpu_counters(struct hfi1_devdata *dd)
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] Staging: rdma: Remove wrapper sdma_start_hw_clean_up
2016-02-25 11:55 [PATCH 0/3] Staging: rdma: Remove wrapper functions Bhumika Goyal
2016-02-25 11:55 ` [PATCH 1/3] Staging: rdma: Remove wrapper function add_rcvctrl Bhumika Goyal
2016-02-25 11:55 ` [PATCH 2/3] Staging: rdma: Remove wrapper clear_rcvctrl Bhumika Goyal
@ 2016-02-25 11:55 ` Bhumika Goyal
2016-02-25 12:49 ` [Outreachy kernel] " Julia Lawall
2016-02-25 14:19 ` [Outreachy kernel] [PATCH 0/3] Staging: rdma: Remove wrapper functions Arnd Bergmann
3 siblings, 1 reply; 7+ messages in thread
From: Bhumika Goyal @ 2016-02-25 11:55 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Bhumika Goyal
The function sdma_start_hw_clean_up can be replaced with direct call to
tasklet_hi_schedule. So drop the function definition and prototype of
sdma_start_hw_clean_up and replace the calls with tasklet_hi_schedule.
Done using coccinelle:
@@
expression e;
@@
- sdma_start_hw_clean_up(e);
+ tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/staging/rdma/hfi1/sdma.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c
index 9a15f1f..d833a00 100644
--- a/drivers/staging/rdma/hfi1/sdma.c
+++ b/drivers/staging/rdma/hfi1/sdma.c
@@ -235,7 +235,6 @@ static void sdma_get(struct sdma_state *);
static void sdma_hw_clean_up_task(unsigned long);
static void sdma_put(struct sdma_state *);
static void sdma_set_state(struct sdma_engine *, enum sdma_states);
-static void sdma_start_hw_clean_up(struct sdma_engine *);
static void sdma_sw_clean_up_task(unsigned long);
static void sdma_sendctrl(struct sdma_engine *, unsigned);
static void init_sdma_regs(struct sdma_engine *, u32, uint);
@@ -670,11 +669,6 @@ static void sdma_sw_tear_down(struct sdma_engine *sde)
wake_up_interruptible(&sde->dd->sdma_unfreeze_wq);
}
-static void sdma_start_hw_clean_up(struct sdma_engine *sde)
-{
- tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
-}
-
static void sdma_set_state(struct sdma_engine *sde,
enum sdma_states next_state)
{
@@ -2293,7 +2287,7 @@ static void __sdma_process_event(struct sdma_engine *sde,
case sdma_event_e15_hw_halt_done:
sdma_set_state(sde,
sdma_state_s15_hw_start_up_clean_wait);
- sdma_start_hw_clean_up(sde);
+ tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
break;
case sdma_event_e25_hw_clean_up_done:
break;
@@ -2422,7 +2416,7 @@ static void __sdma_process_event(struct sdma_engine *sde,
break;
case sdma_event_e40_sw_cleaned:
sdma_set_state(sde, sdma_state_s40_hw_clean_up_wait);
- sdma_start_hw_clean_up(sde);
+ tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
break;
case sdma_event_e50_hw_cleaned:
break;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/3] Staging: rdma: Remove wrapper sdma_start_hw_clean_up
2016-02-25 11:55 ` [PATCH 3/3] Staging: rdma: Remove wrapper sdma_start_hw_clean_up Bhumika Goyal
@ 2016-02-25 12:49 ` Julia Lawall
0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2016-02-25 12:49 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: outreachy-kernel
On Thu, 25 Feb 2016, Bhumika Goyal wrote:
> The function sdma_start_hw_clean_up can be replaced with direct call to
> tasklet_hi_schedule. So drop the function definition and prototype of
> sdma_start_hw_clean_up and replace the calls with tasklet_hi_schedule.
> Done using coccinelle:
>
> @@
> expression e;
> @@
> - sdma_start_hw_clean_up(e);
> + tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
I think that the metavariable should be called sde, not e. You want to
propagate the argument from one call to the other.
julia
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
> drivers/staging/rdma/hfi1/sdma.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c
> index 9a15f1f..d833a00 100644
> --- a/drivers/staging/rdma/hfi1/sdma.c
> +++ b/drivers/staging/rdma/hfi1/sdma.c
> @@ -235,7 +235,6 @@ static void sdma_get(struct sdma_state *);
> static void sdma_hw_clean_up_task(unsigned long);
> static void sdma_put(struct sdma_state *);
> static void sdma_set_state(struct sdma_engine *, enum sdma_states);
> -static void sdma_start_hw_clean_up(struct sdma_engine *);
> static void sdma_sw_clean_up_task(unsigned long);
> static void sdma_sendctrl(struct sdma_engine *, unsigned);
> static void init_sdma_regs(struct sdma_engine *, u32, uint);
> @@ -670,11 +669,6 @@ static void sdma_sw_tear_down(struct sdma_engine *sde)
> wake_up_interruptible(&sde->dd->sdma_unfreeze_wq);
> }
>
> -static void sdma_start_hw_clean_up(struct sdma_engine *sde)
> -{
> - tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
> -}
> -
> static void sdma_set_state(struct sdma_engine *sde,
> enum sdma_states next_state)
> {
> @@ -2293,7 +2287,7 @@ static void __sdma_process_event(struct sdma_engine *sde,
> case sdma_event_e15_hw_halt_done:
> sdma_set_state(sde,
> sdma_state_s15_hw_start_up_clean_wait);
> - sdma_start_hw_clean_up(sde);
> + tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
> break;
> case sdma_event_e25_hw_clean_up_done:
> break;
> @@ -2422,7 +2416,7 @@ static void __sdma_process_event(struct sdma_engine *sde,
> break;
> case sdma_event_e40_sw_cleaned:
> sdma_set_state(sde, sdma_state_s40_hw_clean_up_wait);
> - sdma_start_hw_clean_up(sde);
> + tasklet_hi_schedule(&sde->sdma_hw_clean_up_task);
> break;
> case sdma_event_e50_hw_cleaned:
> break;
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a065f9a17e7716720dbf0505dfdbfeaed90b234f.1456390351.git.bhumirks%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 0/3] Staging: rdma: Remove wrapper functions
2016-02-25 11:55 [PATCH 0/3] Staging: rdma: Remove wrapper functions Bhumika Goyal
` (2 preceding siblings ...)
2016-02-25 11:55 ` [PATCH 3/3] Staging: rdma: Remove wrapper sdma_start_hw_clean_up Bhumika Goyal
@ 2016-02-25 14:19 ` Arnd Bergmann
2016-02-25 14:28 ` Bhumika Goyal
3 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2016-02-25 14:19 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Bhumika Goyal
On Thursday 25 February 2016 17:25:55 Bhumika Goyal wrote:
> The functions add_rcvctrl, clear_rcvctrl, sdma_start_hw_clean_up can be
> replaced with direct calls to the functions they wrapped. Thus remove the
> wrapper functions and replace their calls with the functions they wrapped.
> Changes are done using coccinelle semantic patches.
>
> Bhumika Goyal (3):
> Staging: rdma: Remove wrapper function add_rcvctrl
> Staging: rdma: Remove wrapper clear_rcvctrl
> Staging: rdma: Remove wrapper sdma_start_hw_clean_up
These are all in a grey area. I'd personally suggest doing the third
patch only, but not the first two that remove what seems to be
a useful abstraction.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH 0/3] Staging: rdma: Remove wrapper functions
2016-02-25 14:19 ` [Outreachy kernel] [PATCH 0/3] Staging: rdma: Remove wrapper functions Arnd Bergmann
@ 2016-02-25 14:28 ` Bhumika Goyal
0 siblings, 0 replies; 7+ messages in thread
From: Bhumika Goyal @ 2016-02-25 14:28 UTC (permalink / raw)
To: Arnd Bergmann, Julia Lawall, outreachy-kernel
[-- Attachment #1: Type: text/plain, Size: 878 bytes --]
On Thu, Feb 25, 2016 at 7:49 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday 25 February 2016 17:25:55 Bhumika Goyal wrote:
> > The functions add_rcvctrl, clear_rcvctrl, sdma_start_hw_clean_up can be
> > replaced with direct calls to the functions they wrapped. Thus remove the
> > wrapper functions and replace their calls with the functions they
> wrapped.
> > Changes are done using coccinelle semantic patches.
> >
> > Bhumika Goyal (3):
> > Staging: rdma: Remove wrapper function add_rcvctrl
> > Staging: rdma: Remove wrapper clear_rcvctrl
> > Staging: rdma: Remove wrapper sdma_start_hw_clean_up
>
> These are all in a grey area. I'd personally suggest doing the third
> patch only, but not the first two that remove what seems to be
> a useful abstraction.
>
> Arnd
>
Ok I will send a v2 only for patch 3. Thanks for the feedback.
Thanks,
Bhumika
[-- Attachment #2: Type: text/html, Size: 1445 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread