Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 162590
b: refs/heads/master
c: 4a35147
h: refs/heads/master
v: v3
  • Loading branch information
David Altobelli authored and Greg Kroah-Hartman committed Sep 15, 2009
1 parent 4327215 commit aa4eea3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f7048412163d8f8175ba01063f3db02d42cc6a7
refs/heads/master: 4a351471df352474956f1fdc7bc4e7cf6836503a
42 changes: 41 additions & 1 deletion trunk/drivers/misc/hpilo.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/wait.h>
#include <linux/poll.h>
#include "hpilo.h"

static struct class *ilo_class;
Expand Down Expand Up @@ -102,6 +103,22 @@ static int fifo_dequeue(struct ilo_hwinfo *hw, char *fifobar, int *entry)
return ret;
}

static int fifo_check_recv(struct ilo_hwinfo *hw, char *fifobar)
{
struct fifo *fifo_q = FIFOBARTOHANDLE(fifobar);
unsigned long flags;
int ret = 0;
u64 c;

spin_lock_irqsave(&hw->fifo_lock, flags);
c = fifo_q->fifobar[fifo_q->head & fifo_q->imask];
if (c & ENTRY_MASK_C)
ret = 1;
spin_unlock_irqrestore(&hw->fifo_lock, flags);

return ret;
}

static int ilo_pkt_enqueue(struct ilo_hwinfo *hw, struct ccb *ccb,
int dir, int id, int len)
{
Expand Down Expand Up @@ -146,6 +163,13 @@ static int ilo_pkt_dequeue(struct ilo_hwinfo *hw, struct ccb *ccb,
return ret;
}

static int ilo_pkt_recv(struct ilo_hwinfo *hw, struct ccb *ccb)
{
char *fifobar = ccb->ccb_u3.recv_fifobar;

return fifo_check_recv(hw, fifobar);
}

static inline void doorbell_set(struct ccb *ccb)
{
iowrite8(1, ccb->ccb_u5.db_base);
Expand Down Expand Up @@ -486,6 +510,21 @@ static ssize_t ilo_write(struct file *fp, const char __user *buf,
return err ? -EFAULT : len;
}

static unsigned int ilo_poll(struct file *fp, poll_table *wait)
{
struct ccb_data *data = fp->private_data;
struct ccb *driver_ccb = &data->driver_ccb;

poll_wait(fp, &data->ccb_waitq, wait);

if (is_channel_reset(driver_ccb))
return POLLERR;
else if (ilo_pkt_recv(data->ilo_hw, driver_ccb))
return POLLIN | POLLRDNORM;

return 0;
}

static int ilo_close(struct inode *ip, struct file *fp)
{
int slot;
Expand Down Expand Up @@ -595,6 +634,7 @@ static const struct file_operations ilo_fops = {
.owner = THIS_MODULE,
.read = ilo_read,
.write = ilo_write,
.poll = ilo_poll,
.open = ilo_open,
.release = ilo_close,
};
Expand Down Expand Up @@ -835,7 +875,7 @@ static void __exit ilo_exit(void)
class_destroy(ilo_class);
}

MODULE_VERSION("1.1");
MODULE_VERSION("1.2");
MODULE_ALIAS(ILO_NAME);
MODULE_DESCRIPTION(ILO_NAME);
MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>");
Expand Down

0 comments on commit aa4eea3

Please sign in to comment.