From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751724AbbFZGdh (ORCPT ); Fri, 26 Jun 2015 02:33:37 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:26022 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751759AbbFZGdF (ORCPT ); Fri, 26 Jun 2015 02:33:05 -0400 Message-ID: <558CF1CD.5020200@huawei.com> Date: Fri, 26 Jun 2015 14:31:41 +0800 From: "majun (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: , , , , , , , , , Subject: Re: [PATCH v2 2/3] IRQ/Gic-V3: Change arm-gic-its to support the Mbigen interrupt References: <1434077399-32200-1-git-send-email-majun258@huawei.com> <1434077399-32200-3-git-send-email-majun258@huawei.com> In-Reply-To: <1434077399-32200-3-git-send-email-majun258@huawei.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.236.124] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas: ÔÚ 2015/6/12 10:49, Ma Jun дµÀ: > +static int its_mbigen_prepare(struct irq_domain *domain, struct mbi_desc *desc, > + int hwirq, struct mbi_alloc_info *arg) > +{ > + struct its_node *its = domain->parent->host_data; > + struct its_device *its_dev; > + u32 dev_id; > + > + dev_id = desc->msg_id; > + > + its_dev = its_find_device(its, dev_id); > + if (!its_dev) { > + its_dev = its_create_device(its, dev_id, desc->lines); > + if (!its_dev) > + return -ENOMEM; > + } > + > + arg->scratchpad[0].ptr = its_dev; > + arg->scratchpad[1].ptr = NULL; > + > + arg->desc = desc; > + arg->hwirq = hwirq; > + return 0; > +} > + > +static struct mbigen_domain_ops its_mbigen_ops = { > + .mbigen_prepare = its_mbigen_prepare, > +}; > + > +static struct mbigen_domain_info its_mbigen_domain_info = { > + .ops = &its_mbigen_ops, > +}; > + what's you opinion about the function 'its_mbigen_prepare' ? put this function in irq-gic-v3-its.c or move to mbigen driver ? If I move this function to mbigen driver, some its fuctions (ex. its_find_device, its_create_device) and struct data (ex its_node) would be used in mbigen driver. Now, all these functions and data structure are defined as static. to use them, I have to remove the 'static' definition and put them in a head file £¨ create a new head file). I'm not sure which way is better . From mboxrd@z Thu Jan 1 00:00:00 1970 From: majun258@huawei.com (majun (F)) Date: Fri, 26 Jun 2015 14:31:41 +0800 Subject: [PATCH v2 2/3] IRQ/Gic-V3: Change arm-gic-its to support the Mbigen interrupt In-Reply-To: <1434077399-32200-3-git-send-email-majun258@huawei.com> References: <1434077399-32200-1-git-send-email-majun258@huawei.com> <1434077399-32200-3-git-send-email-majun258@huawei.com> Message-ID: <558CF1CD.5020200@huawei.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Thomas: ? 2015/6/12 10:49, Ma Jun ??: > +static int its_mbigen_prepare(struct irq_domain *domain, struct mbi_desc *desc, > + int hwirq, struct mbi_alloc_info *arg) > +{ > + struct its_node *its = domain->parent->host_data; > + struct its_device *its_dev; > + u32 dev_id; > + > + dev_id = desc->msg_id; > + > + its_dev = its_find_device(its, dev_id); > + if (!its_dev) { > + its_dev = its_create_device(its, dev_id, desc->lines); > + if (!its_dev) > + return -ENOMEM; > + } > + > + arg->scratchpad[0].ptr = its_dev; > + arg->scratchpad[1].ptr = NULL; > + > + arg->desc = desc; > + arg->hwirq = hwirq; > + return 0; > +} > + > +static struct mbigen_domain_ops its_mbigen_ops = { > + .mbigen_prepare = its_mbigen_prepare, > +}; > + > +static struct mbigen_domain_info its_mbigen_domain_info = { > + .ops = &its_mbigen_ops, > +}; > + what's you opinion about the function 'its_mbigen_prepare' ? put this function in irq-gic-v3-its.c or move to mbigen driver ? If I move this function to mbigen driver, some its fuctions (ex. its_find_device, its_create_device) and struct data (ex its_node) would be used in mbigen driver. Now, all these functions and data structure are defined as static. to use them, I have to remove the 'static' definition and put them in a head file ? create a new head file). I'm not sure which way is better .