From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62E99C4345F for ; Mon, 22 Apr 2024 05:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uiMrjM+/VYVj0SeHi2JPhLUhY5JVWJ7sP5wJePBXjL4=; b=jB5p4UwFXRmJgL Sba0iCRgO6m4R8htX0HCvt/tYzGKCtfP8ifVR6OHZx/yWGjgldD/IeywKLfh/kzOrPYFpgjHL0fs7 zkpU7borS+OaHwMSO3y9F/MfyO8XsadTtmSjpp79HNxV1N44WgkB4aqCY3t2Tf+sQWmPtouUUfPS7 FDahsXZoe59jZag37zFDwczOhYq/Xz7oDY65HUBYjGFsdjFfcYbm+Wlzn9IQzyo99sxgMVSeNRJAB bngWxQRInuydPfqfmH9hNRWlqHkRxy4MFXpXBMghnspEE6u9zbzP9CEk6fUUWCkMtknqvYBU5J0Ud PyyvH1T4g6AMxy6pbKcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryln1-0000000C2Rg-0ct3; Mon, 22 Apr 2024 05:00:27 +0000 Received: from fgw21-7.mail.saunalahti.fi ([62.142.5.82]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rylmy-0000000C2Ph-1B7e for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2024 05:00:25 +0000 Received: from localhost (88-113-25-208.elisa-laajakaista.fi [88.113.25.208]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 3694bb42-0065-11ef-abf4-005056bdd08f; Mon, 22 Apr 2024 08:00:19 +0300 (EEST) From: Andy Shevchenko Date: Mon, 22 Apr 2024 08:00:17 +0300 To: Robin Murphy Cc: Will Deacon , Joerg Roedel , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, devicetree@vger.kernel.org, Rob Herring , Saravana Kannan , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , Jean-Philippe Brucker Subject: Re: [PATCH 1/4] iommu: Resolve fwspec ops automatically Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240421_220024_598947_F4560DAD X-CRM114-Status: GOOD ( 14.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fri, Apr 19, 2024 at 05:55:59PM +0100, Robin Murphy kirjoitti: > There's no real need for callers to resolve ops from a fwnode in order > to then pass both to iommu_fwspec_init() - it's simpler and more sensible > for that to resolve the ops itself. This in turn means we can centralise > the notion of checking for a present driver, and enforce that fwspecs > aren't allocated unless and until we know they will be usable. > > Also we've grown a generic fwnode_handle_get() since this code was first > written, so may as well clear up that ugly mismatch while we're in here. ... > +++ b/drivers/iommu/mtk_iommu_v1.c > if (!fwspec) { > - ret = iommu_fwspec_init(dev, &args->np->fwnode, &mtk_iommu_v1_ops); > + ret = iommu_fwspec_init(dev, &args->np->fwnode); I'm wondering, while at it, if can avoid direct dereference of fwnode by using of_fwnode_handle(). > if (ret) > return ret; ... > +++ b/drivers/iommu/of_iommu.c > - ret = iommu_fwspec_init(dev, fwnode, ops); > + ret = iommu_fwspec_init(dev, &iommu_spec->np->fwnode); Ditto. > + if (ret == -EPROBE_DEFER) > + return driver_deferred_probe_check_state(dev); > if (ret) > return ret; ... > --- a/drivers/iommu/tegra-smmu.c > +++ b/drivers/iommu/tegra-smmu.c > - err = iommu_fwspec_init(dev, &dev->of_node->fwnode, ops); > + err = iommu_fwspec_init(dev, &dev->of_node->fwnode); Ditto. > if (err < 0) { > dev_err(dev, "failed to initialize fwspec: %d\n", err); > return err; -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel