Skip to contentSkip to conversation

make pxa2xx audio driver sparse clean

PXA2XX Ian Campbell 3 participants 8 messages Oct 26, 2005 – Oct 28, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Perhaps sparse is being over-zealous but it is simple enough to put right.

Killed a tiny bit of trailing whitespace too.

sound/arm/pxa2xx-ac97.c +3 -3
Index: 2.6/sound/arm/pxa2xx-ac97.c
===================================================================
@@ -43,7 +43,7 @@
 static unsigned short pxa2xx_ac97_read(ac97_t *ac97, unsigned short reg)
 {
 	unsigned short val = -1;
-	volatile u32 *reg_addr;
+	volatile unsigned long *reg_addr;
 
 	down(&car_mutex);
 	if (CAR & CAR_CAIP) {
@@ -70,7 +70,7 @@
 
 	/* valid data now */
 	gsr_bits = 0;
-	val = *reg_addr;			
+	val = *reg_addr;
 	/* but we've just started another cycle... */
 	wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1);
 
@@ -80,7 +80,7 @@
 
 static void pxa2xx_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
 {
-	volatile u32 *reg_addr;
+	volatile unsigned long *reg_addr;
 
 	down(&car_mutex);
 
sound/arm/pxa2xx-pcm.h +2 -2
Index: 2.6/sound/arm/pxa2xx-pcm.h
===================================================================
@@ -13,10 +13,10 @@
 typedef struct {
 	char *name;			/* stream identifier */
 	u32 dcmd;			/* DMA descriptor dcmd field */
-	volatile u32 *drcmr;		/* the DMA request channel to use */
+	volatile unsigned long *drcmr;	/* the DMA request channel to use */
 	u32 dev_addr;			/* device physical address for DMA */
 } pxa2xx_pcm_dma_params_t;
-	
+
 typedef struct {
 	pxa2xx_pcm_dma_params_t *playback_params;
 	pxa2xx_pcm_dma_params_t *capture_params;
Signature · 12 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
#1 lore raw

At Wed, 26 Oct 2005 15:00:27 +0100,

Quoted 7 lines · Ian Campbell

Hi,

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Hmm, is unsigned long a really correct type?
u32 looks correct to me...

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information

#2 lore raw
Quoted 5 lines · Takashi Iwai

At Wed, 26 Oct 2005 15:00:27 +0100,

Quoted 3 lines · Ian Campbell

Hi,

Quoted 7 lines
Quoted 4 lines

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Hmm, is unsigned long a really correct type?
u32 looks correct to me...

Interesting question. Other than SA1100 most other ARM subarches which have a __REG macro do use u32. The change below causes some "initialization from incompatible pointer type" type warnings on my platform and on lubbock/mainstone but nothing which looks important, my platform continues to work.

(I guess if this discussion goes any further we should redirect to the linux-arm-kernel list...)

Ian.

include/asm-arm/arch-pxa/hardware.h 2005-10-26 15:20:01.000000000 +0100 renamed from include/asm-arm/arch-pxa/hardware.h 2005-10-20 10:32:59.000000000 +0100 +2 -2
Index: 2.6/include/asm-arm/arch-pxa/hardware.h
===================================================================
@@ -44,12 +44,12 @@
 
 #ifndef __ASSEMBLY__
 
-# define __REG(x)      (*((volatile unsigned long *)io_p2v(x)))
+# define __REG(x)      (*((volatile u32 *)io_p2v(x)))
 
 /* With indexed regs we don't want to feed the index through io_p2v()
    especially if it is a variable, otherwise horrible code will result. */
 # define __REG2(x,y)   \
-       (*(volatile unsigned long *)((unsigned long)&__REG(x) + (y)))
+       (*(volatile u32 *)((u32)&__REG(x) + (y)))
 
 # define __PREG(x)     (io_v2p((u32)&(x)))
 
Signature · 17 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been virus scanned by MessageLabs.


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
#3 lore raw

At Wed, 26 Oct 2005 15:39:03 +0100,

Quoted 15 lines · Ian Campbell
Quoted 5 lines · Takashi Iwai

At Wed, 26 Oct 2005 15:00:27 +0100,

Quoted 3 lines · Ian Campbell

Hi,

Quoted 7 lines
Quoted 4 lines

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Hmm, is unsigned long a really correct type?
u32 looks correct to me...

Quoted 8 lines

Interesting question. Other than SA1100 most other ARM subarches which have a __REG macro do use u32. The change below causes some "initialization from incompatible pointer type" type warnings on my platform and on lubbock/mainstone but nothing which looks important, my platform continues to work.

(I guess if this discussion goes any further we should redirect to the linux-arm-kernel list...)

Yes, arm list is defintely a better place to ask.

Takashi

Quoted 37 lines

Ian.

Index: 2.6/include/asm-arm/arch-pxa/hardware.h
===================================================================

include/asm-arm/arch-pxa/hardware.h 2005-10-26 15:20:01.000000000 +0100 renamed from include/asm-arm/arch-pxa/hardware.h 2005-10-20 10:32:59.000000000 +0100 +2 -2
@@ -44,12 +44,12 @@
 
 #ifndef __ASSEMBLY__
 
-# define __REG(x)      (*((volatile unsigned long *)io_p2v(x)))
+# define __REG(x)      (*((volatile u32 *)io_p2v(x)))
 
 /* With indexed regs we don't want to feed the index through io_p2v()
    especially if it is a variable, otherwise horrible code will result. */
 # define __REG2(x,y)   \
-       (*(volatile unsigned long *)((unsigned long)&__REG(x) + (y)))
+       (*(volatile u32 *)((u32)&__REG(x) + (y)))
 
 # define __PREG(x)     (io_v2p((u32)&(x)))
 
Signature · 11 lines
-- 
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been virus scanned by MessageLabs.

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information

#4 lore raw
In reply to Ian Campbell
Quoted 11 lines · Ian Campbell
Quoted 10 lines · Takashi Iwai

At Wed, 26 Oct 2005 15:00:27 +0100,

Quoted 7 lines · Ian Campbell

Hi,

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Quoted 8 lines
Quoted 2 lines

Hmm, is unsigned long a really correct type?
u32 looks correct to me...

Interesting question. Other than SA1100 most other ARM subarches which have a __REG macro do use u32. The change below causes some "initialization from incompatible pointer type" type warnings on my platform and on lubbock/mainstone but nothing which looks important, my platform continues to work.

I don't mind that alternative patch, as long as you also fix the other warnings too, in which case it should be submitted to RMK's patch system.

Nicolas

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information

#5 lore raw
Quoted 3 lines · Nicolas Pitre

I don't mind that alternative patch, as long as you also fix the other warnings too, in which case it should be submitted to RMK's patch system.

FYI I submitted it as ARM patch 3044
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3044/1

Now I can leave alsa-devel alone ;-) Sorry for the noise.

Thanks,
Ian.

Signature · 17 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been virus scanned by MessageLabs.


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
#6 lore raw
In reply to Takashi Iwai
Quoted 5 lines · Takashi Iwai

At Wed, 26 Oct 2005 15:00:27 +0100,

Quoted 3 lines · Ian Campbell

Hi,

Quoted 7 lines
Quoted 4 lines

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Hmm, is unsigned long a really correct type?
u32 looks correct to me...

Unsigned long is correct as well on ARM.

Nicolas

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information

#7 lore raw
In reply to Ian Campbell
Quoted 7 lines · Ian Campbell

Hi,

Sparse complains because the PXA255 registers are defined as volatile unsigned long * (through the __REGS macro in include/asm-arm/arch-pxa/hardware.h) and the variable being assigned to a u32 (and hence an unsigned int).

Quoted 6 lines

Perhaps sparse is being over-zealous but it is simple enough to put right.

Killed a tiny bit of trailing whitespace too.

Quoted 55 lines

Index: 2.6/sound/arm/pxa2xx-ac97.c
===================================================================

sound/arm/pxa2xx-ac97.c +3 -3
@@ -43,7 +43,7 @@
 static unsigned short pxa2xx_ac97_read(ac97_t *ac97, unsigned short reg)
 {
 	unsigned short val = -1;
-	volatile u32 *reg_addr;
+	volatile unsigned long *reg_addr;
 
 	down(&car_mutex);
 	if (CAR & CAR_CAIP) {
@@ -70,7 +70,7 @@
 
 	/* valid data now */
 	gsr_bits = 0;
-	val = *reg_addr;			
+	val = *reg_addr;
 	/* but we've just started another cycle... */
 	wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1);
 
@@ -80,7 +80,7 @@
 
 static void pxa2xx_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
 {
-	volatile u32 *reg_addr;
+	volatile unsigned long *reg_addr;
 
 	down(&car_mutex);
 

Index: 2.6/sound/arm/pxa2xx-pcm.h
===================================================================

sound/arm/pxa2xx-pcm.h +2 -2
@@ -13,10 +13,10 @@
 typedef struct {
 	char *name;			/* stream identifier */
 	u32 dcmd;			/* DMA descriptor dcmd field */
-	volatile u32 *drcmr;		/* the DMA request channel to use */
+	volatile unsigned long *drcmr;	/* the DMA request channel to use */
 	u32 dev_addr;			/* device physical address for DMA */
 } pxa2xx_pcm_dma_params_t;
-	
+
 typedef struct {
 	pxa2xx_pcm_dma_params_t *playback_params;
 	pxa2xx_pcm_dma_params_t *capture_params;
Signature · 5 lines
-- 
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200

Nicolas

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information