* [PATCH] ACPI: fan: Reorder symbols to get rid of a few forward declarations
@ 2022-09-17 21:56 Uwe Kleine-König
2022-09-24 16:47 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2022-09-17 21:56 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, kernel
Having the driver struct at the end of the file isn't only more usual, it
also allows to drop a few forward declarations which are just useless
repetition.
While at it also move the MODULE_... macros to the end of the file.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/acpi/fan_core.c | 58 +++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 31 deletions(-)
diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
index b9a9a59ddcc1..52a0b303b70a 100644
--- a/drivers/acpi/fan_core.c
+++ b/drivers/acpi/fan_core.c
@@ -19,43 +19,12 @@
#include "fan.h"
-MODULE_AUTHOR("Paul Diefenbaugh");
-MODULE_DESCRIPTION("ACPI Fan Driver");
-MODULE_LICENSE("GPL");
-
-static int acpi_fan_probe(struct platform_device *pdev);
-static int acpi_fan_remove(struct platform_device *pdev);
-
static const struct acpi_device_id fan_device_ids[] = {
ACPI_FAN_DEVICE_IDS,
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, fan_device_ids);
-#ifdef CONFIG_PM_SLEEP
-static int acpi_fan_suspend(struct device *dev);
-static int acpi_fan_resume(struct device *dev);
-static const struct dev_pm_ops acpi_fan_pm = {
- .resume = acpi_fan_resume,
- .freeze = acpi_fan_suspend,
- .thaw = acpi_fan_resume,
- .restore = acpi_fan_resume,
-};
-#define FAN_PM_OPS_PTR (&acpi_fan_pm)
-#else
-#define FAN_PM_OPS_PTR NULL
-#endif
-
-static struct platform_driver acpi_fan_driver = {
- .probe = acpi_fan_probe,
- .remove = acpi_fan_remove,
- .driver = {
- .name = "acpi-fan",
- .acpi_match_table = fan_device_ids,
- .pm = FAN_PM_OPS_PTR,
- },
-};
-
/* thermal cooling device callbacks */
static int fan_get_max_state(struct thermal_cooling_device *cdev, unsigned long
*state)
@@ -459,6 +428,33 @@ static int acpi_fan_resume(struct device *dev)
return result;
}
+
+static const struct dev_pm_ops acpi_fan_pm = {
+ .resume = acpi_fan_resume,
+ .freeze = acpi_fan_suspend,
+ .thaw = acpi_fan_resume,
+ .restore = acpi_fan_resume,
+};
+#define FAN_PM_OPS_PTR (&acpi_fan_pm)
+
+#else
+
+#define FAN_PM_OPS_PTR NULL
+
#endif
+static struct platform_driver acpi_fan_driver = {
+ .probe = acpi_fan_probe,
+ .remove = acpi_fan_remove,
+ .driver = {
+ .name = "acpi-fan",
+ .acpi_match_table = fan_device_ids,
+ .pm = FAN_PM_OPS_PTR,
+ },
+};
+
module_platform_driver(acpi_fan_driver);
+
+MODULE_AUTHOR("Paul Diefenbaugh");
+MODULE_DESCRIPTION("ACPI Fan Driver");
+MODULE_LICENSE("GPL");
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI: fan: Reorder symbols to get rid of a few forward declarations
2022-09-17 21:56 [PATCH] ACPI: fan: Reorder symbols to get rid of a few forward declarations Uwe Kleine-König
@ 2022-09-24 16:47 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-09-24 16:47 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List, Sascha Hauer
On Sat, Sep 17, 2022 at 11:57 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Having the driver struct at the end of the file isn't only more usual, it
> also allows to drop a few forward declarations which are just useless
> repetition.
>
> While at it also move the MODULE_... macros to the end of the file.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/acpi/fan_core.c | 58 +++++++++++++++++++----------------------
> 1 file changed, 27 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
> index b9a9a59ddcc1..52a0b303b70a 100644
> --- a/drivers/acpi/fan_core.c
> +++ b/drivers/acpi/fan_core.c
> @@ -19,43 +19,12 @@
>
> #include "fan.h"
>
> -MODULE_AUTHOR("Paul Diefenbaugh");
> -MODULE_DESCRIPTION("ACPI Fan Driver");
> -MODULE_LICENSE("GPL");
> -
> -static int acpi_fan_probe(struct platform_device *pdev);
> -static int acpi_fan_remove(struct platform_device *pdev);
> -
> static const struct acpi_device_id fan_device_ids[] = {
> ACPI_FAN_DEVICE_IDS,
> {"", 0},
> };
> MODULE_DEVICE_TABLE(acpi, fan_device_ids);
>
> -#ifdef CONFIG_PM_SLEEP
> -static int acpi_fan_suspend(struct device *dev);
> -static int acpi_fan_resume(struct device *dev);
> -static const struct dev_pm_ops acpi_fan_pm = {
> - .resume = acpi_fan_resume,
> - .freeze = acpi_fan_suspend,
> - .thaw = acpi_fan_resume,
> - .restore = acpi_fan_resume,
> -};
> -#define FAN_PM_OPS_PTR (&acpi_fan_pm)
> -#else
> -#define FAN_PM_OPS_PTR NULL
> -#endif
> -
> -static struct platform_driver acpi_fan_driver = {
> - .probe = acpi_fan_probe,
> - .remove = acpi_fan_remove,
> - .driver = {
> - .name = "acpi-fan",
> - .acpi_match_table = fan_device_ids,
> - .pm = FAN_PM_OPS_PTR,
> - },
> -};
> -
> /* thermal cooling device callbacks */
> static int fan_get_max_state(struct thermal_cooling_device *cdev, unsigned long
> *state)
> @@ -459,6 +428,33 @@ static int acpi_fan_resume(struct device *dev)
>
> return result;
> }
> +
> +static const struct dev_pm_ops acpi_fan_pm = {
> + .resume = acpi_fan_resume,
> + .freeze = acpi_fan_suspend,
> + .thaw = acpi_fan_resume,
> + .restore = acpi_fan_resume,
> +};
> +#define FAN_PM_OPS_PTR (&acpi_fan_pm)
> +
> +#else
> +
> +#define FAN_PM_OPS_PTR NULL
> +
> #endif
>
> +static struct platform_driver acpi_fan_driver = {
> + .probe = acpi_fan_probe,
> + .remove = acpi_fan_remove,
> + .driver = {
> + .name = "acpi-fan",
> + .acpi_match_table = fan_device_ids,
> + .pm = FAN_PM_OPS_PTR,
> + },
> +};
> +
> module_platform_driver(acpi_fan_driver);
> +
> +MODULE_AUTHOR("Paul Diefenbaugh");
> +MODULE_DESCRIPTION("ACPI Fan Driver");
> +MODULE_LICENSE("GPL");
> --
Applied as 6.1 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-24 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17 21:56 [PATCH] ACPI: fan: Reorder symbols to get rid of a few forward declarations Uwe Kleine-König
2022-09-24 16:47 ` Rafael J. Wysocki
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.