Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c073b2db authored by David Altobelli's avatar David Altobelli Committed by Linus Torvalds
Browse files

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: default avatarDavid Altobelli <david.altobelli@hp.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58763a29
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -207,7 +207,7 @@ static void ilo_ccb_close(struct pci_dev *pdev, struct ccb_data *data)
		  &device_ccb->recv_ctrl);
		  &device_ccb->recv_ctrl);


	/* give iLO some time to process stop request */
	/* give iLO some time to process stop request */
	for (retries = 1000; retries > 0; retries--) {
	for (retries = MAX_WAIT; retries > 0; retries--) {
		doorbell_set(driver_ccb);
		doorbell_set(driver_ccb);
		udelay(1);
		udelay(1);
		if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A))
		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)
	doorbell_clr(driver_ccb);
	doorbell_clr(driver_ccb);


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


	return 0;
	return 0;
free:
free:
	pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa);
	ilo_ccb_close(pdev, data);
out:
out:
	return error;
	return error;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,8 @@
#define MAX_ILO_DEV	1
#define MAX_ILO_DEV	1
/* max number of files */
/* max number of files */
#define MAX_OPEN	(MAX_CCB * MAX_ILO_DEV)
#define MAX_OPEN	(MAX_CCB * MAX_ILO_DEV)
/* spin counter for open/close delay */
#define MAX_WAIT	10000


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