platform/surface: aggregator: make ssam_bus_type constant and static
Subsystems (3)
PATCH 1/1 platform/surface: aggregator: make ssam_bus_type constant and static
Now that the driver core can properly handle constant struct bus_type, move the ssam_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
It's also never used outside of drivers/platform/surface/aggregator/bus.c so make it static and don't export it as no one is using it.
--- drivers/platform/surface/aggregator/bus.c | 5 +++-- include/linux/surface_aggregator/device.h | 1 - 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/platform/surface/aggregator/bus.c +3 -2
@@ -35,6 +35,8 @@ static struct attribute *ssam_device_attrs[] = { };ATTRIBUTE_GROUPS (ssam_device); +static const struct bus_type ssam_bus_type; +static int ssam_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct ssam_device *sdev =to_ssam_device (dev);
@@ -329,13 +331,12 @@ static void ssam_bus_remove(struct device *dev) sdrv->remove (to_ssam_device (dev)); } -struct bus_type ssam_bus_type = { +static const struct bus_type ssam_bus_type = { .name ="surface_aggregator" , .match = ssam_bus_match, .probe = ssam_bus_probe, .remove = ssam_bus_remove, }; -EXPORT_SYMBOL_GPL (ssam_bus_type);/** * __ssam_device_driver_register() - Register a SSAM client device driver.
include/linux/surface_aggregator/device.h +0 -1
@@ -193,7 +193,6 @@ struct ssam_device_driver {#ifdef CONFIG_SURFACE_AGGREGATOR_BUS -extern struct bus_type ssam_bus_type;extern const struct device_type ssam_device_type;/**
Signature · 1 line
2.43.0
Quoted 7 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thessam_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.It's also never used outside of
drivers/platform/surface/aggregator/bus.cso make it static and don't export it as no one is using it.
Thanks! Looks good to me.
Quoted 50 lines
Cc Maximilian Luz <[email protected]>Cc Hans de Goede <[email protected]>Cc "Ilpo Järvinen" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/platform/surface/aggregator/bus.c | 5 +++-- include/linux/surface_aggregator/device.h | 1 - 2 files changed, 3 insertions(+), 3 deletions(-)drivers/platform/surface/aggregator/bus.c +3
-2@@ -35,6 +35,8 @@ static struct attribute *ssam_device_attrs[] = { };ATTRIBUTE_GROUPS (ssam_device); +static const struct bus_type ssam_bus_type; +static int ssam_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct ssam_device *sdev =to_ssam_device (dev);@@ -329,13 +331,12 @@ static void ssam_bus_remove(struct device *dev) sdrv->remove (to_ssam_device (dev)); } -struct bus_type ssam_bus_type = { +static const struct bus_type ssam_bus_type = { .name ="surface_aggregator" , .match = ssam_bus_match, .probe = ssam_bus_probe, .remove = ssam_bus_remove, }; -EXPORT_SYMBOL_GPL (ssam_bus_type);/** * __ssam_device_driver_register() - Register a SSAM client device driver. include/linux/surface_aggregator/device.h +0
-1@@ -193,7 +193,6 @@ struct ssam_device_driver {#ifdef CONFIG_SURFACE_AGGREGATOR_BUS -extern struct bus_type ssam_bus_type;extern const struct device_type ssam_device_type;/**
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thessam_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.It's also never used outside of
drivers/platform/surface/aggregator/bus.cso make it static and don't export it as no one is using it.
Quoted 5 lines
Cc Maximilian Luz <[email protected]>Cc Hans de Goede <[email protected]>Cc "Ilpo Järvinen" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Greg, do you plan to merge this yourself (fine with me) or do you want me to merge this through pdx86 ?
Regards,
Hans
Quoted 45 lines
--- drivers/platform/surface/aggregator/bus.c | 5 +++-- include/linux/surface_aggregator/device.h | 1 - 2 files changed, 3 insertions(+), 3 deletions(-)drivers/platform/surface/aggregator/bus.c +3
-2@@ -35,6 +35,8 @@ static struct attribute *ssam_device_attrs[] = { };ATTRIBUTE_GROUPS (ssam_device); +static const struct bus_type ssam_bus_type; +static int ssam_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct ssam_device *sdev =to_ssam_device (dev);@@ -329,13 +331,12 @@ static void ssam_bus_remove(struct device *dev) sdrv->remove (to_ssam_device (dev)); } -struct bus_type ssam_bus_type = { +static const struct bus_type ssam_bus_type = { .name ="surface_aggregator" , .match = ssam_bus_match, .probe = ssam_bus_probe, .remove = ssam_bus_remove, }; -EXPORT_SYMBOL_GPL (ssam_bus_type);/** * __ssam_device_driver_register() - Register a SSAM client device driver. include/linux/surface_aggregator/device.h +0
-1@@ -193,7 +193,6 @@ struct ssam_device_driver {#ifdef CONFIG_SURFACE_AGGREGATOR_BUS -extern struct bus_type ssam_bus_type;extern const struct device_type ssam_device_type;/**
Quoted 11 lines · Hans de Goede
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thessam_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.It's also never used outside of
drivers/platform/surface/aggregator/bus.cso make it static and don't export it as no one is using it.
Quoted 8 lines
Quoted 5 lines
Cc Maximilian Luz <[email protected]>Cc Hans de Goede <[email protected]>Cc "Ilpo Järvinen" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Greg, do you plan to merge this yourself (fine with me) or do you want me to merge this through pdx86 ?
I can merge it, thanks!
greg k-h