[patch 2/3] x86: apic - simplify lapic_get_maxlvt

Previous thread: [patch 3/3] x86: apic - remove dead ifdef from lapic_is_integrated by Cyrill Gorcunov on Wednesday, September 24, 2008 - 9:46 am. (1 message)

Next thread: [patch 1/3] x86: apic,io-apic - generalize lapic_get_version helper by Cyrill Gorcunov on Wednesday, September 24, 2008 - 9:46 am. (1 message)
From: Cyrill Gorcunov
Date: Wednesday, September 24, 2008 - 9:46 am

Lets use lapic_get_version helper and hide
register being read. Also it allow us to
make code a bit tighter.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

Index: linux-2.6.git/arch/x86/kernel/apic.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic.c	2008-09-24 19:17:20.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/apic.c	2008-09-24 19:33:31.000000000 +0400
@@ -309,14 +309,14 @@ int get_physical_broadcast(void)
  */
 int lapic_get_maxlvt(void)
 {
-	unsigned int v;
+	unsigned int ver;
 
-	v = apic_read(APIC_LVR);
+	ver = lapic_get_version();
 	/*
 	 * - we always have APIC integrated on 64bit mode
 	 * - 82489DXs do not report # of LVT entries
 	 */
-	return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2;
+	return APIC_INTEGRATED(ver) ? GET_APIC_MAXLVT(ver) : 2;
 }
 
 /*

-- 
--

From: Hiroshi Shimamoto
Date: Wednesday, September 24, 2008 - 11:58 am

^^^
Hi, is this correct?
Does ver have the full content of apic_read(APIC_LVR)?

thanks,
Hiroshi Shimamoto
--

From: Yinghai Lu
Date: Wednesday, September 24, 2008 - 12:17 pm

On Wed, Sep 24, 2008 at 11:58 AM, Hiroshi Shimamoto


good catch..

YH
--

From: Cyrill Gorcunov
Date: Wednesday, September 24, 2008 - 12:18 pm

[Hiroshi Shimamoto - Wed, Sep 24, 2008 at 11:58:12AM -0700]
| Cyrill Gorcunov wrote:
| > Lets use lapic_get_version helper and hide
| > register being read. Also it allow us to
| > make code a bit tighter.
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > ---
| > 
| > Index: linux-2.6.git/arch/x86/kernel/apic.c
| > ===================================================================
| > --- linux-2.6.git.orig/arch/x86/kernel/apic.c	2008-09-24 19:17:20.000000000 +0400
| > +++ linux-2.6.git/arch/x86/kernel/apic.c	2008-09-24 19:33:31.000000000 +0400
| > @@ -309,14 +309,14 @@ int get_physical_broadcast(void)
| >   */
| >  int lapic_get_maxlvt(void)
| >  {
| > -	unsigned int v;
| > +	unsigned int ver;
| >  
| > -	v = apic_read(APIC_LVR);
| > +	ver = lapic_get_version();
| >  	/*
| >  	 * - we always have APIC integrated on 64bit mode
| >  	 * - 82489DXs do not report # of LVT entries
| >  	 */
| > -	return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2;
| > +	return APIC_INTEGRATED(ver) ? GET_APIC_MAXLVT(ver) : 2;
|                                                       ^^^
| Hi, is this correct?
| Does ver have the full content of apic_read(APIC_LVR)?
| 
| thanks,
| Hiroshi Shimamoto
| 

Hi Hiroshi,

damn, it seems I made a mistake again!
Thanks a lot, Hiroshi! Checking now!
Somehow missed this.

		- Cyrill -
--

From: Cyrill Gorcunov
Date: Wednesday, September 24, 2008 - 12:24 pm

[Hiroshi Shimamoto - Wed, Sep 24, 2008 at 11:58:12AM -0700]
| Cyrill Gorcunov wrote:
| > Lets use lapic_get_version helper and hide
| > register being read. Also it allow us to
| > make code a bit tighter.
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > ---
| > 
| > Index: linux-2.6.git/arch/x86/kernel/apic.c
| > ===================================================================
| > --- linux-2.6.git.orig/arch/x86/kernel/apic.c	2008-09-24 19:17:20.000000000 +0400
| > +++ linux-2.6.git/arch/x86/kernel/apic.c	2008-09-24 19:33:31.000000000 +0400
| > @@ -309,14 +309,14 @@ int get_physical_broadcast(void)
| >   */
| >  int lapic_get_maxlvt(void)
| >  {
| > -	unsigned int v;
| > +	unsigned int ver;
| >  
| > -	v = apic_read(APIC_LVR);
| > +	ver = lapic_get_version();
| >  	/*
| >  	 * - we always have APIC integrated on 64bit mode
| >  	 * - 82489DXs do not report # of LVT entries
| >  	 */
| > -	return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2;
| > +	return APIC_INTEGRATED(ver) ? GET_APIC_MAXLVT(ver) : 2;
|                                                       ^^^
| Hi, is this correct?
| Does ver have the full content of apic_read(APIC_LVR)?
| 
| thanks,
| Hiroshi Shimamoto
| 

Thanks a lot Hiroshi, I just cutted a half of
register (what a shame) :( Sorry.

Ingo, don't apply this series please!

		- Cyrill -
--

Previous thread: [patch 3/3] x86: apic - remove dead ifdef from lapic_is_integrated by Cyrill Gorcunov on Wednesday, September 24, 2008 - 9:46 am. (1 message)

Next thread: [patch 1/3] x86: apic,io-apic - generalize lapic_get_version helper by Cyrill Gorcunov on Wednesday, September 24, 2008 - 9:46 am. (1 message)