summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-17 23:21:24 -0400
committerKees Cook <keescook@chromium.org>2017-11-21 18:57:09 -0500
commit86cb30ec07cdc78ad94d94bb3756c7c2d46968b9 (patch)
tree30c467da4c55c3312224a30f755a861f3b91934b /drivers
parente99e88a9d2b067465adaa9c111ada99a041bef9a (diff)
treewide: setup_timer() -> timer_setup() (2 field)
This converts all remaining setup_timer() calls that use a nested field to reach a struct timer_list. Coccinelle does not have an easy way to match multiple fields, so a new script is needed to change the matches of "&_E->_timer" into "&_E->_field1._timer" in all the rules. spatch --very-quiet --all-includes --include-headers \ -I ./arch/x86/include -I ./arch/x86/include/generated \ -I ./include -I ./arch/x86/include/uapi \ -I ./arch/x86/include/generated/uapi -I ./include/uapi \ -I ./include/generated/uapi --include ./include/linux/kconfig.h \ --dir . \ --cocci-file ~/src/data/timer_setup-2fields.cocci @fix_address_of depends@ expression e; @@ setup_timer( -&(e) +&e , ...) // Update any raw setup_timer() usages that have a NULL callback, but // would otherwise match change_timer_function_usage, since the latter // will update all function assignments done in the face of a NULL // function initialization in setup_timer(). @change_timer_function_usage_NULL@ expression _E; identifier _field1; identifier _timer; type _cast_data; @@ ( -setup_timer(&_E->_field1._timer, NULL, _E); +timer_setup(&_E->_field1._timer, NULL, 0); | -setup_timer(&_E->_field1._timer, NULL, (_cast_data)_E); +timer_setup(&_E->_field1._timer, NULL, 0); | -setup_timer(&_E._field1._timer, NULL, &_E); +timer_setup(&_E._field1._timer, NULL, 0); | -setup_timer(&_E._field1._timer, NULL, (_cast_data)&_E); +timer_setup(&_E._field1._timer, NULL, 0); ) @change_timer_function_usage@ expression _E; identifier _field1; identifier _timer; struct timer_list _stl; identifier _callback; type _cast_func, _cast_data; @@ ( -setup_timer(&_E->_field1._timer, _callback, _E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, &_callback, _E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, _callback, (_cast_data)_E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, &_callback, (_cast_data)_E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, (_cast_func)_callback, _E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, (_cast_func)&_callback, _E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, (_cast_func)_callback, (_cast_data)_E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, (_cast_func)&_callback, (_cast_data)_E); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, _callback, (_cast_data)_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, _callback, (_cast_data)&_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, &_callback, (_cast_data)_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, &_callback, (_cast_data)&_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, (_cast_func)_callback, (_cast_data)_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, (_cast_func)_callback, (_cast_data)&_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, (_cast_func)&_callback, (_cast_data)_E); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, (_cast_func)&_callback, (_cast_data)&_E); +timer_setup(&_E._field1._timer, _callback, 0); | _E->_field1._timer@_stl.function = _callback; | _E->_field1._timer@_stl.function = &_callback; | _E->_field1._timer@_stl.function = (_cast_func)_callback; | _E->_field1._timer@_stl.function = (_cast_func)&_callback; | _E._field1._timer@_stl.function = _callback; | _E._field1._timer@_stl.function = &_callback; | _E._field1._timer@_stl.function = (_cast_func)_callback; | _E._field1._timer@_stl.function = (_cast_func)&_callback; ) // callback(unsigned long arg) @change_callback_handle_cast depends on change_timer_function_usage@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; type _origtype; identifier _origarg; type _handletype; identifier _handle; @@ void _callback( -_origtype _origarg +struct timer_list *t ) { ( ... when != _origarg _handletype *_handle = -(_handletype *)_origarg; +from_timer(_handle, t, _field1._timer); ... when != _origarg | ... when != _origarg _handletype *_handle = -(void *)_origarg; +from_timer(_handle, t, _field1._timer); ... when != _origarg | ... when != _origarg _handletype *_handle; ... when != _handle _handle = -(_handletype *)_origarg; +from_timer(_handle, t, _field1._timer); ... when != _origarg | ... when != _origarg _handletype *_handle; ... when != _handle _handle = -(void *)_origarg; +from_timer(_handle, t, _field1._timer); ... when != _origarg ) } // callback(unsigned long arg) without existing variable @change_callback_handle_cast_no_arg depends on change_timer_function_usage && !change_callback_handle_cast@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; type _origtype; identifier _origarg; type _handletype; @@ void _callback( -_origtype _origarg +struct timer_list *t ) { + _handletype *_origarg = from_timer(_origarg, t, _field1._timer); + ... when != _origarg - (_handletype *)_origarg + _origarg ... when != _origarg } // Avoid already converted callbacks. @match_callback_converted depends on change_timer_function_usage && !change_callback_handle_cast && !change_callback_handle_cast_no_arg@ identifier change_timer_function_usage._callback; identifier t; @@ void _callback(struct timer_list *t) { ... } // callback(struct something *handle) @change_callback_handle_arg depends on change_timer_function_usage && !match_callback_converted && !change_callback_handle_cast && !change_callback_handle_cast_no_arg@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; type _handletype; identifier _handle; @@ void _callback( -_handletype *_handle +struct timer_list *t ) { + _handletype *_handle = from_timer(_handle, t, _field1._timer); ... } // If change_callback_handle_arg ran on an empty function, remove // the added handler. @unchange_callback_handle_arg depends on change_timer_function_usage && change_callback_handle_arg@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; type _handletype; identifier _handle; identifier t; @@ void _callback(struct timer_list *t) { - _handletype *_handle = from_timer(_handle, t, _field1._timer); } // We only want to refactor the setup_timer() data argument if we've found // the matching callback. This undoes changes in change_timer_function_usage. @unchange_timer_function_usage depends on change_timer_function_usage && !change_callback_handle_cast && !change_callback_handle_cast_no_arg && !change_callback_handle_arg@ expression change_timer_function_usage._E; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; identifier change_timer_function_usage._callback; type change_timer_function_usage._cast_data; @@ ( -timer_setup(&_E->_field1._timer, _callback, 0); +setup_timer(&_E->_field1._timer, _callback, (_cast_data)_E); | -timer_setup(&_E._field1._timer, _callback, 0); +setup_timer(&_E._field1._timer, _callback, (_cast_data)&_E); ) // If we fixed a callback from a .function assignment, fix the // assignment cast now. @change_timer_function_assignment depends on change_timer_function_usage && (change_callback_handle_cast || change_callback_handle_cast_no_arg || change_callback_handle_arg)@ expression change_timer_function_usage._E; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; identifier change_timer_function_usage._callback; type _cast_func; typedef TIMER_FUNC_TYPE; @@ ( _E->_field1._timer.function = -_callback +(TIMER_FUNC_TYPE)_callback ; | _E->_field1._timer.function = -&_callback +(TIMER_FUNC_TYPE)_callback ; | _E->_field1._timer.function = -(_cast_func)_callback; +(TIMER_FUNC_TYPE)_callback ; | _E->_field1._timer.function = -(_cast_func)&_callback +(TIMER_FUNC_TYPE)_callback ; | _E._field1._timer.function = -_callback +(TIMER_FUNC_TYPE)_callback ; | _E._field1._timer.function = -&_callback; +(TIMER_FUNC_TYPE)_callback ; | _E._field1._timer.function = -(_cast_func)_callback +(TIMER_FUNC_TYPE)_callback ; | _E._field1._timer.function = -(_cast_func)&_callback +(TIMER_FUNC_TYPE)_callback ; ) // Sometimes timer functions are called directly. Replace matched args. @change_timer_function_calls depends on change_timer_function_usage && (change_callback_handle_cast || change_callback_handle_cast_no_arg || change_callback_handle_arg)@ expression _E; identifier change_timer_function_usage._field1; identifier change_timer_function_usage._timer; identifier change_timer_function_usage._callback; type _cast_data; @@ _callback( ( -(_cast_data)_E +&_E->_field1._timer | -(_cast_data)&_E +&_E._field1._timer | -_E +&_E->_field1._timer ) ) // If a timer has been configured without a data argument, it can be // converted without regard to the callback argument, since it is unused. @match_timer_function_unused_data@ expression _E; identifier _field1; identifier _timer; identifier _callback; @@ ( -setup_timer(&_E->_field1._timer, _callback, 0); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, _callback, 0L); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E->_field1._timer, _callback, 0UL); +timer_setup(&_E->_field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, _callback, 0); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, _callback, 0L); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_E._field1._timer, _callback, 0UL); +timer_setup(&_E._field1._timer, _callback, 0); | -setup_timer(&_field1._timer, _callback, 0); +timer_setup(&_field1._timer, _callback, 0); | -setup_timer(&_field1._timer, _callback, 0L); +timer_setup(&_field1._timer, _callback, 0); | -setup_timer(&_field1._timer, _callback, 0UL); +timer_setup(&_field1._timer, _callback, 0); | -setup_timer(_field1._timer, _callback, 0); +timer_setup(_field1._timer, _callback, 0); | -setup_timer(_field1._timer, _callback, 0L); +timer_setup(_field1._timer, _callback, 0); | -setup_timer(_field1._timer, _callback, 0UL); +timer_setup(_field1._timer, _callback, 0); ) @change_callback_unused_data depends on match_timer_function_unused_data@ identifier match_timer_function_unused_data._callback; type _origtype; identifier _origarg; @@ void _callback( -_origtype _origarg +struct timer_list *unused ) { ... when != _origarg } Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/rsxx/cregs.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c8
-rw-r--r--drivers/infiniband/hw/mthca/mthca_catas.c6
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c5
-rw-r--r--drivers/media/platform/fsl-viu.c7
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_clsf.c4
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_clsf.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/dvm/tt.c18
-rw-r--r--drivers/nfc/nfcmrvl/fw_dnld.c7
-rw-r--r--drivers/nfc/st-nci/se.c16
-rw-r--r--drivers/nfc/st21nfca/se.c17
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c6
12 files changed, 53 insertions, 53 deletions
diff --git a/drivers/block/rsxx/cregs.c b/drivers/block/rsxx/cregs.c
index 926dce9c452f..c148e83e4ed7 100644
--- a/drivers/block/rsxx/cregs.c
+++ b/drivers/block/rsxx/cregs.c
@@ -203,9 +203,9 @@ static int creg_queue_cmd(struct rsxx_cardinfo *card,
203 return 0; 203 return 0;
204} 204}
205 205
206static void creg_cmd_timed_out(unsigned long data) 206static void creg_cmd_timed_out(struct timer_list *t)
207{ 207{
208 struct rsxx_cardinfo *card = (struct rsxx_cardinfo *) data; 208 struct rsxx_cardinfo *card = from_timer(card, t, creg_ctrl.cmd_timer);
209 struct creg_cmd *cmd; 209 struct creg_cmd *cmd;
210 210
211 spin_lock(&card->creg_ctrl.lock); 211 spin_lock(&card->creg_ctrl.lock);
@@ -745,8 +745,7 @@ int rsxx_creg_setup(struct rsxx_cardinfo *card)
745 mutex_init(&card->creg_ctrl.reset_lock); 745 mutex_init(&card->creg_ctrl.reset_lock);
746 INIT_LIST_HEAD(&card->creg_ctrl.queue); 746 INIT_LIST_HEAD(&card->creg_ctrl.queue);
747 spin_lock_init(&card->creg_ctrl.lock); 747 spin_lock_init(&card->creg_ctrl.lock);
748 setup_timer(&card->creg_ctrl.cmd_timer, creg_cmd_timed_out, 748 timer_setup(&card->creg_ctrl.cmd_timer, creg_cmd_timed_out, 0);
749 (unsigned long) card);
750 749
751 return 0; 750 return 0;
752} 751}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index bd5b8065c32e..2fa95aef74d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -268,9 +268,10 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
268 * 268 *
269 * Checks for fence activity. 269 * Checks for fence activity.
270 */ 270 */
271static void amdgpu_fence_fallback(unsigned long arg) 271static void amdgpu_fence_fallback(struct timer_list *t)
272{ 272{
273 struct amdgpu_ring *ring = (void *)arg; 273 struct amdgpu_ring *ring = from_timer(ring, t,
274 fence_drv.fallback_timer);
274 275
275 amdgpu_fence_process(ring); 276 amdgpu_fence_process(ring);
276} 277}
@@ -422,8 +423,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
422 atomic_set(&ring->fence_drv.last_seq, 0); 423 atomic_set(&ring->fence_drv.last_seq, 0);
423 ring->fence_drv.initialized = false; 424 ring->fence_drv.initialized = false;
424 425
425 setup_timer(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback, 426 timer_setup(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback, 0);
426 (unsigned long)ring);
427 427
428 ring->fence_drv.num_fences_mask = num_hw_submission * 2 - 1; 428 ring->fence_drv.num_fences_mask = num_hw_submission * 2 - 1;
429 spin_lock_init(&ring->fence_drv.lock); 429 spin_lock_init(&ring->fence_drv.lock);
diff --git a/drivers/infiniband/hw/mthca/mthca_catas.c b/drivers/infiniband/hw/mthca/mthca_catas.c
index 23cc08d5c24e..ffb98eaaf1c2 100644
--- a/drivers/infiniband/hw/mthca/mthca_catas.c
+++ b/drivers/infiniband/hw/mthca/mthca_catas.c
@@ -130,9 +130,9 @@ static void handle_catas(struct mthca_dev *dev)
130 spin_unlock_irqrestore(&catas_lock, flags); 130 spin_unlock_irqrestore(&catas_lock, flags);
131} 131}
132 132
133static void poll_catas(unsigned long dev_ptr) 133static void poll_catas(struct timer_list *t)
134{ 134{
135 struct mthca_dev *dev = (struct mthca_dev *) dev_ptr; 135 struct mthca_dev *dev = from_timer(dev, t, catas_err.timer);
136 int i; 136 int i;
137 137
138 for (i = 0; i < dev->catas_err.size; ++i) 138 for (i = 0; i < dev->catas_err.size; ++i)
@@ -149,7 +149,7 @@ void mthca_start_catas_poll(struct mthca_dev *dev)
149{ 149{
150 phys_addr_t addr; 150 phys_addr_t addr;
151 151
152 setup_timer(&dev->catas_err.timer, poll_catas, (unsigned long)dev); 152 timer_setup(&dev->catas_err.timer, poll_catas, 0);
153 dev->catas_err.map = NULL; 153 dev->catas_err.map = NULL;
154 154
155 addr = pci_resource_start(dev->pdev, 0) + 155 addr = pci_resource_start(dev->pdev, 0) +
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index ba3fe14bbe00..34c93874af23 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -301,8 +301,9 @@ reset_hfcpci(struct hfc_pci *hc)
301 * Timer function called when kernel timer expires 301 * Timer function called when kernel timer expires
302 */ 302 */
303static void 303static void
304hfcpci_Timer(struct hfc_pci *hc) 304hfcpci_Timer(struct timer_list *t)
305{ 305{
306 struct hfc_pci *hc = from_timer(hc, t, hw.timer);
306 hc->hw.timer.expires = jiffies + 75; 307 hc->hw.timer.expires = jiffies + 75;
307 /* WD RESET */ 308 /* WD RESET */
308/* 309/*
@@ -2042,7 +2043,7 @@ setup_hw(struct hfc_pci *hc)
2042 Write_hfc(hc, HFCPCI_INT_M1, hc->hw.int_m1); 2043 Write_hfc(hc, HFCPCI_INT_M1, hc->hw.int_m1);
2043 /* At this point the needed PCI config is done */ 2044 /* At this point the needed PCI config is done */
2044 /* fifos are still not enabled */ 2045 /* fifos are still not enabled */
2045 setup_timer(&hc->hw.timer, (void *)hfcpci_Timer, (long)hc); 2046 timer_setup(&hc->hw.timer, hfcpci_Timer, 0);
2046 /* default PCM master */ 2047 /* default PCM master */
2047 test_and_set_bit(HFC_CFG_MASTER, &hc->cfg); 2048 test_and_set_bit(HFC_CFG_MASTER, &hc->cfg);
2048 return 0; 2049 return 0;
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index fb43025df573..dba21215dc84 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -339,9 +339,9 @@ static int restart_video_queue(struct viu_dmaqueue *vidq)
339 } 339 }
340} 340}
341 341
342static void viu_vid_timeout(unsigned long data) 342static void viu_vid_timeout(struct timer_list *t)
343{ 343{
344 struct viu_dev *dev = (struct viu_dev *)data; 344 struct viu_dev *dev = from_timer(dev, t, vidq.timeout);
345 struct viu_buf *buf; 345 struct viu_buf *buf;
346 struct viu_dmaqueue *vidq = &dev->vidq; 346 struct viu_dmaqueue *vidq = &dev->vidq;
347 347
@@ -1466,8 +1466,7 @@ static int viu_of_probe(struct platform_device *op)
1466 viu_dev->decoder = v4l2_i2c_new_subdev(&viu_dev->v4l2_dev, ad, 1466 viu_dev->decoder = v4l2_i2c_new_subdev(&viu_dev->v4l2_dev, ad,
1467 "saa7113", VIU_VIDEO_DECODER_ADDR, NULL); 1467 "saa7113", VIU_VIDEO_DECODER_ADDR, NULL);
1468 1468
1469 setup_timer(&viu_dev->vidq.timeout, viu_vid_timeout, 1469 timer_setup(&viu_dev->vidq.timeout, viu_vid_timeout, 0);
1470 (unsigned long)viu_dev);
1471 viu_dev->std = V4L2_STD_NTSC_M; 1470 viu_dev->std = V4L2_STD_NTSC_M;
1472 viu_dev->first = 1; 1471 viu_dev->first = 1;
1473 1472
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c
index 8dc21c9f9716..973c1fb70d09 100644
--- a/drivers/net/ethernet/cisco/enic/enic_clsf.c
+++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c
@@ -123,9 +123,9 @@ struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id)
123} 123}
124 124
125#ifdef CONFIG_RFS_ACCEL 125#ifdef CONFIG_RFS_ACCEL
126void enic_flow_may_expire(unsigned long data) 126void enic_flow_may_expire(struct timer_list *t)
127{ 127{
128 struct enic *enic = (struct enic *)data; 128 struct enic *enic = from_timer(enic, t, rfs_h.rfs_may_expire);
129 bool res; 129 bool res;
130 int j; 130 int j;
131 131
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.h b/drivers/net/ethernet/cisco/enic/enic_clsf.h
index 0ae83e091a62..8c4ce50da6e1 100644
--- a/drivers/net/ethernet/cisco/enic/enic_clsf.h
+++ b/drivers/net/ethernet/cisco/enic/enic_clsf.h
@@ -16,12 +16,11 @@ struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id);
16#ifdef CONFIG_RFS_ACCEL 16#ifdef CONFIG_RFS_ACCEL
17int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, 17int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
18 u16 rxq_index, u32 flow_id); 18 u16 rxq_index, u32 flow_id);
19void enic_flow_may_expire(unsigned long data); 19void enic_flow_may_expire(struct timer_list *t);
20 20
21static inline void enic_rfs_timer_start(struct enic *enic) 21static inline void enic_rfs_timer_start(struct enic *enic)
22{ 22{
23 setup_timer(&enic->rfs_h.rfs_may_expire, enic_flow_may_expire, 23 timer_setup(&enic->rfs_h.rfs_may_expire, enic_flow_may_expire, 0);
24 (unsigned long)enic);
25 mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); 24 mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4);
26} 25}
27 26
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/tt.c b/drivers/net/wireless/intel/iwlwifi/dvm/tt.c
index 5b73492e7ff7..6524533d723c 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/tt.c
@@ -164,9 +164,10 @@ enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv)
164 * without doing anything, driver should continue the 5 seconds timer 164 * without doing anything, driver should continue the 5 seconds timer
165 * to wake up uCode for temperature check until temperature drop below CT 165 * to wake up uCode for temperature check until temperature drop below CT
166 */ 166 */
167static void iwl_tt_check_exit_ct_kill(unsigned long data) 167static void iwl_tt_check_exit_ct_kill(struct timer_list *t)
168{ 168{
169 struct iwl_priv *priv = (struct iwl_priv *)data; 169 struct iwl_priv *priv = from_timer(priv, t,
170 thermal_throttle.ct_kill_exit_tm);
170 struct iwl_tt_mgmt *tt = &priv->thermal_throttle; 171 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
171 unsigned long flags; 172 unsigned long flags;
172 173
@@ -214,9 +215,10 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
214 } 215 }
215} 216}
216 217
217static void iwl_tt_ready_for_ct_kill(unsigned long data) 218static void iwl_tt_ready_for_ct_kill(struct timer_list *t)
218{ 219{
219 struct iwl_priv *priv = (struct iwl_priv *)data; 220 struct iwl_priv *priv = from_timer(priv, t,
221 thermal_throttle.ct_kill_waiting_tm);
220 struct iwl_tt_mgmt *tt = &priv->thermal_throttle; 222 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
221 223
222 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 224 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -612,10 +614,10 @@ void iwl_tt_initialize(struct iwl_priv *priv)
612 memset(tt, 0, sizeof(struct iwl_tt_mgmt)); 614 memset(tt, 0, sizeof(struct iwl_tt_mgmt));
613 615
614 tt->state = IWL_TI_0; 616 tt->state = IWL_TI_0;
615 setup_timer(&priv->thermal_throttle.ct_kill_exit_tm, 617 timer_setup(&priv->thermal_throttle.ct_kill_exit_tm,
616 iwl_tt_check_exit_ct_kill, (unsigned long)priv); 618 iwl_tt_check_exit_ct_kill, 0);
617 setup_timer(&priv->thermal_throttle.ct_kill_waiting_tm, 619 timer_setup(&priv->thermal_throttle.ct_kill_waiting_tm,
618 iwl_tt_ready_for_ct_kill, (unsigned long)priv); 620 iwl_tt_ready_for_ct_kill, 0);
619 /* setup deferred ct kill work */ 621 /* setup deferred ct kill work */
620 INIT_WORK(&priv->tt_work, iwl_bg_tt_work); 622 INIT_WORK(&priv->tt_work, iwl_bg_tt_work);
621 INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter); 623 INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter);
diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c
index 7f8960a46aab..52c8ae504e32 100644
--- a/drivers/nfc/nfcmrvl/fw_dnld.c
+++ b/drivers/nfc/nfcmrvl/fw_dnld.c
@@ -130,9 +130,9 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
130 nfc_fw_download_done(priv->ndev->nfc_dev, priv->fw_dnld.name, error); 130 nfc_fw_download_done(priv->ndev->nfc_dev, priv->fw_dnld.name, error);
131} 131}
132 132
133static void fw_dnld_timeout(unsigned long arg) 133static void fw_dnld_timeout(struct timer_list *t)
134{ 134{
135 struct nfcmrvl_private *priv = (struct nfcmrvl_private *) arg; 135 struct nfcmrvl_private *priv = from_timer(priv, t, fw_dnld.timer);
136 136
137 nfc_err(priv->dev, "FW loading timeout"); 137 nfc_err(priv->dev, "FW loading timeout");
138 priv->fw_dnld.state = STATE_RESET; 138 priv->fw_dnld.state = STATE_RESET;
@@ -538,8 +538,7 @@ int nfcmrvl_fw_dnld_start(struct nci_dev *ndev, const char *firmware_name)
538 } 538 }
539 539
540 /* Configure a timer for timeout */ 540 /* Configure a timer for timeout */
541 setup_timer(&priv->fw_dnld.timer, fw_dnld_timeout, 541 timer_setup(&priv->fw_dnld.timer, fw_dnld_timeout, 0);
542 (unsigned long) priv);
543 mod_timer(&priv->fw_dnld.timer, 542 mod_timer(&priv->fw_dnld.timer,
544 jiffies + msecs_to_jiffies(FW_DNLD_TIMEOUT)); 543 jiffies + msecs_to_jiffies(FW_DNLD_TIMEOUT));
545 544
diff --git a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c
index bd7c1e83169c..f55d082ace71 100644
--- a/drivers/nfc/st-nci/se.c
+++ b/drivers/nfc/st-nci/se.c
@@ -677,7 +677,7 @@ int st_nci_se_io(struct nci_dev *ndev, u32 se_idx,
677} 677}
678EXPORT_SYMBOL(st_nci_se_io); 678EXPORT_SYMBOL(st_nci_se_io);
679 679
680static void st_nci_se_wt_timeout(unsigned long data) 680static void st_nci_se_wt_timeout(struct timer_list *t)
681{ 681{
682 /* 682 /*
683 * No answer from the secure element 683 * No answer from the secure element
@@ -690,7 +690,7 @@ static void st_nci_se_wt_timeout(unsigned long data)
690 */ 690 */
691 /* hardware reset managed through VCC_UICC_OUT power supply */ 691 /* hardware reset managed through VCC_UICC_OUT power supply */
692 u8 param = 0x01; 692 u8 param = 0x01;
693 struct st_nci_info *info = (struct st_nci_info *) data; 693 struct st_nci_info *info = from_timer(info, t, se_info.bwi_timer);
694 694
695 pr_debug("\n"); 695 pr_debug("\n");
696 696
@@ -708,9 +708,10 @@ static void st_nci_se_wt_timeout(unsigned long data)
708 info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME); 708 info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME);
709} 709}
710 710
711static void st_nci_se_activation_timeout(unsigned long data) 711static void st_nci_se_activation_timeout(struct timer_list *t)
712{ 712{
713 struct st_nci_info *info = (struct st_nci_info *) data; 713 struct st_nci_info *info = from_timer(info, t,
714 se_info.se_active_timer);
714 715
715 pr_debug("\n"); 716 pr_debug("\n");
716 717
@@ -725,12 +726,11 @@ int st_nci_se_init(struct nci_dev *ndev, struct st_nci_se_status *se_status)
725 726
726 init_completion(&info->se_info.req_completion); 727 init_completion(&info->se_info.req_completion);
727 /* initialize timers */ 728 /* initialize timers */
728 setup_timer(&info->se_info.bwi_timer, st_nci_se_wt_timeout, 729 timer_setup(&info->se_info.bwi_timer, st_nci_se_wt_timeout, 0);
729 (unsigned long)info);
730 info->se_info.bwi_active = false; 730 info->se_info.bwi_active = false;
731 731
732 setup_timer(&info->se_info.se_active_timer, 732 timer_setup(&info->se_info.se_active_timer,
733 st_nci_se_activation_timeout, (unsigned long)info); 733 st_nci_se_activation_timeout, 0);
734 info->se_info.se_active = false; 734 info->se_info.se_active = false;
735 735
736 info->se_info.xch_error = false; 736 info->se_info.xch_error = false;
diff --git a/drivers/nfc/st21nfca/se.c b/drivers/nfc/st21nfca/se.c
index b2285455f77d..4bed9e842db3 100644
--- a/drivers/nfc/st21nfca/se.c
+++ b/drivers/nfc/st21nfca/se.c
@@ -252,7 +252,7 @@ int st21nfca_hci_se_io(struct nfc_hci_dev *hdev, u32 se_idx,
252} 252}
253EXPORT_SYMBOL(st21nfca_hci_se_io); 253EXPORT_SYMBOL(st21nfca_hci_se_io);
254 254
255static void st21nfca_se_wt_timeout(unsigned long data) 255static void st21nfca_se_wt_timeout(struct timer_list *t)
256{ 256{
257 /* 257 /*
258 * No answer from the secure element 258 * No answer from the secure element
@@ -265,7 +265,8 @@ static void st21nfca_se_wt_timeout(unsigned long data)
265 */ 265 */
266 /* hardware reset managed through VCC_UICC_OUT power supply */ 266 /* hardware reset managed through VCC_UICC_OUT power supply */
267 u8 param = 0x01; 267 u8 param = 0x01;
268 struct st21nfca_hci_info *info = (struct st21nfca_hci_info *) data; 268 struct st21nfca_hci_info *info = from_timer(info, t,
269 se_info.bwi_timer);
269 270
270 pr_debug("\n"); 271 pr_debug("\n");
271 272
@@ -283,9 +284,10 @@ static void st21nfca_se_wt_timeout(unsigned long data)
283 info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME); 284 info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME);
284} 285}
285 286
286static void st21nfca_se_activation_timeout(unsigned long data) 287static void st21nfca_se_activation_timeout(struct timer_list *t)
287{ 288{
288 struct st21nfca_hci_info *info = (struct st21nfca_hci_info *) data; 289 struct st21nfca_hci_info *info = from_timer(info, t,
290 se_info.se_active_timer);
289 291
290 pr_debug("\n"); 292 pr_debug("\n");
291 293
@@ -392,12 +394,11 @@ void st21nfca_se_init(struct nfc_hci_dev *hdev)
392 394
393 init_completion(&info->se_info.req_completion); 395 init_completion(&info->se_info.req_completion);
394 /* initialize timers */ 396 /* initialize timers */
395 setup_timer(&info->se_info.bwi_timer, st21nfca_se_wt_timeout, 397 timer_setup(&info->se_info.bwi_timer, st21nfca_se_wt_timeout, 0);
396 (unsigned long)info);
397 info->se_info.bwi_active = false; 398 info->se_info.bwi_active = false;
398 399
399 setup_timer(&info->se_info.se_active_timer, 400 timer_setup(&info->se_info.se_active_timer,
400 st21nfca_se_activation_timeout, (unsigned long)info); 401 st21nfca_se_activation_timeout, 0);
401 info->se_info.se_active = false; 402 info->se_info.se_active = false;
402 403
403 info->se_info.count_pipes = 0; 404 info->se_info.count_pipes = 0;
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 285397d42558..791a2182de53 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -565,9 +565,9 @@ static irqreturn_t sym53c8xx_intr(int irq, void *dev_id)
565/* 565/*
566 * Linux entry point of the timer handler 566 * Linux entry point of the timer handler
567 */ 567 */
568static void sym53c8xx_timer(unsigned long npref) 568static void sym53c8xx_timer(struct timer_list *t)
569{ 569{
570 struct sym_hcb *np = (struct sym_hcb *)npref; 570 struct sym_hcb *np = from_timer(np, t, s.timer);
571 unsigned long flags; 571 unsigned long flags;
572 572
573 spin_lock_irqsave(np->s.host->host_lock, flags); 573 spin_lock_irqsave(np->s.host->host_lock, flags);
@@ -1351,7 +1351,7 @@ static struct Scsi_Host *sym_attach(struct scsi_host_template *tpnt, int unit,
1351 /* 1351 /*
1352 * Start the timer daemon 1352 * Start the timer daemon
1353 */ 1353 */
1354 setup_timer(&np->s.timer, sym53c8xx_timer, (unsigned long)np); 1354 timer_setup(&np->s.timer, sym53c8xx_timer, 0);
1355 np->s.lasttime=0; 1355 np->s.lasttime=0;
1356 sym_timer (np); 1356 sym_timer (np);
1357 1357