From patchwork Thu Sep 7 11:42:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 111886 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp680640qge; Thu, 7 Sep 2017 04:43:59 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5w1yLdoUgX5WhO3lT8DQXJZkkcoU1rR1S4fVm50UyScSxmwFd1tS1dTpKPrvMjI3LQnIcx X-Received: by 10.98.178.204 with SMTP id z73mr2402534pfl.107.1504784639741; Thu, 07 Sep 2017 04:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504784639; cv=none; d=google.com; s=arc-20160816; b=NvsqJTvsV9elw1GsQSNq3x0HxNOdj5ixOlQTkxT1J/aYj2E+2x7mZMYYToHvqjjful uh/edxJT0COFUXvYrF1/o3O+8+Orn6wg0Yv6eQLTpLhbH+aTAPWUd+TxWnC6iH25trHb 9FndX6MkUbQqdW1JUpzXnX57jNlqqpUHfRk3bXiGz/7Ix1KFS4pJsNdqDWirl8JeUO8C Gy1njZ1aaV60s4QIjr6DtVX6jJqgmfUaClFUdJrvPpCxiAwb1eIDlNDVdGssOAwTalv4 MVxcbNrzYlGPkMG2XJlSTf65jF9rzAs9Gp7YPa/JSjhDHeXW1uE0SCMeh0fktaRinnRq RqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=V4ZjMCWyz22/g+KF/M8qvCQiAVnaQPskC9mrJUwolag=; b=r94qnjcGWrSSR7TsITwDCqiv3t43fpphr3jRQGCBECNfUNO/yjLYjnqkVB2iyYbF1G FseGU3E6y4Kutbjar1seH8EvJOkvm0USUmjG6UZStw/TZ14L8yB/uuLBsjE2GFRvAhcT dETHEHUwvb+vQsRSmnDIK15Aj30RIW4yJwWsRRkK+WayFwyvo5uC8764qbxXtHn6h3Vy fOpoGOZ9OTnUi7rFOclIzSspzSD/mHjZ4rzkoTwwS2sUP/InbTS9d8u5F9fB9yz8xpBM uyB5/hDvMRdhE9WMWWpNtnSjtWuoXPQf8vo/V4JQ4gW8tA4ZWxK7PXCIfkxrf6+6l5mc IZ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=DFUkWbNO; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12si1749199pla.120.2017.09.07.04.43.59; Thu, 07 Sep 2017 04:43:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=DFUkWbNO; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755176AbdIGLn6 (ORCPT + 6 others); Thu, 7 Sep 2017 07:43:58 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17180 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755163AbdIGLn5 (ORCPT ); Thu, 7 Sep 2017 07:43:57 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v87BgcP2021413; Thu, 7 Sep 2017 20:42:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v87BgcP2021413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1504784564; bh=K0SPZy6FWHXrck+Vg0x5IlSdYX0byZWh3KRufW7XNwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DFUkWbNOt4HSvjairCylmMN+cLgJJsBwn6PlYMg+BkcAaZae0W0+DmfYRsqt1dEHS tjN09t/To+FciSbxZViapTFTtEiqvFzT4tZN4nRH/8PIz7zsdmYV1vsGvnkRc84W1+ t18G04RSo1qzAD3wL388GZHrLdkSLMWh2YWj+NKl9jCvMOvuKCBxjeO/C+3T4F88j1 CUYCyP21asMpZHu6ksOSR8EEP6CZ8/Bg7f+5u3HS6N5AuWsr7brMzkw70Sjzc3Plkg +9vPDwbhtVh5r82O4h1ejAnwZ/aDD0DLAydXp3FS+sv7+IgJEN415RJIJ96eLxyO1u 5ADB/LNhyYGqQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Marc Zyngier , Thomas Gleixner , Linus Walleij , linux-gpio@vger.kernel.org, Rob Herring Cc: Jassi Brar , devicetree@vger.kernel.org, Jason Cooper , Masami Hiramatsu , David Daney , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v4 4/6] irqdomain: set irq domain flags before the irq domain becomes visible Date: Thu, 7 Sep 2017 20:42:00 +0900 Message-Id: <1504784522-26841-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com> References: <1504784522-26841-1-git-send-email-yamada.masahiro@socionext.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org irq_domain_create_hierarchy() sets additional flags after the domain is successfully allocated, but the domain becomes visible when it is added to irq_domain_list. When a consumer gets the domain, the flags may not have been set yet. Move "domain->flags |= flags;" into __irq_domain_add(). Signed-off-by: Masahiro Yamada --- Changes in v4: - Newly added include/linux/irqdomain.h | 13 +++++++------ kernel/irq/irqdomain.c | 19 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 31be32d..7609807 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -237,7 +237,8 @@ static inline struct fwnode_handle *irq_domain_alloc_fwnode(void *data) } void irq_domain_free_fwnode(struct fwnode_handle *fwnode); -struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, +struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, + unsigned int flags, int size, irq_hw_number_t hwirq_max, int direct_max, const struct irq_domain_ops *ops, void *host_data); @@ -309,14 +310,14 @@ static inline struct irq_domain *irq_domain_add_linear(struct device_node *of_no const struct irq_domain_ops *ops, void *host_data) { - return __irq_domain_add(of_node_to_fwnode(of_node), size, size, 0, ops, host_data); + return __irq_domain_add(of_node_to_fwnode(of_node), 0, size, size, 0, ops, host_data); } static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, unsigned int max_irq, const struct irq_domain_ops *ops, void *host_data) { - return __irq_domain_add(of_node_to_fwnode(of_node), 0, max_irq, max_irq, ops, host_data); + return __irq_domain_add(of_node_to_fwnode(of_node), 0, 0, max_irq, max_irq, ops, host_data); } static inline struct irq_domain *irq_domain_add_legacy_isa( struct device_node *of_node, @@ -330,7 +331,7 @@ static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node const struct irq_domain_ops *ops, void *host_data) { - return __irq_domain_add(of_node_to_fwnode(of_node), 0, ~0, 0, ops, host_data); + return __irq_domain_add(of_node_to_fwnode(of_node), 0, 0, ~0, 0, ops, host_data); } static inline struct irq_domain *irq_domain_create_linear(struct fwnode_handle *fwnode, @@ -338,14 +339,14 @@ static inline struct irq_domain *irq_domain_create_linear(struct fwnode_handle * const struct irq_domain_ops *ops, void *host_data) { - return __irq_domain_add(fwnode, size, size, 0, ops, host_data); + return __irq_domain_add(fwnode, 0, size, size, 0, ops, host_data); } static inline struct irq_domain *irq_domain_create_tree(struct fwnode_handle *fwnode, const struct irq_domain_ops *ops, void *host_data) { - return __irq_domain_add(fwnode, 0, ~0, 0, ops, host_data); + return __irq_domain_add(fwnode, 0, 0, ~0, 0, ops, host_data); } extern void irq_domain_remove(struct irq_domain *host); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 18d11b9..b317a64 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -115,6 +115,7 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode); /** * __irq_domain_add() - Allocate a new irq_domain data structure * @fwnode: firmware node for the interrupt controller + * @flags: Irq domain flags associated to the domain * @size: Size of linear map; 0 for radix mapping only * @hwirq_max: Maximum number of interrupts supported by controller * @direct_max: Maximum value of direct maps; Use ~0 for no limit; 0 for no @@ -125,7 +126,8 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode); * Allocates and initialize and irq_domain structure. * Returns pointer to IRQ domain, or NULL on failure. */ -struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, +struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, + unsigned int flags, int size, irq_hw_number_t hwirq_max, int direct_max, const struct irq_domain_ops *ops, void *host_data) @@ -213,6 +215,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL); domain->ops = ops; domain->host_data = host_data; + domain->flags |= flags; domain->hwirq_max = hwirq_max; domain->revmap_size = size; domain->revmap_direct_max_irq = direct_max; @@ -319,7 +322,7 @@ struct irq_domain *irq_domain_add_simple(struct device_node *of_node, { struct irq_domain *domain; - domain = __irq_domain_add(of_node_to_fwnode(of_node), size, size, 0, ops, host_data); + domain = __irq_domain_add(of_node_to_fwnode(of_node), 0, size, size, 0, ops, host_data); if (!domain) return NULL; @@ -363,7 +366,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, { struct irq_domain *domain; - domain = __irq_domain_add(of_node_to_fwnode(of_node), first_hwirq + size, + domain = __irq_domain_add(of_node_to_fwnode(of_node), 0, first_hwirq + size, first_hwirq + size, 0, ops, host_data); if (domain) irq_domain_associate_many(domain, first_irq, first_hwirq, size); @@ -1133,14 +1136,10 @@ struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent, { struct irq_domain *domain; - if (size) - domain = irq_domain_create_linear(fwnode, size, ops, host_data); - else - domain = irq_domain_create_tree(fwnode, ops, host_data); - if (domain) { + domain = __irq_domain_add(fwnode, flags, size, size ? size : ~0, 0, + ops, host_data); + if (domain) domain->parent = parent; - domain->flags |= flags; - } return domain; }