Alsa support for Maemo SDK (n770) - Remove compile warnings
PATCH 1/1 Alsa support for Maemo SDK (n770) - Remove compile warnings
Hello,
Here is a patch to remove compile warnings. It must be applied
after last patch set I sent.
This patch simply changes signedness of some point from the code
to match the correct sign used by dsp-protocol structures. All must use unsigned variables.
It also changes the way the pthread_mutex is initialized. The
warning about pthreads is also removed.
I tested the compilation with:
gcc (GCC) 4.1.2 20061028 (prerelease) (Debian 4.1.1-19) and
sbox-arm-linux-gcc (GCC) 3.4.4 (release) (CodeSourcery ARM 2005q3-2)
Here is its diffstat:
alsa-dsp.c | 1 - dsp-ctl.c | 4 ++-- dsp-protocol.c | 27 ++++++++++++++------------- dsp-protocol.h | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-)
BR,
---
Eduardo Bezerra Valentin
Quoted 77 lines · Takashi Iwai
At Wed, 1 Nov 2006 13:06:00 -0400,
Quoted 7 lines · Eduardo Valentin
Hello all,
This patch series will add alsa support for Maemo SDK (nokia 770).
This is an alsa plugin and the patch series is against alsa-plugins-1.0.13rc2 source code.Quoted 5 lines
The plugin adds alsa support by communicating with n770's audio system.
To add ALSA support, an EXT PCM I/O plugin and EXT CTL plugin were
written. The code is based on SDK documentation from the alsa-project site.Thanks for patches. I committed them to ALSA HG repo now.
I noticed many compile warnings with maemo plugin like below. Most of them are harmless. But a warning about
pthread_mutexattr_settypeshould be fixed.Takashi
if
/bin/sh../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -MT dsp-protocol.lo -MD -MP -MF ".deps/dsp-protocol.Tpo" -c -o dsp-protocol.lodsp-protocol.c; \
then mv -f ".deps/dsp-protocol.Tpo" ".deps/dsp-protocol.Plo"; else rm -f ".deps/dsp-protocol.Tpo"; exit 1; fi
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -MT dsp-protocol.lo -MD -MP -MF .deps/dsp-protocol.Tpo -cdsp-protocol.c-fPIC -DPIC -o.libs/dsp-protocol.odsp-protocol.c: In function 'dsp_protocol_create':
dsp-protocol.c:111: warning: implicit declaration of function 'pthread_mutexattr_settype'dsp-protocol.c: In function 'dsp_protocol_set_volume':
dsp-protocol.c:654: warning: pointer targets in passing argument 2 of 'dsp_protocol_linear2Q15' differ in signedness
dsp-protocol.c:654: warning: pointer targets in passing argument 3 of 'dsp_protocol_linear2Q15' differ in signednessdsp-protocol.c: In function 'dsp_protocol_set_mic_enabled':
dsp-protocol.c:871: warning: unused parameter 'dsp_protocol'if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -MT dsp-ctl.lo -MD -MP -MF ".deps/dsp-ctl.Tpo" -c -o dsp-ctl.lo dsp-ctl.c; \ then mv -f ".deps/dsp-ctl.Tpo" ".deps/dsp-ctl.Plo"; else rm -f ".deps/dsp-ctl.Tpo"; exit 1; figcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -MT dsp-ctl.lo -MD -MP -MF .deps/dsp-ctl.Tpo -c
dsp-ctl.c-fPIC -DPIC -o.libs/dsp-ctl.odsp-ctl.c: In function 'dsp_ctl_elem_list':
dsp-ctl.c:139: warning: comparison between signed and unsigneddsp-ctl.c: In function 'dsp_ctl_get_attribute':
dsp-ctl.c:224: warning: comparison between signed and unsigneddsp-ctl.c: In function 'dsp_ctl_get_integer_info':
dsp-ctl.c:253: warning: comparison between signed and unsigneddsp-ctl.c: In function 'dsp_ctl_read_integer':
dsp-ctl.c:281: warning: comparison between signed and unsigned
dsp-ctl.c:288: warning: pointer targets in passing argument 2 of 'dsp_protocol_get_volume' differ in signedness
dsp-ctl.c:288: warning: pointer targets in passing argument 3 of 'dsp_protocol_get_volume' differ in signednessdsp-ctl.c: In function 'dsp_ctl_write_integer':
dsp-ctl.c:325: warning: comparison between signed and unsigned
dsp-ctl.c:332: warning: pointer targets in passing argument 2 of 'dsp_protocol_get_volume' differ in signedness
dsp-ctl.c:332: warning: pointer targets in passing argument 3 of 'dsp_protocol_get_volume' differ in signedness
dsp-ctl.c:350: warning: comparison between signed and unsigneddsp-ctl.c: In function 'dsp_ctl_read_event':
dsp-ctl.c:378: warning: unused parameter 'ext'
dsp-ctl.c:378: warning: unused parameter 'id'
dsp-ctl.c:379: warning: unused parameter 'event_mask'dsp-ctl.c: In function '_snd_ctl_dsp_ctl_open':
dsp-ctl.c:528: warning: unused parameter 'root'/bin/sh../libtool --tag=CC --mode=link gcc -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -shared -lm -ldl -lpthread -module -avoid-version -export-dynamic -o libasound_module_ctl_dsp_ctl.la -rpath/usr/lib/alsa-libdsp-protocol.lo dsp-ctl.lo -lasound -lm -ldl -lpthread -lasound
gcc -shared.libs/dsp-protocol.o.libs/dsp-ctl.o-lm -ldl -lpthread/usr/lib/libasound.so-Wl,-soname -Wl,libasound_module_ctl_dsp_ctl.so -o .libs/libasound_module_ctl_dsp_ctl.so creating libasound_module_ctl_dsp_ctl.la
(cd .libs && rm -f libasound_module_ctl_dsp_ctl.la && ln -s ../libasound_module_ctl_dsp_ctl.la libasound_module_ctl_dsp_ctl.la)
if/bin/sh../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -MT alsa-dsp.lo -MD -MP -MF ".deps/alsa-dsp.Tpo" -c -o alsa-dsp.loalsa-dsp.c; \
then mv -f ".deps/alsa-dsp.Tpo" ".deps/alsa-dsp.Plo"; else rm -f ".deps/alsa-dsp.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -fPIC -DPIC -O2 -I/usr/include/alsa -O2 -Wall -W -pipe -g -MT alsa-dsp.lo -MD -MP -MF .deps/alsa-dsp.Tpo -calsa-dsp.c-fPIC -DPIC -o.libs/alsa-dsp.oalsa-dsp.c: In function 'alsa_dsp_transfer':
alsa-dsp.c:146: warning: comparison between signed and unsigned
alsa-dsp.c:167: warning: label 'out' defined but not usedalsa-dsp.c: In function 'alsa_dsp_hw_params':
alsa-dsp.c:241: warning: unused parameter 'params'alsa-dsp.c: In function 'alsa_dsp_pause':
alsa-dsp.c:365: warning: unused parameter 'enable'alsa-dsp.c: In function '_snd_pcm_alsa_dsp_open':
alsa-dsp.c:647: warning: unused parameter 'root'
Signature · 1 line
Eduardo Bezerra Valentin
maemo/alsa-dsp.c +0 -1
@@ -164,7 +164,6 @@ static snd_pcm_sframes_t alsa_dsp_transf words); result *=2 ; result /= alsa_dsp->bytes_per_frame; - out: alsa_dsp->hw_pointer += result;DLEAVE (result);return result;
maemo/dsp-ctl.c +2 -2
@@ -273,7 +273,7 @@ static int dsp_ctl_read_integer(snd_ctl_ long *value) {int ret =0 ; -char left, right; +unsigned char left, right;snd_ctl_dsp_t *dsp_ctl = ext->private_data;control_list_t *tmp = dsp_ctl->controls[key];
@@ -317,7 +317,7 @@ static int dsp_ctl_write_integer(snd_ctl long *value) {int ret; -char left, right; +unsigned char left, right;snd_ctl_dsp_t *dsp_ctl = ext->private_data;control_list_t *tmp = dsp_ctl->controls[key];
maemo/dsp-protocol.c +14 -13
@@ -69,10 +69,12 @@ union semun {static int dsp_protocol_flush (dsp_protocol_t * dsp_protocol);static int dsp_protocol_send_command (dsp_protocol_t * dsp_protocol,const short int command); -static void dsp_protocol_linear2Q15 (const short int input, -short int *scale,short int *power2); -static void dsp_protocol_Q152linear (const short int scale, -const short int power2,short int *output); +static void dsp_protocol_linear2Q15 (const unsigned short int input, +unsigned short int *scale, +unsigned short int *power2); +static void dsp_protocol_Q152linear (const unsigned short int scale, +const unsigned short int power2, +unsigned short int *output);static int dsp_protocol_update_state (dsp_protocol_t * dsp_protocol);static inline int dsp_protocol_get_sem (dsp_protocol_t * dsp_protocol);static inline int dsp_protocol_lock_dev (dsp_protocol_t * dsp_protocol);
@@ -90,8 +92,8 @@ static inline int dsp_protocol_unlock_de*/ int dsp_protocol_create (dsp_protocol_t ** dsp_protocol) { +pthread_mutex_t mutex =PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP ;int ret =0 ; -pthread_mutexattr_t mattr;DENTER (); *dsp_protocol = (dsp_protocol_t *)calloc (1 ,sizeof (dsp_protocol_t));if ((*dsp_protocol) ==NULL ) {
@@ -107,9 +109,7 @@ int dsp_protocol_create(dsp_protocol_t * (*dsp_protocol)->bridge_buffer_size =0 ; (*dsp_protocol)->mmap_buffer_size =0 ; (*dsp_protocol)->mmap_buffer =NULL ; -pthread_mutexattr_init (&mattr); -pthread_mutexattr_settype (PTHREAD_MUTEX_ERRORCHECK_NP ); -pthread_mutex_init (&((*dsp_protocol)->mutex), &mattr); + (*dsp_protocol)->mutex = mutex; (*dsp_protocol)->sem_set_id =-1 ;#ifdef USE_RESOURCE_MANAGER (*dsp_protocol)->dbus_connection =dbus_bus_get (DBUS_BUS_SYSTEM ,NULL );
@@ -719,7 +719,7 @@ int dsp_protocol_set_volume(dsp_protocolint dsp_protocol_get_volume (dsp_protocol_t * dsp_protocol,unsigned char *left,unsigned char *right) { -short int tmp; +unsigned short int tmp;int ret;audio_status_info_t audio_status_info;DENTER ();
@@ -1050,8 +1050,9 @@ static int dsp_protocol_send_command(dsp* Converts a 0 - 100 value to a Q15 format value. * */ -static void dsp_protocol_linear2Q15 (const short int input, -short int *scale,short int *power2) +static void dsp_protocol_linear2Q15 (const unsigned short int input, +unsigned short int *scale, +unsigned short int *power2) {unsigned long int val =MAGIC_NUMBER * input;DENTER ();
@@ -1079,8 +1080,8 @@ static void dsp_protocol_linear2Q15(cons* Converts a Q15 format value to a 0 - 100 value. * */ -static void dsp_protocol_Q152linear (const short int scale, -const short int power2,short int *output) +static void dsp_protocol_Q152linear (const unsigned short int scale, +const unsigned short int power2,unsigned short int *output) {float result = scale *1.0 /0x8000 *pow (2.0 ,1.0 * power2) *100.0 ;DENTER ();
maemo/dsp-protocol.h +1 -1
@@ -24,7 +24,7 @@#ifndef _DSP_PROTOCOL_H#define _DSP_PROTOCOL_H -#define _GNU_SOURCE +#define __USE_GNU#include <features.h> #include <pthread.h> #include <semaphore.h>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
At Mon, 6 Nov 2006 15:10:23 -0400,
Quoted 17 lines · Eduardo Valentin
Hello,
Here is a patch to remove compile warnings. It must be applied
after last patch set I sent.
This patch simply changes signedness of some point from the code
to match the correct sign used by dsp-protocol structures. All must use unsigned variables.
It also changes the way thepthread_mutexis initialized. The
warning about pthreads is also removed.I tested the compilation with:
gcc (GCC) 4.1.2 20061028 (prerelease) (Debian 4.1.1-19) and
sbox-arm-linux-gcc (GCC) 3.4.4 (release) (CodeSourcery ARM 2005q3-2)Here is its diffstat:
Quoted 8 lines
alsa-dsp.c | 1 - dsp-ctl.c | 4 ++-- dsp-protocol.c | 27 ++++++++++++++------------- dsp-protocol.h | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-)Signed-off-by Eduardo Valentin <[email protected]>
Thanks. Applied to ALSA HG tree now.
Takashi
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642