Commit c2191cac authored by Michael Welling's avatar Michael Welling
Browse files

Create a struct to pass irq and trigger type


Signed-off-by: Michael Welling's avatarMichael Welling <mwelling@ieee.org>
parent 866e3ccb
......@@ -34,12 +34,15 @@ static int gpio_ioctl_rt(struct rtdm_fd *fd, unsigned int request,
struct gpio_priv *ctx = rtdm_fd_to_private(fd);
int err = 0;
int irq;
struct gpio_irq_data irq_data;
switch(request) {
case GPIO_IRQ_BIND:
ctx->irq = (int) arg;
if (copy_from_user(&irq_data, arg, sizeof(irq_data)))
return -EFAULT;
ctx->irq = irq_data.irq;
irq = gpio_to_irq(ctx->irq);
irq_set_irq_type(irq, IRQF_TRIGGER_LOW);
irq_set_irq_type(irq, irq_data.type);
err = rtdm_irq_request(&ctx->irq_handle, irq, gpio_irq_handler,
0, "rtdm_gpio", ctx);
if (err < 0) {
......
......@@ -15,4 +15,9 @@
#define GPIO_IRQ_BIND _IOW(GPIO_IOC_MAGIC, 7, int)
#define GPIO_IRQ_WAIT _IO(GPIO_IOC_MAGIC, 8)
struct gpio_irq_data {
unsigned int irq;
unsigned int type;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment