From patchwork Wed Apr 19 13:22:53 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: 13216799 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 AC2F5C77B7E for ; Wed, 19 Apr 2023 13:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233450AbjDSNXX (ORCPT ); Wed, 19 Apr 2023 09:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233137AbjDSNXV (ORCPT ); Wed, 19 Apr 2023 09:23:21 -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 A2D3A83F7; Wed, 19 Apr 2023 06:22:57 -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=1681910575; bh=F1Xh/pDNAlchgFKirA0vgid7PL0x67US+gdddb/wlr4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VNIRAemzz0YzaaaYfycLL5n96oMcnfjzaSn+rSAqGd5jKy3U+Lcnygbi4iJbVWwcO iq2n6Ry4eGkUuI7mNVkZjgy4QOFGROvd2j0tsXElI93P3VtTBcuxvzzoi2yRCcoFyB nvDTZASfh42ptV99LsX2cV6gNT1lfBpMQv0lNxvc= Date: Wed, 19 Apr 2023 15:22:53 +0200 Subject: [PATCH v2 1/4] block: constify partition prober array MIME-Version: 1.0 Message-Id: <20230419-const-partition-v2-1-817b58f85cd1@weissschuh.net> References: <20230419-const-partition-v2-0-817b58f85cd1@weissschuh.net> In-Reply-To: <20230419-const-partition-v2-0-817b58f85cd1@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=1681910574; l=828; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=F1Xh/pDNAlchgFKirA0vgid7PL0x67US+gdddb/wlr4=; b=VuyLji4uA3RU0pCdR8qOs9X6x53gpMW01ICgxehm6k/R3hR/2nK1o5yq5lHod71uW2GsxbcWr 7ZS+XtaJqhWDXmBVHPvQz6uVBwUMCKoIac5GOj8V8uRDAwcyZoEj5fJ 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 Link: 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 7b8ef6296abd..890072ae5c7c 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 Wed Apr 19 13:22:54 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: 13216798 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 B7165C77B75 for ; Wed, 19 Apr 2023 13:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233383AbjDSNXW (ORCPT ); Wed, 19 Apr 2023 09:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232538AbjDSNXV (ORCPT ); Wed, 19 Apr 2023 09:23:21 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAAB09D; Wed, 19 Apr 2023 06:22:57 -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=1681910575; bh=/NP/SzJYqje2B6An2X0zaHYKDmfg6cIoTAC4LTa0nsU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DjC6xogZ8vdoAuknx8BDGfPaRnykrz9xcRbgVW7nzGMeqQ50VZGDA3DvVCHBfD/nJ WqAt4yvnq17RtZOl7UY/0OluKSeGw6C655enulLswcs2Yn+oyuMF1qiUjhWQQeNQuT zoZMF/ERau7yAZyzo+ehmaJXuufOS5qB5EcTPvn8= Date: Wed, 19 Apr 2023 15:22:54 +0200 Subject: [PATCH v2 2/4] block: constify struct part_type part_type MIME-Version: 1.0 Message-Id: <20230419-const-partition-v2-2-817b58f85cd1@weissschuh.net> References: <20230419-const-partition-v2-0-817b58f85cd1@weissschuh.net> In-Reply-To: <20230419-const-partition-v2-0-817b58f85cd1@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=1681910574; l=1158; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=/NP/SzJYqje2B6An2X0zaHYKDmfg6cIoTAC4LTa0nsU=; b=RVEwfL+7+5QpTdEBliTOBBgh4In8m9UisuGjkigMRMGT226hZAkSI0rhApMZVMjiPiKT2DD/r M3GggOalo1+DiojreFTyVLjtR78spWyBhje4gDEmoB2zUBnRPehI5jC 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 890072ae5c7c..43bde8118a78 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -264,7 +264,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 941304f17492..de783481ec71 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; /* Must be consistent with blk_mq_poll_stats_bkt() */ From patchwork Wed Apr 19 13:22:55 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: 13216797 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 28C3FC6FD18 for ; Wed, 19 Apr 2023 13:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233014AbjDSNXV (ORCPT ); Wed, 19 Apr 2023 09:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbjDSNXV (ORCPT ); Wed, 19 Apr 2023 09:23:21 -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 AA7F2146E4; Wed, 19 Apr 2023 06:22:57 -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=1681910575; bh=kF2K3Rlh4UxwVdG+nyD6f0YN/COQ4qVDn3yxp2SKVxc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YFcCgHB8hGVlTs6lQ4T9459c4/d4RD3GEKKZ6KWt41n4/reI6B9YihsWBxTuhXcGe ZJ2q4Lm8Q1519saGzleo4rXllH3ATrhOp+8odSpXU2VUCGYNS47aTycBDc5SLXGlPk txYPxfm5rUXQ8DsBx0VWYqP4eurgBl6AngEUgVnE= Date: Wed, 19 Apr 2023 15:22:55 +0200 Subject: [PATCH v2 3/4] block: constify struct part_attr_group MIME-Version: 1.0 Message-Id: <20230419-const-partition-v2-3-817b58f85cd1@weissschuh.net> References: <20230419-const-partition-v2-0-817b58f85cd1@weissschuh.net> In-Reply-To: <20230419-const-partition-v2-0-817b58f85cd1@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=1681910574; l=600; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=kF2K3Rlh4UxwVdG+nyD6f0YN/COQ4qVDn3yxp2SKVxc=; b=hGep4w3kBAcn2BOjS1uLDC86/cXeBxeh1sDHAoHUGWD8Pzz7IlRumdd7npMtycAN4auCvh7xQ P701kG2CAYvBm+/VUjf4ZtHX2qeArE5wFJh037KFpKqwZ10UILi7IMP 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 43bde8118a78..cb37ac71868e 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -236,7 +236,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 Wed Apr 19 13:22:56 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: 13216801 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 C40D3C77B7F for ; Wed, 19 Apr 2023 13:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbjDSNXY (ORCPT ); Wed, 19 Apr 2023 09:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233285AbjDSNXW (ORCPT ); Wed, 19 Apr 2023 09:23:22 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF871544B; Wed, 19 Apr 2023 06:22:57 -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=1681910575; bh=8DxUrecEQXlbonVWV4Ctfw1+JpOz8+kV4zNOKiNZtnI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EuPD8BRIlvKUCLVjp7Upw3ZZO5pD4ibHJE9vtrc4epUR2LZaoLh9ECIH+2n32WZ4m cjxNEGlufps3Mm6d4lT5ibxTd1/9caMUNAT0U/0V9ZjKhemjWY9rC8g/1NDoV+ZNNy /9K9OkyjZ35rAPk5FiE7xu0MlAS46KPL/txh+XUg= Date: Wed, 19 Apr 2023 15:22:56 +0200 Subject: [PATCH v2 4/4] block: constify the whole_disk device_attribute MIME-Version: 1.0 Message-Id: <20230419-const-partition-v2-4-817b58f85cd1@weissschuh.net> References: <20230419-const-partition-v2-0-817b58f85cd1@weissschuh.net> In-Reply-To: <20230419-const-partition-v2-0-817b58f85cd1@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=1681910574; l=692; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=8DxUrecEQXlbonVWV4Ctfw1+JpOz8+kV4zNOKiNZtnI=; b=W8wtHEqlEeRjokNrSDbMW0sWD5kabWuQvCIsJIndbub7dUQ4ew9L9Tn1wyDt7ehZLINwcbk5q EJhucksR1XXAklmW8BR7VVTUdQzMu/jEbFgwm4/erFLRVkb9Mop3OdE 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 cb37ac71868e..302ac06708e6 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -296,7 +296,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