/* set_irq_type - set the irq trigger type for an irq @irq: irq number @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h  */
int set_irq_type(unsigned int irq, unsigned int type)
/* set_irq_type - set the irq trigger type for an irq @irq: irq number @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h  */
int set_irq_type(unsigned int irq, unsigned int type)
{
	struct irq_desc *desc = irq_to_desc(irq);
	unsigned long flags;
	int ret = -ENXIO;
	if (!desc) {
		printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
		return -ENODEV;
	}
	type &= IRQ_TYPE_SENSE_MASK;
	if (type == IRQ_TYPE_NONE)
		return 0;
	raw_spin_lock_irqsave(&desc->lock, flags);
	ret = __irq_set_trigger(desc, irq, type);
	raw_spin_unlock_irqrestore(&desc->lock, flags);
	return ret;
}