From patchwork Tue Feb 7 16:40:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13131851 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 7557EC6379F for ; Tue, 7 Feb 2023 16:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbjBGQlM (ORCPT ); Tue, 7 Feb 2023 11:41:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbjBGQlJ (ORCPT ); Tue, 7 Feb 2023 11:41:09 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E681B274B0; Tue, 7 Feb 2023 08:41:05 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1675788063; bh=tp+CWN/+yd0W5v40fAP7KUNvPikSs18mqdmw2p/hWRQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uU7CtPzTe5MIdEJlgHEWag/l3jX6vrydTTGUfZIqXOaWJdnWufzuyGe4O3asl+pnH QHnYdovuCepK5wCDGKe+9dBUucVotrl4L+q6KzIUd28cHpwn1d7DHroyNmisN0yZNK xkxmx494gvgBM3oRi2zlVU4ffreGvxvgjQJAfDDg= Date: Tue, 07 Feb 2023 16:40:44 +0000 Subject: [PATCH 1/3] platform/x86: dell-wmi-sysman: Make kobj_type structure constant MIME-Version: 1.0 Message-Id: <20230207-kobj_type-pdx86-v1-1-8e2c4fb83105@weissschuh.net> References: <20230207-kobj_type-pdx86-v1-0-8e2c4fb83105@weissschuh.net> In-Reply-To: <20230207-kobj_type-pdx86-v1-0-8e2c4fb83105@weissschuh.net> To: Divya Bharathi , Prasanth Ksr , Hans de Goede , Mark Gross , Mark Pearson , Justin Ernst Cc: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675788060; l=970; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=tp+CWN/+yd0W5v40fAP7KUNvPikSs18mqdmw2p/hWRQ=; b=r+Yj3iPMAqit28OyyFW6s0X1kVp5YaUfTfUEdIhs49LoYnIfd25FZNQBxHpJ8uatoR5RJoIM5 oD3j9bavBN/DztOA/U4NVZEbGhwbLBuFvhxNPYL5w631fosssBW3lpv X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org 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 definition to prevent modification at runtime. Signed-off-by: Thomas Weißschuh --- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c index 0a6411a8a104..0285b47d99d1 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c @@ -255,7 +255,7 @@ static void attr_name_release(struct kobject *kobj) kfree(kobj); } -static struct kobj_type attr_name_ktype = { +static const struct kobj_type attr_name_ktype = { .release = attr_name_release, .sysfs_ops = &wmi_sysman_kobj_sysfs_ops, }; From patchwork Tue Feb 7 16:40:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13131849 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 AD34DC636D6 for ; Tue, 7 Feb 2023 16:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbjBGQlK (ORCPT ); Tue, 7 Feb 2023 11:41:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbjBGQlJ (ORCPT ); Tue, 7 Feb 2023 11:41:09 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7260B227BA; Tue, 7 Feb 2023 08:41:05 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1675788063; bh=sIINCN7IeSQnZAy+3mzwnlsDKx8GVmGFg6BN70eqw0Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RUKWslX5NK+uR2zMHAaLg8sRLcKc5KnQ8I4RgGW1I8k8rYyjLlE4SQ8QrzH0BvHfG QTrGmBMRvB6LrC6d0APNr/4GzdhsNg/5gBFNMS+fxOyREVvssT4Pk+UifRBY5uG455 NW3yxZK5nUwfbL2L7Cd+ebx1hBJ56ifVXDn5gDig= Date: Tue, 07 Feb 2023 16:40:45 +0000 Subject: [PATCH 2/3] platform/x86: think-lmi: Make kobj_type structure constant MIME-Version: 1.0 Message-Id: <20230207-kobj_type-pdx86-v1-2-8e2c4fb83105@weissschuh.net> References: <20230207-kobj_type-pdx86-v1-0-8e2c4fb83105@weissschuh.net> In-Reply-To: <20230207-kobj_type-pdx86-v1-0-8e2c4fb83105@weissschuh.net> To: Divya Bharathi , Prasanth Ksr , Hans de Goede , Mark Gross , Mark Pearson , Justin Ernst Cc: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675788060; l=1130; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=sIINCN7IeSQnZAy+3mzwnlsDKx8GVmGFg6BN70eqw0Q=; b=BLAqaxlzMZjuN+CxSMEkYS+JiIpaysfVsDa9fZY5W6OT26a8bZ83Ei0smpmgFWxNkHrZz7sUj De9jdoAKlJHAG6GyqiLerzVyLWwIE5hPXslSTLzRibzpdaS5kTIlu5Z X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org 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 definition to prevent modification at runtime. Signed-off-by: Thomas Weißschuh --- drivers/platform/x86/think-lmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index a01a92769c1a..b616e4501cb2 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1089,12 +1089,12 @@ static void tlmi_pwd_setting_release(struct kobject *kobj) kfree(setting); } -static struct kobj_type tlmi_attr_setting_ktype = { +static const struct kobj_type tlmi_attr_setting_ktype = { .release = &tlmi_attr_setting_release, .sysfs_ops = &tlmi_kobj_sysfs_ops, }; -static struct kobj_type tlmi_pwd_setting_ktype = { +static const struct kobj_type tlmi_pwd_setting_ktype = { .release = &tlmi_pwd_setting_release, .sysfs_ops = &tlmi_kobj_sysfs_ops, }; From patchwork Tue Feb 7 16:40:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13131850 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 42EC0C636CC for ; Tue, 7 Feb 2023 16:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231331AbjBGQlK (ORCPT ); Tue, 7 Feb 2023 11:41:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbjBGQlJ (ORCPT ); Tue, 7 Feb 2023 11:41:09 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E4344AE; Tue, 7 Feb 2023 08:41:05 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1675788063; bh=TV/He8u1kfiZlTL0/7QF9LBr+vgFExVcFn1jZsSmxKc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Np0p/qX6fF/BkRtANswQUP/kXDWMU/QH1abMmv+dcm/wpn/3u4NL/WGKve8c243XR +6Enk9Zt8EX6JSP3TB5VYkS+jHc5Yj0I9x476Mr820QHDAomsCR8YIRoY0kzAvAGWs iV3GQ52UEwrRlE1fegGQ2dTI6UdJzQBTh+pwlMEk= Date: Tue, 07 Feb 2023 16:40:46 +0000 Subject: [PATCH 3/3] x86/platform/uv: Make kobj_type structure constant MIME-Version: 1.0 Message-Id: <20230207-kobj_type-pdx86-v1-3-8e2c4fb83105@weissschuh.net> References: <20230207-kobj_type-pdx86-v1-0-8e2c4fb83105@weissschuh.net> In-Reply-To: <20230207-kobj_type-pdx86-v1-0-8e2c4fb83105@weissschuh.net> To: Divya Bharathi , Prasanth Ksr , Hans de Goede , Mark Gross , Mark Pearson , Justin Ernst Cc: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675788060; l=1514; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=TV/He8u1kfiZlTL0/7QF9LBr+vgFExVcFn1jZsSmxKc=; b=JXG663aio6LtX4AEJ6H51TedaQpcygBJSufjXli4A9UDwVKGTZ2zttN9PPdEa3N28PN7WxaRW QbPVsrCML4IDqI7067eObmBgetVSZaXP9sFoMGmBmtylvByqxHtX46U X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org 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 definition to prevent modification at runtime. Signed-off-by: Thomas Weißschuh Reviewed-by: Justin Ernst --- drivers/platform/x86/uv_sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c index 73fc38ee7430..38d1b692d3c0 100644 --- a/drivers/platform/x86/uv_sysfs.c +++ b/drivers/platform/x86/uv_sysfs.c @@ -203,7 +203,7 @@ static const struct sysfs_ops hub_sysfs_ops = { .show = hub_type_show, }; -static struct kobj_type hub_attr_type = { +static const struct kobj_type hub_attr_type = { .release = hub_release, .sysfs_ops = &hub_sysfs_ops, .default_groups = uv_hub_groups, @@ -356,7 +356,7 @@ static const struct sysfs_ops uv_port_sysfs_ops = { .show = uv_port_type_show, }; -static struct kobj_type uv_port_attr_type = { +static const struct kobj_type uv_port_attr_type = { .release = uv_port_release, .sysfs_ops = &uv_port_sysfs_ops, .default_groups = uv_port_groups, @@ -528,7 +528,7 @@ static const struct sysfs_ops uv_pci_top_sysfs_ops = { .show = pci_top_type_show, }; -static struct kobj_type uv_pci_top_attr_type = { +static const struct kobj_type uv_pci_top_attr_type = { .release = uv_pci_top_release, .sysfs_ops = &uv_pci_top_sysfs_ops, };