Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp563487rwl; Wed, 9 Aug 2023 20:22:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrh6KO+2yIOy6azrLquMNCd4ssjA2EyYRU2y/vT0yznaLa1939XXF7YZ5Zx4HEnKL/ZOhS X-Received: by 2002:a17:902:9b87:b0:1b8:6850:c3c4 with SMTP id y7-20020a1709029b8700b001b86850c3c4mr931129plp.22.1691637723853; Wed, 09 Aug 2023 20:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691637723; cv=none; d=google.com; s=arc-20160816; b=DmGdlCyUUKhGnGPcVEYfgXZWaCLZtw4nW8gP6JtPqCov6P7Nwq+8m6tUFAB72rKMLI 0XK2kJNMJD9np0RmXrpDluI+NIkhH228mP55zQGWpBZ12zA8lOvHynM3FcaNgxjrI9Qr DyOKaA1jnzTsT5mW7yYLNSMicAlM/ZRqjraQ+zNLJDgq6ESEnBVm4kP/kjsLCEE8wJTY pT6jE2/eT4Hx8ugai5FtvbQ/WXS3g2Nd4Dx9eGEloa1XmyqLgmiXq2I4mEnz/3De25RG XOdSFwxjWBmUaqf9eAhdkiT0vo2cgaCJRZfa3iSCSTNBS1ya6+BLRhpENVMTIVkecfFi nb1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=VrBuNEjn9+bnwR8lfuBBj6C9ooimYtUAM/O8O7ejN0Y=; fh=r+VlOdz9yHieXWJnz0Rf9gwDu6JsUzRZtfjjcVRKdpQ=; b=M/Fv93MdaByZFFChtw5cWFHbvOajp4941F80GHKAA3Jl0/LQpTdEnjX8aqTjCJ4aEv b/p0f5CYWaTAMonbb0Dqgmm2I84xEZdjAbXxf7vB4iC/OVZtfJ0uEpoBjx9Q/ZRdTBvK i6Uj7mTK9s8V+7dKUIC5wQrRGHG7UXClH2XdW/6B55e7QNBs0SQCmjMCP2X7gXByRWFu BJFqeh6gQrIOdgGVKWMM9pJU+Xa6IfIrJUhvL41qTEVeKhLfew+eXQ/qOfUNWG5a6gg8 0yLeoibQHHt2/q+aUeCtJnTHvoYOHIikHyerBTunCf1zfuHTggrTFEEI6k2OtYqmxlW+ NfCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OpNIouhw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a170903108400b001b9ea40d26fsi527354pld.295.2023.08.09.20.21.51; Wed, 09 Aug 2023 20:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OpNIouhw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbjHJCai (ORCPT + 99 others); Wed, 9 Aug 2023 22:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjHJCag (ORCPT ); Wed, 9 Aug 2023 22:30:36 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0218319A1; Wed, 9 Aug 2023 19:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691634636; x=1723170636; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=u10rf6iFQykAk9HFSkdlXADbfhAXSl4szqQixOVoh8c=; b=OpNIouhwfyPNXN1nv6QA2NCAAXQeCPAxou2Q1Fg+/hmWXxfBGAU1MzQ6 g6PDKSWUiRSNuGW3ptTKpgtRB0MBEsd6dWDCAxa3n/eYnPeJR1oL1z3wr 0mHiOex9Iz58sGVTkVD/liqX4XNFGbn2G1/+cxpQQT+a6ZKHTiMrNX/fL N2UUZdHfynzlxT21R9szeeoTppf9x//suXbUIk/cTRQLgsWGRdLVZMSI8 6z5ixRLB9Dy96xjBbJANPHA+31G67zVsdxJqQOEdHZJyEzq8s+HosW5U4 djl8Fea3X6BW7uCYlJX7WY6FYychdegDjUyW/t2/h5K2ZLexk9tImHvun Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10797"; a="437636749" X-IronPort-AV: E=Sophos;i="6.01,160,1684825200"; d="scan'208";a="437636749" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2023 19:30:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10797"; a="846192096" X-IronPort-AV: E=Sophos;i="6.01,160,1684825200"; d="scan'208";a="846192096" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.254.214.239]) ([10.254.214.239]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2023 19:30:30 -0700 Message-ID: Date: Thu, 10 Aug 2023 10:30:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 05/12] iommu: Change the return value of dev_iommu_get() Content-Language: en-US To: Jason Gunthorpe References: <20230727054837.147050-1-baolu.lu@linux.intel.com> <20230727054837.147050-6-baolu.lu@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/8/10 0:58, Jason Gunthorpe wrote: > On Thu, Jul 27, 2023 at 01:48:30PM +0800, Lu Baolu wrote: >> Make dev_iommu_get() return 0 for success and error numbers for failure. >> This will make the code neat and readable. No functionality changes. >> >> Reviewed-by: Jacob Pan >> Signed-off-by: Lu Baolu >> --- >> drivers/iommu/iommu.c | 19 +++++++++++-------- >> 1 file changed, 11 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index 00309f66153b..4ba3bb692993 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -290,20 +290,20 @@ void iommu_device_unregister(struct iommu_device *iommu) >> } >> EXPORT_SYMBOL_GPL(iommu_device_unregister); > It could probably use a nicer name too? > > iommu_alloc_dev_iommu() ? > > Also with Joerg's current tree we can add a device_lock_assert() to > this function, from what I can tell. Sure. Will update them in the next version. Best regards, baolu