Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4216134rwe; Tue, 30 Aug 2022 06:37:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7I7qtEWLgMJHAwS6cm16U94fg1Jm28EJRLCT7YgbzDZlWSF9ItN4Un5d5v5lOdhrsdvZmk X-Received: by 2002:a05:6402:50cb:b0:440:87d4:3ad2 with SMTP id h11-20020a05640250cb00b0044087d43ad2mr20356547edb.219.1661866639521; Tue, 30 Aug 2022 06:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661866639; cv=none; d=google.com; s=arc-20160816; b=xRKEGcHRyXfQcyjssiWf9dsdFMyL0NnOugUKP2zAu4rbxUudOFtfSVRrBu/2lS5hMn WxibQ/unfchp2QlkUy6xTEmHuAfPlfsVDZO4ruCAcO209pz6xy39NoHB+eRRt62zyFfD 9dt0/avGgvFthqan9d6+i0QnCtelXUtCOm8rz2QqJgDGTaoSyMStNIQR6UQvToQcqPkk IGCaPR6tbAkW3Yuf4ncheTZ8dccCAdvrr8y7iXubDFnYWWwWnrN07mkNwWgU/os9Kwko 1cN+e7fUQdkXubd8ezq7TbPwQ0Ff89Uu5EH21Ah3ZyYpS8dLxXT6NOcd9t3Shwxd5E90 lVyg== 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:cc:to:subject:user-agent:mime-version:date:message-id; bh=HiUbWQZGoIjrWdmdoJaw55oGki5huUbgIjnVfUNOZcs=; b=wZPtZTUQ0QTSIsLS3+fOi5D4Bi9Aba3Qafy8tNcJW3iAp88nRGtBlZVta49j3o5/c6 dHZQsC2iDp0KPgli5pnszU7gf4EVCesS70odFRHK2rtIO4+18LiHNCxh+2HoGxt/Vw6O iNxRim9vtTR3+NElgM88Q+koQItG4Z+KfNGy3bXnWVOzdlhSLJytH3slAqvC8wvd5cK1 DQ1mLH8lsxRQU71IBRGN8b8tBa6T6w9Sx13a1mbwAXCNB04pqLkEH+p4sMZziObREHuc DQSptl0dbuymVUKygdfh0VOPVxALA1ZMLc1Qrf1ntKiRiGrm1lJVLLpSU3x26gZVv6+Y YKvQ== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk33-20020a1709077fa100b00741a3548ca5si3210722ejc.761.2022.08.30.06.36.52; Tue, 30 Aug 2022 06:37:19 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbiH3M6X (ORCPT + 99 others); Tue, 30 Aug 2022 08:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiH3M6F (ORCPT ); Tue, 30 Aug 2022 08:58:05 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A73524BD4 for ; Tue, 30 Aug 2022 05:58:01 -0700 (PDT) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MH6gM4yVTzYcpg; Tue, 30 Aug 2022 20:53:35 +0800 (CST) Received: from [10.174.178.41] (10.174.178.41) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 30 Aug 2022 20:57:58 +0800 Message-ID: <2501c884-7c78-d367-3463-5b86d302da89@huawei.com> Date: Tue, 30 Aug 2022 20:57:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] iommu: use iommu_group_ref_get to hold group reference To: Robin Murphy , , , CC: , , References: <20220826024024.101553-1-yuancan@huawei.com> <5f47c5b7-534d-5714-1f91-04005ada8b8f@arm.com> From: Yuan Can In-Reply-To: <5f47c5b7-534d-5714-1f91-04005ada8b8f@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.41] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,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 在 2022/8/30 17:32, Robin Murphy 写道: > On 2022-08-26 03:40, Yuan Can wrote: >> Replace kobject_get with iommu_group_ref_get for better >> readability. > > I disagree, sorry. iommu_group_ref_get() is meant as a helper for > drivers, and the core code uses the raw kobject internally everywhere > else, including several other times within this function. Especially > the raw kobject_put() in the cleanup path - in terms of readability > I'd say it's actively harmful to obfuscate what that pairs with. > > Thanks, > Robin. Understood, thanks for your reply. Best regards, Yuan Can > >> Signed-off-by: Yuan Can >> --- >>   drivers/iommu/iommu.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index 780fb7071577..8e7f30f7188c 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -903,7 +903,7 @@ int iommu_group_add_device(struct iommu_group >> *group, struct device *dev) >>           goto err_free_name; >>       } >>   -    kobject_get(group->devices_kobj); >> +    iommu_group_ref_get(group); >>         dev->iommu_group = group; >