* [PATCH] coresight: constify the struct device_type usage
@ 2024-02-19 13:43 Ricardo B. Marliere
2024-02-19 15:36 ` James Clark
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ricardo B. Marliere @ 2024-02-19 13:43 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-kernel, Greg Kroah-Hartman,
Ricardo B. Marliere
Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
coresight_dev_type variable to be a constant structure as well, placing it
into read-only memory which can not be modified at runtime.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
drivers/hwtracing/coresight/coresight-priv.h | 2 +-
drivers/hwtracing/coresight/coresight-sysfs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
index eb365236f9a9..ca3362cbdb70 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -13,7 +13,7 @@
#include <linux/pm_runtime.h>
extern struct mutex coresight_mutex;
-extern struct device_type coresight_dev_type[];
+extern const struct device_type coresight_dev_type[];
/*
* Coresight management registers (0xf00-0xfcc)
diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c
index f9444e2cb1d9..1e67cc7758d7 100644
--- a/drivers/hwtracing/coresight/coresight-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-sysfs.c
@@ -377,7 +377,7 @@ static struct attribute *coresight_source_attrs[] = {
};
ATTRIBUTE_GROUPS(coresight_source);
-struct device_type coresight_dev_type[] = {
+const struct device_type coresight_dev_type[] = {
[CORESIGHT_DEV_TYPE_SINK] = {
.name = "sink",
.groups = coresight_sink_groups,
---
base-commit: c099fdd218a0fedfe87e0b88d2ba0667eab3b3c8
change-id: 20240219-device_cleanup-coresight-00ba00fd5f21
Best regards,
--
Ricardo B. Marliere <ricardo@marliere.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] coresight: constify the struct device_type usage
2024-02-19 13:43 [PATCH] coresight: constify the struct device_type usage Ricardo B. Marliere
@ 2024-02-19 15:36 ` James Clark
2024-02-21 3:39 ` Anshuman Khandual
2024-06-21 9:30 ` Suzuki K Poulose
2 siblings, 0 replies; 4+ messages in thread
From: James Clark @ 2024-02-19 15:36 UTC (permalink / raw)
To: Ricardo B. Marliere, Suzuki K Poulose
Cc: coresight, linux-arm-kernel, linux-kernel, Greg Kroah-Hartman,
Mike Leach, Alexander Shishkin
On 19/02/2024 13:43, Ricardo B. Marliere wrote:
> Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
> core can properly handle constant struct device_type. Move the
> coresight_dev_type variable to be a constant structure as well, placing it
> into read-only memory which can not be modified at runtime.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
> drivers/hwtracing/coresight/coresight-priv.h | 2 +-
> drivers/hwtracing/coresight/coresight-sysfs.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
> index eb365236f9a9..ca3362cbdb70 100644
> --- a/drivers/hwtracing/coresight/coresight-priv.h
> +++ b/drivers/hwtracing/coresight/coresight-priv.h
> @@ -13,7 +13,7 @@
> #include <linux/pm_runtime.h>
>
> extern struct mutex coresight_mutex;
> -extern struct device_type coresight_dev_type[];
> +extern const struct device_type coresight_dev_type[];
>
> /*
> * Coresight management registers (0xf00-0xfcc)
> diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c
> index f9444e2cb1d9..1e67cc7758d7 100644
> --- a/drivers/hwtracing/coresight/coresight-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-sysfs.c
> @@ -377,7 +377,7 @@ static struct attribute *coresight_source_attrs[] = {
> };
> ATTRIBUTE_GROUPS(coresight_source);
>
> -struct device_type coresight_dev_type[] = {
> +const struct device_type coresight_dev_type[] = {
> [CORESIGHT_DEV_TYPE_SINK] = {
> .name = "sink",
> .groups = coresight_sink_groups,
>
> ---
> base-commit: c099fdd218a0fedfe87e0b88d2ba0667eab3b3c8
> change-id: 20240219-device_cleanup-coresight-00ba00fd5f21
>
> Best regards,
Reviewed-by: James Clark <james.clark@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] coresight: constify the struct device_type usage
2024-02-19 13:43 [PATCH] coresight: constify the struct device_type usage Ricardo B. Marliere
2024-02-19 15:36 ` James Clark
@ 2024-02-21 3:39 ` Anshuman Khandual
2024-06-21 9:30 ` Suzuki K Poulose
2 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2024-02-21 3:39 UTC (permalink / raw)
To: Ricardo B. Marliere, Suzuki K Poulose, Mike Leach, James Clark,
Alexander Shishkin
Cc: coresight, linux-arm-kernel, linux-kernel, Greg Kroah-Hartman
On 2/19/24 19:13, Ricardo B. Marliere wrote:
> Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
> core can properly handle constant struct device_type. Move the
> coresight_dev_type variable to be a constant structure as well, placing it
> into read-only memory which can not be modified at runtime.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> drivers/hwtracing/coresight/coresight-priv.h | 2 +-
> drivers/hwtracing/coresight/coresight-sysfs.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
> index eb365236f9a9..ca3362cbdb70 100644
> --- a/drivers/hwtracing/coresight/coresight-priv.h
> +++ b/drivers/hwtracing/coresight/coresight-priv.h
> @@ -13,7 +13,7 @@
> #include <linux/pm_runtime.h>
>
> extern struct mutex coresight_mutex;
> -extern struct device_type coresight_dev_type[];
> +extern const struct device_type coresight_dev_type[];
>
> /*
> * Coresight management registers (0xf00-0xfcc)
> diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c
> index f9444e2cb1d9..1e67cc7758d7 100644
> --- a/drivers/hwtracing/coresight/coresight-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-sysfs.c
> @@ -377,7 +377,7 @@ static struct attribute *coresight_source_attrs[] = {
> };
> ATTRIBUTE_GROUPS(coresight_source);
>
> -struct device_type coresight_dev_type[] = {
> +const struct device_type coresight_dev_type[] = {
> [CORESIGHT_DEV_TYPE_SINK] = {
> .name = "sink",
> .groups = coresight_sink_groups,
>
> ---
> base-commit: c099fdd218a0fedfe87e0b88d2ba0667eab3b3c8
> change-id: 20240219-device_cleanup-coresight-00ba00fd5f21
>
> Best regards,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] coresight: constify the struct device_type usage
2024-02-19 13:43 [PATCH] coresight: constify the struct device_type usage Ricardo B. Marliere
2024-02-19 15:36 ` James Clark
2024-02-21 3:39 ` Anshuman Khandual
@ 2024-06-21 9:30 ` Suzuki K Poulose
2 siblings, 0 replies; 4+ messages in thread
From: Suzuki K Poulose @ 2024-06-21 9:30 UTC (permalink / raw)
To: Ricardo B. Marliere, James Clark, Alexander Shishkin, Mike Leach
Cc: Suzuki K Poulose, coresight, linux-kernel, Greg Kroah-Hartman,
linux-arm-kernel
On Mon, 19 Feb 2024 10:43:05 -0300, Ricardo B. Marliere wrote:
> Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
> core can properly handle constant struct device_type. Move the
> coresight_dev_type variable to be a constant structure as well, placing it
> into read-only memory which can not be modified at runtime.
>
>
Applied, thanks!
[1/1] coresight: constify the struct device_type usage
https://git.kernel.org/coresight/c/4dcc0f95ca2a9738e5e4e3bd7571fd95a9cbf272
Best regards,
--
Suzuki K Poulose <suzuki.poulose@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-21 9:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19 13:43 [PATCH] coresight: constify the struct device_type usage Ricardo B. Marliere
2024-02-19 15:36 ` James Clark
2024-02-21 3:39 ` Anshuman Khandual
2024-06-21 9:30 ` Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®