lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090616165135.2ef993a4@dxy.sh.intel.com>
Date:	Tue, 16 Jun 2009 16:51:35 +0800
From:	Alek Du <alek.du@...el.com>
To:	Ben Dooks <ben-linux@...ff.org>
CC:	Florian Fainelli <florian@...nwrt.org>,
	Ben Dooks <ben-linux@...ff.org>,
	Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: Add gpio_detect, gpio_debounce and
 gpio_alt_func features to GPIOLIB

On Tue, 16 Jun 2009 16:45:24 +0800
Ben Dooks <ben-linux@...ff.org> wrote:

under set_type callback.
> 
> Somehow you are still missing my point, this is the way it can be done
> at the moment, without any extension to the API!
> 
> int attach_my_gpio_irq(int gpio, void *irqpw)
> {
> 	int ret;
> 	int irq;
> 
> 	irq = gpio_to_irq(gpio);
> 	if (irq < 0) {
> 		printk(KERN_ERR "%s: no gpio irq available\n", __func__);
> 		return irq;
> 	}
> 
> 	ret = request_irq(irq, my_irq_handler, IRQF_TRIGGER_FALLING,
> 			  "mygpio", irqpw);
> 	if (ret < 0) 
> 		printk(KERN_ERR "%s: cannot request irq\n", __func__);
> 
> 	return ret;
> }
> 
I mean, in the set_type of the irq_chip driver, you need to call something like rb532_gpio_set_ilevel.
The GPIO driver needs to export rb532_gpio_set_ilevel, and this is specific to each GPIO driver. Ideally,
I should always call gpio_detect(gpio, ...) here.

static int rb532_set_type(unsigned int irq_nr, unsigned type)
{
	int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
	int group = irq_to_group(irq_nr);

	if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13))
		return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;

	switch (type) {
	case IRQ_TYPE_LEVEL_HIGH:
		rb532_gpio_set_ilevel(1, gpio);
		break;
	case IRQ_TYPE_LEVEL_LOW:
		rb532_gpio_set_ilevel(0, gpio);
		break;
	default:
		return -EINVAL;
	}
	return 0;
}




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ