linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers
@ 2012-08-13 21:44 Guenter Roeck
  2012-08-16  8:57 ` Thomas Abraham
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2012-08-13 21:44 UTC (permalink / raw)
  To: spi-devel-general, linux-samsung-soc
  Cc: Mark Brown, Grant Likely, Ben Dooks, Kukjin Kim

Hi all,

looking through SPI master drivers, I noticed that the following drivers call
spi_master_get() in their suspend and resume functions. Yet, there is no
matching call to spi_master_put(), meaning the reference count will increase
with each suspend/resume cycle.
	spi-coldfire-qspi.c
	spi-s3c64xx.c
Other SPI master drivers also support suspend and resume, but do not call
spi_master_get() in the suspend/resume functions. The spi-pl022 driver calls
spi_master_suspend() and spi_master_resume() like the above, but does not
call spi_master_get() either.

This leads me to believe that the above drivers will hang on unload after a
suspend/resume cycle due to the extra references.

Can someone please have a look and confirm if my understanding is correct ?
If so I'll send a set of patches to fix the problems.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers
  2012-08-13 21:44 Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers Guenter Roeck
@ 2012-08-16  8:57 ` Thomas Abraham
  2012-08-16 13:48   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Abraham @ 2012-08-16  8:57 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: spi-devel-general, linux-samsung-soc, Mark Brown, Grant Likely,
	Ben Dooks, Kukjin Kim

On 14 August 2012 03:14, Guenter Roeck <linux@roeck-us.net> wrote:
> Hi all,
>
> looking through SPI master drivers, I noticed that the following drivers call
> spi_master_get() in their suspend and resume functions. Yet, there is no
> matching call to spi_master_put(), meaning the reference count will increase
> with each suspend/resume cycle.
>         spi-coldfire-qspi.c
>         spi-s3c64xx.c
> Other SPI master drivers also support suspend and resume, but do not call
> spi_master_get() in the suspend/resume functions. The spi-pl022 driver calls
> spi_master_suspend() and spi_master_resume() like the above, but does not
> call spi_master_get() either.
>
> This leads me to believe that the above drivers will hang on unload after a
> suspend/resume cycle due to the extra references.
>
> Can someone please have a look and confirm if my understanding is correct ?
> If so I'll send a set of patches to fix the problems.

For spi-s3c64xx.c, yes it does seem that the spi_master_get() and
spi_master_put() calls are not balanced.  The probable change could be

-  struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+ struct spi_master *master = dev_get_drvdata(dev);

Thanks,
Thomas.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers
  2012-08-16  8:57 ` Thomas Abraham
@ 2012-08-16 13:48   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-08-16 13:48 UTC (permalink / raw)
  To: Thomas Abraham
  Cc: spi-devel-general, linux-samsung-soc, Mark Brown, Grant Likely,
	Ben Dooks, Kukjin Kim

On Thu, Aug 16, 2012 at 02:27:49PM +0530, Thomas Abraham wrote:
> On 14 August 2012 03:14, Guenter Roeck <linux@roeck-us.net> wrote:
> > Hi all,
> >
> > looking through SPI master drivers, I noticed that the following drivers call
> > spi_master_get() in their suspend and resume functions. Yet, there is no
> > matching call to spi_master_put(), meaning the reference count will increase
> > with each suspend/resume cycle.
> >         spi-coldfire-qspi.c
> >         spi-s3c64xx.c
> > Other SPI master drivers also support suspend and resume, but do not call
> > spi_master_get() in the suspend/resume functions. The spi-pl022 driver calls
> > spi_master_suspend() and spi_master_resume() like the above, but does not
> > call spi_master_get() either.
> >
> > This leads me to believe that the above drivers will hang on unload after a
> > suspend/resume cycle due to the extra references.
> >
> > Can someone please have a look and confirm if my understanding is correct ?
> > If so I'll send a set of patches to fix the problems.
> 
> For spi-s3c64xx.c, yes it does seem that the spi_master_get() and
> spi_master_put() calls are not balanced.  The probable change could be
> 
> -  struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> + struct spi_master *master = dev_get_drvdata(dev);
> 
Yes, that is what I thought.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-16 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13 21:44 Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers Guenter Roeck
2012-08-16  8:57 ` Thomas Abraham
2012-08-16 13:48   ` Guenter Roeck

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).