diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/shpchp_hpc.c | 59 |
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; | |||
221 | static atomic_t shpchp_num_controllers = ATOMIC_INIT(0); | 221 | static atomic_t shpchp_num_controllers = ATOMIC_INIT(0); |
222 | 222 | ||
223 | static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs); | 223 | static irqreturn_t shpc_isr(int irq, void *dev_id, struct pt_regs *regs); |
224 | 224 | static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int sec); | |
225 | static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds); | ||
226 | static int hpc_check_cmd_status(struct controller *ctrl); | 225 | static int hpc_check_cmd_status(struct controller *ctrl); |
227 | 226 | ||
228 | static inline u8 shpc_readb(struct controller *ctrl, int reg) | 227 | static 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 | */ | ||
272 | static void int_poll_timeout(unsigned long lphp_ctlr) | 273 | static 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 | /* |
296 | static void start_int_poll_timer(struct php_ctlr_state_s *php_ctlr, int seconds) | 293 | * This function starts the interrupt polling timer. |
294 | */ | ||
295 | static 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 | ||
314 | static inline int shpc_wait_cmd(struct controller *ctrl) | 307 | static inline int shpc_wait_cmd(struct controller *ctrl) |