* [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration
@ 2022-07-07 6:14 Uwe Kleine-König
2022-07-07 6:14 ` [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver Uwe Kleine-König
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2022-07-07 6:14 UTC (permalink / raw)
To: Scott Wood, Michael Ellerman; +Cc: kernel, Paul Mackerras, linuxppc-dev
By moving up pmc_types and pmc_match, the forward declaration for pmc_match
can be dropped.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/powerpc/platforms/83xx/suspend.c | 43 +++++++++++++--------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 6d47a5b81485..30b7700a2c98 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -319,7 +319,27 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
.end = mpc83xx_suspend_end,
};
-static const struct of_device_id pmc_match[];
+static struct pmc_type pmc_types[] = {
+ {
+ .has_deep_sleep = 1,
+ },
+ {
+ .has_deep_sleep = 0,
+ }
+};
+
+static const struct of_device_id pmc_match[] = {
+ {
+ .compatible = "fsl,mpc8313-pmc",
+ .data = &pmc_types[0],
+ },
+ {
+ .compatible = "fsl,mpc8349-pmc",
+ .data = &pmc_types[1],
+ },
+ {}
+};
+
static int pmc_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
@@ -406,27 +426,6 @@ static int pmc_remove(struct platform_device *ofdev)
return -EPERM;
};
-static struct pmc_type pmc_types[] = {
- {
- .has_deep_sleep = 1,
- },
- {
- .has_deep_sleep = 0,
- }
-};
-
-static const struct of_device_id pmc_match[] = {
- {
- .compatible = "fsl,mpc8313-pmc",
- .data = &pmc_types[0],
- },
- {
- .compatible = "fsl,mpc8349-pmc",
- .data = &pmc_types[1],
- },
- {}
-};
-
static struct platform_driver pmc_driver = {
.driver = {
.name = "mpc83xx-pmc",
base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver
2022-07-07 6:14 [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Uwe Kleine-König
@ 2022-07-07 6:14 ` Uwe Kleine-König
2022-07-07 8:44 ` Christophe Leroy
2022-07-15 18:41 ` Scott Wood
2022-07-07 6:14 ` [PATCH 3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable Uwe Kleine-König
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2022-07-07 6:14 UTC (permalink / raw)
To: Scott Wood, Michael Ellerman; +Cc: kernel, Paul Mackerras, linuxppc-dev
Returning an error in .remove() doesn't prevent a driver from being
unloaded. On unbind this only results in an error message, but the
device is remove anyhow.
I guess the author's idea of just returning -EPERM in .remove() was to
prevent unbinding a device. To achieve that set the suppress_bind_attrs
driver property and drop the useless .remove callback.
This is a preparation for making platform remove callbacks return void.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/powerpc/platforms/83xx/suspend.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 30b7700a2c98..309f42ab63d4 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -421,18 +421,13 @@ static int pmc_probe(struct platform_device *ofdev)
return ret;
}
-static int pmc_remove(struct platform_device *ofdev)
-{
- return -EPERM;
-};
-
static struct platform_driver pmc_driver = {
.driver = {
.name = "mpc83xx-pmc",
.of_match_table = pmc_match,
+ .suppress_bind_attrs = true,
},
.probe = pmc_probe,
- .remove = pmc_remove
};
builtin_platform_driver(pmc_driver);
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver
2022-07-07 6:14 ` [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver Uwe Kleine-König
@ 2022-07-07 8:44 ` Christophe Leroy
2022-07-15 18:41 ` Scott Wood
1 sibling, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-07-07 8:44 UTC (permalink / raw)
To: Uwe Kleine-König, Scott Wood, Michael Ellerman
Cc: kernel@pengturonix.de, linuxppc-dev@lists.ozlabs.org,
Paul Mackerras
Le 07/07/2022 à 08:14, Uwe Kleine-König a écrit :
> Returning an error in .remove() doesn't prevent a driver from being
> unloaded. On unbind this only results in an error message, but the
> device is remove anyhow.
>
> I guess the author's idea of just returning -EPERM in .remove() was to
> prevent unbinding a device. To achieve that set the suppress_bind_attrs
> driver property and drop the useless .remove callback.
>
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/platforms/83xx/suspend.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
> index 30b7700a2c98..309f42ab63d4 100644
> --- a/arch/powerpc/platforms/83xx/suspend.c
> +++ b/arch/powerpc/platforms/83xx/suspend.c
> @@ -421,18 +421,13 @@ static int pmc_probe(struct platform_device *ofdev)
> return ret;
> }
>
> -static int pmc_remove(struct platform_device *ofdev)
> -{
> - return -EPERM;
> -};
> -
> static struct platform_driver pmc_driver = {
> .driver = {
> .name = "mpc83xx-pmc",
> .of_match_table = pmc_match,
> + .suppress_bind_attrs = true,
> },
> .probe = pmc_probe,
> - .remove = pmc_remove
> };
>
> builtin_platform_driver(pmc_driver);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver
2022-07-07 6:14 ` [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver Uwe Kleine-König
2022-07-07 8:44 ` Christophe Leroy
@ 2022-07-15 18:41 ` Scott Wood
1 sibling, 0 replies; 8+ messages in thread
From: Scott Wood @ 2022-07-15 18:41 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Ellerman
Cc: kernel, Paul Mackerras, linuxppc-dev
On Thu, 2022-07-07 at 08:14 +0200, Uwe Kleine-König wrote:
> Returning an error in .remove() doesn't prevent a driver from being
> unloaded. On unbind this only results in an error message, but the
> device is remove anyhow.
>
> I guess the author's idea of just returning -EPERM in .remove() was to
> prevent unbinding a device. To achieve that set the suppress_bind_attrs
> driver property and drop the useless .remove callback.
I don't remember if I thought it would prevent removal, or if it was just the
only thing I could do to signal that removing it would be a bad idea (albeit
of relatively little consequence since it can't be built as a module).
suppress_bind_attrs didn't exist back then. :-)
In any case,
Acked-by: Scott Wood <oss@buserror.net>
-Scott
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable
2022-07-07 6:14 [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Uwe Kleine-König
2022-07-07 6:14 ` [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver Uwe Kleine-König
@ 2022-07-07 6:14 ` Uwe Kleine-König
2022-07-07 8:49 ` Christophe Leroy
2022-07-07 8:43 ` [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Christophe Leroy
2022-07-29 13:03 ` Michael Ellerman
3 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2022-07-07 6:14 UTC (permalink / raw)
To: Scott Wood, Michael Ellerman; +Cc: kernel, Paul Mackerras, linuxppc-dev
pmc_dev is only assigned in .probe(), otherwise the variable is unused.
So drop this pointer that serves no purpose.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/powerpc/platforms/83xx/suspend.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 309f42ab63d4..3fa8979ac8a6 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -100,7 +100,6 @@ struct pmc_type {
int has_deep_sleep;
};
-static struct platform_device *pmc_dev;
static int has_deep_sleep, deep_sleeping;
static int pmc_irq;
static struct mpc83xx_pmc __iomem *pmc_regs;
@@ -356,7 +355,6 @@ static int pmc_probe(struct platform_device *ofdev)
has_deep_sleep = type->has_deep_sleep;
immrbase = get_immrbase();
- pmc_dev = ofdev;
is_pci_agent = mpc83xx_is_pci_agent();
if (is_pci_agent < 0)
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable
2022-07-07 6:14 ` [PATCH 3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable Uwe Kleine-König
@ 2022-07-07 8:49 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-07-07 8:49 UTC (permalink / raw)
To: Uwe Kleine-König, Scott Wood, Michael Ellerman
Cc: kernel@pengturonix.de, linuxppc-dev@lists.ozlabs.org,
Paul Mackerras
Le 07/07/2022 à 08:14, Uwe Kleine-König a écrit :
> pmc_dev is only assigned in .probe(), otherwise the variable is unused.
> So drop this pointer that serves no purpose.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/platforms/83xx/suspend.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
> index 309f42ab63d4..3fa8979ac8a6 100644
> --- a/arch/powerpc/platforms/83xx/suspend.c
> +++ b/arch/powerpc/platforms/83xx/suspend.c
> @@ -100,7 +100,6 @@ struct pmc_type {
> int has_deep_sleep;
> };
>
> -static struct platform_device *pmc_dev;
> static int has_deep_sleep, deep_sleeping;
> static int pmc_irq;
> static struct mpc83xx_pmc __iomem *pmc_regs;
> @@ -356,7 +355,6 @@ static int pmc_probe(struct platform_device *ofdev)
>
> has_deep_sleep = type->has_deep_sleep;
> immrbase = get_immrbase();
> - pmc_dev = ofdev;
>
> is_pci_agent = mpc83xx_is_pci_agent();
> if (is_pci_agent < 0)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration
2022-07-07 6:14 [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Uwe Kleine-König
2022-07-07 6:14 ` [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver Uwe Kleine-König
2022-07-07 6:14 ` [PATCH 3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable Uwe Kleine-König
@ 2022-07-07 8:43 ` Christophe Leroy
2022-07-29 13:03 ` Michael Ellerman
3 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-07-07 8:43 UTC (permalink / raw)
To: Uwe Kleine-König, Scott Wood, Michael Ellerman
Cc: kernel@pengturonix.de, linuxppc-dev@lists.ozlabs.org,
Paul Mackerras
Le 07/07/2022 à 08:14, Uwe Kleine-König a écrit :
> By moving up pmc_types and pmc_match, the forward declaration for pmc_match
> can be dropped.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/platforms/83xx/suspend.c | 43 +++++++++++++--------------
> 1 file changed, 21 insertions(+), 22 deletions(-)
>
> diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
> index 6d47a5b81485..30b7700a2c98 100644
> --- a/arch/powerpc/platforms/83xx/suspend.c
> +++ b/arch/powerpc/platforms/83xx/suspend.c
> @@ -319,7 +319,27 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
> .end = mpc83xx_suspend_end,
> };
>
> -static const struct of_device_id pmc_match[];
> +static struct pmc_type pmc_types[] = {
> + {
> + .has_deep_sleep = 1,
> + },
> + {
> + .has_deep_sleep = 0,
> + }
> +};
> +
> +static const struct of_device_id pmc_match[] = {
> + {
> + .compatible = "fsl,mpc8313-pmc",
> + .data = &pmc_types[0],
> + },
> + {
> + .compatible = "fsl,mpc8349-pmc",
> + .data = &pmc_types[1],
> + },
> + {}
> +};
> +
> static int pmc_probe(struct platform_device *ofdev)
> {
> struct device_node *np = ofdev->dev.of_node;
> @@ -406,27 +426,6 @@ static int pmc_remove(struct platform_device *ofdev)
> return -EPERM;
> };
>
> -static struct pmc_type pmc_types[] = {
> - {
> - .has_deep_sleep = 1,
> - },
> - {
> - .has_deep_sleep = 0,
> - }
> -};
> -
> -static const struct of_device_id pmc_match[] = {
> - {
> - .compatible = "fsl,mpc8313-pmc",
> - .data = &pmc_types[0],
> - },
> - {
> - .compatible = "fsl,mpc8349-pmc",
> - .data = &pmc_types[1],
> - },
> - {}
> -};
> -
> static struct platform_driver pmc_driver = {
> .driver = {
> .name = "mpc83xx-pmc",
>
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration
2022-07-07 6:14 [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Uwe Kleine-König
` (2 preceding siblings ...)
2022-07-07 8:43 ` [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Christophe Leroy
@ 2022-07-29 13:03 ` Michael Ellerman
3 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2022-07-29 13:03 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Ellerman, Scott Wood
Cc: linuxppc-dev, Paul Mackerras
On Thu, 7 Jul 2022 08:14:39 +0200, Uwe Kleine-König wrote:
> By moving up pmc_types and pmc_match, the forward declaration for pmc_match
> can be dropped.
>
>
Applied to powerpc/next.
[1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration
https://git.kernel.org/powerpc/c/fde345e4d39a4f16697a8060564fff1dbac05035
[2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver
https://git.kernel.org/powerpc/c/ccc1439b924bca5d5a5d81cf6b0d4b10b321282e
[3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable
https://git.kernel.org/powerpc/c/95b002e4e47a36d88deec70808ef36674fb33cf5
cheers
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-07-29 13:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-07 6:14 [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Uwe Kleine-König
2022-07-07 6:14 ` [PATCH 2/3] powerpc/platforms/83xx/suspend: Prevent unloading the driver Uwe Kleine-König
2022-07-07 8:44 ` Christophe Leroy
2022-07-15 18:41 ` Scott Wood
2022-07-07 6:14 ` [PATCH 3/3] powerpc/platforms/83xx/suspend: Remove write-only global variable Uwe Kleine-König
2022-07-07 8:49 ` Christophe Leroy
2022-07-07 8:43 ` [PATCH 1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration Christophe Leroy
2022-07-29 13:03 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).