Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754954AbdCJExO (ORCPT ); Thu, 9 Mar 2017 23:53:14 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:3964 "EHLO dggrg03-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751782AbdCJExN (ORCPT ); Thu, 9 Mar 2017 23:53:13 -0500 To: , , , , , From: gengdongjiu Subject: [PATCH] irqdomain: handle the per-CPU irq trigger type settings Message-ID: Date: Fri, 10 Mar 2017 12:52:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.58C23129.0271,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: ca41156a96ec8b60cc5ddcc2c805ac18 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1354 Lines: 32 when devices parse and map an per-cpu interrupt into linux virq space using irq_of_parse_and_map API, it will always be failed if needs to set the specified irq trigger type, 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. Signed-off-by: Dongjiu Geng Zhanghai bin 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);