linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] spi: Dont call prepare/unprepare transfer if not populated
@ 2012-05-10 13:50 Shubhrajyoti D
       [not found] ` <1336657841-2306-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Shubhrajyoti D @ 2012-05-10 13:50 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: andrew-g2DYL2Zd6BY, Linus Walleij,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Shubhrajyoti D

Currently the prepare/unprepare transfer are called unconditionally.
The assumption is that every driver using the spi core queue infrastructure
has to populate the prepare and unprepare functions. This encourages
drivers to populate empty functions to prevent crashing.
This patch prevents the call to prepare/unprepare if not populated.

Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---

 drivers/spi/spi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 37c555e..30e114c 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -532,7 +532,7 @@ static void spi_pump_messages(struct kthread_work *work)
 	/* Lock queue and check for queue work */
 	spin_lock_irqsave(&master->queue_lock, flags);
 	if (list_empty(&master->queue) || !master->running) {
-		if (master->busy) {
+		if (master->busy &&  master->unprepare_transfer_hardware) {
 			ret = master->unprepare_transfer_hardware(master);
 			if (ret) {
 				spin_unlock_irqrestore(&master->queue_lock, flags);
@@ -562,7 +562,7 @@ static void spi_pump_messages(struct kthread_work *work)
 		master->busy = true;
 	spin_unlock_irqrestore(&master->queue_lock, flags);
 
-	if (!was_busy) {
+	if (!was_busy && master->prepare_transfer_hardware) {
 		ret = master->prepare_transfer_hardware(master);
 		if (ret) {
 			dev_err(&master->dev,
-- 
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/

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

* Re: [PATCH RFC] spi: Dont call prepare/unprepare transfer if not populated
       [not found] ` <1336657841-2306-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
@ 2012-05-10 14:01   ` Linus Walleij
       [not found]     ` <CACRpkdZmr+i6d+k8XU6Qxo425=mFZo5kzUe1wFk+grxDshaoVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2012-05-10 14:01 UTC (permalink / raw)
  To: Shubhrajyoti D
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, andrew-g2DYL2Zd6BY

On Thu, May 10, 2012 at 3:50 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:

> Currently the prepare/unprepare transfer are called unconditionally.
> The assumption is that every driver using the spi core queue infrastructure
> has to populate the prepare and unprepare functions. This encourages
> drivers to populate empty functions to prevent crashing.
> This patch prevents the call to prepare/unprepare if not populated.
>
> Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>

Great!
Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij

------------------------------------------------------------------------------
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/

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

* Re: [PATCH RFC] spi: Dont call prepare/unprepare transfer if not populated
       [not found]     ` <CACRpkdZmr+i6d+k8XU6Qxo425=mFZo5kzUe1wFk+grxDshaoVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-05-11  3:24       ` Grant Likely
  2012-05-15 19:58         ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Likely @ 2012-05-11  3:24 UTC (permalink / raw)
  To: Linus Walleij, Shubhrajyoti D
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, andrew-g2DYL2Zd6BY

On Thu, 10 May 2012 16:01:27 +0200, Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On Thu, May 10, 2012 at 3:50 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
> 
> > Currently the prepare/unprepare transfer are called unconditionally.
> > The assumption is that every driver using the spi core queue infrastructure
> > has to populate the prepare and unprepare functions. This encourages
> > drivers to populate empty functions to prevent crashing.
> > This patch prevents the call to prepare/unprepare if not populated.
> >
> > Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> 
> Great!
> Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Applied, thanks (after fixing extra whitespace defect).

g.


------------------------------------------------------------------------------
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/

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

* Re: [PATCH RFC] spi: Dont call prepare/unprepare transfer if not populated
  2012-05-11  3:24       ` Grant Likely
@ 2012-05-15 19:58         ` Andrew Lunn
       [not found]           ` <20120515195801.GE23254-g2DYL2Zd6BY@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2012-05-15 19:58 UTC (permalink / raw)
  To: Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Linus Walleij, andrew-g2DYL2Zd6BY, Shubhrajyoti D,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, May 10, 2012 at 09:24:55PM -0600, Grant Likely wrote:
> On Thu, 10 May 2012 16:01:27 +0200, Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> > On Thu, May 10, 2012 at 3:50 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
> > 
> > > Currently the prepare/unprepare transfer are called unconditionally.
> > > The assumption is that every driver using the spi core queue infrastructure
> > > has to populate the prepare and unprepare functions. This encourages
> > > drivers to populate empty functions to prevent crashing.
> > > This patch prevents the call to prepare/unprepare if not populated.
> > >
> > > Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> > 
> > Great!
> > Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 
> Applied, thanks (after fixing extra whitespace defect).

Hi Grant

Is this going to appear in linux-next soon? Can i depend on having
this patch for 3.5?

     Thanks
	Andrew


------------------------------------------------------------------------------
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/

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

* Re: [PATCH RFC] spi: Dont call prepare/unprepare transfer if not populated
       [not found]           ` <20120515195801.GE23254-g2DYL2Zd6BY@public.gmane.org>
@ 2012-05-20  5:00             ` Grant Likely
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Likely @ 2012-05-20  5:00 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Linus Walleij, andrew-g2DYL2Zd6BY, Shubhrajyoti D,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, 15 May 2012 21:58:01 +0200, Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org> wrote:
> On Thu, May 10, 2012 at 09:24:55PM -0600, Grant Likely wrote:
> > On Thu, 10 May 2012 16:01:27 +0200, Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> > > On Thu, May 10, 2012 at 3:50 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
> > > 
> > > > Currently the prepare/unprepare transfer are called unconditionally.
> > > > The assumption is that every driver using the spi core queue infrastructure
> > > > has to populate the prepare and unprepare functions. This encourages
> > > > drivers to populate empty functions to prevent crashing.
> > > > This patch prevents the call to prepare/unprepare if not populated.
> > > >
> > > > Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > > Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> > > 
> > > Great!
> > > Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > 
> > Applied, thanks (after fixing extra whitespace defect).
> 
> Hi Grant
> 
> Is this going to appear in linux-next soon? Can i depend on having
> this patch for 3.5?

It's pushed out now.

g.


------------------------------------------------------------------------------
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/

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

end of thread, other threads:[~2012-05-20  5:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10 13:50 [PATCH RFC] spi: Dont call prepare/unprepare transfer if not populated Shubhrajyoti D
     [not found] ` <1336657841-2306-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-05-10 14:01   ` Linus Walleij
     [not found]     ` <CACRpkdZmr+i6d+k8XU6Qxo425=mFZo5kzUe1wFk+grxDshaoVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-11  3:24       ` Grant Likely
2012-05-15 19:58         ` Andrew Lunn
     [not found]           ` <20120515195801.GE23254-g2DYL2Zd6BY@public.gmane.org>
2012-05-20  5:00             ` Grant Likely

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