Commit c073b2db006ba9370be1eecc36a1be1d9ce31310

Authored by David Altobelli
Committed by Linus Torvalds
1 parent 58763a2974

hpilo: open/close fix

The device can take a while to respond to an open/close request, so
increase the time kernel will wait for response (1 ms to 10ms).

Also, properly clean up a channel on a failed open, by calling the channel
close routine.  Just freeing the memory isn't sufficient, the device needs
to be informed that the channel is no longer open, and the device memory
cleared of references to freed dma buffer.

Signed-off-by: David Altobelli <david.altobelli@hp.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 5 additions and 3 deletions Side-by-side Diff

drivers/misc/hpilo.c
... ... @@ -207,7 +207,7 @@
207 207 &device_ccb->recv_ctrl);
208 208  
209 209 /* give iLO some time to process stop request */
210   - for (retries = 1000; retries > 0; retries--) {
  210 + for (retries = MAX_WAIT; retries > 0; retries--) {
211 211 doorbell_set(driver_ccb);
212 212 udelay(1);
213 213 if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A))
... ... @@ -309,7 +309,7 @@
309 309 doorbell_clr(driver_ccb);
310 310  
311 311 /* make sure iLO is really handling requests */
312   - for (i = 1000; i > 0; i--) {
  312 + for (i = MAX_WAIT; i > 0; i--) {
313 313 if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL))
314 314 break;
315 315 udelay(1);
... ... @@ -326,7 +326,7 @@
326 326  
327 327 return 0;
328 328 free:
329   - pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa);
  329 + ilo_ccb_close(pdev, data);
330 330 out:
331 331 return error;
332 332 }
drivers/misc/hpilo.h
... ... @@ -19,6 +19,8 @@
19 19 #define MAX_ILO_DEV 1
20 20 /* max number of files */
21 21 #define MAX_OPEN (MAX_CCB * MAX_ILO_DEV)
  22 +/* spin counter for open/close delay */
  23 +#define MAX_WAIT 10000
22 24  
23 25 /*
24 26 * Per device, used to track global memory allocations.