From patchwork Wed Sep 4 14:17:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13790972 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5957CCA0ED3 for ; Wed, 4 Sep 2024 14:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ELDHVvYsM0/cFEKySzl95MUb/4tJhoB1VGQyY2w6COY=; b=HmRiTLQoJcIm6vAV9M8pBjFznZ Ecv0AP0oPtQxNtk4xEITy1d8e73KyB31UTJuNROnYwCoIHAvr5K6hlLO7dPOd2wyL15b2LNuZXt2A Vl14LJ9+LPqBMo8bGfu//3GA6TRBTS0Vjs6MzrpjgX+Qa8COCcfYtT4hgEjWBxbTc+CIQs+1u73eb cSuhKmyyk9zq57uspisTXEVF31RY2GSRtJQpFAHay33f5/CQtFFAun3TvZDLukFJMLbh1FgP5VssI 1V9dAQuuJ8fxCRBx7YOeLjiHbETco60u8EWCUKMnDYv4Vw3/o+tSVNUAq37z5aOTpZr0y8LPcYv2m cZ6AOSJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slqrY-00000004kus-37s6; Wed, 04 Sep 2024 14:20:00 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slqpZ-00000004k01-31iQ for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 14:18:01 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-374ca7a10d4so1954066f8f.3 for ; Wed, 04 Sep 2024 07:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725459475; x=1726064275; darn=lists.infradead.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=ELDHVvYsM0/cFEKySzl95MUb/4tJhoB1VGQyY2w6COY=; b=BPO/stU7Z7KtJWprbaj5c5C4h8c5tZH3f/QYaj2kSkGaZR3mWoOUHtawnPR9yHFi+P pXE763s9jk9uvI1AQnAX31iUh179EkTYJgh4MS2O3fmzP3cnJdzqYi9UdUfvLWgfzs4A oe+l1LO+Qrb6vrey0sYrozy7N6EBf0JmLK9xuGuWmXFZUzC1ZzfOV+0DsXYS+kdXIUZY VZbo20UwZ7kmveVmTPsDP2tpxXZ72Wduo1IGzsXDz/UsqyF5t+Qj4x+KoQQaHvFG4ibA ePw/x7JRjJS+6LFXUDTt6oHJfBik/dwbb++P2gfCDGs/hH4n3lhBGhj3CYRd05L5LJ+D vb0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725459475; x=1726064275; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ELDHVvYsM0/cFEKySzl95MUb/4tJhoB1VGQyY2w6COY=; b=R4edktVA5q9FlP+0SXBQ9/KvqN/XuKL/NsMOffY8rrUOmvkbT1/+/xIH7SEdu321LD CDzVMOMoNbSxp0xQsWgZnCHjbsrWDXeh+JdwPnWedBXQtc56lWisMnqOeKzmJrjd0FzQ LobcAKc2kkivvD3IuskgFqG76YluahejgTi3Sqq0NGeeMSHRHshhhKoH499wHyYFwQOz arOErikqSmsC3eAlg88YC+l4ls6i43QvIKeHVro4GbfzCK+D5os99FppB4XsusbBLAic EFasqUV9E/81lKaNUXbn2dWRtIGygoUA17qmYwaGvkd4uNhTt8mmOkFNEwzDaBXW3c5e GHMQ== X-Forwarded-Encrypted: i=1; AJvYcCVzbjWz9BQGFK2AAecylgGMKPqi/Ffs9CUlgIGYN6GEsm79pm1kzmErkmDLV4MzWP1IcxEu7LLpZ+mep6n8Cklz@lists.infradead.org X-Gm-Message-State: AOJu0YwMeh+LsLjbk8a50e1bTeinJGtzsKI96Z7yrjFGKMEb3etuLu44 pdew2z9gB31I0u+UMd6w3k3PHMMMI9H3fwWScf7htmCtmWbXZCuED68t7cOpTVSXy0DX67AgU/B kIC0= X-Google-Smtp-Source: AGHT+IGkD3blpPqv6B8eGGu6NVRvgAJ4j0fFjCWqCu3ka/hfnJLfo9Cgeq7k7QsaXhiUlobUpmTbug== X-Received: by 2002:adf:e407:0:b0:374:ba61:b77e with SMTP id ffacd0b85a97d-374ba61b935mr8044857f8f.63.1725459474751; Wed, 04 Sep 2024 07:17:54 -0700 (PDT) Received: from localhost (189-18-187-19.dsl.telesp.net.br. [189.18.187.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d8c4d6e012sm7272417a91.29.2024.09.04.07.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 07:17:54 -0700 (PDT) From: "Ricardo B. Marliere" Date: Wed, 04 Sep 2024 11:17:23 -0300 Subject: [PATCH v2] bus: fsl-mc: constify the struct device_type usage MIME-Version: 1.0 Message-Id: <20240904-class_cleanup-fsl-mc-bus-v2-1-83fa25cbdc68@suse.com> X-B4-Tracking: v=1; b=H4sIAPJr2GYC/x3MwQqDMAyA4VeRnA2E2oPuVWRIG1MXqJ00OAbiu 6/s+B3+/wKTqmLw6C6o8lHTd2lwfQf8CmUT1LUZHDlPE3nkHMwWzhLKeWCyjDtjPA2HSH4dKcW JB2j5USXp97+en/f9A1VYS49qAAAA To: Stuart Yoder , Laurentiu Tudor , Christophe Leroy Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , "Ricardo B. Marliere" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=6798; i=ricardo.marliere@suse.com; h=from:subject:message-id; bh=iF+xnUz4ZVPd2l4qR5ydbQTMDvMlGwihx9FK85bYczg=; b=owEBbQKS/ZANAwAIAckLinxjhlimAcsmYgBm2GwQbmdWX+KAX9FGwgD5cr9/sgSd7B39pIqzz xJTXfoySfSJAjMEAAEIAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZthsEAAKCRDJC4p8Y4ZY puoVD/9auRpWOIpZjhD950/p+J7hVSvnPgH+pRzGey3BK46K1hcAzVYEcFl9i297Hz+3xAtJk7w ACaGCph4gu+0M6T3OCNLMuj2IUpKxKQMfYaazzWVKzrJ7Cf5a9Ns2cqG7MQFnDquzbp5nwzs+nU 2aJwBvfZKMQzDvhP6X8ipnyEAMVHYqSVGAPisW87ko4JvOEOZ0WKFi17a3BjMej6FimmZU6APe0 RdGrGJ6AikKI87SvmHjxy1ZWgJIMyeTsXWg64t/k/Mc6aW7Qb9QZRFGUx2tn1q/3g5n/sB4UMwK inoGtkCTdBJX2FL7lprYxdRU8IayrJ/05+XbYkoh0wQFACtVXa6nXyA+u/XtTieAftD1+aQTIrO ZLBt0divL6ngyTsrjTVHIjjISI8r6bDEu307mM9CRUhXm2qmpBAKc/Te0wTZQ3zfR1MxFMA09jq bTIEdwp+mMTz2yv18JoJuB6oTwS2V2SavRg5f+eOdyuvjnY4JAOiP4PPnioEzQcyHY/TZae31WZ po2XBK6RTkWq4g6pxCNercNDdUGLjHZ1J/56yiQ50bfts4M1rBMIJXcPGK6+KJWwtwbEzEN/D8w ZwG8xszSNQ/6nO2WrTVDgkWiSSm/jOCimjNZ2YIFZewUVzy7vr3E70ZYrHGsnh8DxrT5tOGwdEd tKxyF6hkCGpUczQ== X-Developer-Key: i=ricardo.marliere@suse.com; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_071758_804136_E5B54293 X-CRM114-Status: GOOD ( 11.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move all the device_type variables used in the bus to be constant structures as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere --- v1->v2: - Added missing specifiers regarding: https://lore.kernel.org/oe-kbuild-all/202403091124.VOzGG1lj-lkp@intel.com/ https://lore.kernel.org/oe-kbuild-all/202403090918.89zrHUF2-lkp@intel.com/ https://lore.kernel.org/oe-kbuild-all/202409041701.8NfSraMa-lkp@intel.com/ v1: https://lore.kernel.org/all/20240309-device_cleanup-gregkh-v1-1-8ca586ef17ba@marliere.net/ --- drivers/bus/fsl-mc/fsl-mc-bus.c | 36 ++++++++++++++++++------------------ include/linux/fsl/mc.h | 30 +++++++++++++++--------------- 2 files changed, 33 insertions(+), 33 deletions(-) --- base-commit: 431c1646e1f86b949fa3685efc50b660a364c2b6 change-id: 20240904-class_cleanup-fsl-mc-bus-3b04d80fb9c3 Best regards, diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index dd68b8191a0a..2f68aa30dae6 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -320,90 +320,90 @@ struct bus_type fsl_mc_bus_type = { }; EXPORT_SYMBOL_GPL(fsl_mc_bus_type); -struct device_type fsl_mc_bus_dprc_type = { +const struct device_type fsl_mc_bus_dprc_type = { .name = "fsl_mc_bus_dprc" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dprc_type); -struct device_type fsl_mc_bus_dpni_type = { +const struct device_type fsl_mc_bus_dpni_type = { .name = "fsl_mc_bus_dpni" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpni_type); -struct device_type fsl_mc_bus_dpio_type = { +const struct device_type fsl_mc_bus_dpio_type = { .name = "fsl_mc_bus_dpio" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpio_type); -struct device_type fsl_mc_bus_dpsw_type = { +const struct device_type fsl_mc_bus_dpsw_type = { .name = "fsl_mc_bus_dpsw" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpsw_type); -struct device_type fsl_mc_bus_dpbp_type = { +const struct device_type fsl_mc_bus_dpbp_type = { .name = "fsl_mc_bus_dpbp" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpbp_type); -struct device_type fsl_mc_bus_dpcon_type = { +const struct device_type fsl_mc_bus_dpcon_type = { .name = "fsl_mc_bus_dpcon" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpcon_type); -struct device_type fsl_mc_bus_dpmcp_type = { +const struct device_type fsl_mc_bus_dpmcp_type = { .name = "fsl_mc_bus_dpmcp" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpmcp_type); -struct device_type fsl_mc_bus_dpmac_type = { +const struct device_type fsl_mc_bus_dpmac_type = { .name = "fsl_mc_bus_dpmac" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpmac_type); -struct device_type fsl_mc_bus_dprtc_type = { +const struct device_type fsl_mc_bus_dprtc_type = { .name = "fsl_mc_bus_dprtc" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dprtc_type); -struct device_type fsl_mc_bus_dpseci_type = { +const struct device_type fsl_mc_bus_dpseci_type = { .name = "fsl_mc_bus_dpseci" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpseci_type); -struct device_type fsl_mc_bus_dpdmux_type = { +const struct device_type fsl_mc_bus_dpdmux_type = { .name = "fsl_mc_bus_dpdmux" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdmux_type); -struct device_type fsl_mc_bus_dpdcei_type = { +const struct device_type fsl_mc_bus_dpdcei_type = { .name = "fsl_mc_bus_dpdcei" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdcei_type); -struct device_type fsl_mc_bus_dpaiop_type = { +const struct device_type fsl_mc_bus_dpaiop_type = { .name = "fsl_mc_bus_dpaiop" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpaiop_type); -struct device_type fsl_mc_bus_dpci_type = { +const struct device_type fsl_mc_bus_dpci_type = { .name = "fsl_mc_bus_dpci" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpci_type); -struct device_type fsl_mc_bus_dpdmai_type = { +const struct device_type fsl_mc_bus_dpdmai_type = { .name = "fsl_mc_bus_dpdmai" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdmai_type); -struct device_type fsl_mc_bus_dpdbg_type = { +const struct device_type fsl_mc_bus_dpdbg_type = { .name = "fsl_mc_bus_dpdbg" }; EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdbg_type); -static struct device_type *fsl_mc_get_device_type(const char *type) +static const struct device_type *fsl_mc_get_device_type(const char *type) { static const struct { - struct device_type *dev_type; + const struct device_type *dev_type; const char *type; } dev_types[] = { { &fsl_mc_bus_dprc_type, "dprc" }, diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h index 083c860fd28e..ee6cbf9ab580 100644 --- a/include/linux/fsl/mc.h +++ b/include/linux/fsl/mc.h @@ -438,21 +438,21 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev, extern struct bus_type fsl_mc_bus_type; -extern struct device_type fsl_mc_bus_dprc_type; -extern struct device_type fsl_mc_bus_dpni_type; -extern struct device_type fsl_mc_bus_dpio_type; -extern struct device_type fsl_mc_bus_dpsw_type; -extern struct device_type fsl_mc_bus_dpbp_type; -extern struct device_type fsl_mc_bus_dpcon_type; -extern struct device_type fsl_mc_bus_dpmcp_type; -extern struct device_type fsl_mc_bus_dpmac_type; -extern struct device_type fsl_mc_bus_dprtc_type; -extern struct device_type fsl_mc_bus_dpseci_type; -extern struct device_type fsl_mc_bus_dpdmux_type; -extern struct device_type fsl_mc_bus_dpdcei_type; -extern struct device_type fsl_mc_bus_dpaiop_type; -extern struct device_type fsl_mc_bus_dpci_type; -extern struct device_type fsl_mc_bus_dpdmai_type; +extern const struct device_type fsl_mc_bus_dprc_type; +extern const struct device_type fsl_mc_bus_dpni_type; +extern const struct device_type fsl_mc_bus_dpio_type; +extern const struct device_type fsl_mc_bus_dpsw_type; +extern const struct device_type fsl_mc_bus_dpbp_type; +extern const struct device_type fsl_mc_bus_dpcon_type; +extern const struct device_type fsl_mc_bus_dpmcp_type; +extern const struct device_type fsl_mc_bus_dpmac_type; +extern const struct device_type fsl_mc_bus_dprtc_type; +extern const struct device_type fsl_mc_bus_dpseci_type; +extern const struct device_type fsl_mc_bus_dpdmux_type; +extern const struct device_type fsl_mc_bus_dpdcei_type; +extern const struct device_type fsl_mc_bus_dpaiop_type; +extern const struct device_type fsl_mc_bus_dpci_type; +extern const struct device_type fsl_mc_bus_dpdmai_type; static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev) {