From patchwork Tue May 30 17:09:57 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: 13260790 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 9E218C7EE2F for ; Tue, 30 May 2023 17:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233011AbjE3RKG (ORCPT ); Tue, 30 May 2023 13:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjE3RKD (ORCPT ); Tue, 30 May 2023 13:10:03 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3A30C9; Tue, 30 May 2023 10:10:01 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1685466599; bh=apIFDLHl3uyZ3nUh5SjhWlSyk5P+UTn/1j0vvZ5474M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oPF56zRQrlugpPXKlPAegMLvT8bylBT6l6eq0rW00XU8jltV+SONKMfkNdeHt0FgC A1+k39drMfa3hR/yGkObcA8Bp3nMK5SugOSAEWJndacstmFZSRj/HkMJnIgDFQfUNr rerf/z8GpUbUmTsAddDPa3IcV6M+oa4ep+KXfDy4= Date: Tue, 30 May 2023 19:09:57 +0200 Subject: [PATCH v3 1/4] block: constify partition prober array MIME-Version: 1.0 Message-Id: <20230419-const-partition-v3-1-4e14e48be367@weissschuh.net> References: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> In-Reply-To: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= , kernel test robot X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1685466599; l=830; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=apIFDLHl3uyZ3nUh5SjhWlSyk5P+UTn/1j0vvZ5474M=; b=IFJ0t3Kix1Cs0Berp2pyXH7ZCfDifLrNQG5HeDr/OAwefjYUQYpW5RGF+nbqHWjQzd7iKD9eR U+Y+YkpnlSIACPpgz2RrEK20+BHx3DDi8ktcWcGrALyEfNvDHNqGilY X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The array is never modified so it can be const. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202304191640.SkNk7kVN-lkp@intel.com/ Signed-off-by: Thomas Weißschuh --- block/partitions/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 49e0496ff23c..650603dbe557 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -12,7 +12,7 @@ #include #include "check.h" -static int (*check_part[])(struct parsed_partitions *) = { +static int (*const check_part[])(struct parsed_partitions *) = { /* * Probe partition formats with tables at disk address 0 * that also have an ADFS boot block at 0xdc0. From patchwork Tue May 30 17:09:58 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: 13260791 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 7F428C7EE31 for ; Tue, 30 May 2023 17:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232806AbjE3RKG (ORCPT ); Tue, 30 May 2023 13:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbjE3RKD (ORCPT ); Tue, 30 May 2023 13:10:03 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9954C5; Tue, 30 May 2023 10:10:01 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1685466599; bh=TDcsEObqDEqUFLkaZxdwkd+rbgOVyl6Oeik3NcBOSJo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NVp1GAsc19XCcuvXfWwL4+XSe4WPk8xkDet4rXnspI2mkeaOZAay9LskXQsImgW9B urF5EHovX1hXysn8AKuGSu1/c0qbYigqKProQ1FTA46qk/fDx0Ds+W3NeB7JqWp8N9 Kof9jDuAgN0sShbMQVKkj66ZjH4ACbqmPXtODpbA= Date: Tue, 30 May 2023 19:09:58 +0200 Subject: [PATCH v3 2/4] block: constify struct part_type part_type MIME-Version: 1.0 Message-Id: <20230419-const-partition-v3-2-4e14e48be367@weissschuh.net> References: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> In-Reply-To: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1685466599; l=1107; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=TDcsEObqDEqUFLkaZxdwkd+rbgOVyl6Oeik3NcBOSJo=; b=oSjURq96HBDYpKY4JnJWySWXwkVKz7vIQEklCwkAZjytNGPBfRim/ebjLzos8T71z3svTYHrU fTq8h33Ac+BCFjyMYG6aylqqquIJCwO14CHEv7SYZ/gpPTmN2B2dxUJ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The struct is never modified so it can be const. Signed-off-by: Thomas Weißschuh --- block/partitions/core.c | 2 +- include/linux/blkdev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 650603dbe557..2bc21063edef 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -256,7 +256,7 @@ static int part_uevent(const struct device *dev, struct kobj_uevent_env *env) return 0; } -struct device_type part_type = { +const struct device_type part_type = { .name = "partition", .groups = part_attr_groups, .release = part_release, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index b2ac587e3402..d89c2da14698 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -41,7 +41,7 @@ struct blk_stat_callback; struct blk_crypto_profile; extern const struct device_type disk_type; -extern struct device_type part_type; +extern const struct device_type part_type; extern struct class block_class; /* From patchwork Tue May 30 17:09:59 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: 13260788 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 EECFDC7EE23 for ; Tue, 30 May 2023 17:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232524AbjE3RKE (ORCPT ); Tue, 30 May 2023 13:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbjE3RKD (ORCPT ); Tue, 30 May 2023 13:10:03 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8797AB0; Tue, 30 May 2023 10:10:01 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1685466599; bh=peTYqiDIJwMTxZXYjxcESzL+meJW7xb6TLmkgWy1rDc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MmjqZ4Bwp3Be9YZkCiQrCu81B7RID2MZyRYNDKbotmDWxShteyHcm1yIXpHbWaMMz ixOQuE0fZAoVnWX0HxLiz+EoZ2ijRs8ub7JyJRcOojiVC5rIp49fVbWYZswP3IwpnH WijGAA3AtwxEYEWjAsuf2R+b8xhgzBN1F2G5BHkY= Date: Tue, 30 May 2023 19:09:59 +0200 Subject: [PATCH v3 3/4] block: constify struct part_attr_group MIME-Version: 1.0 Message-Id: <20230419-const-partition-v3-3-4e14e48be367@weissschuh.net> References: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> In-Reply-To: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1685466599; l=600; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=peTYqiDIJwMTxZXYjxcESzL+meJW7xb6TLmkgWy1rDc=; b=+Z0u8TxxAEUMeMtX7vnTcg9bBfSWnxQKVHdDaMkRx8ThH4UBGbG+XxJDmSna8Y+jVPy8qvJa3 vMWFel4P/ptBSHvxB1hRLoMenbH1i+utkQEHWKC7N7gBxWKydnFQlN0 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The struct is never modified so it can be const. Signed-off-by: Thomas Weißschuh --- block/partitions/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 2bc21063edef..d5f5633bf725 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -228,7 +228,7 @@ static struct attribute *part_attrs[] = { NULL }; -static struct attribute_group part_attr_group = { +static const struct attribute_group part_attr_group = { .attrs = part_attrs, }; From patchwork Tue May 30 17:10:00 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: 13260789 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 48843C7EE24 for ; Tue, 30 May 2023 17:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbjE3RKE (ORCPT ); Tue, 30 May 2023 13:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbjE3RKD (ORCPT ); Tue, 30 May 2023 13:10:03 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97BABE; Tue, 30 May 2023 10:10:01 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1685466599; bh=hwbEAsSX9O3Q/FuzB+mJE3YvogxYgzykVJP1zCu7+7U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dm5eUFL/Yka8KKt3Elb7WyHilwbgTER89Scv87Yw00J6QKGMcZSyfiUp3TZm/mEHQ 6uD706PdJm/hf8D42aD6iVBxmJZ/IzJrlmIf8VubNXHEv9DoFbRrqG/MpAojAD0mqm RQSSC9Jnbjq25duMBmt3HiqgvWID9DqTt9cEvrVM= Date: Tue, 30 May 2023 19:10:00 +0200 Subject: [PATCH v3 4/4] block: constify the whole_disk device_attribute MIME-Version: 1.0 Message-Id: <20230419-const-partition-v3-4-4e14e48be367@weissschuh.net> References: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> In-Reply-To: <20230419-const-partition-v3-0-4e14e48be367@weissschuh.net> To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1685466599; l=692; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=hwbEAsSX9O3Q/FuzB+mJE3YvogxYgzykVJP1zCu7+7U=; b=7NcHib0T8ZH6rifFN3Q7kFkaNeaNU7I9XZVb1eBcPLgzE6m08e+M8Gl0HbY2viAm80dmpnutw S6PR66DIfqTCCyKdlad2aDDWuA7RusQ/vaGZnqjDuw5E9eFI/dahrcx X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The struct is never modified so it can be const. Signed-off-by: Thomas Weißschuh --- block/partitions/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index d5f5633bf725..82d26427deae 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -288,7 +288,7 @@ static ssize_t whole_disk_show(struct device *dev, { return 0; } -static DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL); +static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL); /* * Must be called either with open_mutex held, before a disk can be opened or