Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750799AbdCMEqH (ORCPT ); Mon, 13 Mar 2017 00:46:07 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3866 "EHLO dggrg02-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750738AbdCMEp6 (ORCPT ); Mon, 13 Mar 2017 00:45:58 -0400 From: Dongjiu Geng To: , , , CC: , Subject: [PATCH v2-kernel 4.1] irqdomain: handle the per-CPU irq trigger type settings Date: Mon, 13 Mar 2017 13:00:26 +0800 Message-ID: <1489381226-8806-1-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.7.7 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.187.203] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.58C6237D.00DD,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0aca164e4fb56204401ba020db26353f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1675 Lines: 47 when percpu devices set its IRQ trigger type using irq_of_parse and_map API,it will be failed because irq_set_irq_type is only for 1-N mode interrupt source,not for per-cpu interrupt source. so handle per-cpu IRQs for this failure. problem: per cpu device call irq_of_parse_and_map to set its timer trigger type IRQ_TYPE_EDGE_RISING, irq_of_parse_and_map will call irq_create_of_mapping to set trigger_type through irq_set_irq_type. But irq_set_irq_type uses IRQ_GET_DESC_CHECK_GLOBAL and not IRQ_GET_DESC_CHECK_PERCPU. per-cpu IRQ is per-cpu and not global. solution: storing the type into irqdata, then get this IRQ type fromirq_get_trigger_type, and enable_percpu_irq sets the type Signed-off-by: Dongjiu Geng Signed-off-by: Haibin Zhang --- kernel/irq/irqdomain.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 9fd618d..8116cf2 100755 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -542,8 +542,16 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) /* Set type if specified and different than the current one */ if (type != IRQ_TYPE_NONE && - type != irq_get_trigger_type(virq)) - irq_set_irq_type(virq, type); + type != irq_get_trigger_type(virq)) { + int ret = 0; + struct irq_data *irq_data = irq_get_irq_data(virq); + + ret = irq_set_irq_type(virq, type); + + /* Handle per-cpu IRQ: just save type in irq_data */ + if (-EINVAL == ret && irq_data) + irqd_set_trigger_type(irq_data, type); + } return virq; } EXPORT_SYMBOL_GPL(irq_create_of_mapping); -- 1.7.7