From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 DE55822B584; Thu, 9 Oct 2025 17:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760029439; cv=none; b=hc37KkTuQr/Db3Z4VvIBNQOTEGaEBTLcHnaj02b1vi135TvnTvSye/5rUdoEv1FAXak9nVFgKg0BwdSYXqG0IJk3zOu3orE0q2qhdVj7BhSxGPESTxyhnngQtTyhpSipMu08Ej4Gdf/nIGtdDa+NlteLBh/4Rrxnt7xcsBe35Q8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760029439; c=relaxed/simple; bh=yMqD7LmueVOI1G4KF/wczSdi+WjbyGueTtyV+hDePzU=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Hx7FbC9lpktuUAusXMagdRGwd/SUpigyTazyv5XNepxKZyu4ct3wguAj8O4FkHGqaa/4V2TWieE2lrPLZIWfzDG2wG15Vjvey88rM5pBf3Cn0XJWOY7X6P5mqePxnuK3u6U7OmHARg65jXQUP+OyDdW9SJhQRTSkGwyhfloy0Pg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cjGR31Pj7z67KQK; Fri, 10 Oct 2025 01:03:11 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 530081402E9; Fri, 10 Oct 2025 01:03:54 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 9 Oct 2025 18:03:53 +0100 Date: Thu, 9 Oct 2025 18:03:51 +0100 From: Jonathan Cameron To: Marc Zyngier CC: , , , Thomas Gleixner , "Mark Rutland" , Will Deacon , "Rafael J. Wysocki" , Rob Herring , "Saravana Kannan" , Greg Kroah-Hartman , Sven Peter , Janne Grunau , Suzuki K Poulose , James Clark Subject: Re: [PATCH v3 04/26] platform: Add firmware-agnostic irq and affinity retrieval interface Message-ID: <20251009180351.00000d3d@huawei.com> In-Reply-To: <20250922082833.2038905-5-maz@kernel.org> References: <20250922082833.2038905-1-maz@kernel.org> <20250922082833.2038905-5-maz@kernel.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500010.china.huawei.com (7.191.174.240) To dubpeml100005.china.huawei.com (7.214.146.113) On Mon, 22 Sep 2025 09:28:11 +0100 Marc Zyngier wrote: > Expand platform_get_irq_optional() to also return an affinity if > available, renaming it to platform_get_irq_affinity() in the > process. > > platform_get_irq_optional() is preserved with its current semantics > by calling into the new helper with a NULL affinity pointer. > > Signed-off-by: Marc Zyngier Maybe a breadcrumb of a comment for those of us who can't be bothered to figure out why this needs the ifndef CONFIG_SPARC? Otherwise a question on whether it's worth spinning a fwnode.h handler to hide away the fwnode type in get_irq_affinity. I think not given the complexity already there for the platform device irq stuff, but thought I'd mention it. Reviewed-by: Jonathan Cameron > --- > drivers/base/platform.c | 60 +++++++++++++++++++++++++++------ > include/linux/platform_device.h | 2 ++ > 2 files changed, 52 insertions(+), 10 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index 09450349cf323..3a058f63ef0d3 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -150,25 +150,37 @@ devm_platform_ioremap_resource_byname(struct platform_device *pdev, > EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname); > #endif /* CONFIG_HAS_IOMEM */ > > +static const struct cpumask *get_irq_affinity(struct platform_device *dev, > + unsigned int num) > +{ > + const struct cpumask *mask = NULL; > +#ifndef CONFIG_SPARC > + struct fwnode_handle *fwnode = dev_fwnode(&dev->dev); > + > + if (is_of_node(fwnode)) > + mask = of_irq_get_affinity(to_of_node(fwnode), num); > + else if (is_acpi_device_node(fwnode)) > + mask = acpi_irq_get_affinity(ACPI_HANDLE_FWNODE(fwnode), num); Not sure how useful it will be more generally, but maybe use fwnode.h and appropriate callback rather than opencoding here? Mind you the extra handling in existing platform_get_irq_optional() for corner cases doesn't really fit with that model. > +#endif > + > + return mask ?: cpu_possible_mask; > +}