Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp968011lqs; Fri, 14 Jun 2024 10:34:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6W0o6sr58E0YyL1BYVoCRmJh90NtKg/Ngahf+Yvm66NrfFW+FyXu2sjIqL22QWjJtiCg+k0sd4oat1wOBm4Lm9HlHY9NKhd9rN5D6kA== X-Google-Smtp-Source: AGHT+IFcQ52BN2CFY9AEJaP6OtK76k+1tyjBoKTOarkYAwODT5IbXAS/jdIzneGfmB7t1o0osaYe X-Received: by 2002:a05:6808:1910:b0:3d2:20e2:368e with SMTP id 5614622812f47-3d24e987574mr4837072b6e.40.1718386472502; Fri, 14 Jun 2024 10:34:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718386472; cv=pass; d=google.com; s=arc-20160816; b=xmc23rRLENPnI0sGBQ39Lte8NYp8ybW+FeVUz5hmJAwD1Sq9EEOfin8fsMfIRNIvV4 78pjks2j5OhkuqGtBEZOpMvGqW+v8rbDRK5kBxMuhQwaA30rUj1e2xuwOXol1ZJvF8uU Y4hT3CwiQS/addLZtYV4uR93UY5sWSVZMQ/mvuD40T7jozpTe+RV4yNUrYaPLjiedbbq m2UL31y3fLZrQMfiKiOgrgHzLquw2kMYtwu9eG7zFzLHdA7Nkgb0T6AD4gQZP/FKZkN5 4TSsriiCwlFedYytntLAyasHrfU/NeBKQDp0Pckq6saOLTmP5iE2yZXA7KKHV4VJhB0F CxOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zDaB47WOjYw+Y1hfwmwgGI9KoC30S0XrnbD9FfSrUiI=; fh=bujJSrd+k1h/0aZbC1LeFD2/cY2NpcCgJFppOaBslqM=; b=rt9P240NB3gWtimR2zudd5FsRA+yzRhd2PI2Qu9PGJqOxZRXqy+MxO72SJASUVyi4a wceS+LeF0likhQmgIbPLwEGbFBQ47g2jOxtUVgxPUjusoqKmucxgyJzY+eeBK6oVzUtq MaYJN0nv12Uac/RRzOBxAZASyAGZd77ux+SohWdpIoclzQn1kN+tNzx0TIV0Tb9yOYIa 5YwJP2MuoCaxHUwOUYF4ixVHDR4oY3gFshjAjY6z8YRn8w5uWSPa/yiBsG5D0S8gOtPJ XUwPc2NTtGWEq1JeIjJ/2Ib+1v/SUu+iJKqLpGmRE+LVPVLIj8dyyWOBxSftXtIBcsf5 C2fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=QOXUQncZ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-215362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798abd16f3csi394509885a.441.2024.06.14.10.34.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 10:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=QOXUQncZ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-215362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 173DF1C260BC for ; Fri, 14 Jun 2024 17:33:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C913219EEDB; Fri, 14 Jun 2024 17:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="QOXUQncZ" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C157E19DF58; Fri, 14 Jun 2024 17:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718386374; cv=none; b=rEG2/9TIzHlv7fvPo5fGZXJ/YMLLfzTQoqX9/VuqbZRiPzsyA3erEFbDl8m4Zx5S3SC48OTPqQl7ch3q83WFYPsRD94xeogJmwx2TLt+iFYJcV2jgIQetxCPPtTxzGdAFqi09hclrUi57ms+ZHgXz1d3axErzjb3pMhwadJF2ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718386374; c=relaxed/simple; bh=yb2LMuPsZMTzsBXPHdT8is7Lp6RxhR9frz8vdpQRO2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qY7DaxTqGNiYrggwCzBLsHrb/Ya8uzsJaRK/3m+dMUyKb2C7x5GzFZNHRg6alP9zloSXBM1sr5rEbFv/dYmah2KM0tvjqf2zm7BdMPF8k3NMKHWLjdDdzkbOPFc0h3tDdwH5nYoq/68Ll8gfg5D8WbCvC5ErpLoryLqh11FZyPY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=QOXUQncZ; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id 683FFFF80A; Fri, 14 Jun 2024 17:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718386371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zDaB47WOjYw+Y1hfwmwgGI9KoC30S0XrnbD9FfSrUiI=; b=QOXUQncZrkWjeNSF9gf5Fnuw/j8AWhnmkrsiFgkvnP7X3OzKRFVvwohRTG8VQbtlTTyHLP gqWrZsvRkJsbmQ9krt7jebcRv7rCIOkQGRlAKUUMqft2AfTdBNrEb/8hvxhHNErdPT5uyY V0fqpn8SyxlUtx+U8hNftQ+GYxD8HQY6r44o2eHwDBRDvEZG2UXD9ky3mwpxkC9GpKuJ2E ytoXUH8DPFBPuWz081iPhs7oFYzIVYe60z2UA+4LKnSHzTeSXVBCds9LznQWFFp5JRyPnE 8fejBsGIUB9lVcmXwNzpp+ugxNR+CRNLSevuRTsh3eSoTG3i1NK0452fTBpUpA== From: Herve Codina To: Matti Vaittinen , Herve Codina , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Richard Weinberger , Anton Ivanov , Johannes Berg , Marc Zyngier Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-um@lists.infradead.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni Subject: [PATCH 06/23] irqdomain: Convert __irq_domain_create() to use struct irq_domain_info Date: Fri, 14 Jun 2024 19:32:07 +0200 Message-ID: <20240614173232.1184015-7-herve.codina@bootlin.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240614173232.1184015-1-herve.codina@bootlin.com> References: <20240614173232.1184015-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com The existing __irq_domain_create() use a bunch of parameters to create an irq domain. With the introduction of irq_domain_info structure, these parameters are available in the information structure itself. Using directly this information structure allows future flexibility to add other parameters in a simple way without the need to change the __irq_domain_create() prototype. Convert __irq_domain_create() to use the information structure. Suggested-by: Thomas Gleixner Signed-off-by: Herve Codina --- kernel/irq/irqdomain.c | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 0b152061e63a..28a463e25d99 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -179,45 +179,40 @@ static int irq_domain_set_name(struct irq_domain *domain, return 0; } -static struct irq_domain *__irq_domain_create(struct fwnode_handle *fwnode, - unsigned int size, - irq_hw_number_t hwirq_max, - int direct_max, - const struct irq_domain_ops *ops, - void *host_data) +static struct irq_domain *__irq_domain_create(const struct irq_domain_info *info) { struct irq_domain *domain; int err; - if (WARN_ON((size && direct_max) || - (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max) || - (direct_max && direct_max != hwirq_max))) + if (WARN_ON((info->size && info->direct_max) || + (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && info->direct_max) || + (info->direct_max && info->direct_max != info->hwirq_max))) return NULL; - domain = kzalloc_node(struct_size(domain, revmap, size), - GFP_KERNEL, of_node_to_nid(to_of_node(fwnode))); + domain = kzalloc_node(struct_size(domain, revmap, info->size), + GFP_KERNEL, of_node_to_nid(to_of_node(info->fwnode))); if (!domain) return NULL; - err = irq_domain_set_name(domain, fwnode); + err = irq_domain_set_name(domain, info->fwnode); if (err) { kfree(domain); return NULL; } - domain->fwnode = fwnode_handle_get(fwnode); + domain->fwnode = fwnode_handle_get(info->fwnode); fwnode_dev_initialized(domain->fwnode, true); /* Fill structure */ INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL); - domain->ops = ops; - domain->host_data = host_data; - domain->hwirq_max = hwirq_max; + domain->ops = info->ops; + domain->host_data = info->host_data; + domain->hwirq_max = info->hwirq_max; - if (direct_max) + if (info->direct_max) domain->flags |= IRQ_DOMAIN_FLAG_NO_MAP; - domain->revmap_size = size; + domain->revmap_size = info->size; /* * Hierarchical domains use the domain lock of the root domain @@ -264,8 +259,7 @@ struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info) { struct irq_domain *domain; - domain = __irq_domain_create(info->fwnode, info->size, info->hwirq_max, - info->direct_max, info->ops, info->host_data); + domain = __irq_domain_create(info); if (!domain) return ERR_PTR(-ENOMEM); @@ -1204,13 +1198,19 @@ struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent, const struct irq_domain_ops *ops, void *host_data) { + struct irq_domain_info info = { + .fwnode = fwnode, + .size = size, + .hwirq_max = size, + .ops = ops, + .host_data = host_data, + }; struct irq_domain *domain; - if (size) - domain = __irq_domain_create(fwnode, size, size, 0, ops, host_data); - else - domain = __irq_domain_create(fwnode, 0, ~0, 0, ops, host_data); + if (!info.size) + info.hwirq_max = ~0U; + domain = __irq_domain_create(&info); if (domain) { if (parent) domain->root = parent->root; -- 2.45.0