From nobody Thu Dec 18 13:45:53 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B2F1E243353 for ; Wed, 15 Jan 2025 08:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736931264; cv=none; b=MKJfGNqrfv7PDE37SivEX/6aJ4S49t9VHYjKwTO0qNL2nTzKWAspIkYS3n6RsyY9uN22cdrzGr2edAOAf/4AaR/ujZvkO9LFJkOhp084kp4ioI/Tl9SaGg0jnlvK4oQNBpAZrBgjsiqd7ZB3YLSpzZwmaPkkukC+ST6R0iE5v5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736931264; c=relaxed/simple; bh=j4+WCm5JysyXYn7cTB+5Bcjti8kIzOlSUhRV5/xt0KQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ej7V/lVqY89aQ3ty9/RiwPA8AXp2KcaYMP0QKqgoJ1zkma3UEjzSBch5IhzA4qRRDV85ru/HzVwfdcu5b32gHotlZYCOlZZnC/+waCNeC5zUcDg/iCG307QyNtvi9PuBQtDiOoAJb4yA/Ncznvtswr2RGypD+OJLOP8GG9ZzdS8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jPVtTRI8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jPVtTRI8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BD26C4CEE1; Wed, 15 Jan 2025 08:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736931264; bh=j4+WCm5JysyXYn7cTB+5Bcjti8kIzOlSUhRV5/xt0KQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPVtTRI8dSx7k4wSgMyQwGLLHPSaWS/xyUw21MhNmoJoj0/bGdwxZtom6AP38QhC5 pJa2dxu8iXR8B0zUaDjAQGGzxq5yWTWfRymoJg8sdzXddTkChnYPhgVdZdj/wTuSOT fjcOi8hjWIoYITWEbTvCs0d+AN1vPQ8PR5A6ueghFUu5YbyEEah0/yc5dtNwr2OYnZ z5+vvsCKoqn2U0pOUtumWrM8MHlEVSDG+oFRuQx0llxSGsMurQK6v+2tcDKyO8Bnn+ S8SHB900svEShwvnBUQ/PNt0SoILDNADG7v1vMHmrgkUO6xRs/ZzukWVmyXhTN9SI7 WO+CMrZ7fEI1w== From: "Jiri Slaby (SUSE)" To: tglx@linutronix.de Cc: maz@kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH 07/18] irqdomain: Make irq_domain_instantiate() returned domains an initializer Date: Wed, 15 Jan 2025 09:53:56 +0100 Message-ID: <20250115085409.1629787-8-jirislaby@kernel.org> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250115085409.1629787-1-jirislaby@kernel.org> References: <20250115085409.1629787-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" I was thinking whether add a \n before the 'return' or this. And this looks both more compact and more readable. Note irq_domain_create_hierarchy()'s handling of size is now part of info's initializer (using the ternary operator). That makes more sense while reading it. Signed-off-by: Jiri Slaby (SUSE) --- include/linux/irqdomain.h | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 15919ca8b3cb..7903dbbbdef1 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -445,9 +445,8 @@ static inline struct irq_domain *irq_domain_add_linear(= struct device_node *of_no .ops =3D ops, .host_data =3D host_data, }; - struct irq_domain *d; + struct irq_domain *d =3D irq_domain_instantiate(&info); =20 - d =3D irq_domain_instantiate(&info); return IS_ERR(d) ? NULL : d; } =20 @@ -464,9 +463,8 @@ static inline struct irq_domain *irq_domain_add_nomap(s= truct device_node *of_nod .ops =3D ops, .host_data =3D host_data, }; - struct irq_domain *d; + struct irq_domain *d =3D irq_domain_instantiate(&info); =20 - d =3D irq_domain_instantiate(&info); return IS_ERR(d) ? NULL : d; } =20 @@ -483,9 +481,8 @@ static inline struct irq_domain *irq_domain_add_tree(st= ruct device_node *of_node .ops =3D ops, .host_data =3D host_data, }; - struct irq_domain *d; + struct irq_domain *d =3D irq_domain_instantiate(&info); =20 - d =3D irq_domain_instantiate(&info); return IS_ERR(d) ? NULL : d; } =20 @@ -501,9 +498,8 @@ static inline struct irq_domain *irq_domain_create_line= ar(struct fwnode_handle * .ops =3D ops, .host_data =3D host_data, }; - struct irq_domain *d; + struct irq_domain *d =3D irq_domain_instantiate(&info); =20 - d =3D irq_domain_instantiate(&info); return IS_ERR(d) ? NULL : d; } =20 @@ -517,9 +513,8 @@ static inline struct irq_domain *irq_domain_create_tree= (struct fwnode_handle *fw .ops =3D ops, .host_data =3D host_data, }; - struct irq_domain *d; + struct irq_domain *d =3D irq_domain_instantiate(&info); =20 - d =3D irq_domain_instantiate(&info); return IS_ERR(d) ? NULL : d; } =20 @@ -637,18 +632,14 @@ static inline struct irq_domain *irq_domain_create_hi= erarchy(struct irq_domain * struct irq_domain_info info =3D { .fwnode =3D fwnode, .size =3D size, - .hwirq_max =3D size, + .hwirq_max =3D size ? : ~0U, .ops =3D ops, .host_data =3D host_data, .domain_flags =3D flags, .parent =3D parent, }; - struct irq_domain *d; - - if (!info.size) - info.hwirq_max =3D ~0U; + struct irq_domain *d =3D irq_domain_instantiate(&info); =20 - d =3D irq_domain_instantiate(&info); return IS_ERR(d) ? NULL : d; } =20 --=20 2.48.0