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

2012-08-01 Thread 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: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 least some of the 
 drivers
 also call spi_master_get(), and thus need two calls to spi_master_put() (or a
 call to spi_master_put and a call to kfree).
 
Hmm, are you saying that there must be a spi_master_put call matching
spi_alloc_master?  I think we only need to have spi_master_get and
spi_master_put matched.

Regards,
Shawn


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Marek Vasut
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: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 least some of the
  drivers also call spi_master_get(), and thus need two calls to
  spi_master_put() (or a call to spi_master_put and a call to kfree).
 
 Hmm, are you saying that there must be a spi_master_put call matching
 spi_alloc_master?  I think we only need to have spi_master_get and
 spi_master_put matched.

Naw, spi_master_get() does refcounting, spi_alloc_master() doesnt. You don't 
need to match spi_alloc_master() with spi_master_put()

 Regards,
 Shawn

Best regards,
Marek Vasut

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 08/10 V2] spi: Add DMA support into SPI driver

2012-08-01 Thread Marek Vasut
Dear Marek Vasut,

[...]

 -out_host_free:
 +out_free_dma:
 + dma_release_channel(ssp-dmach);
   clk_disable_unprepare(ssp-clk);
 +out_host_free:
   spi_master_put(host);
   kfree(host);
 +

Please remove this newline.

   return ret;
  }

Missing dma_release_channel() in .remove!

Best regards,
Marek Vasut

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 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 li...@roeck-us.net 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 -0700, Guenter Roeck wrote:
I think the call to spi_master_put() triggers the call to
spi_master_release(). If so, kfree() would not be needed at all, and 
the
documentation is wrong.
  
   Also those drivers calling kfree in probe.
 
  Looks like that to me ...
 
  Doesn't seem to be far spread, fortunately. Only spi-davinci.c, spi-imx.c, 
  and
  spi-omap2-mcspi.c
 
 I have a  omapsdp I could patch spi-omap2-mcspi.c  file thanks for the catch.

For that it would be good to determine if there is a memory leak when removing
the driver (I don't see where the memory allocated with spi_alloc_master is
removed).

Thanks,
Guenter

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Marek Vasut
Dear 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:
 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 least some of the
   drivers also call spi_master_get(), and thus need two calls to
   spi_master_put() (or a call to spi_master_put and a call to kfree).
  
  Hmm, are you saying that there must be a spi_master_put call matching
  spi_alloc_master?  I think we only need to have spi_master_get and
  spi_master_put matched.
 
 Yes, I think that may be so. Of course, I may be wrong, but ultimately that
 is what almost all drivers do in the probe error path. Some of the drivers
 do it in the remove path as well, though many don't. I suspect that all
 drivers using spi_alloc_master() which do not call spi_master_put() in the
 remove function may have a memory leak.

CCing Mark.

 Someone who knows the spi infrastructure better than I should have a closer
 look, though. The question is really quite simple: For example, in
 spi-atmel.c, how is the allocated master freed in the _remove function ?
 If it doesn't need the call to spi_master_put(), why do, for example,
 spi-stmp.c or spi-mpc52xx.c call it ?
 
 On the other side, I must admit I am getting more and more confused after
 looking into the code. For example, the probe function error path in
 spi-mpc52xx.c accesses the master's devdata after the call to
 spi_master_put(). If spi_master_put() frees the memory as we think it
 does, the code would access freed memory. The same happens in the remove
 path. And spi_master_put() is not always called, meaning there is either a
 memory leak or I am completely confused.

I'll poke through the stuff later if you won't get your answers (later == 
around 
tomorrow)

 Thanks,
 Guenter

Best regards,
Marek Vasut

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Marek Vasut
Dear 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 li...@roeck-us.net 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 -0700, Guenter Roeck wrote:
 I think the call to spi_master_put() triggers the call to
 spi_master_release(). If so, kfree() would not be needed at all,
 and the documentation is wrong.

Also those drivers calling kfree in probe.
   
   Looks like that to me ...
   
   Doesn't seem to be far spread, fortunately. Only spi-davinci.c,
   spi-imx.c, and spi-omap2-mcspi.c
  
  I have a  omapsdp I could patch spi-omap2-mcspi.c  file thanks for the
  catch.
 
 For that it would be good to determine if there is a memory leak when
 removing the driver (I don't see where the memory allocated with
 spi_alloc_master is removed).

When the refcounting for the device reaches 0, it's deallocated. (Aka _put long 
enough and it'll disappear)

 Thanks,
 Guenter

Best regards,
Marek Vasut

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Marek Vasut
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:
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 least some of
the drivers also call spi_master_get(), and thus need two calls to
spi_master_put() (or a call to spi_master_put and a call to kfree).
   
   Hmm, are you saying that there must be a spi_master_put call matching
   spi_alloc_master?  I think we only need to have spi_master_get and
   spi_master_put matched.
  
  Naw, spi_master_get() does refcounting, spi_alloc_master() doesnt. You
  don't need to match spi_alloc_master() with spi_master_put()
 
 I must be missing something.  Why do almost all spi drivers call it in the
 error path, even if there is no call to spi_master_get ?

To push the refcounting to 0, to deallocate the device, I'd say ...

Best regards,
Marek Vasut

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 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:
 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 least some of
 the drivers also call spi_master_get(), and thus need two calls to
 spi_master_put() (or a call to spi_master_put and a call to kfree).

Hmm, are you saying that there must be a spi_master_put call matching
spi_alloc_master?  I think we only need to have spi_master_get and
spi_master_put matched.
   
   Naw, spi_master_get() does refcounting, spi_alloc_master() doesnt. You
   don't need to match spi_alloc_master() with spi_master_put()
  
  I must be missing something.  Why do almost all spi drivers call it in the
  error path, even if there is no call to spi_master_get ?
 
 To push the refcounting to 0, to deallocate the device, I'd say ...
 

Guess we are in violent agreement. The sequence would then either be
master = spi_alloc_device();
...
spi_master_put(master);
or
master = spi_alloc_device();
...
kfree(master);

which makes sense to me. Question still is why most drivers neither call kfree()
nor spi_master_put() in the remove function.

Thanks,
Guenter

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Shawn Guo
On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote:
  I must be missing something.  Why do almost all spi drivers call it in the
  error path, even if there is no call to spi_master_get ?
 
 To push the refcounting to 0, to deallocate the device, I'd say ...
 
It's not going to work if spi_master_put is called without
spi_master_get being called before that.

Regards,
Shawn


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Shawn Guo
On Wed, Aug 01, 2012 at 03:40:53PM +0800, Shawn Guo wrote:
 On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote:
   I must be missing something.  Why do almost all spi drivers call it in the
   error path, even if there is no call to spi_master_get ?
  
  To push the refcounting to 0, to deallocate the device, I'd say ...
  
 It's not going to work if spi_master_put is called without
 spi_master_get being called before that.
 
I'm saying that kref_put on a kref that is never called on by kref_get
will not trigger the release.

Regards,
Shawn


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Shawn Guo
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_alloc_master rather than spi_alloc_device,
isn't it?

Regards,
Shawn

   ...
   spi_master_put(master);
 or
   master = spi_alloc_device();
   ...
   kfree(master);
 
 which makes sense to me. Question still is why most drivers neither call 
 kfree()
 nor spi_master_put() in the remove function.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Lothar Waßmann
Shawn Guo writes:
 On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote:
   I must be missing something.  Why do almost all spi drivers call it in the
   error path, even if there is no call to spi_master_get ?
  
  To push the refcounting to 0, to deallocate the device, I'd say ...
  
 It's not going to work if spi_master_put is called without
 spi_master_get being called before that.
 
spi_alloc_master() calls device_initialize() which resuires a
device_put() (called from spi_master_put()) to free the device.

Thus each call of either spi_alloc_master() or spi_master_get() must
be paired with an spi_master_put() call to free the resources.

The kfree() is taken care of by the spi_master_release() function that
is called once the last reference to the underlying struct device has
been released. Thus kfree() must not be called after
spi_alloc_master().


Lothar Waßmann
-- 
___

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | i...@karo-electronics.de
___

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Shawn Guo
On Wed, Aug 01, 2012 at 09:38:07AM +0200, Lothar Waßmann wrote:
 Shawn Guo writes:
  On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote:
I must be missing something.  Why do almost all spi drivers call it in 
the
error path, even if there is no call to spi_master_get ?
   
   To push the refcounting to 0, to deallocate the device, I'd say ...
   
  It's not going to work if spi_master_put is called without
  spi_master_get being called before that.
  
 spi_alloc_master() calls device_initialize() which resuires a
 device_put() (called from spi_master_put()) to free the device.
 
Ah, indeed.  I missed that kref_init() will initialize the refcount
to 1.

Thanks,
Shawn


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Shubhrajyoti D
The kfree() is taken care of by the spi core (spi_master_release() function)
that is called once the last reference to the underlying struct device has
been released. So the driver need not call kfree.

Also 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 li...@roeck-us.net
Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
---
 drivers/spi/spi-omap2-mcspi.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 7d46b15..b5035e2 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1203,18 +1203,16 @@ static int __devinit omap2_mcspi_probe(struct 
platform_device *pdev)
 
status = spi_register_master(master);
if (status  0)
-   goto err_spi_register;
+   goto disable_pm;
 
return status;
 
-err_spi_register:
-   spi_master_put(master);
 disable_pm:
pm_runtime_disable(pdev-dev);
 dma_chnl_free:
kfree(mcspi-dma_channels);
 free_master:
-   kfree(master);
+   spi_master_put(master);
platform_set_drvdata(pdev, NULL);
return status;
 }
-- 
1.7.5.4


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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_alloc_master rather than spi_alloc_device,
 isn't it?
 
Yes, sorry. Too late at night, too tired :(.

Guenter

 Regards,
 Shawn
 
  ...
  spi_master_put(master);
  or
  master = spi_alloc_device();
  ...
  kfree(master);
  
  which makes sense to me. Question still is why most drivers neither call 
  kfree()
  nor spi_master_put() in the remove function.
 
 

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Guenter Roeck
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() function)
 that is called once the last reference to the underlying struct device has
 been released. So the driver need not call kfree.
 
 Also 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 li...@roeck-us.net

Reported-by: may be better here.

 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com

Acked-by: Guenter Roeck li...@roeck-us.net

I suspect that spi_master_put(master); may also be missing in
omap2_mcspi_remove(), but we'll need someone to confirm that.

Thanks,
Guenter

 ---
  drivers/spi/spi-omap2-mcspi.c |6 ++
  1 files changed, 2 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
 index 7d46b15..b5035e2 100644
 --- a/drivers/spi/spi-omap2-mcspi.c
 +++ b/drivers/spi/spi-omap2-mcspi.c
 @@ -1203,18 +1203,16 @@ static int __devinit omap2_mcspi_probe(struct 
 platform_device *pdev)
  
   status = spi_register_master(master);
   if (status  0)
 - goto err_spi_register;
 + goto disable_pm;
  
   return status;
  
 -err_spi_register:
 - spi_master_put(master);
  disable_pm:
   pm_runtime_disable(pdev-dev);
  dma_chnl_free:
   kfree(mcspi-dma_channels);
  free_master:
 - kfree(master);
 + spi_master_put(master);
   platform_set_drvdata(pdev, NULL);
   return status;
  }
 -- 
 1.7.5.4
 
 

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


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

2012-08-01 Thread Mark Brown
On Mon, Jul 23, 2012 at 10:40:48PM +0200, 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.

Looks reasonable overall.

 + bits_per_word = dev-bits_per_word;
 + if (t  t-bits_per_word)
 + bits_per_word = t-bits_per_word;
 +
 + if (bits_per_word != 8) {
 + dev_err(dev-dev, %s, unsupported bits_per_word=%d\n,
 + __func__, bits_per_word);
 + return -EINVAL;
 + }

 + if (dev-max_speed_hz)
 + hz = dev-max_speed_hz;
 + if (t  t-speed_hz)
 + hz = t-speed_hz;
 + if (hz == 0) {
 + dev_err(dev-dev, Cannot continue with zero clock\n);
 + return -EINVAL;
 + }

These two blocks use a different style (the first does the first assign
unconditionally, the second uses initialisation with declaration).  I
prefer the first style but YMMV and it doesn't matter.

For the missing clock rate might it make sense to just use whatever the
clock happens to come out as?

 +static void mxs_spi_cleanup(struct spi_device *dev)
 +{
 + return;
 +}

Empty functions are generally a warning sign...  why do we need this
one?

 +static int __devexit mxs_spi_remove(struct platform_device *pdev)
 +{

 + clk_disable_unprepare(ssp-clk);

It'd be nice to only keep the clocks enabled while doing transfers but
again totally non-essential.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 08/10 RESEND] spi: Add DMA support into SPI driver

2012-08-01 Thread Mark Brown
On Mon, Jul 23, 2012 at 10:40:50PM +0200, Marek Vasut wrote:

 + /*
 +  * Small blocks can be transfered via PIO.
 +  * Measured by empiric means:
 +  *
 +  * dd if=/dev/mtdblock0 of=/dev/null bs=1024k count=1
 +  *
 +  * DMA only: 2.164808 seconds, 473.0KB/s
 +  * Combined: 1.676276 seconds, 610.9KB/s
 +  */

I've seen other devices end up using the FIFO length as the decision
point here which makes intuitive sense to me unless the FIFO is
extremely deep.

Not reviewed this properly yet but it looks OK from a first read
through.

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure

2012-08-01 Thread Daniel Mack
Mark,

could you have another look at these patches maybe? They aren't urgent,
I just want to avoid the get lost.

Thanks for your time,
Daniel


On 25.07.2012 13:44, Daniel Mack wrote:
 The spi-gpio driver currently assumes the chipselect gpio number is
 stored in -controller_data of the device's static board information.
 
 In devicetree environments, this information is unavailable and has to
 be derived from the DT node.
 
 This patch moves the gpio storage to the controller's private data so
 the DT bindings can easily build upon the driver.
 
 Signed-off-by: Daniel Mack zon...@gmail.com
 ---
  drivers/spi/spi-gpio.c |   34 --
  1 file changed, 24 insertions(+), 10 deletions(-)
 
 diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
 index 0094c64..e79e311 100644
 --- a/drivers/spi/spi-gpio.c
 +++ b/drivers/spi/spi-gpio.c
 @@ -46,6 +46,7 @@ struct spi_gpio {
   struct spi_bitbang  bitbang;
   struct spi_gpio_platform_data   pdata;
   struct platform_device  *pdev;
 + int cs_gpios[0];
  };
  
  /*--*/
 @@ -89,15 +90,21 @@ struct spi_gpio {
  
  /*--*/
  
 -static inline const struct spi_gpio_platform_data * __pure
 -spi_to_pdata(const struct spi_device *spi)
 +static inline struct spi_gpio * __pure
 +spi_to_spi_gpio(const struct spi_device *spi)
  {
   const struct spi_bitbang*bang;
 - const struct spi_gpio   *spi_gpio;
 + struct spi_gpio *spi_gpio;
  
   bang = spi_master_get_devdata(spi-master);
   spi_gpio = container_of(bang, struct spi_gpio, bitbang);
 - return spi_gpio-pdata;
 + return spi_gpio;
 +}
 +
 +static inline struct spi_gpio_platform_data * __pure
 +spi_to_pdata(const struct spi_device *spi)
 +{
 + return spi_to_spi_gpio(spi)-pdata;
  }
  
  /* this is #defined to avoid unused-variable warnings when inlining */
 @@ -210,7 +217,8 @@ static u32 spi_gpio_spec_txrx_word_mode3(struct 
 spi_device *spi,
  
  static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
  {
 - unsigned long cs = (unsigned long) spi-controller_data;
 + struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
 + unsigned int cs = spi_gpio-cs_gpios[spi-chip_select];
  
   /* set initial clock polarity */
   if (is_active)
 @@ -224,8 +232,9 @@ static void spi_gpio_chipselect(struct spi_device *spi, 
 int is_active)
  
  static int spi_gpio_setup(struct spi_device *spi)
  {
 - unsigned long   cs = (unsigned long) spi-controller_data;
 - int status = 0;
 + unsigned intcs = (unsigned int) spi-controller_data;
 + int status = 0;
 + struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
  
   if (spi-bits_per_word  32)
   return -EINVAL;
 @@ -238,8 +247,11 @@ static int spi_gpio_setup(struct spi_device *spi)
   status = gpio_direction_output(cs, spi-mode  
 SPI_CS_HIGH);
   }
   }
 - if (!status)
 + if (!status) {
   status = spi_bitbang_setup(spi);
 + spi_gpio-cs_gpios[spi-chip_select] = cs;
 + }
 +
   if (status) {
   if (!spi-controller_state  cs != SPI_GPIO_NO_CHIPSELECT)
   gpio_free(cs);
 @@ -249,7 +261,8 @@ static int spi_gpio_setup(struct spi_device *spi)
  
  static void spi_gpio_cleanup(struct spi_device *spi)
  {
 - unsigned long   cs = (unsigned long) spi-controller_data;
 + struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
 + unsigned int cs = spi_gpio-cs_gpios[spi-chip_select];
  
   if (cs != SPI_GPIO_NO_CHIPSELECT)
   gpio_free(cs);
 @@ -330,7 +343,8 @@ static int __devinit spi_gpio_probe(struct 
 platform_device *pdev)
   if (status  0)
   return status;
  
 - master = spi_alloc_master(pdev-dev, sizeof *spi_gpio);
 + master = spi_alloc_master(pdev-dev, sizeof(*spi_gpio) +
 + (sizeof(int) * SPI_N_CHIPSEL));
   if (!master) {
   status = -ENOMEM;
   goto gpio_free;
 


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH resend 1/2] SPI: spi-gpio: store chipselect information in private structure

2012-08-01 Thread Daniel Mack
The spi-gpio driver currently assumes the chipselect gpio number is
stored in -controller_data of the device's static board information.

In devicetree environments, this information is unavailable and has to
be derived from the DT node.

This patch moves the gpio storage to the controller's private data so
the DT bindings can easily build upon the driver.

Signed-off-by: Daniel Mack zon...@gmail.com
Cc: Mark Brown broo...@opensource.wolfsonmicro.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linus Walleij linus.wall...@stericsson.com
---
 drivers/spi/spi-gpio.c | 34 --
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 0b56cfc..ff7263c 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -46,6 +46,7 @@ struct spi_gpio {
struct spi_bitbang  bitbang;
struct spi_gpio_platform_data   pdata;
struct platform_device  *pdev;
+   int cs_gpios[0];
 };
 
 /*--*/
@@ -89,15 +90,21 @@ struct spi_gpio {
 
 /*--*/
 
-static inline const struct spi_gpio_platform_data * __pure
-spi_to_pdata(const struct spi_device *spi)
+static inline struct spi_gpio * __pure
+spi_to_spi_gpio(const struct spi_device *spi)
 {
const struct spi_bitbang*bang;
-   const struct spi_gpio   *spi_gpio;
+   struct spi_gpio *spi_gpio;
 
bang = spi_master_get_devdata(spi-master);
spi_gpio = container_of(bang, struct spi_gpio, bitbang);
-   return spi_gpio-pdata;
+   return spi_gpio;
+}
+
+static inline struct spi_gpio_platform_data * __pure
+spi_to_pdata(const struct spi_device *spi)
+{
+   return spi_to_spi_gpio(spi)-pdata;
 }
 
 /* this is #defined to avoid unused-variable warnings when inlining */
@@ -210,7 +217,8 @@ static u32 spi_gpio_spec_txrx_word_mode3(struct spi_device 
*spi,
 
 static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
 {
-   unsigned long cs = (unsigned long) spi-controller_data;
+   struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
+   unsigned int cs = spi_gpio-cs_gpios[spi-chip_select];
 
/* set initial clock polarity */
if (is_active)
@@ -224,8 +232,9 @@ static void spi_gpio_chipselect(struct spi_device *spi, int 
is_active)
 
 static int spi_gpio_setup(struct spi_device *spi)
 {
-   unsigned long   cs = (unsigned long) spi-controller_data;
-   int status = 0;
+   unsigned intcs = (unsigned int) spi-controller_data;
+   int status = 0;
+   struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
 
if (spi-bits_per_word  32)
return -EINVAL;
@@ -239,8 +248,11 @@ static int spi_gpio_setup(struct spi_device *spi)
!(spi-mode  SPI_CS_HIGH));
}
}
-   if (!status)
+   if (!status) {
status = spi_bitbang_setup(spi);
+   spi_gpio-cs_gpios[spi-chip_select] = cs;
+   }
+
if (status) {
if (!spi-controller_state  cs != SPI_GPIO_NO_CHIPSELECT)
gpio_free(cs);
@@ -250,7 +262,8 @@ static int spi_gpio_setup(struct spi_device *spi)
 
 static void spi_gpio_cleanup(struct spi_device *spi)
 {
-   unsigned long   cs = (unsigned long) spi-controller_data;
+   struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
+   unsigned int cs = spi_gpio-cs_gpios[spi-chip_select];
 
if (cs != SPI_GPIO_NO_CHIPSELECT)
gpio_free(cs);
@@ -331,7 +344,8 @@ static int __devinit spi_gpio_probe(struct platform_device 
*pdev)
if (status  0)
return status;
 
-   master = spi_alloc_master(pdev-dev, sizeof *spi_gpio);
+   master = spi_alloc_master(pdev-dev, sizeof(*spi_gpio) +
+   (sizeof(int) * SPI_N_CHIPSEL));
if (!master) {
status = -ENOMEM;
goto gpio_free;
-- 
1.7.11.2


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure

2012-08-01 Thread Daniel Mack
On 01.08.2012 22:51, Mark Brown wrote:
 On Wed, Aug 01, 2012 at 10:45:19PM +0200, Daniel Mack wrote:
 
 could you have another look at these patches maybe? They aren't urgent,
 I just want to avoid the get lost.
 
 Can you please resend them with me in the CCs?  My process for handling
 patches is very heavily based on my inbox.
 

Sure. This time, I added you, Grant and Linus W to the patch using Cc:
lines. Let's see if that works better :)


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Fais des rencontres sans sortir ta carte bancaire

2012-08-01 Thread Service rencontre par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE3MjYyJmM9NDgzNjEyJmQ9MjAxMi0wOC0wMiAwMDoyMDowMSZlPTEmaD0xNzI2MSZmPTE3MjYyJmc9MTcyNjI=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE3MjYyJmM9NDgzNjEyJmQ9MjAxMi0wOC0wMiAwMDoyMDowMSZlPTEmaD0xNzI2MSZmPTE3MjYyJmc9MTcyNjI=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Soldes jusqu'à -60 pour cent sur la mode Femme

2012-08-01 Thread Lulu Castagnette par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE3MjYxJmM9NDgzNjEyJmQ9MjAxMi0wOC0wMiAwMDozMDowMSZlPTEmaD0xNzI2MCZmPTE3MjYxJmc9MTcyNjE=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE3MjYxJmM9NDgzNjEyJmQ9MjAxMi0wOC0wMiAwMDozMDowMSZlPTEmaD0xNzI2MCZmPTE3MjYxJmc9MTcyNjE=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Profitez de 50% de réduction* pour retrouver la ligne avec Weight Watchers

2012-08-01 Thread Weight Watchers par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE3MjY1JmM9NDgzNjEyJmQ9MjAxMi0wOC0wMiAwMDozMDowMSZlPTEmaD0xNzI2NCZmPTE3MjY1Jmc9MTcyNjU=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE3MjY1JmM9NDgzNjEyJmQ9MjAxMi0wOC0wMiAwMDozMDowMSZlPTEmaD0xNzI2NCZmPTE3MjY1Jmc9MTcyNjU=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[SPAM] Important Notice Regarding Your Website

2012-08-01 Thread Network Solution
Upon reviewing your account, we noticed that your website is not listed first 
on Google, Yahoo, Bing or any other search engine.
This may be costing you sales and website traffic, so we wanted to bring this 
to your attention.

Please give me a call at 1 (800) 455-8040 to discuss how we can get you first 
on many keywords related to your business.

Thank you for your prompt attention to this matter.

Shane Epperson
Network Traffic Coordinator
Best Page Rankings
1 (800) 455-8040
bestpager...@gmx.com




















Click This Link to Stop Future Messages 
mailto:listservi...@gmx.com?subject=unsubscribe%3a%20spi-devel-gene...@lists.sourceforge.net



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general