Re: [PATCH resend] spi core: Provide means to instantiate devices through sysfs

2012-09-22 Thread Guenter Roeck
On Sat, Sep 22, 2012 at 12:11:33PM -0400, Mark Brown wrote: > On Mon, Sep 17, 2012 at 04:51:20PM -0700, Guenter Roeck wrote: > > The I2C core provides a means to instantiate devices from userspace > > using sysfs attributes. Provide the same mechanism for SPI devices. > > S

[PATCH resend] spi core: Provide means to instantiate devices through sysfs

2012-09-17 Thread Guenter Roeck
The I2C core provides a means to instantiate devices from userspace using sysfs attributes. Provide the same mechanism for SPI devices. Signed-off-by: Guenter Roeck --- This helped me tremendously for testing new SPI master and client drivers. Maybe it is useful for others as well. ping: Any

Re: [PATCH 1/4] hwmon: (lm70) Simplify show_name function

2012-09-16 Thread Guenter Roeck
On Sun, Sep 16, 2012 at 08:44:56PM +0200, Jean Delvare wrote: > On Sun, 16 Sep 2012 09:19:34 -0700, Guenter Roeck wrote: > > On Sun, Sep 16, 2012 at 03:09:01PM +0200, Jean Delvare wrote: > > > On Tue, 11 Sep 2012 13:52:50 -0700, Guenter Roeck wrote: > > > That's a

Re: [PATCH 1/4] hwmon: (lm70) Simplify show_name function

2012-09-16 Thread Guenter Roeck
On Sun, Sep 16, 2012 at 03:09:01PM +0200, Jean Delvare wrote: > Hi Guenter, > > On Tue, 11 Sep 2012 13:52:50 -0700, Guenter Roeck wrote: > > Instead of using a switch statement to determine the device name, use > > to_spi_device(dev)->modalias to simplify the cod

[PATCH] spi core: Provide means to instantiate devices through sysfs

2012-09-08 Thread Guenter Roeck
The I2C core provides a means to instantiate devices from userspace using sysfs attributes. Provide the same mechanism for SPI devices. Signed-off-by: Guenter Roeck --- This helped me tremendously for testing new SPI master and client drivers. Maybe it is useful for others as well

Re: [PATCH] Revert "spi/doc: spi_master_put must be followed up by kfree"

2012-09-04 Thread Guenter Roeck
On Tue, Sep 04, 2012 at 09:25:23AM +0200, Uwe Kleine-König wrote: > On Mon, Sep 03, 2012 at 01:26:26PM -0700, Guenter Roeck wrote: > > Actually, spi_master_put() after spi_alloc_master() must _not_ be followed > > by kfree(). The memory is already freed with the call to

[PATCH] Revert "spi/doc: spi_master_put must be followed up by kfree"

2012-09-03 Thread Guenter Roeck
elsewhere in the kernel, often in the networking stack. This reverts commit eb4af0f5349235df2e4a5057a72fc8962d00308a. Cc: Uwe Kleine-Koenig Signed-off-by: Guenter Roeck --- drivers/spi/spi.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi

Re: [PATCH] spi/mxs: Fix device remove function

2012-08-24 Thread Guenter Roeck
On Sat, Aug 25, 2012 at 12:07:37AM +0200, Marek Vasut wrote: [ ... ] > > > On a side note, at least some of the spi bitbang drivers have a similar > > problem. Unfortunately, I can not fix it right now because I have no means > > to test it, and have no idea what exactly is _supposed_ to happen.

Re: [PATCH] spi/mxs: Fix device remove function

2012-08-24 Thread Guenter Roeck
On Fri, Aug 24, 2012 at 10:10:12PM +0200, Marek Vasut wrote: > Dear Guenter Roeck, > > > The call sequence > > spi_alloc_master/spi_register_master/spi_unregister_master is complete; it > > reduces the device reference count to zero, which results in device memory >

[PATCH] spi/mxs: Fix device remove function

2012-08-24 Thread Guenter Roeck
unnecessaary calls to platform_set_drvdata(). Cc: Marek Vasut Signed-off-by: Guenter Roeck --- Applies to -next (as of 8/24/12). drivers/spi/spi-mxs.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 130a436..cb189b7

Re: [PATCH 1/3] spi/stmp: Fix device remove function

2012-08-24 Thread Guenter Roeck
On Fri, Aug 24, 2012 at 10:47:08AM +0200, Wolfram Sang wrote: > On Thu, Aug 23, 2012 at 08:08:47PM -0700, Guenter Roeck wrote: > > The call sequence spi_alloc_master/spi_register_master/spi_unregister_master > > is complete; it reduces the device reference count to zero, w

[PATCH 3/3] spi/topcliff-pch: Fix device remove function

2012-08-23 Thread Guenter Roeck
subsystem resets device driver data to NULL after the call to the remove function returns, so there is no need to do it here. Signed-off-by: Guenter Roeck --- drivers/spi/spi-topcliff-pch.c |2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi

[PATCH 2/3] spi/tegra: Fix device remove function

2012-08-23 Thread Guenter Roeck
to solve the problem. Signed-off-by: Guenter Roeck --- drivers/spi/spi-tegra.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c index ef52c1c..e28445d 100644 --- a/drivers/spi/spi-tegra.c +++ b/drivers/spi/spi-tegra.c

[PATCH 1/3] spi/stmp: Fix device remove function

2012-08-23 Thread Guenter Roeck
respective check and drop the unnecessaary call to platform_set_drvdata(). Signed-off-by: Guenter Roeck --- Note that this driver is impossible to build, since it depends on ARCH_STMP3XXX which is not defined anywhere. drivers/spi/spi-stmp.c |6 +- 1 file changed, 1 insertion(+), 5

Re: [PATCH] spi/s3c64xx: Drop extra calls to spi_master_get in suspend/remove functions

2012-08-23 Thread Guenter Roeck
On Thu, Aug 23, 2012 at 02:40:45PM +0900, Kukjin Kim wrote: > Guenter Roeck wrote: > > > > Suspend and resume functions call spi_master_get() without matching > > spi_master_put(). The extra references are unnecessary and cause > > subsequent > > module unload

[PATCH] spi/sc18is602: Return -EINVAL for probe failures due to I2C function mismatch

2012-08-22 Thread Guenter Roeck
condition. Replace error return value with -EINVAL to trigger an error message showing that the probe function failed. Signed-off-by: Guenter Roeck --- drivers/spi/spi-sc18is602.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi

Re: [PATCH] spi: Master driver for NXP SC18IS602/603

2012-08-22 Thread Guenter Roeck
On Wed, Aug 22, 2012 at 07:32:30PM +0100, Mark Brown wrote: > On Sat, Aug 18, 2012 at 09:06:27AM -0700, Guenter Roeck wrote: > > This driver adds support for NXP SC18IS602/603 I2C to SPI bus bridge. > > > > Signed-off-by: Guenter Roeck > > Applied, thanks. One smal

Re: [2/2] spi: Add SPI master controller for OCTEON SOCs.

2012-08-21 Thread Guenter Roeck
On Fri, May 11, 2012 at 08:34:46PM -, David Daney wrote: > From: David Daney > > Add the driver, link it into the kbuild system and provide device tree > binding documentation. > > Signed-off-by: David Daney > Acked-by: Grant Likely > [ ... ] > + > +static int __devexit octeon_spi_remove

[PATCH] spi/pl022: Fix device remove function

2012-08-19 Thread Guenter Roeck
: Guenter Roeck --- drivers/spi/spi-pl022.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index aab518e..47c6753 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2171,7 +2171,6 @@ pl022_remove(struct amba_device *adev

[PATCH 4/4] spi/mpc512x-psc: Avoid access to freed memory in device remove function

2012-08-18 Thread Guenter Roeck
to solve the problem. Signed-off-by: Guenter Roeck --- drivers/spi/spi-mpc512x-psc.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 4c63f77..0a1e39e 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b

[PATCH 2/4] spi/mpc52xx: Fix device remove function

2012-08-18 Thread Guenter Roeck
call to spi_unregister_master results in device memory being freed, it must no longer be accessed afterwards. To fix both problems, call spi_master_get to get an extra reference to the device, and call spi_master_put only after the last access to device data. Signed-off-by: Guenter Roeck

[PATCH 3/4] spi/mpc52xx-psc: Avoid access to freed memory in device remove function

2012-08-18 Thread Guenter Roeck
to solve the problem. Signed-off-by: Guenter Roeck --- drivers/spi/spi-mpc52xx-psc.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c index 6604715..bd47d26 100644 --- a/drivers/spi/spi-mpc52xx-psc.c +++ b

[PATCH 1/4] spi/mpc52xx: Fix error handling in probe function

2012-08-18 Thread Guenter Roeck
The call to spi_master_put() is needed to free device memory. It must be called after spi_alloc_master, and must only be called after the device memory is no longer used. Signed-off-by: Guenter Roeck --- drivers/spi/spi-mpc52xx.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions

[PATCH] spi: Master driver for NXP SC18IS602/603

2012-08-18 Thread Guenter Roeck
This driver adds support for NXP SC18IS602/603 I2C to SPI bus bridge. Signed-off-by: Guenter Roeck --- There is one checkatch warning: WARNING: please write a paragraph that describes the config symbol fully #101: FILE: drivers/spi/Kconfig:328: +config SPI_SC18IS602 I

Re: [PATCH] spi/s3c64xx: Drop extra calls to spi_master_get in suspend/remove functions

2012-08-16 Thread Guenter Roeck
Sigh. s/remove/resume/ in headline. Guenter On Thu, Aug 16, 2012 at 08:14:25PM -0700, Guenter Roeck wrote: > Suspend and resume functions call spi_master_get() without matching > spi_master_put(). The extra references are unnecessary and cause subsequent > module unload attempts to f

[PATCH 2/2] spi/coldfire-qspi: Drop extra calls to spi_master_get in suspend/resume functions

2012-08-16 Thread Guenter Roeck
Suspend and resume functions call spi_master_get() without matching spi_master_put(). The extra references are unnecessary and cause subsequent module unload attempts to fail, so drop the calls. Signed-off-by: Guenter Roeck --- drivers/spi/spi-coldfire-qspi.c |4 ++-- 1 file changed, 2

[PATCH 1/2] spi: spi-coldfire-qspi: Drop extra spi_master_put in device remove function

2012-08-16 Thread Guenter Roeck
-off-by: Guenter Roeck --- drivers/spi/spi-coldfire-qspi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c index b2d4b9e..1a30b47 100644 --- a/drivers/spi/spi-coldfire-qspi.c +++ b/drivers/spi/spi-coldfire-qspi.c @@ -533,7 +533,6

[PATCH] spi/s3c64xx: Drop extra calls to spi_master_get in suspend/remove functions

2012-08-16 Thread Guenter Roeck
Suspend and resume functions call spi_master_get() without matching spi_master_put(). The extra references are unnecessary and cause subsequent module unload attempts to fail. Drop the calls. Signed-off-by: Guenter Roeck --- drivers/spi/spi-s3c64xx.c |8 1 file changed, 4

Re: Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers

2012-08-16 Thread Guenter Roeck
On Thu, Aug 16, 2012 at 02:27:49PM +0530, Thomas Abraham wrote: > On 14 August 2012 03:14, Guenter Roeck wrote: > > Hi all, > > > > looking through SPI master drivers, I noticed that the following drivers > > call > > spi_master_get() in their suspend and r

Unbalanced calls to spi_master_get in coldfire-qspi and s3c64xx SPI master drivers

2012-08-13 Thread Guenter Roeck
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

[RFC PATCH] spi/bcm63xx: Ensure that memory is freed only after it is no longer used

2012-08-10 Thread Guenter Roeck
the problem. Cc: Florian Fainelli Signed-off-by: Guenter Roeck --- Several drivers have this problem, and I am trying to find a common fix. This solution is modeled after the approach used in spi-txx9spi:txx9spi_remove. The other possible fix would be to move spi_unregister_master() to the end

Re: [PATCH] spi: omap2-mcspi: Fix the error handling in probe

2012-08-02 Thread Guenter Roeck
On Thu, Aug 02, 2012 at 03:37:13PM +0530, Shubhrajyoti wrote: > On Wednesday 01 August 2012 08:37 PM, Guenter Roeck wrote: > > On Wed, Aug 01, 2012 at 03:06:28PM +0530, Shubhrajyoti D wrote: > >> The kfree() is taken care of by the spi core (spi_master_release() > >> fu

Re: [PATCH] spi: omap2-mcspi: Fix the error handling in probe

2012-08-01 Thread Guenter Roeck
lso the put was missed in some of the error handling fix the same. > There by fixing the missing device_put in some of the error paths. > > Cc: Guenter Roeck Reported-by: may be better here. > Signed-off-by: Shubhrajyoti D Acked-by: Guenter Roeck I suspect that "spi_master_put(

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 03:50:12PM +0800, Shawn Guo wrote: > On Tue, Jul 31, 2012 at 11:56:50PM -0700, Guenter Roeck wrote: > > Guess we are in violent agreement. The sequence would then either be > > master = spi_alloc_device(); > > The discussion is around spi_all

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote: > Dear Guenter Roeck, > > > On Wed, Aug 01, 2012 at 08:10:37AM +0200, Marek Vasut wrote: > > > Dear Shawn Guo, > > > > > > > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: &g

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 08:10:37AM +0200, Marek Vasut wrote: > Dear Shawn Guo, > > > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > > On Tue, Jul 31, 2012 at 10:2

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 11:16:15AM +0530, Shubhrajyoti Datta wrote: > On Wed, Aug 1, 2012 at 10:59 AM, Guenter Roeck wrote: > > On Wed, Aug 01, 2012 at 07:00:54AM +0200, Marek Vasut wrote: > >> Dear Shawn Guo, > >> > >> > On Tue, Jul 31, 2012 at 08:35:59PM

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 02:28:40PM +0800, Shawn Guo wrote: > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > > > Anyo

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > Anyone up for writing some patches ? If not, I'll do it. > > > Go ahead. > Ok, will do. It isn't that simple, actually, since at leas

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 07:00:54AM +0200, Marek Vasut wrote: > Dear Shawn Guo, > > > On Tue, Jul 31, 2012 at 08:35:59PM -0700, Guenter Roeck wrote: > > > I think the call to spi_master_put() triggers the call to > > > spi_master_release(). If so, kfree() would

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 11:53:36AM +0800, Shawn Guo wrote: > On Wed, Aug 01, 2012 at 04:31:04AM +0200, Marek Vasut wrote: > > > Couple of reasons for asking: No other SPI master driver calls it in the > > > remove function (unless I missed it), most drivers don't call it in the > > > probe function

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
Hi Marek, On Wed, Aug 01, 2012 at 04:31:04AM +0200, Marek Vasut wrote: > Dear Guenter Roeck, > > [...] > > > > +static int __devexit mxs_spi_remove(struct platform_device *pdev) > > > +{ > > > + struct spi_master *host; > > > +

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Fri, Jul 06, 2012 at 06:17:25AM -, Marek Vasut wrote: > This is slightly reworked version of the SPI driver. > Support for DT has been added and it's been converted > to queued API. > > Based on previous attempt by: > Fabio Estevam > > Signed-off-by: Fabio Estevam > Signed-off-by: Marek