linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kronos <kronos@people.it>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Kronos <kronos@people.it>, John Zielinski <grim@undead.cc>,
	Linux Fbdev development list
	<linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: radeon_pm.c locking problem
Date: Mon, 5 Jul 2004 18:41:04 +0200	[thread overview]
Message-ID: <20040705164104.GA14968@dreamland.darkstar.lan> (raw)
In-Reply-To: <1089035092.3014.7.camel@gaston>

Il Mon, Jul 05, 2004 at 08:44:53AM -0500, Benjamin Herrenschmidt ha scritto: 
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> 
> > is expanded in:
> > 
> > do {
> >         unsigned long flags;
> >         spin_lock_irqsave(&rinfo->reg_lock, flags);
> >         __OUTPLL(pllPIXCLKS_CNTL, INPLL(pllPIXCLKS_CNTL) & ~PIXCLKS_CNTL__PIX2CLK_SRC_SEL_MASK);
> >         spin_unlock_irqrestore(&rinfo->reg_lock, flags);
> > } while(0)
> > 
> > and INPLL will try to reacquire the lock ->reg_lock. We could either use
> > __INPLL (which does not take the lock) or make OUTPLL an inline function
> > (in this way INPLL is called before entering the function).
> 
> Make it an inline function...

Here it is:

--- linux-2.6/drivers/video/aty/radeonfb.h.orig	2004-07-05 18:27:05.000000000 +0200
+++ linux-2.6/drivers/video/aty/radeonfb.h	2004-07-05 18:38:52.000000000 +0200
@@ -393,37 +393,43 @@
 
 #define INPLL(addr)		_INPLL(rinfo, addr)
 
-#define OUTPLL(addr,val)	\
-	do {	\
-		unsigned long flags;\
-		spin_lock_irqsave(&rinfo->reg_lock, flags); \
-		__OUTPLL(addr, val); \
-		spin_unlock_irqrestore(&rinfo->reg_lock, flags); \
-	} while(0)
-
-#define OUTPLLP(addr,val,mask)  					\
-	do {								\
-		unsigned long flags;                                    \
-		unsigned int _tmp;					\
-		spin_lock_irqsave(&rinfo->reg_lock, flags); 		\
-		_tmp  = __INPLL(rinfo,addr);				\
-		_tmp &= (mask);						\
-		_tmp |= (val);						\
-		__OUTPLL(addr, _tmp);					\
-		spin_unlock_irqrestore(&rinfo->reg_lock, flags); 	\
-	} while (0)
-
-#define OUTREGP(addr,val,mask)  					\
-	do {								\
-		unsigned long flags;                                    \
-		unsigned int _tmp;					\
-		spin_lock_irqsave(&rinfo->reg_lock, flags); 		\
-		_tmp = INREG(addr);				       	\
-		_tmp &= (mask);						\
-		_tmp |= (val);						\
-		OUTREG(addr, _tmp);					\
-		spin_unlock_irqrestore(&rinfo->reg_lock, flags); 	\
-	} while (0)
+static inline void _OUTPLL(struct radeonfb_info *rinfo, unsigned int addr, unsigned int val)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&rinfo->reg_lock, flags);
+	__OUTPLL(addr, val);
+	spin_unlock_irqrestore(&rinfo->reg_lock, flags);
+}
+
+#define OUTPLL(addr,val)	_OUTPLL(rinfo, addr, val)
+
+static inline void _OUTPLLP(struct radeonfb_info *rinfo, unsigned int addr, unsigned int val, unsigned int mask)
+{
+	unsigned long flags;
+	unsigned int tmp;
+	spin_lock_irqsave(&rinfo->reg_lock, flags);
+	tmp = __INPLL(rinfo, addr);
+	tmp &= (mask);
+	tmp |= (val);
+	__OUTPLL(addr, tmp);
+	spin_unlock_irqrestore(&rinfo->reg_lock, flags);
+}
+
+#define OUTPLLP(addr,val,mask)	_OUTPLLP(rinfo,addr,val,mask)
+
+static inline void _OUTREGP(struct radeonfb_info *rinfo, unsigned int addr, unsigned int val, unsigned int mask)
+{
+	unsigned long flags;
+	unsigned int tmp;
+	spin_lock_irqsave(&rinfo->reg_lock, flags);
+	tmp = INREG(addr);
+	tmp &= (mask);
+	tmp |= (val);
+	OUTREG(addr, tmp);
+	spin_unlock_irqrestore(&rinfo->reg_lock, flags);
+}
+
+#define OUTREGP(addr,val,mask)	_OUTREGP(rinfo,addr,val,mask)
 
 #define MS_TO_HZ(ms)       ((ms * HZ + 999) / 1000)
 

Luca
-- 
Home: http://kronoz.cjb.net
Runtime error 6D at f000:a12f : user incompetente


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com

  reply	other threads:[~2004-07-05 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02 17:29 radeon_pm.c locking problem John Zielinski
2004-07-02 18:52 ` Kronos
2004-07-05 13:44   ` Benjamin Herrenschmidt
2004-07-05 16:41     ` Kronos [this message]
2004-07-05 21:24       ` David Eger
2004-07-05 22:03         ` Benjamin Herrenschmidt
2004-07-02 20:14 ` David Eger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040705164104.GA14968@dreamland.darkstar.lan \
    --to=kronos@people.it \
    --cc=benh@kernel.crashing.org \
    --cc=grim@undead.cc \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).