* [PATCH] SPI: meson-spifc add missed calls to remove function
@ 2021-04-23 3:42 Artem Lapkin
2021-04-23 11:47 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Artem Lapkin @ 2021-04-23 3:42 UTC (permalink / raw
To: narmstrong
Cc: khilman, jbrunet, martin.blumenstingl, dri-devel, linux-spi,
broonie, linux-arm-kernel, linux-amlogic, linux-kernel,
christianshewitt, art, nick, gouwa
Problem: rmmod meson_gx_mmc - not stable without spi_master_suspend call
and we can get stuck when try unload this module
rmmod meson_gx_mmc
...
[ 421.108614] Deleting MTD partitions on "spi0.0":
[ 424.219862] spi_master spi0: Failed to power device: -13
...
lsmod | grep spi
spi_meson_spifc 16384 -1
Solution: just add spi_master_suspend(master) call
Signed-off-by: Artem Lapkin <art@khadas.com>
---
drivers/spi/spi-meson-spifc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c
index 8eca6f24c..8a97a6dbf 100644
--- a/drivers/spi/spi-meson-spifc.c
+++ b/drivers/spi/spi-meson-spifc.c
@@ -359,6 +359,7 @@ static int meson_spifc_remove(struct platform_device *pdev)
struct spi_master *master = platform_get_drvdata(pdev);
struct meson_spifc *spifc = spi_master_get_devdata(master);
+ spi_master_suspend(master);
pm_runtime_get_sync(&pdev->dev);
clk_disable_unprepare(spifc->clk);
pm_runtime_disable(&pdev->dev);
--
2.25.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] SPI: meson-spifc add missed calls to remove function
2021-04-23 3:42 [PATCH] SPI: meson-spifc add missed calls to remove function Artem Lapkin
@ 2021-04-23 11:47 ` Mark Brown
2021-04-24 0:08 ` Art Nikpal
[not found] ` <CAKaHn9+d5crmmG-aKyLuvyxk+A7aC9qqfX_3wuMXm50pg+pZ4w@mail.gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: Mark Brown @ 2021-04-23 11:47 UTC (permalink / raw
To: Artem Lapkin
Cc: narmstrong, khilman, jbrunet, martin.blumenstingl, dri-devel,
linux-spi, linux-arm-kernel, linux-amlogic, linux-kernel,
christianshewitt, art, nick, gouwa
[-- Attachment #1.1: Type: text/plain, Size: 730 bytes --]
On Fri, Apr 23, 2021 at 11:42:47AM +0800, Artem Lapkin wrote:
> Problem: rmmod meson_gx_mmc - not stable without spi_master_suspend call
> and we can get stuck when try unload this module
> +++ b/drivers/spi/spi-meson-spifc.c
> @@ -359,6 +359,7 @@ static int meson_spifc_remove(struct platform_device *pdev)
> struct spi_master *master = platform_get_drvdata(pdev);
> struct meson_spifc *spifc = spi_master_get_devdata(master);
>
> + spi_master_suspend(master);
> pm_runtime_get_sync(&pdev->dev);
> clk_disable_unprepare(spifc->clk);
> pm_runtime_disable(&pdev->dev);
I would expect the driver to unregister the controller at the start of
the remove function, suspend doesn't really make sense here.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] SPI: meson-spifc add missed calls to remove function
2021-04-23 11:47 ` Mark Brown
@ 2021-04-24 0:08 ` Art Nikpal
[not found] ` <CAKaHn9+d5crmmG-aKyLuvyxk+A7aC9qqfX_3wuMXm50pg+pZ4w@mail.gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Art Nikpal @ 2021-04-24 0:08 UTC (permalink / raw
To: Mark Brown
Cc: Neil Armstrong, Kevin Hilman, jbrunet, Martin Blumenstingl,
dri-devel, linux-spi, linux-arm-kernel, linux-amlogic,
linux-kernel, Christian Hewitt, Artem Lapkin, nick, Gouwa Wang
> I would expect the driver to unregister the controller at the start of
> the remove function, suspend doesn't really make sense here
It's strange - But without spi_master_suspend i have randomly stucks
when i try unload this module - as was written before
i was test it (load/unload module in loop) and for me suspend make sense here
If anybody has another solution - or real problem not here - please
help to find the right way!
PS: i have another way for solve this problem (may be it can help us
fix problem in kernel)
# before unload module need
echo -n spi0.0 > /sys/bus/spi/drivers/spi-nor/unbind
# after unbind driver we can unload module without problem
rmmod spi_meson_spifc # can stuck without unbind driver before ...
On Fri, Apr 23, 2021 at 7:48 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Apr 23, 2021 at 11:42:47AM +0800, Artem Lapkin wrote:
> > Problem: rmmod meson_gx_mmc - not stable without spi_master_suspend call
> > and we can get stuck when try unload this module
>
> > +++ b/drivers/spi/spi-meson-spifc.c
> > @@ -359,6 +359,7 @@ static int meson_spifc_remove(struct platform_device *pdev)
> > struct spi_master *master = platform_get_drvdata(pdev);
> > struct meson_spifc *spifc = spi_master_get_devdata(master);
> >
> > + spi_master_suspend(master);
> > pm_runtime_get_sync(&pdev->dev);
> > clk_disable_unprepare(spifc->clk);
> > pm_runtime_disable(&pdev->dev);
>
> I would expect the driver to unregister the controller at the start of
> the remove function, suspend doesn't really make sense here.
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] SPI: meson-spifc add missed calls to remove function
[not found] ` <CAKaHn9+d5crmmG-aKyLuvyxk+A7aC9qqfX_3wuMXm50pg+pZ4w@mail.gmail.com>
@ 2021-04-26 11:56 ` Mark Brown
2021-04-30 8:49 ` Art Nikpal
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2021-04-26 11:56 UTC (permalink / raw
To: Art Nikpal
Cc: Neil Armstrong, Kevin Hilman, jbrunet, Martin Blumenstingl,
dri-devel, linux-spi, linux-arm-kernel, linux-amlogic,
linux-kernel, Christian Hewitt, Artem Lapkin, nick, Gouwa Wang
[-- Attachment #1.1: Type: text/plain, Size: 590 bytes --]
On Sat, Apr 24, 2021 at 07:57:19AM +0800, Art Nikpal wrote:
> > I would expect the driver to unregister the controller at the start of
> > the remove function, suspend doesn't really make sense here
> It's strange - But without spi_master_suspend i have randomly stucks when i
> try unload this module - as was written before
> i was test it (load/unload module in loop) and for me suspend make sense
> here
> If anybody has another solution - or real problem not here - please write
> to me the right way!
As I said above unregister the controller at the start of the remove
function.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] SPI: meson-spifc add missed calls to remove function
2021-04-26 11:56 ` Mark Brown
@ 2021-04-30 8:49 ` Art Nikpal
2021-04-30 10:59 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Art Nikpal @ 2021-04-30 8:49 UTC (permalink / raw
To: Mark Brown
Cc: Neil Armstrong, Kevin Hilman, jbrunet, Martin Blumenstingl,
dri-devel, linux-spi, linux-arm-kernel, linux-amlogic,
linux-kernel, Christian Hewitt, Artem Lapkin, nick, Gouwa Wang
Yep! but
if i try call spi_master_put(master) or spi_unregister_controller(master);
it's made Segmentation fault for me
what's wrong - may be somebody can help me
On Mon, Apr 26, 2021 at 7:57 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Sat, Apr 24, 2021 at 07:57:19AM +0800, Art Nikpal wrote:
>
> > > I would expect the driver to unregister the controller at the start of
> > > the remove function, suspend doesn't really make sense here
>
> > It's strange - But without spi_master_suspend i have randomly stucks when i
> > try unload this module - as was written before
> > i was test it (load/unload module in loop) and for me suspend make sense
> > here
>
> > If anybody has another solution - or real problem not here - please write
> > to me the right way!
>
> As I said above unregister the controller at the start of the remove
> function.
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] SPI: meson-spifc add missed calls to remove function
2021-04-30 8:49 ` Art Nikpal
@ 2021-04-30 10:59 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-04-30 10:59 UTC (permalink / raw
To: Art Nikpal
Cc: Neil Armstrong, Kevin Hilman, jbrunet, Martin Blumenstingl,
dri-devel, linux-spi, linux-arm-kernel, linux-amlogic,
linux-kernel, Christian Hewitt, Artem Lapkin, nick, Gouwa Wang
[-- Attachment #1.1: Type: text/plain, Size: 765 bytes --]
On Fri, Apr 30, 2021 at 04:49:35PM +0800, Art Nikpal wrote:
> Yep! but
Please don't top post, reply in line with needed context. This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.
> if i try call spi_master_put(master) or spi_unregister_controller(master);
> it's made Segmentation fault for me
>
> what's wrong - may be somebody can help me
Probably something is referencing the controller afer it was freed, I do
notice that the current version of the driver uses devm_ to register the
controller so you'd end up with a double free unless you either use devm_
when freeing or change to a normal registration.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-30 10:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-23 3:42 [PATCH] SPI: meson-spifc add missed calls to remove function Artem Lapkin
2021-04-23 11:47 ` Mark Brown
2021-04-24 0:08 ` Art Nikpal
[not found] ` <CAKaHn9+d5crmmG-aKyLuvyxk+A7aC9qqfX_3wuMXm50pg+pZ4w@mail.gmail.com>
2021-04-26 11:56 ` Mark Brown
2021-04-30 8:49 ` Art Nikpal
2021-04-30 10:59 ` Mark Brown
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 read-only IMAP folder(s) and NNTP newsgroup(s).