Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbcL3I6T (ORCPT ); Fri, 30 Dec 2016 03:58:19 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:30746 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752302AbcL3I6S (ORCPT ); Fri, 30 Dec 2016 03:58:18 -0500 Subject: Re: [PATCH v5 04/14] irqchip: gicv3-its: platform-msi: refactor its_pmsi_prepare() To: Hanjun Guo , Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi References: <1482384922-21507-1-git-send-email-guohanjun@huawei.com> <1482384922-21507-5-git-send-email-guohanjun@huawei.com> CC: Charles Garcia-Tobin , , , Tomasz Nowicki , , , Sinan Kaya , , Hanjun Guo , Greg KH , "Thomas Gleixner" , Agustin Vega-Frias , From: Xinwei Kong Message-ID: <5866216A.4090907@hisilicon.com> Date: Fri, 30 Dec 2016 16:57:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1482384922-21507-5-git-send-email-guohanjun@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.64.103] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2370 Lines: 69 On 2016/12/22 13:35, Hanjun Guo wrote: > From: Hanjun Guo > > Adding ACPI support for platform MSI, we need to retrieve the > dev id in ACPI way instead of device tree, we already have > a well formed function its_pmsi_prepare() to get the dev id > but it's OF dependent, so collect OF related code and put them > into a single function to make its_pmsi_prepare() more friendly > to ACPI later. > > Signed-off-by: Hanjun Guo > Tested-by: Sinan Kaya > Cc: Marc Zyngier > Cc: Lorenzo Pieralisi > Cc: Tomasz Nowicki > Cc: Thomas Gleixner > --- > drivers/irqchip/irq-gic-v3-its-platform-msi.c | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c > index 470b4aa..3c94278 100644 > --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c > +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c > @@ -24,15 +24,11 @@ > .name = "ITS-pMSI", > }; > > -static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, > - int nvec, msi_alloc_info_t *info) > +static int of_pmsi_get_dev_id(struct irq_domain *domain, struct device *dev, > + u32 *dev_id) > { > - struct msi_domain_info *msi_info; > - u32 dev_id; > int ret, index = 0; > > - msi_info = msi_get_domain_info(domain->parent); > - > /* Suck the DeviceID out of the msi-parent property */ > do { > struct of_phandle_args args; > @@ -43,11 +39,24 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, > if (args.np == irq_domain_get_of_node(domain)) { > if (WARN_ON(args.args_count != 1)) > return -EINVAL; > - dev_id = args.args[0]; > + *dev_id = args.args[0]; > break; > } > } while (!ret); > > + return ret; > +} > + > +static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, > + int nvec, msi_alloc_info_t *info) > +{ > + struct msi_domain_info *msi_info; > + u32 dev_id; > + int ret; > + > + msi_info = msi_get_domain_info(domain->parent); > + > + ret = of_pmsi_get_dev_id(domain, dev, &dev_id); > if (ret) > return ret; > Tested-by: Xinwei Kong