* [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static
@ 2023-12-19 17:18 Greg Kroah-Hartman
2023-12-19 19:32 ` Maximilian Luz
2023-12-21 13:03 ` Hans de Goede
0 siblings, 2 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-19 17:18 UTC (permalink / raw)
To: hdegoede
Cc: linux-kernel, Greg Kroah-Hartman, Maximilian Luz,
Ilpo Järvinen, platform-driver-x86
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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/platform/surface/aggregator/bus.c | 5 +++--
include/linux/surface_aggregator/device.h | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c
index 42ccd7f1c9b9..118caa651bec 100644
--- a/drivers/platform/surface/aggregator/bus.c
+++ b/drivers/platform/surface/aggregator/bus.c
@@ -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.
diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h
index 42b249b4c24b..8cd8c38cf3f3 100644
--- a/include/linux/surface_aggregator/device.h
+++ b/include/linux/surface_aggregator/device.h
@@ -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;
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static
2023-12-19 17:18 [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static Greg Kroah-Hartman
@ 2023-12-19 19:32 ` Maximilian Luz
2023-12-21 13:03 ` Hans de Goede
1 sibling, 0 replies; 4+ messages in thread
From: Maximilian Luz @ 2023-12-19 19:32 UTC (permalink / raw)
To: Greg Kroah-Hartman, hdegoede
Cc: linux-kernel, Ilpo Järvinen, platform-driver-x86
On 12/19/23 18:18, Greg Kroah-Hartman wrote:
> 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.
Thanks! Looks good to me.
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> 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
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/platform/surface/aggregator/bus.c | 5 +++--
> include/linux/surface_aggregator/device.h | 1 -
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c
> index 42ccd7f1c9b9..118caa651bec 100644
> --- a/drivers/platform/surface/aggregator/bus.c
> +++ b/drivers/platform/surface/aggregator/bus.c
> @@ -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.
> diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h
> index 42b249b4c24b..8cd8c38cf3f3 100644
> --- a/include/linux/surface_aggregator/device.h
> +++ b/include/linux/surface_aggregator/device.h
> @@ -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;
>
> /**
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static
2023-12-19 17:18 [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static Greg Kroah-Hartman
2023-12-19 19:32 ` Maximilian Luz
@ 2023-12-21 13:03 ` Hans de Goede
2023-12-21 13:10 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2023-12-21 13:03 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-kernel, Maximilian Luz, Ilpo Järvinen, platform-driver-x86
Hi Greg,
On 12/19/23 18:18, Greg Kroah-Hartman wrote:
> 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
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg, do you plan to merge this yourself (fine with me)
or do you want me to merge this through pdx86 ?
Regards,
Hans
> ---
> drivers/platform/surface/aggregator/bus.c | 5 +++--
> include/linux/surface_aggregator/device.h | 1 -
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c
> index 42ccd7f1c9b9..118caa651bec 100644
> --- a/drivers/platform/surface/aggregator/bus.c
> +++ b/drivers/platform/surface/aggregator/bus.c
> @@ -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.
> diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h
> index 42b249b4c24b..8cd8c38cf3f3 100644
> --- a/include/linux/surface_aggregator/device.h
> +++ b/include/linux/surface_aggregator/device.h
> @@ -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;
>
> /**
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static
2023-12-21 13:03 ` Hans de Goede
@ 2023-12-21 13:10 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-21 13:10 UTC (permalink / raw)
To: Hans de Goede
Cc: linux-kernel, Maximilian Luz, Ilpo Järvinen, platform-driver-x86
On Thu, Dec 21, 2023 at 02:03:03PM +0100, Hans de Goede wrote:
> Hi Greg,
>
> On 12/19/23 18:18, Greg Kroah-Hartman wrote:
> > 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
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-21 13:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 17:18 [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static Greg Kroah-Hartman
2023-12-19 19:32 ` Maximilian Luz
2023-12-21 13:03 ` Hans de Goede
2023-12-21 13:10 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.