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 6BC2BC636CC for ; Thu, 16 Feb 2023 06:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbjBPG7H (ORCPT ); Thu, 16 Feb 2023 01:59:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbjBPG7F (ORCPT ); Thu, 16 Feb 2023 01:59:05 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F681F92F for ; Wed, 15 Feb 2023 22:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RgQ3dStbuqA3MyHPiSK9lgXyHpToH26LxqUJEAcMrDlMm1W/lMdIdVxZAQku+9aBfqzFnuzPx9cf5d4XSKvCT7Sv+FAg3AbHzHCPoYA0afUJEdUjWs3OktENCOK8FP3crZrrdZDJ44u6Vdaj1d2DWF44a5TV8kQM8zsCETJ8H4c85ycRjAMQvENKBSvBwS19UIIsv6bjsQrW5d2aWZkLI0uxG8kZZ9HaEAXOMwk/vhNM5d2MaeJ27H79tkW8aGI8a6lgqJHxgzWtN7EfAVybh+Zsz0Uuwi18EVv62c2KorZJ61JlIVFXR6wV+mhKQeRtY+wjuv4vDYzt/OxC2umxig== 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=lGlC97RgIXSWT2N/hqrSClBkyPGbRVbLnd7D58br+RM=; b=C0WorjvSeW153L8dSMTo+On/5pdHZlRQCWGvYUSpfLwfO20GH5bYx6etLpZsHp8UaB9x70D46LOvj5hiQgT/hMUE8oV3yak5yva+tJbLYlhSE1vpzSMlwH1KCdUIE6Q9FPAytw857fwbG1UUYXvaOcMGtuJWYDJxnKTuc+ktNYY1zV0FenhrGs0k8q5coHs/qsHvBdZADDNtV//vZcSVzw2VQmleBEjhahZttwzPLPUolwBvzcBznlIr1lTipke/gQ21Wuc/NIjnloRvtjpEIKKNvluU9leYGfH2D6ntHtGTPGA9BlgZSD7u6NBjWExCXRpXjC6K2VdGCpkgbSWLPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lGlC97RgIXSWT2N/hqrSClBkyPGbRVbLnd7D58br+RM=; b=12a0sBqGTZcb9HjxWOBDbxxO1SVtw95K6XuJW19/eHKfS18XwAPE7h7ztKi4eDpqeMwYH9ariz8t9ZZ2IQMsBGTTYE7n66k1rDZZvnMEoqg8+Hy8TX0jqE7/C8Zydds6U7i2DETXdYw+IQXmehFVC9CC03RoUaVjprpazTm1QAk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by MW3PR12MB4540.namprd12.prod.outlook.com (2603:10b6:303:52::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 06:58:53 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::2e4f:4041:28be:ba7a]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::2e4f:4041:28be:ba7a%6]) with mapi id 15.20.6111.013; Thu, 16 Feb 2023 06:58:53 +0000 Message-ID: Date: Thu, 16 Feb 2023 07:58:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] drm/amdgpu: make kobj_type structures constant Content-Language: en-US To: =?UTF-8?Q?Thomas_Wei=c3=9fschuh?= , Alex Deucher , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20230216-kobj_type-amdgpu-v1-1-b382ab606dc7@weissschuh.net> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <20230216-kobj_type-amdgpu-v1-1-b382ab606dc7@weissschuh.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR2P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:92::18) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|MW3PR12MB4540:EE_ X-MS-Office365-Filtering-Correlation-Id: 28c8376c-cf38-4be0-2828-08db0feb43a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vop2Vt3Q7z4YUnePptsbIIKPvySR5XepuCp1TfGs8tajNY/UVrik4guU1W1/vmXNyRivc8nWpI8QkH/AJWhP+pD1e5MaK8i1sFnb+aeLQBnhcFa5Yc3WOgysqZFMjkqM9Uj8akAIfv0Z8301E1bWmeVRKfBBZrGnHNewkXy4NGPRcqdw8pdHjZox0moQuEF6Xpff4kYQwiLDGKSiX90GfMa13xqvcOJ/ipS23/vsjlh/N7bEz0Z7sImT8iO0ewDUIxQnK75P9+SSgvnWRJ7U7KWe/7bjpy4G/IdpWHbu7j8UX23MPvcUCe1auwtdjgJb9yLbNY29XrKT3VZwG5xIcS++LtkHlb5cDo/i5DibWEp/8Om8PuE58Kbqj/yo+KIK4+PNvnOI22vOEndn/+E6bV9dLyQUIVFJ+SUY9O1USILInoHljmt6MhW2DSN25dvMHaPmg+7e8AblaQ5FtIiMlC5GiBn2XVJgJakxbGGjFqSbu2v4vJQOfC8VUUH1OeTC/mut9dhnEO/vkntj1bB/LLOPjb0WUGsM6zfGeByTP3lUu0vlPNVE8BaOpcM5xMELUTNTZEeMx0aJCac20CFqsReI9PaZfQt4ktdqdOobw8Vl9LbZmfKba8RHao2C3OOyVZhR0EFbs6YTAKqlkfOxaw5SW6zHpPNxWfh7IYH9nkmy9PZ5h5U+pG0tOemmUf90WHlA2FNQTqrWctQAqoX5U+gBTFx+ZHgYaCAcclhxNSs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3587.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(346002)(396003)(376002)(39860400002)(366004)(451199018)(5660300002)(8936002)(8676002)(41300700001)(2906002)(66476007)(4326008)(66556008)(66946007)(316002)(110136005)(31686004)(6512007)(6666004)(186003)(478600001)(6486002)(6506007)(26005)(36756003)(2616005)(83380400001)(38100700002)(86362001)(31696002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?T1B2ZUNXZ244eDJjSGFLajcrcW9xTmtLOFlwTXlVWUFWL2NCL2owb3VnT3Vv?= =?utf-8?B?SEIzNkRhL0RWNzk5QmRURkFGUVYwZExuSG8zYjgvMGdrWnlBQ0RSYzVLV3dW?= =?utf-8?B?MTd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tOKzYvejBLaWlnUUJJVFgz?= =?utf-8?B?ejZMbzZMQU1mMFduWWhkMUZsMEtHeEs0amI0UlY5SER3VjI2bCtBbmhJRVM2?= =?utf-8?B?aElWb1FaSUJwWUZDQ3J5WVFpdHpGQlBySklnQ2pxSnFMSllMVHJjZTd0N3Va?= =?utf-8?B?a0FVUmN0dlpQMno4VlY2OU54SDNTRTdNQ0dRNEU4TVNCMUFCd2lsSlhlTnFB?= =?utf-8?Q?W/GxBDreDHAJIKtbcdc8RYjU1?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28c8376c-cf38-4be0-2828-08db0feb43a7 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 06:58:53.2003 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7cg5gzUAZnjWy6wUXOlCUYZIytw5uEkxVqIRFV20gUdacA1ZA6dZBzxekTy/tTE5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4540 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 16.02.23 um 02:07 schrieb Thomas Weißschuh: > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") > the driver core allows the usage of const struct kobj_type. > > Take advantage of this to constify the structure definitions to prevent > modification at runtime. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Christian König > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 10 +++++----- > drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 2 +- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c > index 1bbd56029a4f..8e04952e5144 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c > @@ -704,7 +704,7 @@ static void ip_hw_instance_release(struct kobject *kobj) > kfree(ip_hw_instance); > } > > -static struct kobj_type ip_hw_instance_ktype = { > +static const struct kobj_type ip_hw_instance_ktype = { > .release = ip_hw_instance_release, > .sysfs_ops = &ip_hw_instance_sysfs_ops, > .default_groups = ip_hw_instance_groups, > @@ -723,7 +723,7 @@ static void ip_hw_id_release(struct kobject *kobj) > kfree(ip_hw_id); > } > > -static struct kobj_type ip_hw_id_ktype = { > +static const struct kobj_type ip_hw_id_ktype = { > .release = ip_hw_id_release, > .sysfs_ops = &kobj_sysfs_ops, > }; > @@ -786,18 +786,18 @@ static const struct sysfs_ops ip_die_entry_sysfs_ops = { > .show = ip_die_entry_attr_show, > }; > > -static struct kobj_type ip_die_entry_ktype = { > +static const struct kobj_type ip_die_entry_ktype = { > .release = ip_die_entry_release, > .sysfs_ops = &ip_die_entry_sysfs_ops, > .default_groups = ip_die_entry_groups, > }; > > -static struct kobj_type die_kobj_ktype = { > +static const struct kobj_type die_kobj_ktype = { > .release = die_kobj_release, > .sysfs_ops = &kobj_sysfs_ops, > }; > > -static struct kobj_type ip_discovery_ktype = { > +static const struct kobj_type ip_discovery_ktype = { > .release = ip_disc_release, > .sysfs_ops = &kobj_sysfs_ops, > }; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c > index 4b9e7b050ccd..6d13ce6ec9cc 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c > @@ -228,7 +228,7 @@ static const struct sysfs_ops amdgpu_xgmi_hive_ops = { > .show = amdgpu_xgmi_show_attrs, > }; > > -struct kobj_type amdgpu_xgmi_hive_type = { > +static const struct kobj_type amdgpu_xgmi_hive_type = { > .release = amdgpu_xgmi_hive_release, > .sysfs_ops = &amdgpu_xgmi_hive_ops, > .default_groups = amdgpu_xgmi_hive_groups, > > --- > base-commit: 033c40a89f55525139fd5b6342281b09b97d05bf > change-id: 20230216-kobj_type-amdgpu-4d3f0e1e05d4 > > Best regards,