Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3993996rwe; Tue, 30 Aug 2022 02:40:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6w/3Mm5kDuijubT9XggTue2+9bXXOrImOoaNDpQzrNq4IABjJ85j9qDlBLSYxtfhCO7SNJ X-Received: by 2002:a05:6402:42d4:b0:443:4b8:8cba with SMTP id i20-20020a05640242d400b0044304b88cbamr19711681edc.3.1661852412776; Tue, 30 Aug 2022 02:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661852412; cv=none; d=google.com; s=arc-20160816; b=v1vMtu2Ws2Ie1ToJZ5PuvKqIYFnI601vlIBKdfVf4XWpWatpSUoPOf/ZvzIXrfwAPN NNc1u2S3aNDW6Tz4+QSMnebY/173USmRUoB3KDJJA/bQiYJHDiAu4m3BiBW8Fy182I8A d0qRkMGmDGNeBHigEtIIzk/8/d9u3TJHO6r7uuOYE8vnNBiyUViRyiUfIg7gnqVXmZEm N54DDVReFFiFADVCx9PpTHaT1nfZ1SwDLajWsTjSYGKsfx2O5b71XG85oJ0vI4b9Hpe9 uH/6K31u7ET3rK5zatTWaf37aHq8egt69yjtO4OULsan3Kmuq6IJtPHV/RMttWauJCFi ++rg== 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:content-language:subject:user-agent:mime-version :date:message-id; bh=Q1SrKsZiaX4mAuf4SgyusSnFGghSJ7r5yrs04eW+ke4=; b=z/UshYDoVy8RLkpUqxhEJqoKD4UkiPjODVijTU0zCshr3FIlJM0zt4ekELAV70nL/P x3HyhGbYufStcjT+rNhlVVVhW2hJWmZw0qZKXSC1N4FPcJhjdFc++ODqsThJ20VmicQZ WdYpC3jr/SofYHe70As2pfnknVTTF56pv3LAxMyey8exygu+OmpwycGaAq0l7Fnxe0+x t5NlQSzBnZ95m/7D49hAXekpNHdjIuw6XtEpn74/8tJHPnrnqAcjbISzpGO+Ad5SME67 Ie/x0+UaDPnxZ4Oqcj//MI6n++GFVLiBuBN1dw1jxc0NTXBlEqW8ZMPEp3h6YU5SOwRq JnTg== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a056402084a00b0043a23aed655si9250369edz.386.2022.08.30.02.39.47; Tue, 30 Aug 2022 02:40:12 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbiH3Jd5 (ORCPT + 99 others); Tue, 30 Aug 2022 05:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231536AbiH3Jcw (ORCPT ); Tue, 30 Aug 2022 05:32:52 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8493A8CC7 for ; Tue, 30 Aug 2022 02:32:32 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B83223A; Tue, 30 Aug 2022 02:32:36 -0700 (PDT) Received: from [10.57.13.45] (unknown [10.57.13.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E7DDA3F766; Tue, 30 Aug 2022 02:32:28 -0700 (PDT) Message-ID: <5f47c5b7-534d-5714-1f91-04005ada8b8f@arm.com> Date: Tue, 30 Aug 2022 10:32:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] iommu: use iommu_group_ref_get to hold group reference Content-Language: en-GB To: Yuan Can , joro@8bytes.org, will@kernel.org, iommu@lists.linux.dev Cc: linux-kernel@vger.kernel.org, baolu.lu@linux.intel.com, haifeng.zhao@linux.intel.com References: <20220826024024.101553-1-yuancan@huawei.com> From: Robin Murphy In-Reply-To: <20220826024024.101553-1-yuancan@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 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. > 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; >