> @@ -134,6 +136,7 @@ config DRM_AMDGPU
>       select HWMON
>       select BACKLIGHT_CLASS_DEVICE
>       select INTERVAL_TREE
> +     select DRM_AMD_GNB_BUS

Here you select the symbol.

[...]

> +config DRM_AMD_GNB_BUS
> +     tristate "AMD GNB bus - used for GNB IPs such as ACP and ISP"

Here you make it user selectable. Use either or having both doesn't work too
well.

> +
> +endmenu
> diff --git a/drivers/gpu/drm/amd/bus/Makefile 
> b/drivers/gpu/drm/amd/bus/Makefile
> new file mode 100644
> index 0000000..c41ffc9
> --- /dev/null
> +++ b/drivers/gpu/drm/amd/bus/Makefile
> @@ -0,0 +1,4 @@
> +#
> +ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/bus/
> +
> +obj-$(CONFIG_DRM_AMD_GNB_BUS) := amd_gnb_bus.o
> diff --git a/drivers/gpu/drm/amd/bus/amd_gnb_bus.c 
> b/drivers/gpu/drm/amd/bus/amd_gnb_bus.c
> new file mode 100644
> index 0000000..071b16c
> --- /dev/null
> +++ b/drivers/gpu/drm/amd/bus/amd_gnb_bus.c
> @@ -0,0 +1,266 @@
[..]
> +#ifdef CONFIG_PM_SLEEP
> +static int amd_gnb_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
> +{
> +     struct amd_gnb_bus_dev *amd_gnb_bus_dev = to_amd_gnb_bus_device(dev);
> +     struct amd_gnb_bus_driver *driver;
> +
> +     if (!amd_gnb_bus_dev || !dev->driver)
> +             return 0;
> +     driver = to_amd_gnb_bus_driver(dev->driver);
> +     if (!driver->suspend)
> +             return 0;
> +     return driver->suspend(amd_gnb_bus_dev, mesg);
> +}
> +
> +static int amd_gnb_bus_legacy_resume(struct device *dev)
> +{
> +     struct amd_gnb_bus_dev *amd_gnb_bus_dev = to_amd_gnb_bus_device(dev);
> +     struct amd_gnb_bus_driver *driver;
> +
> +     if (!amd_gnb_bus_dev || !dev->driver)
> +             return 0;
> +     driver = to_amd_gnb_bus_driver(dev->driver);
> +     if (!driver->resume)
> +             return 0;
> +     return driver->resume(amd_gnb_bus_dev);
> +}
[...]


Preferably don't add support for legacy suspend/resume to new subsystems.
Support for this is supposed to be removed from the kernel. Just use
dev_pm_ops and then you can drop all of the above since the PM core does the
right thing on its own for dev_pm_ops. No need to have support at the bus
level if there is nothing special to do at the bus level.

[...]

Reply via email to