Skip to content

Commit c073b2d

Browse files
David Altobellitorvalds
authored andcommitted
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>
1 parent 58763a2 commit c073b2d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/misc/hpilo.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static void ilo_ccb_close(struct pci_dev *pdev, struct ccb_data *data)
207207
&device_ccb->recv_ctrl);
208208

209209
/* give iLO some time to process stop request */
210-
for (retries = 1000; retries > 0; retries--) {
210+
for (retries = MAX_WAIT; retries > 0; retries--) {
211211
doorbell_set(driver_ccb);
212212
udelay(1);
213213
if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A))
@@ -309,7 +309,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
309309
doorbell_clr(driver_ccb);
310310

311311
/* make sure iLO is really handling requests */
312-
for (i = 1000; i > 0; i--) {
312+
for (i = MAX_WAIT; i > 0; i--) {
313313
if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL))
314314
break;
315315
udelay(1);
@@ -326,7 +326,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
326326

327327
return 0;
328328
free:
329-
pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa);
329+
ilo_ccb_close(pdev, data);
330330
out:
331331
return error;
332332
}

‎drivers/misc/hpilo.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#define MAX_ILO_DEV 1
2020
/* max number of files */
2121
#define MAX_OPEN (MAX_CCB * MAX_ILO_DEV)
22+
/* spin counter for open/close delay */
23+
#define MAX_WAIT 10000
2224

2325
/*
2426
* Per device, used to track global memory allocations.

0 commit comments

Comments
 (0)