[PATCH 35/37] staging/lustre: remove wrappers for timer functions

Arnd Bergmann arnd at arndb.de
Wed Sep 23 19:13:58 UTC 2015


This is a simple cleanup that I did after noticing that the abstraction
for the timer functions in completely pointless, and the one user (ptlrpc)
can just as well call the native Linux functions.

For good measure, this also removes the empty libcfs_arch_init()
and libcfs_arch_cleanup() functions that are defined in the
same file.

Signed-off-by: Arnd Bergmann <arnd at arndb.de>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |  3 -
 .../lustre/include/linux/libcfs/libcfs_prim.h      | 12 ----
 .../lustre/lustre/libcfs/linux/linux-prim.c        | 64 ----------------------
 drivers/staging/lustre/lustre/libcfs/module.c      |  3 -
 drivers/staging/lustre/lustre/ptlrpc/service.c     | 11 ++--
 5 files changed, 6 insertions(+), 87 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 259a33658d3f..385ced15c742 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -62,9 +62,6 @@ static inline int __is_po2(unsigned long long val)
 
 #include <linux/list.h>
 
-int libcfs_arch_init(void);
-void libcfs_arch_cleanup(void);
-
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
index 62ade0809264..082fe6de90e4 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
@@ -40,20 +40,8 @@
 #ifndef __LIBCFS_PRIM_H__
 #define __LIBCFS_PRIM_H__
 
-/*
- * Timer
- */
-typedef  void (cfs_timer_func_t)(ulong_ptr_t);
-
 void add_wait_queue_exclusive_head(wait_queue_head_t *, wait_queue_t *);
 
-void cfs_init_timer(struct timer_list *t);
-void cfs_timer_init(struct timer_list *t, cfs_timer_func_t *func, void *arg);
-void cfs_timer_arm(struct timer_list *t, unsigned long deadline);
-void cfs_timer_disarm(struct timer_list *t);
-int  cfs_timer_is_armed(struct timer_list *t);
-unsigned long cfs_timer_deadline(struct timer_list *t);
-
 /*
  * Memory
  */
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
index 12b6af4cac3e..89084460231a 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
@@ -70,55 +70,6 @@ add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link)
 }
 EXPORT_SYMBOL(add_wait_queue_exclusive_head);
 
-void cfs_init_timer(struct timer_list *t)
-{
-	init_timer(t);
-}
-EXPORT_SYMBOL(cfs_init_timer);
-
-void cfs_timer_init(struct timer_list *t, cfs_timer_func_t *func, void *arg)
-{
-	init_timer(t);
-	t->function = func;
-	t->data = (unsigned long)arg;
-}
-EXPORT_SYMBOL(cfs_timer_init);
-
-void cfs_timer_arm(struct timer_list *t, unsigned long deadline)
-{
-	mod_timer(t, deadline);
-}
-EXPORT_SYMBOL(cfs_timer_arm);
-
-void cfs_timer_disarm(struct timer_list *t)
-{
-	del_timer(t);
-}
-EXPORT_SYMBOL(cfs_timer_disarm);
-
-int  cfs_timer_is_armed(struct timer_list *t)
-{
-	return timer_pending(t);
-}
-EXPORT_SYMBOL(cfs_timer_is_armed);
-
-unsigned long cfs_timer_deadline(struct timer_list *t)
-{
-	return t->expires;
-}
-EXPORT_SYMBOL(cfs_timer_deadline);
-
-void cfs_enter_debugger(void)
-{
-#if defined(CONFIG_KGDB)
-	/* BREAKPOINT(); */
-#else
-	/* nothing */
-#endif
-}
-EXPORT_SYMBOL(cfs_enter_debugger);
-
-
 sigset_t
 cfs_block_allsigs(void)
 {
@@ -194,18 +145,3 @@ cfs_clear_sigpending(void)
 	spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 EXPORT_SYMBOL(cfs_clear_sigpending);
-
-int
-libcfs_arch_init(void)
-{
-	return 0;
-}
-EXPORT_SYMBOL(libcfs_arch_init);
-
-void
-libcfs_arch_cleanup(void)
-{
-	return;
-}
-EXPORT_SYMBOL(libcfs_arch_cleanup);
-
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index a19f5796b642..5e4262a2e6f3 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -701,7 +701,6 @@ static int init_libcfs_module(void)
 {
 	int rc;
 
-	libcfs_arch_init();
 	libcfs_init_nidstrings();
 
 	rc = libcfs_debug_init(5 * 1024 * 1024);
@@ -777,8 +776,6 @@ static void exit_libcfs_module(void)
 	rc = libcfs_debug_cleanup();
 	if (rc)
 		pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc);
-
-	libcfs_arch_cleanup();
 }
 
 MODULE_VERSION("1.0.0");
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 3fac9756dcc0..623871beb5aa 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -649,7 +649,8 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc,
 	if (array->paa_reqs_count == NULL)
 		goto free_reqs_array;
 
-	cfs_timer_init(&svcpt->scp_at_timer, ptlrpc_at_timer, svcpt);
+	setup_timer(&svcpt->scp_at_timer, ptlrpc_at_timer, (unsigned long)svcpt);
+
 	/* At SOW, service time should be quick; 10s seems generous. If client
 	 * timeout is less than this, we'll be sending an early reply. */
 	at_init(&svcpt->scp_at_estimate, 10, 0);
@@ -1155,7 +1156,7 @@ static void ptlrpc_at_set_timer(struct ptlrpc_service_part *svcpt)
 	__s32 next;
 
 	if (array->paa_count == 0) {
-		cfs_timer_disarm(&svcpt->scp_at_timer);
+		del_timer(&svcpt->scp_at_timer);
 		return;
 	}
 
@@ -1165,7 +1166,7 @@ static void ptlrpc_at_set_timer(struct ptlrpc_service_part *svcpt)
 	if (next <= 0) {
 		ptlrpc_at_timer((unsigned long)svcpt);
 	} else {
-		cfs_timer_arm(&svcpt->scp_at_timer, cfs_time_shift(next));
+		mod_timer(&svcpt->scp_at_timer, cfs_time_shift(next));
 		CDEBUG(D_INFO, "armed %s at %+ds\n",
 		       svcpt->scp_service->srv_name, next);
 	}
@@ -2866,7 +2867,7 @@ ptlrpc_service_del_atimer(struct ptlrpc_service *svc)
 	/* early disarm AT timer... */
 	ptlrpc_service_for_each_part(svcpt, i, svc) {
 		if (svcpt->scp_service != NULL)
-			cfs_timer_disarm(&svcpt->scp_at_timer);
+			del_timer(&svcpt->scp_at_timer);
 	}
 }
 
@@ -3006,7 +3007,7 @@ ptlrpc_service_free(struct ptlrpc_service *svc)
 			break;
 
 		/* In case somebody rearmed this in the meantime */
-		cfs_timer_disarm(&svcpt->scp_at_timer);
+		del_timer(&svcpt->scp_at_timer);
 		array = &svcpt->scp_at_array;
 
 		kfree(array->paa_reqs_array);
-- 
2.1.0.rc2



More information about the devel mailing list