From patchwork Wed Apr 19 16:11:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 675083 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 7006BC6FD18 for ; Wed, 19 Apr 2023 16:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233097AbjDSQMk (ORCPT ); Wed, 19 Apr 2023 12:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233291AbjDSQM1 (ORCPT ); Wed, 19 Apr 2023 12:12:27 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 361E0273B for ; Wed, 19 Apr 2023 09:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PXXDKPNzylCtFiYzpKUMLwwVww23mnbJzrgwqCoVQFpo9JHOo26/TTSkBYbuyZu2R3kstectC4jD3yyrSE8G+yq0LtkkRF6+UrIbycsab+jDN3tIgeUEazAzepAQgck+t+aP7TuddXhgoPwsMCxfX1KlMi4G75dM/eafTyd0JXaRFevd7Lxmj4evwR/zvZ78nRHug50kqBaRsWeHuUJKqZln5/nNb+uH0Wnrbf5v58fGUPOphizEvd6Z0UTcoiKpgRj10RYJsII75S/ddAZdB2YY9yyzAP+Il5U02sOS9lRrS19iLtovJ2hSR8z4GxuYwhPBObvOuk5X1hqF3KVHXg== 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=Ob1XCKWMZ1f8+JVqs+EBlACIP6d3Jj0FvGWJMUiTryM=; b=hvjAO1pQyBaek0uTy6zrKzEHM5lu4PQwV10blFXbEHQsyYGGd2cGFez/OtcB4y5TcSZnNDjccwTI+pRYYJ66v81IGFNHBmVuMyf0rg9dLT0DZhwnBAKx91tS0q/uLhH+acH+CgWloolITgsl31PJ3+Uubze1uGRQQTOtCO5u58hr1WThIzlJ/bDQ00z84tgPdWdfelV407fcxD+sWm6qLZRyJFhBSUsc0aHW04yotWc+sz/Fm0O6d9wdrw4XFUCakjIab7CGBfuPYJaKfm3EQblXImD7+u53LGplkp45bPDvL1RQAXimkrdURfBpeMB/qS5NR//9tQGpAFXSzxFwDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ob1XCKWMZ1f8+JVqs+EBlACIP6d3Jj0FvGWJMUiTryM=; b=svJsc6luABNNQFcI7BswDOsmGkEl2CpIXc0FaF9sDxxbZVzZUfwiSPsXbmL/dzxyEQ2xSFcnms+QqvVInmVKFjFgGwluM1m80YfhMSDZLqv1C1rc77jAuyjf3A24jEhdHx3OQ+eCnSnHKOzLy/vBD+FVHVLWP9fAaQufR0TM0E5KsaRASBbyv/LRMfQjpJ/f3aV/Szc/qCi4vobaSvZ5+nj0raj5ktloCKT9OlpRmmYJPOdz/Up8hkctxM6mtKGolW8GjduIt62nkHLy8gNNOC6GDy5QA/TmB0gwiXUCr8YNT5z8+0QdVk+N3SREJpDUdJNuqcVmFBpQps41LYIwBg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB6342.namprd12.prod.outlook.com (2603:10b6:208:3c1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Wed, 19 Apr 2023 16:12:02 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%6]) with mapi id 15.20.6319.020; Wed, 19 Apr 2023 16:12:02 +0000 From: Jason Gunthorpe To: Lu Baolu , Christophe Leroy , David Woodhouse , iommu@lists.linux.dev, Joerg Roedel , Len Brown , linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Nicholas Piggin , "Rafael J. Wysocki" , Robin Murphy , Will Deacon Cc: Kevin Tian , Nicolin Chen Subject: [PATCH 02/11] iommu: Use iommu_group_ref_get/put() for dev->iommu_group Date: Wed, 19 Apr 2023 13:11:48 -0300 Message-Id: <2-v1-8aecc628b904+2f42-iommu_probe_jgg@nvidia.com> In-Reply-To: <0-v1-8aecc628b904+2f42-iommu_probe_jgg@nvidia.com> References: X-ClientProxiedBy: BY5PR13CA0008.namprd13.prod.outlook.com (2603:10b6:a03:180::21) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 475ca1c8-411f-402f-485b-08db40f0ceb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rdc5Jut1iyB9vH0nN/YooH8lraIpWFKLaCSfhSFG070biEHGmacakRnHwFrMbuL3FkmLUqh+wAJlGkgiah5NLSleUho90952WrygMRP1+FGhwAfDzY59walc2vgc07gdsC3Cx2AxXDhVcYY+reDlEpM8332fNqeMOD/lhJe2eESox46vWnCNGq/koQFLBdFI9k9wZw7LH4aPk0n9q60c/S3QbujyaN6IB6WGz7M14Ec1YFCO5JUa7MlZYVhe1m88hYqcWSXr3rvxC1TtHZE7zZe1OdnOqhKE7ZOY6FJUSqGwN8A/uSwlHuHMlIqqh9Zkv+CmyyJpxLOIK/+99SkS1AjCaP9HC5E6k6ccZvfM9+ydFOG5Ue9MIqXmNoaxp1ooQtX7Yh2+rxwNR6Gs2HeVlJ+vBFXhU81IlxX8dU6vZajd+Ez3cflPzHvpnqs65Sas1wuL/zbrEYxIMbvBvMkGXc1a0F8TwlQI+njDhafJgCpFzCO67ZY+wH8YCPvWsytvUIQuIL/KMSD4syyXTI8kHn4h182mRWicS1fToUfi4QThfo/F5/oNg1MkR28hdtf+ZnS4MSXhTuogMRLJ4+nGr/r94hTu/Fi2yiYTTn5MXhGRUe2dvJ+nrOzQc6vvvnlL X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR12MB5869.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(39860400002)(366004)(346002)(136003)(451199021)(6666004)(6486002)(478600001)(110136005)(86362001)(36756003)(2616005)(83380400001)(107886003)(6512007)(186003)(6506007)(26005)(38100700002)(316002)(921005)(66946007)(66476007)(66556008)(4744005)(2906002)(8676002)(5660300002)(8936002)(7416002)(41300700001)(4326008)(54906003)(4216001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1K5W1cDddxAqOWX1h4yXFUPe38nxM6RznUhliDnP2UsbCEjRB2T9b5fgpsqamGL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seRvyVkZ8Z3uqv0Jm7+Desy1Zj1OJn/k/BsxpQar31h+sxEVcICUnUhXiUQBi4xTGx6370oUUgEjll+XtpII2jaCXANRgBhlcoTDW7IDw4LZNI5RNTsnPWgWyAVN7UH6dvstzEkUlcp3eNLBbCsZnIXipnYv1SDhJMXa34yneXfAlY/2HXmjtcdcwnIPMUA8jkF0VM7Aiv8k50NP8l+oNRO63WoGSn+Du+iQqm9yAyxQ79J57jxGKWNbKtq/TayrL0kBW9T5yV1OmEK2o6GMxOa8gvZL6RLzE9IAQlmBgKbhWZeZReMXEv8VrYsBo/9MUsx5cmlZUeyNVct8NxICDh5BoOuW7dZkrBCTTHXQNvGI+5nPdO1gV1sv6oI75LkJkNVejzY6F+GDT5sqDz80q0Hi8sblN8TaM/ErMN5owujlFISTEnTpAbaHQwSNf6z X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 475ca1c8-411f-402f-485b-08db40f0ceb3 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 16:12:00.9098 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RlQ+YSeIikrBcNmIqqrMQNrBudwIYaH/4aadbrPQx4XFuk9NjAVcYXw9J9R0wfY8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6342 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org No reason to open code this, use the proper helper functions. Signed-off-by: Jason Gunthorpe Reviewed-by: Kevin Tian --- drivers/iommu/iommu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index c486e648402d5c..73e9f50fba9dd2 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -496,7 +496,7 @@ static void __iommu_group_release_device(struct iommu_group *group, kfree(grp_dev->name); kfree(grp_dev); dev->iommu_group = NULL; - kobject_put(group->devices_kobj); + iommu_group_put(group); } static void iommu_release_device(struct device *dev) @@ -1063,8 +1063,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; mutex_lock(&group->mutex);