aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-05-11 22:13:02 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-19 17:13:24 -0400
commitf42639572680f4d69d9522f91c65e793ebeca098 (patch)
tree62a905ab3c2f5f11319d1e558bf87c0e75459f83 /drivers/pci/hotplug
parent4085399da3c2176ba8ed64e93a2722907d41df3f (diff)
[PATCH] shpchp: Cleanup interrupt polling timer
This patch cleans up the interrupt polling timer code in shpchp_hpc.c. This has no functional changes. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Cc: Kristen Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index f6b3bf3ee7ca..3a8186c405f1 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -221,8 +221,7 @@ static spinlock_t list_lock;
221static atomic_t shpchp_num_controllers = ATOMIC_INIT(0); 221static atomic_t shpchp_num_controllers = ATOMIC_INIT(0);
222 222
223static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs); 223static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs);
224 224static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int sec);
225static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds);
226static int hpc_check_cmd_status(struct controller *ctrl); 225static int hpc_check_cmd_status(struct controller *ctrl);
227 226
228static inline u8 shpc_readb(struct controller *ctrl, int reg) 227static inline u8 shpc_readb(struct controller *ctrl, int reg)
@@ -268,47 +267,41 @@ static inline int shpc_indirect_read(struct controller *ctrl, int index,
268 return pci_read_config_dword(pdev, cap_offset + DWORD_DATA, value); 267 return pci_read_config_dword(pdev, cap_offset + DWORD_DATA, value);
269} 268}
270 269
271/* This is the interrupt polling timeout function. */ 270/*
271 * This is the interrupt polling timeout function.
272 */
272static void int_poll_timeout(unsigned long lphp_ctlr) 273static void int_poll_timeout(unsigned long lphp_ctlr)
273{ 274{
274 struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *)lphp_ctlr; 275 struct php_ctlr_state_s *php_ctlr =
275 276 (struct php_ctlr_state_s *)lphp_ctlr;
276 DBG_ENTER_ROUTINE
277 277
278 if ( !php_ctlr ) { 278 DBG_ENTER_ROUTINE
279 err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
280 return;
281 }
282 279
283 /* Poll for interrupt events. regs == NULL => polling */ 280 /* Poll for interrupt events. regs == NULL => polling */
284 shpc_isr(0, php_ctlr->callback_instance_id, NULL ); 281 shpc_isr(0, php_ctlr->callback_instance_id, NULL);
285 282
286 init_timer(&php_ctlr->int_poll_timer); 283 init_timer(&php_ctlr->int_poll_timer);
287 if (!shpchp_poll_time) 284 if (!shpchp_poll_time)
288 shpchp_poll_time = 2; /* reset timer to poll in 2 secs if user doesn't specify at module installation*/ 285 shpchp_poll_time = 2; /* default polling interval is 2 sec */
289 286
290 start_int_poll_timer(php_ctlr, shpchp_poll_time); 287 start_int_poll_timer(php_ctlr, shpchp_poll_time);
291 288
292 return; 289 DBG_LEAVE_ROUTINE
293} 290}
294 291
295/* This function starts the interrupt polling timer. */ 292/*
296static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds) 293 * This function starts the interrupt polling timer.
294 */
295static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int sec)
297{ 296{
298 if (!php_ctlr) { 297 /* Clamp to sane value */
299 err("%s: Invalid HPC controller handle!\n", __FUNCTION__); 298 if ((sec <= 0) || (sec > 60))
300 return; 299 sec = 2;
301 } 300
302 301 php_ctlr->int_poll_timer.function = &int_poll_timeout;
303 if ( ( seconds <= 0 ) || ( seconds > 60 ) ) 302 php_ctlr->int_poll_timer.data = (unsigned long)php_ctlr;
304 seconds = 2; /* Clamp to sane value */ 303 php_ctlr->int_poll_timer.expires = jiffies + sec * HZ;
305 304 add_timer(&php_ctlr->int_poll_timer);
306 php_ctlr->int_poll_timer.function = &int_poll_timeout;
307 php_ctlr->int_poll_timer.data = (unsigned long)php_ctlr; /* Instance data */
308 php_ctlr->int_poll_timer.expires = jiffies + seconds * HZ;
309 add_timer(&php_ctlr->int_poll_timer);
310
311 return;
312} 305}
313 306
314static inline int shpc_wait_cmd(struct controller *ctrl) 307static inline int shpc_wait_cmd(struct controller *ctrl)