Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Cc: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Cc: <platform-driver-x86@vger.kernel.org>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/2023121957-tapered-upswing-8326@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+3 -3
+3 -2
drivers/platform/surface/aggregator/bus.c
··· 35 35 }; 36 36 ATTRIBUTE_GROUPS(ssam_device); 37 37 38 + static const struct bus_type ssam_bus_type; 39 + 38 40 static int ssam_device_uevent(const struct device *dev, struct kobj_uevent_env *env) 39 41 { 40 42 const struct ssam_device *sdev = to_ssam_device(dev); ··· 331 329 sdrv->remove(to_ssam_device(dev)); 332 330 } 333 331 334 - struct bus_type ssam_bus_type = { 332 + static const struct bus_type ssam_bus_type = { 335 333 .name = "surface_aggregator", 336 334 .match = ssam_bus_match, 337 335 .probe = ssam_bus_probe, 338 336 .remove = ssam_bus_remove, 339 337 }; 340 - EXPORT_SYMBOL_GPL(ssam_bus_type); 341 338 342 339 /** 343 340 * __ssam_device_driver_register() - Register a SSAM client device driver.
-1
include/linux/surface_aggregator/device.h
··· 193 193 194 194 #ifdef CONFIG_SURFACE_AGGREGATOR_BUS 195 195 196 - extern struct bus_type ssam_bus_type; 197 196 extern const struct device_type ssam_device_type; 198 197 199 198 /**