From patchwork Mon Dec 6 22:39:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12660301 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 752F2C433EF for ; Mon, 6 Dec 2021 22:48:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.240089.416504 (Exim 4.92) (envelope-from ) id 1muMmp-0003nt-55; Mon, 06 Dec 2021 22:48:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 240089.416504; Mon, 06 Dec 2021 22:48:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muMmo-0003mM-TF; Mon, 06 Dec 2021 22:48:42 +0000 Received: by outflank-mailman (input) for mailman id 240089; Mon, 06 Dec 2021 22:48:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muMdV-0004dp-IO for xen-devel@lists.xenproject.org; Mon, 06 Dec 2021 22:39:05 +0000 Received: from galois.linutronix.de (galois.linutronix.de [2a0a:51c0:0:12e:550::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 50ffd966-56e5-11ec-a5e1-b9374ead2679; Mon, 06 Dec 2021 23:39:05 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 50ffd966-56e5-11ec-a5e1-b9374ead2679 Message-ID: <20211206210437.930931987@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1638830344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=11mt+Jmu6lYZoJ/3IBTchhg0X7hNMh7U8hV3wTjzP1I=; b=WLNIDDbSqg6ZNF/29e7tH8UwUOFk2EeNDk2aQtKE194+3FZbn2IyTY09FPdPXsFch1rREV bHiBikoE+htwWwkZ98+r2iJcJF4BJIfJGORFery8zTsIXXv8qY/BnTAQCzK2Y90vBqaI3i pTnJ3/GqqFjSRdcqEcV6r4l3lkJzYXOiTT8eCZJt9SaBE4puAi/BOEPvD8/FfqXQreE7F+ zb98MZjDll7RPuhru4zU1y+P5n5o/hBbVpi4o+t7lWO62CUbaHDwVzeg3fUxjRX5cIIObF NBD1uktE6TzIA7rj6wdUDqx33SyRr/CesaqSYilItbzElrg9eAWo3BSQWhfVmQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1638830344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=11mt+Jmu6lYZoJ/3IBTchhg0X7hNMh7U8hV3wTjzP1I=; b=055wvAQ36GPmaJY67QdSBCaQUzixTKksKeMT+TcQSXTPqcQgHL6ExaAEjyPzzu0Hdn1N/a VkAH9N6Rm2PvfNCg== From: Thomas Gleixner To: LKML Cc: Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , linux-pci@vger.kernel.org, Cedric Le Goater , xen-devel@lists.xenproject.org, Juergen Gross , Greg Kroah-Hartman , Stuart Yoder , Laurentiu Tudor , Will Deacon , Santosh Shilimkar , iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org, Nishanth Menon , Tero Kristo , linux-arm-kernel@lists.infradead.org, Vinod Koul , Mark Rutland , Robin Murphy , Sinan Kaya Subject: [patch V2 05/36] bus: fsl-mc-msi: Allocate MSI device data on first use References: <20211206210307.625116253@linutronix.de> MIME-Version: 1.0 Date: Mon, 6 Dec 2021 23:39:04 +0100 (CET) Allocate the MSI device data on first invocation of the allocation function. Signed-off-by: Thomas Gleixner Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jason Gunthorpe Cc: Stuart Yoder Cc: Laurentiu Tudor --- drivers/bus/fsl-mc/fsl-mc-msi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/bus/fsl-mc/fsl-mc-msi.c +++ b/drivers/bus/fsl-mc/fsl-mc-msi.c @@ -253,6 +253,14 @@ int fsl_mc_msi_domain_alloc_irqs(struct struct irq_domain *msi_domain; int error; + msi_domain = dev_get_msi_domain(dev); + if (!msi_domain) + return -EINVAL; + + error = msi_setup_device_data(dev); + if (error) + return error; + if (!list_empty(dev_to_msi_list(dev))) return -EINVAL; @@ -260,12 +268,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct if (error < 0) return error; - msi_domain = dev_get_msi_domain(dev); - if (!msi_domain) { - error = -EINVAL; - goto cleanup_msi_descs; - } - /* * NOTE: Calling this function will trigger the invocation of the * its_fsl_mc_msi_prepare() callback