Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1724666

[PATCH 13/31] timer: Remove meaningless .data/.function assignments

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject [PATCH 13/31] timer: Remove meaningless .data/.function assignments
Date 2017-09-01 01:40 +0200
Message-ID <ukHe4-3XZ-55@gated-at.bofh.it> (permalink)
References <ukHe1-3XZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Several timer users needlessly reset their .function/.data fields during
their timer callback, but nothing else changes them. Some users do not
use their .data field at all. Each instance is removed here.

Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Aditya Shankar <aditya.shankar@microchip.com>
Cc: Ganesh Krishna <ganesh.krishna@microchip.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/block/amiflop.c                           | 3 +--
 drivers/net/wan/hdlc_cisco.c                      | 2 --
 drivers/net/wan/hdlc_fr.c                         | 2 --
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +---
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index c4b1cba27178..6680d75bc857 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -323,7 +323,7 @@ static void fd_deselect (int drive)
 
 }
 
-static void motor_on_callback(unsigned long nr)
+static void motor_on_callback(unsigned long ignored)
 {
 	if (!(ciaa.pra & DSKRDY) || --on_attempts == 0) {
 		complete_all(&motor_on_completion);
@@ -344,7 +344,6 @@ static int fd_motor_on(int nr)
 		fd_select(nr);
 
 		reinit_completion(&motor_on_completion);
-		motor_on_timer.data = nr;
 		mod_timer(&motor_on_timer, jiffies + HZ/2);
 
 		on_attempts = 10;
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index c696d42f4502..6c98d85f2773 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -276,8 +276,6 @@ static void cisco_timer(unsigned long arg)
 	spin_unlock(&st->lock);
 
 	st->timer.expires = jiffies + st->settings.interval * HZ;
-	st->timer.function = cisco_timer;
-	st->timer.data = arg;
 	add_timer(&st->timer);
 }
 
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index de42faca076a..7da2424c28a4 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -644,8 +644,6 @@ static void fr_timer(unsigned long arg)
 			state(hdlc)->settings.t391 * HZ;
 	}
 
-	state(hdlc)->timer.function = fr_timer;
-	state(hdlc)->timer.data = arg;
 	add_timer(&state(hdlc)->timer);
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 68fd5b3b8b2d..2fca2b017093 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -275,7 +275,7 @@ static void update_scan_time(void)
 		last_scanned_shadow[i].time_scan = jiffies;
 }
 
-static void remove_network_from_shadow(unsigned long arg)
+static void remove_network_from_shadow(unsigned long unused)
 {
 	unsigned long now = jiffies;
 	int i, j;
@@ -296,7 +296,6 @@ static void remove_network_from_shadow(unsigned long arg)
 	}
 
 	if (last_scanned_cnt != 0) {
-		hAgingTimer.data = arg;
 		mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
 	}
 }
@@ -313,7 +312,6 @@ static int is_network_in_shadow(struct network_info *pstrNetworkInfo,
 	int i;
 
 	if (last_scanned_cnt == 0) {
-		hAgingTimer.data = (unsigned long)user_void;
 		mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
 		state = -1;
 	} else {
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/31] struct timer_list callback argument conversion, step 1 Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 01/31] coccinelle: Improve setup_timer.cocci matching Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 16/31] usb/phy-isp1301-omap: Remove .data assignment Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 10/31] timer: Remove users of expire and data arguments to DEFINE_TIMER Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 04/31] timer: Remove init_timer_on_stack() in favor of setup_timer_on_stack() Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 15/31] timer: Additional init_timer() -> setup_timer() conversions Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 09/31] timer: Remove unused static initializer macros Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 08/31] timer: Remove users of TIMER_INITIALIZER Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 03/31] timer: Remove init_timer_pinned_deferrable() in favor of setup_pinned_deferrable_timer() Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 07/31] timer: Remove users of TIMER_DEFERRED_INITIALIZER Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 12/31] timer: Remove expires argument from __TIMER_INITIALIZER() Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 18/31] scsi/aic7xxx: Clean up timer usage Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 30/31] appletalk: Remove unneeded synchronization Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 06/31] timer: Remove init_timer_deferrable() in favor of setup_deferrable_timer() Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 11/31] timer: Remove expires and data arguments from DEFINE_TIMER Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
    Re: [PATCH 11/31] timer: Remove expires and data arguments from DEFINE_TIMER Geert Uytterhoeven <geert@linux-m68k.org> - 2017-09-01 09:30 +0200
  [PATCH 05/31] timer: Remove init_timer_pinned() in favor of setup_pinned_timer() Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 17/31] media/i2c/tc358743: Initialize timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
  [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
    Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with  with static timer Ralf Baechle <ralf@linux-mips.org> - 2017-09-01 09:10 +0200
      Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with  with static timer Kees Cook <keescook@chromium.org> - 2017-09-01 19:00 +0200
    Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with  with static timer Ralf Baechle <ralf@linux-mips.org> - 2017-09-02 01:00 +0200
  [PATCH 13/31] timer: Remove meaningless .data/.function assignments Kees Cook <keescook@chromium.org> - 2017-09-01 01:40 +0200
    Re: [PATCH 13/31] timer: Remove meaningless .data/.function  assignments Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-01 07:10 +0200
    Re: [PATCH 13/31] timer: Remove meaningless .data/.function assignments Krzysztof Halasa <khc@pm.waw.pl> - 2017-09-01 20:10 +0200
    Re: [PATCH 13/31] timer: Remove meaningless .data/.function  assignments Jens Axboe <axboe@kernel.dk> - 2017-09-01 22:10 +0200
  [PATCH 28/31] infiniband/rdmavt: Remove redundant timer initialization Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
  [PATCH 22/31] sparc/led: Use separate static data field with with static timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
  Re: [PATCH 31/31] timer: Switch to testing for .function instead of .data Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-09-01 01:50 +0200
    Re: [PATCH 31/31] timer: Switch to testing for .function instead of .data Kees Cook <keescook@chromium.org> - 2017-09-01 02:00 +0200
      Re: [PATCH 31/31] timer: Switch to testing for .function instead of .data Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-09-01 03:10 +0200
  [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
    Re: [PATCH 23/31] mips/sgi-ip32: Use separate static data field with  with static timer Ralf Baechle <ralf@linux-mips.org> - 2017-09-01 09:10 +0200
    Re: [PATCH 23/31] mips/sgi-ip32: Use separate static data field with  with static timer Ralf Baechle <ralf@linux-mips.org> - 2017-09-02 01:00 +0200
  [PATCH 20/31] net/core: Collapse redundant sk_timer callback data assignments Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
  [PATCH 27/31] usb/gadget/snps_udc_core: Move timer initialization earlier Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
    Re: [PATCH 27/31] usb/gadget/snps_udc_core: Move timer initialization earlier Michal Nazarewicz <mina86@mina86.com> - 2017-09-03 23:20 +0200
      Re: [PATCH 27/31] usb/gadget/snps_udc_core: Move timer initialization earlier Kees Cook <keescook@chromium.org> - 2017-09-07 01:30 +0200
  [PATCH 21/31] s390/char/sclp: Use separate static data field with with static timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
  [PATCH 29/31] scsi/bnx2i: Initialize timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
  [PATCH 19/31] timer: Remove open-coded casts for .data and .function Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
    Re: [PATCH 19/31] timer: Remove open-coded casts for .data and  .function Tyrel Datwyler <tyreld@linux.vnet.ibm.com> - 2017-09-01 02:30 +0200
    Re: [PATCH 19/31] timer: Remove open-coded casts for .data and  .function Tyrel Datwyler <turtle.in.the.kernel@gmail.com> - 2017-09-01 02:30 +0200
  [PATCH 25/31] net/atm/mpc: Use separate static data field with with static timer Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
  [PATCH 31/31] timer: Switch to testing for .function instead of .data Kees Cook <keescook@chromium.org> - 2017-09-01 01:50 +0200
    Re: [PATCH 31/31] timer: Switch to testing for .function instead of  .data Jeff Kirsher <jeffrey.t.kirsher@intel.com> - 2017-09-01 23:40 +0200
    Re: [PATCH 31/31] timer: Switch to testing for .function instead of .data "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-09-02 16:00 +0200

csiph-web