From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C41F0ECAAD4 for ; Tue, 30 Aug 2022 09:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231810AbiH3Jd6 (ORCPT ); Tue, 30 Aug 2022 05:33:58 -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 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; >