Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1953108rwo; Thu, 3 Aug 2023 02:24:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlGaV/CqpyCuGb5h/mbY7273dUDhj77eGqaU5JltawPs3Z4V2orIRUYEl1yBXia2rS+etYWg X-Received: by 2002:a05:6a00:3983:b0:686:dd81:394c with SMTP id fi3-20020a056a00398300b00686dd81394cmr17979193pfb.15.1691054650436; Thu, 03 Aug 2023 02:24:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691054650; cv=pass; d=google.com; s=arc-20160816; b=tOffMO7nljhDwwmlKkuZkQwGxiJcRWwWfEvdJoOJmEa2Hs9Pbge7TOxJA1BMVpJXVO XP+B1/sWuUW03rctG1F8j3UEEJZuPS9BQhq1rpI6A2JIaSvSmz7cK9YRpPhYB/o6RLci gbAUoalLTZsLnRrge9MA2bcweNhqFBFZTrfi7stk5wye2La7a9l0wioFkC2ohns0jbXu Dm9+lUf1k0k22mBwoNu8cKulIcfmRnPtn2WUu2BzUSrtaT0Z3BGWXbE+qxFnnbGaX1PA yXBZCI5dZ4nFBbRwT7TXRN6l/MlQ1b2W0NcEj9t/C935i3WhvSgBO3gyr8BWHzXeZaHO MVLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=80z3S4lg8hX0ZomMtz03JWZNB6dLZrOZoQ5PB+FhlcI=; fh=7VbWX9ml271g0zEbFQlLcMOW8H52gHN96JzKQbq7x4c=; b=PLtyuuvqXAWP6cCFDzy3oUi0CX3md5ol6oX0lQsVHDdvHp92sF1gli/rI3Wri6aK2d dYq1+VAzSeQ+looBhrx9ACYacl0SwblT9H4A1fFUvQ2NoCOl4YIGIlI/hwAxXixWJWOU KlcA52kkF9lDsEClm9HXgi7jpgR/hMxu4oi+SLCzROFdjXBFNtP8y53+BpmMVsgToJuL vT2aSJk9RQcSX5N0mf9yIa3Tds+rjUK8X54F0tmldzSTZIu/Od3HtQERZYOFZzdWpiAJ 1q1f6p+ILDBD4v4GHmezwgmYsIa21Hm6JyRvIfn85U98kLY9/b2CHTM/gs+3AvjTpCTS FCcg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZvkuXifI; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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 fd29-20020a056a002e9d00b006824bcb19b5si2063379pfb.4.2023.08.03.02.23.58; Thu, 03 Aug 2023 02:24:10 -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=ZvkuXifI; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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 S234072AbjHCIIl (ORCPT + 99 others); Thu, 3 Aug 2023 04:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234466AbjHCIIH (ORCPT ); Thu, 3 Aug 2023 04:08:07 -0400 Received: from mgamail.intel.com (unknown [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61F903C14; Thu, 3 Aug 2023 01:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691049619; x=1722585619; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=tkQPq5ikxQbF1wPuS4wbR7iVr2TTwbkrCuI+oFHC6Cg=; b=ZvkuXifIBrA8Lnrpi2kdsM6upm9kh7KLN06Krvv3Pr0M3AcLN9AlxlUb clKyS9az7CcDPNOFFcfuck97QOyWHFajVok8I0FYUwA2fu9wXm+UtHosS GM/HOACZrWgaXTh65qaS42UIJY1y5Ar56Ff1fvZ73msyEy5Dw0K+7/qK4 yyVPa94qF1YktsU/XX59REtpiIDnh/9+iODLa5DQa+rZe1yzv28eZ0Iau FcL/AuCqwAAvurgdOSI6XlLZ7B1N3d/xhyR8rUCC2E126V9MW9Z7Yv08y WDcbouWcjLG5Nm/ZyS/YHyNXhBf0yAI3+fHb7PSMZFw4xpNxE8A+BxGTw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="369797325" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="369797325" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 01:00:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="764501552" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="764501552" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga001.jf.intel.com with ESMTP; 03 Aug 2023 00:59:59 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 00:59:59 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 00:59:59 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Thu, 3 Aug 2023 00:59:59 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Thu, 3 Aug 2023 00:59:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G8JMeHTwCUiMqSI3T1oC3DSC4ZCosAyKker1UUQxa8wkRhDKFBhZU9VHEICLn4pBwMjPFqJlEJoKNykaJKfq294zyOzHWtpZDLcuvZ9xMKS0o7lp4w6moP/DEPt0ARftvsdt2nTAlRCEC8qbgoB1UY0YhhoTX5C04XpeqmubZxdAFPBwiY1VF708fM4qm4PVIUfyG2RiEH+j+0OM37IAmdsVD280DiFXGwFDwa3owiazJH0Q6nzPHiNFrDr2ulaA1TmusnImzTEPChwRkOGPBYpc6HvjE6ZuTct7xKM+eLvYvktQoT4W5wtl33gxJ5SCJtOWW4349moypx6JeiGCLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=80z3S4lg8hX0ZomMtz03JWZNB6dLZrOZoQ5PB+FhlcI=; b=LaxoeJ/9umteq5KQRR7b8IVDkYvae2iIM90Vj1bGYj5wqv1XWlsNSbN/hGdbHQwCD0+u3id+50rPIY2FbJ/ZXUgtFvV0RwZQRmiaguQB+z+tMU0L58yuDRnqmmwu2h/QvBVNyWDOCycpKFJEyhgDFCd5cmi34TjtsZpXSxnOb0wsBzJzlR6bYE1IDlCO3Jk3U7VkBGzJvumH8lwn5Dk1mfHxrtTQ7iciqyd9aTrrtASLTybQSO9BmzNL5EQRvYaOTu1p9UcNNgoZBlee9p+dxLuAJlIUWoxtKZHZufLSZVoqugKi5YifNJb5ZBLP/864fqLvffqBywnK4MKD+tqPdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BN9PR11MB5276.namprd11.prod.outlook.com (2603:10b6:408:135::18) by PH7PR11MB6881.namprd11.prod.outlook.com (2603:10b6:510:200::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Thu, 3 Aug 2023 07:59:56 +0000 Received: from BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::dcf3:7bac:d274:7bed]) by BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::dcf3:7bac:d274:7bed%4]) with mapi id 15.20.6652.020; Thu, 3 Aug 2023 07:59:56 +0000 From: "Tian, Kevin" To: Lu Baolu , Joerg Roedel , "Will Deacon" , Robin Murphy , "Jason Gunthorpe" , Jean-Philippe Brucker , Nicolin Chen CC: "Liu, Yi L" , 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() Thread-Topic: [PATCH v2 05/12] iommu: Change the return value of dev_iommu_get() Thread-Index: AQHZwE5aOEc+6ikxPE+EMdq5oUz2zq/YPxrQ Date: Thu, 3 Aug 2023 07:59:56 +0000 Message-ID: References: <20230727054837.147050-1-baolu.lu@linux.intel.com> <20230727054837.147050-6-baolu.lu@linux.intel.com> In-Reply-To: <20230727054837.147050-6-baolu.lu@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5276:EE_|PH7PR11MB6881:EE_ x-ms-office365-filtering-correlation-id: d6ccf6d1-01a6-4e01-3045-08db93f7a0b5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3eM/dCpW1ZqNx7arZ+jGrjwLF0YQ/u9ewsNkn3iNEKcWY7y58uicIGNi1YCSI1Vc5mXZH5MG4L/ObpiX1dfcousnyErK6VnB6SBDLeQPMdr74baAFaw1AHGAtehFu4tbZ1+0shltPfMNDCw3tu6UaEpBtRrYoRmXxnAOTeRWxUrLYNYENq30wTfpqqa342ou3pPWW3CyrdHXjVMRKHUOBjzHlanuJt6kK8FfENqX4QRJ3XP+q0rFx/BSDItyuLlGXNQX7+xUQLS505pIF6RlPZBfxgUFJ4qKPxC+2b/dZlL5wsjoL5a8s6XIbmPLjhG/nvaPcpO45wTIOX1+DCqt25xdPxe4astqNFlZeCbie3JV2ITbUERkPnKMAXCCRDFefKahGV26BRHXXj338Wn9ruys5OnpDLIyzUa9UNCfHm1S3AoAyMQMTCOTQmZqIh3dJ5XKF5fUn8B5faLLU1V1thuRgd1u/XT3p2VWY/4obb6PbaTHZZ0RFowl5X9zM4CHPdcEe/JKIxqbmY2l+A3a1Gkx17mjqMoQoS3zztWb+woun45aYRWrpoupXHItSvLEY786JfAQzpXpUsICDgG4+c/pgKxN00rpwhmrdohXvZ+vCZ/vkn28ErhEylnW+YrdprqHPjQX0onQQVmCuIEEtw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5276.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(136003)(346002)(39860400002)(376002)(366004)(451199021)(38070700005)(86362001)(33656002)(54906003)(478600001)(110136005)(55016003)(38100700002)(82960400001)(122000001)(6506007)(186003)(26005)(83380400001)(8676002)(8936002)(41300700001)(52536014)(966005)(9686003)(71200400001)(7696005)(316002)(66446008)(66476007)(66556008)(5660300002)(4326008)(7416002)(64756008)(66946007)(2906002)(76116006);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Oke7+WQCg6AoFasdafDCQMqGXn//KL8mbJI+Cp/FkrzmhYuGuB9jXKZymZjs?= =?us-ascii?Q?DS+aQkG9FzbYKR2JlnEj4bhuEjPF68DAUAuobpewQWA/COM2Ug0r4b6BS6xg?= =?us-ascii?Q?rLvJrxcx/xEtbGMUCAwx1bPJt/Sll8/0q30bzyHPbP74X/yv8hVee2F3OCjz?= =?us-ascii?Q?8GrZh/C7iz3nTpHQnTqyy8H3u5RaLOD4SnPjLdR02sjExDz2uZ/YtxBJM+CX?= =?us-ascii?Q?f23BoakFUeQn3DDbvjm9Zr0r2h3cZbk1StiYCY4mgN9mtR9iNZudmCqjmNBq?= =?us-ascii?Q?zZo59bCu6Y4ySP4zlQ0vHetX7zsqFQ8sA3ahOR14mERj4Nsbqha3XjQNGF1C?= =?us-ascii?Q?jPLBHJwGl3GPNG/7x53jB9KKhkre0RRLsQGfD6skalbvQgA3q9O5lEygCm+2?= =?us-ascii?Q?b5IW3Q9jm7OAWUBuqWsKuHhorbON+GeKatzDrJgrXOk07t7Uca8V8DydSen8?= =?us-ascii?Q?IoDiUXepx+ByZpYA55pL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MoCd8RQ3ZVXLQEdNQli8j2J9ma5Zww4hRrdPQNheQcYO4Pqxm3w9yI0WqLtl?= =?us-ascii?Q?o0xQoscSplBA1Q9ZOZuLHwvbwkT0bz5SyVw9jGxYNT3QlLiL9KacXRgQMXgT?= =?us-ascii?Q?U37/6DIfcYIfAQqUFje0W7wf1v0iYVQQWVdwfun0VjGSSCTuv9N65D/4MBnE?= =?us-ascii?Q?IBQ79q+wJbQNNDqr46IKdT9WJ3VkXw+JsvpL3k5O?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5276.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6ccf6d1-01a6-4e01-3045-08db93f7a0b5 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2023 07:59:56.5136 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Gt2/J1SwtRS0Yf5PWgm9iADwkjlsVxD8OChf+OUPQjyPOHPmBZNF46t4Ms4/5MnboR4HFc5UNVUu34PiByXaqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6881 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 > From: Lu Baolu > Sent: Thursday, July 27, 2023 1:49 PM >=20 > Make dev_iommu_get() return 0 for success and error numbers for failure. > This will make the code neat and readable. No functionality changes. >=20 > Reviewed-by: Jacob Pan > Signed-off-by: Lu Baolu > --- > drivers/iommu/iommu.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) >=20 > 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); >=20 > -static struct dev_iommu *dev_iommu_get(struct device *dev) > +static int dev_iommu_get(struct device *dev) > { > struct dev_iommu *param =3D dev->iommu; >=20 > if (param) > - return param; > + return 0; >=20 > param =3D kzalloc(sizeof(*param), GFP_KERNEL); > if (!param) > - return NULL; > + return -ENOMEM; >=20 > mutex_init(¶m->lock); > dev->iommu =3D param; > - return param; > + return 0; > } >=20 Jason's series [1] has been queued. Time to refine according to the discussion in [2]. [1] https://lore.kernel.org/linux-iommu/ZLFYXlSBZrlxFpHM@8bytes.org/ [2] https://lore.kernel.org/linux-iommu/c815fa2b-00df-91e1-8353-8258773957e= 4@linux.intel.com/