* [PATCH] mfd: core: check existence of enable/disable callbacks
@ 2016-05-10 5:27 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2016-05-10 5:27 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, Lee Jones; +Cc: Masahiro Yamada
Child devices may not know if their MFD cells have enable/disable
callbacks.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/mfd/mfd-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 88bd1b1..95dbf3a 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -33,7 +33,7 @@ int mfd_cell_enable(struct platform_device *pdev)
int err = 0;
/* only call enable hook if the cell wasn't previously enabled */
- if (atomic_inc_return(cell->usage_count) == 1)
+ if (atomic_inc_return(cell->usage_count) == 1 && cell->enable)
err = cell->enable(pdev);
/* if the enable hook failed, decrement counter to allow retries */
@@ -50,7 +50,7 @@ int mfd_cell_disable(struct platform_device *pdev)
int err = 0;
/* only disable if no other clients are using it */
- if (atomic_dec_return(cell->usage_count) == 0)
+ if (atomic_dec_return(cell->usage_count) == 0 && cell->disable)
err = cell->disable(pdev);
/* if the disable hook failed, increment to allow retries */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] mfd: core: check existence of enable/disable callbacks
@ 2016-05-10 5:27 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2016-05-10 5:27 UTC (permalink / raw)
To: linux-arm-kernel
Child devices may not know if their MFD cells have enable/disable
callbacks.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/mfd/mfd-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 88bd1b1..95dbf3a 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -33,7 +33,7 @@ int mfd_cell_enable(struct platform_device *pdev)
int err = 0;
/* only call enable hook if the cell wasn't previously enabled */
- if (atomic_inc_return(cell->usage_count) == 1)
+ if (atomic_inc_return(cell->usage_count) == 1 && cell->enable)
err = cell->enable(pdev);
/* if the enable hook failed, decrement counter to allow retries */
@@ -50,7 +50,7 @@ int mfd_cell_disable(struct platform_device *pdev)
int err = 0;
/* only disable if no other clients are using it */
- if (atomic_dec_return(cell->usage_count) == 0)
+ if (atomic_dec_return(cell->usage_count) == 0 && cell->disable)
err = cell->disable(pdev);
/* if the disable hook failed, increment to allow retries */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-10 5:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 5:27 [PATCH] mfd: core: check existence of enable/disable callbacks Masahiro Yamada
2016-05-10 5:27 ` Masahiro Yamada
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.