2024-02-04 16:13:47

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH] fpga: dfl: make dfl_bus_type const

Now that the driver core can properly handle constant struct bus_type,
move the dfl_bus_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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
drivers/fpga/dfl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index e6d12fbab653..094ee97ea26c 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -327,7 +327,7 @@ static struct attribute *dfl_dev_attrs[] = {
};
ATTRIBUTE_GROUPS(dfl_dev);

-static struct bus_type dfl_bus_type = {
+static const struct bus_type dfl_bus_type = {
.name = "dfl",
.match = dfl_bus_match,
.probe = dfl_bus_probe,

---
base-commit: 8680970410625875c34d6b97b6fd89d7d62a74ec
change-id: 20240204-bus_cleanup-fpga-e8e3c3d562b7

Best regards,
--
Ricardo B. Marliere <[email protected]>



2024-02-05 20:19:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: make dfl_bus_type const

On Sun, Feb 04, 2024 at 01:14:05PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the dfl_bus_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 <[email protected]>
> Suggested-by: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>

Reviewed-by: Greg Kroah-Hartman <[email protected]>

2024-02-06 06:02:57

by Xu Yilun

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: make dfl_bus_type const

On Mon, Feb 05, 2024 at 04:50:05AM -0800, Greg Kroah-Hartman wrote:
> On Sun, Feb 04, 2024 at 01:14:05PM -0300, Ricardo B. Marliere wrote:
> > Now that the driver core can properly handle constant struct bus_type,
> > move the dfl_bus_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 <[email protected]>
> > Suggested-by: Greg Kroah-Hartman <[email protected]>
> > Signed-off-by: Ricardo B. Marliere <[email protected]>
>
> Reviewed-by: Greg Kroah-Hartman <[email protected]>

Acked-by: Xu Yilun <[email protected]>

Applied to for-next.

Thanks.
>