public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* usr/include/linux/soundcard.h warnings for 'make headers_check'
@ 2009-01-20 15:38 Jaswinder Singh Rajput
  2009-01-21  0:08 ` Takashi Iwai
  0 siblings, 1 reply; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-20 15:38 UTC (permalink / raw)
  To: alsa-devel, tiwai, Sam Ravnborg, Ingo Molnar, LKML

usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
 usr/include/linux/soundcard.h:1047: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1048: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1049: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1050: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1051: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1053: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1055: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1056: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1061: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1062: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1078: extern's make no sense in userspace
 usr/include/linux/soundcard.h:1079: extern's make no sense in userspace

Do we need to fix these warnings.

If yes, then how can we fix these warnings.

Thanks

--
JSR


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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-01-20 15:38 usr/include/linux/soundcard.h warnings for 'make headers_check' Jaswinder Singh Rajput
@ 2009-01-21  0:08 ` Takashi Iwai
  2009-01-21  0:25   ` Jaswinder Singh Rajput
                     ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Takashi Iwai @ 2009-01-21  0:08 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: alsa-devel, Sam Ravnborg, Ingo Molnar, LKML

At Tue, 20 Jan 2009 21:08:22 +0530,
Jaswinder Singh Rajput wrote:
> 
> usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
>  usr/include/linux/soundcard.h:1047: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1048: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1049: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1050: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1051: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1053: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1055: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1056: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1061: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1062: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1078: extern's make no sense in userspace
>  usr/include/linux/soundcard.h:1079: extern's make no sense in userspace
> 
> Do we need to fix these warnings.

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for
compatibility in some way.


Takashi

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-01-21  0:08 ` Takashi Iwai
@ 2009-01-21  0:25   ` Jaswinder Singh Rajput
  2009-01-21  5:41   ` Sam Ravnborg
  2009-01-24  6:50   ` Jaswinder Singh Rajput
  2 siblings, 0 replies; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-21  0:25 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Sam Ravnborg, Ingo Molnar, LKML

Hello Sam,

On Wed, 2009-01-21 at 01:08 +0100, Takashi Iwai wrote:
> At Tue, 20 Jan 2009 21:08:22 +0530,
> Jaswinder Singh Rajput wrote:
> > 
> > usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
> >  usr/include/linux/soundcard.h:1047: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1048: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1049: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1050: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1051: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1053: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1055: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1056: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1061: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1062: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1078: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1079: extern's make no sense in userspace
> > 
> > Do we need to fix these warnings.
> 
> No, these are declarations for OSS-lib.
> It doesn't belong to kernel, but it's better to keep it for
> compatibility in some way.
> 

Do you have some plan where extern is required like in this case.

--
JSR



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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-01-21  0:08 ` Takashi Iwai
  2009-01-21  0:25   ` Jaswinder Singh Rajput
@ 2009-01-21  5:41   ` Sam Ravnborg
  2009-02-03 20:27     ` Arnd Bergmann
  2009-01-24  6:50   ` Jaswinder Singh Rajput
  2 siblings, 1 reply; 20+ messages in thread
From: Sam Ravnborg @ 2009-01-21  5:41 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Jaswinder Singh Rajput, alsa-devel, Ingo Molnar, LKML

On Wed, Jan 21, 2009 at 01:08:37AM +0100, Takashi Iwai wrote:
> At Tue, 20 Jan 2009 21:08:22 +0530,
> Jaswinder Singh Rajput wrote:
> > 
> > usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
> >  usr/include/linux/soundcard.h:1047: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1048: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1049: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1050: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1051: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1053: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1055: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1056: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1061: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1062: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1078: extern's make no sense in userspace
> >  usr/include/linux/soundcard.h:1079: extern's make no sense in userspace
> > 
> > Do we need to fix these warnings.
> 
> No, these are declarations for OSS-lib.
> It doesn't belong to kernel, but it's better to keep it for
> compatibility in some way.

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel.
The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons.
We can let the definiton stay for a while - but eventually they have to
be dropped from the kernel.

	Sam

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-01-21  0:08 ` Takashi Iwai
  2009-01-21  0:25   ` Jaswinder Singh Rajput
  2009-01-21  5:41   ` Sam Ravnborg
@ 2009-01-24  6:50   ` Jaswinder Singh Rajput
  2 siblings, 0 replies; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-24  6:50 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaswinder Singh Rajput, alsa-devel, Sam Ravnborg, Ingo Molnar,
	LKML

On Wed, Jan 21, 2009 at 5:38 AM, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 20 Jan 2009 21:08:22 +0530,
> Jaswinder Singh Rajput wrote:
>>
>> usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
>>  usr/include/linux/soundcard.h:1047: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1048: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1049: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1050: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1051: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1053: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1055: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1056: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1061: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1062: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1078: extern's make no sense in userspace
>>  usr/include/linux/soundcard.h:1079: extern's make no sense in userspace
>>
>> Do we need to fix these warnings.
>
> No, these are declarations for OSS-lib.
> It doesn't belong to kernel, but it's better to keep it for
> compatibility in some way.
>

Do you find some better place for:

void seqbuf_dump(void); /* This function must be provided by programs */

extern int OSS_init(int seqfd, int buflen);
extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
extern void OSS_patch_caching(int dev, int chn, int patch,
                              int fd, unsigned char *buf, int buflen);
extern void OSS_drum_caching(int dev, int chn, int patch,
                              int fd, unsigned char *buf, int buflen);
extern void OSS_write_patch(int fd, unsigned char *buf, int len);
extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
..

#ifdef OSSLIB
#  define SEQ_USE_EXTBUF() \
                extern unsigned char *_seqbuf; \
                extern int _seqbuflen;extern int _seqbufptr
#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int
_requested_seqbuflen=len
#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)

#  define SEQ_LOAD_GMINSTR(dev, instr) \
                OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
#  define SEQ_LOAD_GMDRUM(dev, drum) \
                OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
#else /* !OSSLIB */

#  define SEQ_LOAD_GMINSTR(dev, instr)
#  define SEQ_LOAD_GMDRUM(dev, drum)

#  define SEQ_USE_EXTBUF() \
                extern unsigned char _seqbuf[]; \
                extern int _seqbuflen;extern int _seqbufptr

..

what are your plans.

--
JSR

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-01-21  5:41   ` Sam Ravnborg
@ 2009-02-03 20:27     ` Arnd Bergmann
  2009-02-04  4:04       ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 20+ messages in thread
From: Arnd Bergmann @ 2009-02-03 20:27 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Takashi Iwai, Jaswinder Singh Rajput, alsa-devel, Ingo Molnar,
	LKML

On Wednesday 21 January 2009, Sam Ravnborg wrote:
> 
> > No, these are declarations for OSS-lib.
> > It doesn't belong to kernel, but it's better to keep it for
> > compatibility in some way.
> 
> But not in the kernel for sure.
> I just checked and for example: OSS_init is not used anywhere in the kernel.
> The kernel headers are not a "dump all your stuff" ground anymore.
> 
> So I encourage you to find a better home for the user space library definitons.
> We can let the definiton stay for a while - but eventually they have to
> be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and
no current distro appears to be shipping it. All new OSSlib versions (the
oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
 with various operating systems. There is no danger in
 using them but applications written for more recent OSS
 versions will not compile with older header files.

 The latest versions of these include files (such as
 soundcard.h) are distributed in ../include/sys. Use
 the -I/usr/lib/oss/include switch when compiling
 programs. Alternatively copy these files to /usr/include/sys
 so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against
OSSlib by now also has the correct version of the header installed.
Consequently, we should just drop the #ifndef __KERNEL__ section
of soundcard.h (all the macros in there depend on the extern
declarations), and maybe add an

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib
#endif

	Arnd <><

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-03 20:27     ` Arnd Bergmann
@ 2009-02-04  4:04       ` Jaswinder Singh Rajput
  2009-02-04  6:39         ` Takashi Iwai
  0 siblings, 1 reply; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-02-04  4:04 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Sam Ravnborg, Takashi Iwai, alsa-devel, Ingo Molnar, LKML

On Tue, 2009-02-03 at 21:27 +0100, Arnd Bergmann wrote:
> On Wednesday 21 January 2009, Sam Ravnborg wrote:
> > 
> > > No, these are declarations for OSS-lib.
> > > It doesn't belong to kernel, but it's better to keep it for
> > > compatibility in some way.
> > 
> > But not in the kernel for sure.
> > I just checked and for example: OSS_init is not used anywhere in the kernel.
> > The kernel headers are not a "dump all your stuff" ground anymore.
> > 
> > So I encourage you to find a better home for the user space library definitons.
> > We can let the definiton stay for a while - but eventually they have to
> > be dropped from the kernel.
> 
> The last free version of OSSlib that matches this header is from ~1997, and
> no current distro appears to be shipping it. All new OSSlib versions (the
> oldest I found was from ~2003) contain in their documentation:
> 
> "Older versions of some OSS include files are distributed
>  with various operating systems. There is no danger in
>  using them but applications written for more recent OSS
>  versions will not compile with older header files.
> 
>  The latest versions of these include files (such as
>  soundcard.h) are distributed in ../include/sys. Use
>  the -I/usr/lib/oss/include switch when compiling
>  programs. Alternatively copy these files to /usr/include/sys
>  so that they replace the original ones."
> 
> I think it's safe enough to assume that everyone that builds against
> OSSlib by now also has the correct version of the header installed.
> Consequently, we should just drop the #ifndef __KERNEL__ section
> of soundcard.h (all the macros in there depend on the extern
> declarations), and maybe add an
> 
> #ifdef OSSLIB
> #error need to use <sys/soundcard.h> from libOSSlib
> #endif
> 

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move
all this stuff to sys/soundcard.h.

Sam also requested to move this stuff to other place.

We are waiting for Takashi reply.

--
JSR



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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04  4:04       ` Jaswinder Singh Rajput
@ 2009-02-04  6:39         ` Takashi Iwai
  2009-02-04  8:34           ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 20+ messages in thread
From: Takashi Iwai @ 2009-02-04  6:39 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

At Wed, 04 Feb 2009 09:34:12 +0530,
Jaswinder Singh Rajput wrote:
> 
> On Tue, 2009-02-03 at 21:27 +0100, Arnd Bergmann wrote:
> > On Wednesday 21 January 2009, Sam Ravnborg wrote:
> > > 
> > > > No, these are declarations for OSS-lib.
> > > > It doesn't belong to kernel, but it's better to keep it for
> > > > compatibility in some way.
> > > 
> > > But not in the kernel for sure.
> > > I just checked and for example: OSS_init is not used anywhere in the kernel.
> > > The kernel headers are not a "dump all your stuff" ground anymore.
> > > 
> > > So I encourage you to find a better home for the user space library definitons.
> > > We can let the definiton stay for a while - but eventually they have to
> > > be dropped from the kernel.
> > 
> > The last free version of OSSlib that matches this header is from ~1997, and
> > no current distro appears to be shipping it. All new OSSlib versions (the
> > oldest I found was from ~2003) contain in their documentation:
> > 
> > "Older versions of some OSS include files are distributed
> >  with various operating systems. There is no danger in
> >  using them but applications written for more recent OSS
> >  versions will not compile with older header files.
> > 
> >  The latest versions of these include files (such as
> >  soundcard.h) are distributed in ../include/sys. Use
> >  the -I/usr/lib/oss/include switch when compiling
> >  programs. Alternatively copy these files to /usr/include/sys
> >  so that they replace the original ones."
> > 
> > I think it's safe enough to assume that everyone that builds against
> > OSSlib by now also has the correct version of the header installed.
> > Consequently, we should just drop the #ifndef __KERNEL__ section
> > of soundcard.h (all the macros in there depend on the extern
> > declarations), and maybe add an
> > 
> > #ifdef OSSLIB
> > #error need to use <sys/soundcard.h> from libOSSlib
> > #endif
> > 
> 
> sys/soundcard.h is also pointing to linux/soundcard.h, we need to move
> all this stuff to sys/soundcard.h.

All which stuff?
If you are referring to OSS-lib stuff in soundcard.h, then I'm for
it.

Also giving an error with an ifdef OSSLIB like Arnd suggested would be
nice, too.  But maybe we need one more ifdef such as

#ifdef OSSLIB
#ifndef _SYS_SOUNDCARD_H
#error ...
#endif
#endif


thanks,

Takashi

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04  6:39         ` Takashi Iwai
@ 2009-02-04  8:34           ` Jaswinder Singh Rajput
  2009-02-04  9:03             ` Takashi Iwai
  0 siblings, 1 reply; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-02-04  8:34 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

On Wed, 2009-02-04 at 07:39 +0100, Takashi Iwai wrote:
> At Wed, 04 Feb 2009 09:34:12 +0530,
> Jaswinder Singh Rajput wrote:
> > 
> > On Tue, 2009-02-03 at 21:27 +0100, Arnd Bergmann wrote:
> > > On Wednesday 21 January 2009, Sam Ravnborg wrote:
> > > > 
> > > > > No, these are declarations for OSS-lib.
> > > > > It doesn't belong to kernel, but it's better to keep it for
> > > > > compatibility in some way.
> > > > 
> > > > But not in the kernel for sure.
> > > > I just checked and for example: OSS_init is not used anywhere in the kernel.
> > > > The kernel headers are not a "dump all your stuff" ground anymore.
> > > > 
> > > > So I encourage you to find a better home for the user space library definitons.
> > > > We can let the definiton stay for a while - but eventually they have to
> > > > be dropped from the kernel.
> > > 
> > > The last free version of OSSlib that matches this header is from ~1997, and
> > > no current distro appears to be shipping it. All new OSSlib versions (the
> > > oldest I found was from ~2003) contain in their documentation:
> > > 
> > > "Older versions of some OSS include files are distributed
> > >  with various operating systems. There is no danger in
> > >  using them but applications written for more recent OSS
> > >  versions will not compile with older header files.
> > > 
> > >  The latest versions of these include files (such as
> > >  soundcard.h) are distributed in ../include/sys. Use
> > >  the -I/usr/lib/oss/include switch when compiling
> > >  programs. Alternatively copy these files to /usr/include/sys
> > >  so that they replace the original ones."
> > > 
> > > I think it's safe enough to assume that everyone that builds against
> > > OSSlib by now also has the correct version of the header installed.
> > > Consequently, we should just drop the #ifndef __KERNEL__ section
> > > of soundcard.h (all the macros in there depend on the extern
> > > declarations), and maybe add an
> > > 
> > > #ifdef OSSLIB
> > > #error need to use <sys/soundcard.h> from libOSSlib
> > > #endif
> > > 
> > 
> > sys/soundcard.h is also pointing to linux/soundcard.h, we need to move
> > all this stuff to sys/soundcard.h.
> 
> All which stuff?
> If you are referring to OSS-lib stuff in soundcard.h, then I'm for
> it.
> 

We need to fix things in such a way that we can replace:
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
with
#ifdef __KERNEL__
and only keep those things in this file which we need in kernel and move
userspace declarations which are not required for kernel to
sys/soundcard.h


> Also giving an error with an ifdef OSSLIB like Arnd suggested would be
> nice, too.  But maybe we need one more ifdef such as
> 
> #ifdef OSSLIB
> #ifndef _SYS_SOUNDCARD_H
> #error ...
> #endif
> #endif
> 

hmm, so you want to confirm that we only come through sys/soundcard.h
for OSSLIB

Thanks,
--
JSR


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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04  8:34           ` Jaswinder Singh Rajput
@ 2009-02-04  9:03             ` Takashi Iwai
  2009-02-04 10:37               ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 20+ messages in thread
From: Takashi Iwai @ 2009-02-04  9:03 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

At Wed, 04 Feb 2009 14:04:54 +0530,
Jaswinder Singh Rajput wrote:
> 
> On Wed, 2009-02-04 at 07:39 +0100, Takashi Iwai wrote:
> > At Wed, 04 Feb 2009 09:34:12 +0530,
> > Jaswinder Singh Rajput wrote:
> > > 
> > > On Tue, 2009-02-03 at 21:27 +0100, Arnd Bergmann wrote:
> > > > On Wednesday 21 January 2009, Sam Ravnborg wrote:
> > > > > 
> > > > > > No, these are declarations for OSS-lib.
> > > > > > It doesn't belong to kernel, but it's better to keep it for
> > > > > > compatibility in some way.
> > > > > 
> > > > > But not in the kernel for sure.
> > > > > I just checked and for example: OSS_init is not used anywhere in the kernel.
> > > > > The kernel headers are not a "dump all your stuff" ground anymore.
> > > > > 
> > > > > So I encourage you to find a better home for the user space library definitons.
> > > > > We can let the definiton stay for a while - but eventually they have to
> > > > > be dropped from the kernel.
> > > > 
> > > > The last free version of OSSlib that matches this header is from ~1997, and
> > > > no current distro appears to be shipping it. All new OSSlib versions (the
> > > > oldest I found was from ~2003) contain in their documentation:
> > > > 
> > > > "Older versions of some OSS include files are distributed
> > > >  with various operating systems. There is no danger in
> > > >  using them but applications written for more recent OSS
> > > >  versions will not compile with older header files.
> > > > 
> > > >  The latest versions of these include files (such as
> > > >  soundcard.h) are distributed in ../include/sys. Use
> > > >  the -I/usr/lib/oss/include switch when compiling
> > > >  programs. Alternatively copy these files to /usr/include/sys
> > > >  so that they replace the original ones."
> > > > 
> > > > I think it's safe enough to assume that everyone that builds against
> > > > OSSlib by now also has the correct version of the header installed.
> > > > Consequently, we should just drop the #ifndef __KERNEL__ section
> > > > of soundcard.h (all the macros in there depend on the extern
> > > > declarations), and maybe add an
> > > > 
> > > > #ifdef OSSLIB
> > > > #error need to use <sys/soundcard.h> from libOSSlib
> > > > #endif
> > > > 
> > > 
> > > sys/soundcard.h is also pointing to linux/soundcard.h, we need to move
> > > all this stuff to sys/soundcard.h.
> > 
> > All which stuff?
> > If you are referring to OSS-lib stuff in soundcard.h, then I'm for
> > it.
> > 
> 
> We need to fix things in such a way that we can replace:
> #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
> with
> #ifdef __KERNEL__
> and only keep those things in this file which we need in kernel and move
> userspace declarations which are not required for kernel to
> sys/soundcard.h

Which means to remove only the OSS-lib part.  Some other macros are
used in sound/oss/*.c.  And, there are cases that apps want to use
SEQ* macros without oss-lib (which are actually most cases).


> > Also giving an error with an ifdef OSSLIB like Arnd suggested would be
> > nice, too.  But maybe we need one more ifdef such as
> > 
> > #ifdef OSSLIB
> > #ifndef _SYS_SOUNDCARD_H
> > #error ...
> > #endif
> > #endif
> > 
> 
> hmm, so you want to confirm that we only come through sys/soundcard.h
> for OSSLIB

Yes.


Takashi

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04  9:03             ` Takashi Iwai
@ 2009-02-04 10:37               ` Jaswinder Singh Rajput
  2009-02-04 10:52                 ` Takashi Iwai
  0 siblings, 1 reply; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-02-04 10:37 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

On Wed, 2009-02-04 at 10:03 +0100, Takashi Iwai wrote:
> At Wed, 04 Feb 2009 14:04:54 +0530,
> Jaswinder Singh Rajput wrote:
> > 
> > On Wed, 2009-02-04 at 07:39 +0100, Takashi Iwai wrote:
> > > At Wed, 04 Feb 2009 09:34:12 +0530,
> > > Jaswinder Singh Rajput wrote:
> > > > 
> > > > On Tue, 2009-02-03 at 21:27 +0100, Arnd Bergmann wrote:
> > > > > On Wednesday 21 January 2009, Sam Ravnborg wrote:
> > > > > > 
> > > > > > > No, these are declarations for OSS-lib.
> > > > > > > It doesn't belong to kernel, but it's better to keep it for
> > > > > > > compatibility in some way.
> > > > > > 
> > > > > > But not in the kernel for sure.
> > > > > > I just checked and for example: OSS_init is not used anywhere in the kernel.
> > > > > > The kernel headers are not a "dump all your stuff" ground anymore.
> > > > > > 
> > > > > > So I encourage you to find a better home for the user space library definitons.
> > > > > > We can let the definiton stay for a while - but eventually they have to
> > > > > > be dropped from the kernel.
> > > > > 
> > > > > The last free version of OSSlib that matches this header is from ~1997, and
> > > > > no current distro appears to be shipping it. All new OSSlib versions (the
> > > > > oldest I found was from ~2003) contain in their documentation:
> > > > > 
> > > > > "Older versions of some OSS include files are distributed
> > > > >  with various operating systems. There is no danger in
> > > > >  using them but applications written for more recent OSS
> > > > >  versions will not compile with older header files.
> > > > > 
> > > > >  The latest versions of these include files (such as
> > > > >  soundcard.h) are distributed in ../include/sys. Use
> > > > >  the -I/usr/lib/oss/include switch when compiling
> > > > >  programs. Alternatively copy these files to /usr/include/sys
> > > > >  so that they replace the original ones."
> > > > > 
> > > > > I think it's safe enough to assume that everyone that builds against
> > > > > OSSlib by now also has the correct version of the header installed.
> > > > > Consequently, we should just drop the #ifndef __KERNEL__ section
> > > > > of soundcard.h (all the macros in there depend on the extern
> > > > > declarations), and maybe add an
> > > > > 
> > > > > #ifdef OSSLIB
> > > > > #error need to use <sys/soundcard.h> from libOSSlib
> > > > > #endif
> > > > > 
> > > > 
> > > > sys/soundcard.h is also pointing to linux/soundcard.h, we need to move
> > > > all this stuff to sys/soundcard.h.
> > > 
> > > All which stuff?
> > > If you are referring to OSS-lib stuff in soundcard.h, then I'm for
> > > it.
> > > 
> > 
> > We need to fix things in such a way that we can replace:
> > #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
> > with
> > #ifdef __KERNEL__
> > and only keep those things in this file which we need in kernel and move
> > userspace declarations which are not required for kernel to
> > sys/soundcard.h
> 
> Which means to remove only the OSS-lib part.  Some other macros are
> used in sound/oss/*.c.  And, there are cases that apps want to use
> SEQ* macros without oss-lib (which are actually most cases).
> 

In kernel space we use USE_SEQ_MACROS in:
sound/oss/mpu401.c
sound/oss/midi_synth.c

so we can replace
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
with
#ifdef USE_SEQ_MACROS
and keep SEQ* macros used by above files so we do not break kernel and
move rest of the block in sys/soundcard.h so userspace will be also
happy.

--
JSR


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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 10:37               ` Jaswinder Singh Rajput
@ 2009-02-04 10:52                 ` Takashi Iwai
  2009-02-04 11:31                   ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 20+ messages in thread
From: Takashi Iwai @ 2009-02-04 10:52 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

At Wed, 04 Feb 2009 16:07:57 +0530,
Jaswinder Singh Rajput wrote:
> 
> On Wed, 2009-02-04 at 10:03 +0100, Takashi Iwai wrote:
> > At Wed, 04 Feb 2009 14:04:54 +0530,
> > Jaswinder Singh Rajput wrote:
> > > 
> > > On Wed, 2009-02-04 at 07:39 +0100, Takashi Iwai wrote:
> > > > At Wed, 04 Feb 2009 09:34:12 +0530,
> > > > Jaswinder Singh Rajput wrote:
> > > > > 
> > > > > On Tue, 2009-02-03 at 21:27 +0100, Arnd Bergmann wrote:
> > > > > > On Wednesday 21 January 2009, Sam Ravnborg wrote:
> > > > > > > 
> > > > > > > > No, these are declarations for OSS-lib.
> > > > > > > > It doesn't belong to kernel, but it's better to keep it for
> > > > > > > > compatibility in some way.
> > > > > > > 
> > > > > > > But not in the kernel for sure.
> > > > > > > I just checked and for example: OSS_init is not used anywhere in the kernel.
> > > > > > > The kernel headers are not a "dump all your stuff" ground anymore.
> > > > > > > 
> > > > > > > So I encourage you to find a better home for the user space library definitons.
> > > > > > > We can let the definiton stay for a while - but eventually they have to
> > > > > > > be dropped from the kernel.
> > > > > > 
> > > > > > The last free version of OSSlib that matches this header is from ~1997, and
> > > > > > no current distro appears to be shipping it. All new OSSlib versions (the
> > > > > > oldest I found was from ~2003) contain in their documentation:
> > > > > > 
> > > > > > "Older versions of some OSS include files are distributed
> > > > > >  with various operating systems. There is no danger in
> > > > > >  using them but applications written for more recent OSS
> > > > > >  versions will not compile with older header files.
> > > > > > 
> > > > > >  The latest versions of these include files (such as
> > > > > >  soundcard.h) are distributed in ../include/sys. Use
> > > > > >  the -I/usr/lib/oss/include switch when compiling
> > > > > >  programs. Alternatively copy these files to /usr/include/sys
> > > > > >  so that they replace the original ones."
> > > > > > 
> > > > > > I think it's safe enough to assume that everyone that builds against
> > > > > > OSSlib by now also has the correct version of the header installed.
> > > > > > Consequently, we should just drop the #ifndef __KERNEL__ section
> > > > > > of soundcard.h (all the macros in there depend on the extern
> > > > > > declarations), and maybe add an
> > > > > > 
> > > > > > #ifdef OSSLIB
> > > > > > #error need to use <sys/soundcard.h> from libOSSlib
> > > > > > #endif
> > > > > > 
> > > > > 
> > > > > sys/soundcard.h is also pointing to linux/soundcard.h, we need to move
> > > > > all this stuff to sys/soundcard.h.
> > > > 
> > > > All which stuff?
> > > > If you are referring to OSS-lib stuff in soundcard.h, then I'm for
> > > > it.
> > > > 
> > > 
> > > We need to fix things in such a way that we can replace:
> > > #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
> > > with
> > > #ifdef __KERNEL__
> > > and only keep those things in this file which we need in kernel and move
> > > userspace declarations which are not required for kernel to
> > > sys/soundcard.h
> > 
> > Which means to remove only the OSS-lib part.  Some other macros are
> > used in sound/oss/*.c.  And, there are cases that apps want to use
> > SEQ* macros without oss-lib (which are actually most cases).
> > 
> 
> In kernel space we use USE_SEQ_MACROS in:
> sound/oss/mpu401.c
> sound/oss/midi_synth.c
> 
> so we can replace
> #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
> with
> #ifdef USE_SEQ_MACROS

Then this will break user-space apps.  They don't define
USE_SEQ_MACROS always.


Takashi

> and keep SEQ* macros used by above files so we do not break kernel and
> move rest of the block in sys/soundcard.h so userspace will be also
> happy.

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 10:52                 ` Takashi Iwai
@ 2009-02-04 11:31                   ` Jaswinder Singh Rajput
  2009-02-04 11:43                     ` Takashi Iwai
  0 siblings, 1 reply; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-02-04 11:31 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

On Wed, 2009-02-04 at 11:52 +0100, Takashi Iwai wrote:
> At Wed, 04 Feb 2009 16:07:57 +0530,
> Jaswinder Singh Rajput wrote:
> > 
> > In kernel space we use USE_SEQ_MACROS in:
> > sound/oss/mpu401.c
> > sound/oss/midi_synth.c
> > 
> > so we can replace
> > #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
> > with
> > #ifdef USE_SEQ_MACROS
> 
> Then this will break user-space apps.  They don't define
> USE_SEQ_MACROS always.
> 

If userspace apps are coming through sys/soundcard.h we can define
USE_SEQ_MACROS in it 
OR 
define USE_SEQ_MACROS in linux/soundcard.h for userspace 
OR 
need to redefine better #ifdef

Thanks,
--
JSR


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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 11:31                   ` Jaswinder Singh Rajput
@ 2009-02-04 11:43                     ` Takashi Iwai
  2009-02-04 12:51                       ` Arnd Bergmann
  0 siblings, 1 reply; 20+ messages in thread
From: Takashi Iwai @ 2009-02-04 11:43 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

At Wed, 04 Feb 2009 17:01:37 +0530,
Jaswinder Singh Rajput wrote:
> 
> On Wed, 2009-02-04 at 11:52 +0100, Takashi Iwai wrote:
> > At Wed, 04 Feb 2009 16:07:57 +0530,
> > Jaswinder Singh Rajput wrote:
> > > 
> > > In kernel space we use USE_SEQ_MACROS in:
> > > sound/oss/mpu401.c
> > > sound/oss/midi_synth.c
> > > 
> > > so we can replace
> > > #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
> > > with
> > > #ifdef USE_SEQ_MACROS
> > 
> > Then this will break user-space apps.  They don't define
> > USE_SEQ_MACROS always.
> > 
> 
> If userspace apps are coming through sys/soundcard.h

It's not always true -- that's the whole problem I'm concerned.
Apparently old apps do include linux/soundcard.h.

I agree to remove the stuff causing warnings, i.e. moving oss-lib part
to sys/soundcard.h.  In this case, the only possible regression is the
case where apps use OSS-lib and include linux/soundcard.h.  For other
cases (use sequencer stuff with linux/soundcard.h but without
oss-lib), it will still work.


Takashi

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 11:43                     ` Takashi Iwai
@ 2009-02-04 12:51                       ` Arnd Bergmann
  2009-02-04 12:58                         ` Takashi Iwai
  2009-02-04 13:44                         ` Jaswinder Singh Rajput
  0 siblings, 2 replies; 20+ messages in thread
From: Arnd Bergmann @ 2009-02-04 12:51 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaswinder Singh Rajput, Sam Ravnborg, alsa-devel, Ingo Molnar,
	LKML

On Wednesday 04 February 2009, Takashi Iwai wrote:

> It's not always true -- that's the whole problem I'm concerned.
> Apparently old apps do include linux/soundcard.h.
> 
> I agree to remove the stuff causing warnings, i.e. moving oss-lib part
> to sys/soundcard.h.  In this case, the only possible regression is the
> case where apps use OSS-lib and include linux/soundcard.h.  For other
> cases (use sequencer stuff with linux/soundcard.h but without
> oss-lib), it will still work.

You cannot "move" things to <sys/soundcard.h>, because that file
is provided by glibc as a simple redirect to <linux/soundcard.h>.
The problem there is obviously the compatibility of combinations
of kernel and glibc before and after the change.

The use cases I can see include:

1. A simple app that only needs the ioctl definitions in
   linux/soundcard.h and does not care about all this.

2. A slightly more sophisticated app that uses the !OSSLIB part of
   <sys/soundcard.h> or <linux/soundcard.h>.

3. A new OSSlib application for OSS-3.9 or OSS-4.x that uses the
   <sys/soundcard.h> file provided by OSSlib, instead of the
   one from glibc.

4. A legacy OSSlib application from the last century using either
   linux/soundcard.h or sys/soundcard.h to get at the macros.

5. An application that gets compiled against <linux/soundcard.h>
   but linked against OSSlib 3.9 or 4.x.

Removing the macros and extern declarations from linux/soundcard.h
will break the final two cases. The only options I can see here
are "do nothing" and "screw them". 
Both should be fine, because the warning is easy to shut up
with a small preprocessor macro #define _SEQ_EXTERN extern,
and it's rather unlikely that anyone runs into this problem
on a 2.6 kernel in the first place.

	Arnd <><

---
This patch breaks building against OSSlib with the kernel headers
instead of its own headers. It should still work with any
version of the library from the 2003 onwards which provide
their own headers for the latest interface.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
  */
 #define LOCL_STARTAUDIO		1
 
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
+#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
 /*
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
@@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
 
 void seqbuf_dump(void);	/* This function must be provided by programs */
 
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
 #define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char *_seqbuf; \
-		extern int _seqbuflen;extern int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char _seqbuf[]; \
-		extern int _seqbuflen;extern int _seqbufptr
+
+#define SEQ_LOAD_GMINSTR(dev, instr)
+#define SEQ_LOAD_GMDRUM(dev, drum)
+
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+		_SEQ_EXTERN unsigned char _seqbuf[]; \
+		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
 
 #ifndef USE_SIMPLE_MACROS
 /* Sample seqbuf_dump() implementation:
@@ -1131,7 +1107,6 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
  */
 #define _SEQ_NEEDBUF(len)	/* empty */
 #endif
-#endif /* !OSSLIB */
 
 #define SEQ_VOLUME_MODE(dev, mode)	{_SEQ_NEEDBUF(8);\
 					_seqbuf[_seqbufptr] = SEQ_EXTENDED;\
@@ -1215,14 +1190,8 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 		_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
 
 #define SEQ_SET_PATCH SEQ_PGM_CHANGE
-#ifdef OSSLIB
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
-		{OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
-		 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
-#else
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
+#define SEQ_PGM_CHANGE(dev, chn, patch) \
 		_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-#endif
 
 #define SEQ_CONTROL(dev, chn, controller, value) \
 		_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
@@ -1300,19 +1269,12 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 /*
  * Patch loading.
  */
-#ifdef OSSLIB
-#   define SEQ_WRPATCH(patchx, len) \
-		OSS_write_patch(seqfd, (char*)(patchx), len)
-#   define SEQ_WRPATCH2(patchx, len) \
-		OSS_write_patch2(seqfd, (char*)(patchx), len)
-#else
-#   define SEQ_WRPATCH(patchx, len) \
+#define SEQ_WRPATCH(patchx, len) \
 		{if (_seqbufptr) SEQ_DUMPBUF();\
 		 if (write(seqfd, (char*)(patchx), len)==-1) \
 		    perror("Write patch: /dev/sequencer");}
-#   define SEQ_WRPATCH2(patchx, len) \
+#define SEQ_WRPATCH2(patchx, len) \
 		(SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
-#endif
 
 #endif
 #endif

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 12:51                       ` Arnd Bergmann
@ 2009-02-04 12:58                         ` Takashi Iwai
  2009-02-04 13:44                         ` Jaswinder Singh Rajput
  1 sibling, 0 replies; 20+ messages in thread
From: Takashi Iwai @ 2009-02-04 12:58 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jaswinder Singh Rajput, Sam Ravnborg, alsa-devel, Ingo Molnar,
	LKML

At Wed, 4 Feb 2009 13:51:17 +0100,
Arnd Bergmann wrote:
> 
> On Wednesday 04 February 2009, Takashi Iwai wrote:
> 
> > It's not always true -- that's the whole problem I'm concerned.
> > Apparently old apps do include linux/soundcard.h.
> > 
> > I agree to remove the stuff causing warnings, i.e. moving oss-lib part
> > to sys/soundcard.h.  In this case, the only possible regression is the
> > case where apps use OSS-lib and include linux/soundcard.h.  For other
> > cases (use sequencer stuff with linux/soundcard.h but without
> > oss-lib), it will still work.
> 
> You cannot "move" things to <sys/soundcard.h>, because that file
> is provided by glibc as a simple redirect to <linux/soundcard.h>.
> The problem there is obviously the compatibility of combinations
> of kernel and glibc before and after the change.

Ah right.

> The use cases I can see include:
> 
> 1. A simple app that only needs the ioctl definitions in
>    linux/soundcard.h and does not care about all this.
> 
> 2. A slightly more sophisticated app that uses the !OSSLIB part of
>    <sys/soundcard.h> or <linux/soundcard.h>.
> 
> 3. A new OSSlib application for OSS-3.9 or OSS-4.x that uses the
>    <sys/soundcard.h> file provided by OSSlib, instead of the
>    one from glibc.
> 
> 4. A legacy OSSlib application from the last century using either
>    linux/soundcard.h or sys/soundcard.h to get at the macros.
> 
> 5. An application that gets compiled against <linux/soundcard.h>
>    but linked against OSSlib 3.9 or 4.x.
> 
> Removing the macros and extern declarations from linux/soundcard.h
> will break the final two cases. The only options I can see here
> are "do nothing" and "screw them". 
> Both should be fine, because the warning is easy to shut up
> with a small preprocessor macro #define _SEQ_EXTERN extern,
> and it's rather unlikely that anyone runs into this problem
> on a 2.6 kernel in the first place.
> 
> 	Arnd <><
> 
> ---
> This patch breaks building against OSSlib with the kernel headers
> instead of its own headers. It should still work with any
> version of the library from the 2003 onwards which provide
> their own headers for the latest interface.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

The patch looks reasonable to me.

Acked-by: Takashi Iwai <tiwai@suse.de>

Or, I'll include the patch later to sound git tree unless any
objection comes up.


thanks,

Takashi

> 
> --- a/include/linux/soundcard.h
> +++ b/include/linux/soundcard.h
> @@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
>   */
>  #define LOCL_STARTAUDIO		1
>  
> -#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
> +#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
>  /*
>   *	Some convenience macros to simplify programming of the
>   *	/dev/sequencer interface
> @@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
>  
>  void seqbuf_dump(void);	/* This function must be provided by programs */
>  
> -extern int OSS_init(int seqfd, int buflen);
> -extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
> -extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
> -extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
> -extern void OSS_patch_caching(int dev, int chn, int patch,
> -			      int fd, unsigned char *buf, int buflen);
> -extern void OSS_drum_caching(int dev, int chn, int patch,
> -			      int fd, unsigned char *buf, int buflen);
> -extern void OSS_write_patch(int fd, unsigned char *buf, int len);
> -extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
> -
>  #define SEQ_PM_DEFINES int __foo_bar___
> -#ifdef OSSLIB
> -#  define SEQ_USE_EXTBUF() \
> -		extern unsigned char *_seqbuf; \
> -		extern int _seqbuflen;extern int _seqbufptr
> -#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
> -#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
> -#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
> -#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
> -
> -#  define SEQ_LOAD_GMINSTR(dev, instr) \
> -		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
> -#  define SEQ_LOAD_GMDRUM(dev, drum) \
> -		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
> -#else /* !OSSLIB */
> -
> -#  define SEQ_LOAD_GMINSTR(dev, instr)
> -#  define SEQ_LOAD_GMDRUM(dev, drum)
> -
> -#  define SEQ_USE_EXTBUF() \
> -		extern unsigned char _seqbuf[]; \
> -		extern int _seqbuflen;extern int _seqbufptr
> +
> +#define SEQ_LOAD_GMINSTR(dev, instr)
> +#define SEQ_LOAD_GMDRUM(dev, drum)
> +
> +#define _SEQ_EXTERN extern
> +#define SEQ_USE_EXTBUF() \
> +		_SEQ_EXTERN unsigned char _seqbuf[]; \
> +		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
>  
>  #ifndef USE_SIMPLE_MACROS
>  /* Sample seqbuf_dump() implementation:
> @@ -1131,7 +1107,6 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
>   */
>  #define _SEQ_NEEDBUF(len)	/* empty */
>  #endif
> -#endif /* !OSSLIB */
>  
>  #define SEQ_VOLUME_MODE(dev, mode)	{_SEQ_NEEDBUF(8);\
>  					_seqbuf[_seqbufptr] = SEQ_EXTENDED;\
> @@ -1215,14 +1190,8 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
>  		_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
>  
>  #define SEQ_SET_PATCH SEQ_PGM_CHANGE
> -#ifdef OSSLIB
> -#   define SEQ_PGM_CHANGE(dev, chn, patch) \
> -		{OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
> -		 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
> -#else
> -#   define SEQ_PGM_CHANGE(dev, chn, patch) \
> +#define SEQ_PGM_CHANGE(dev, chn, patch) \
>  		_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
> -#endif
>  
>  #define SEQ_CONTROL(dev, chn, controller, value) \
>  		_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
> @@ -1300,19 +1269,12 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
>  /*
>   * Patch loading.
>   */
> -#ifdef OSSLIB
> -#   define SEQ_WRPATCH(patchx, len) \
> -		OSS_write_patch(seqfd, (char*)(patchx), len)
> -#   define SEQ_WRPATCH2(patchx, len) \
> -		OSS_write_patch2(seqfd, (char*)(patchx), len)
> -#else
> -#   define SEQ_WRPATCH(patchx, len) \
> +#define SEQ_WRPATCH(patchx, len) \
>  		{if (_seqbufptr) SEQ_DUMPBUF();\
>  		 if (write(seqfd, (char*)(patchx), len)==-1) \
>  		    perror("Write patch: /dev/sequencer");}
> -#   define SEQ_WRPATCH2(patchx, len) \
> +#define SEQ_WRPATCH2(patchx, len) \
>  		(SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
> -#endif
>  
>  #endif
>  #endif
> 

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 12:51                       ` Arnd Bergmann
  2009-02-04 12:58                         ` Takashi Iwai
@ 2009-02-04 13:44                         ` Jaswinder Singh Rajput
  2009-02-04 13:49                           ` Takashi Iwai
  2009-02-04 14:02                           ` Arnd Bergmann
  1 sibling, 2 replies; 20+ messages in thread
From: Jaswinder Singh Rajput @ 2009-02-04 13:44 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Takashi Iwai, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

On Wed, 2009-02-04 at 13:51 +0100, Arnd Bergmann wrote:

> ---
> This patch breaks building against OSSlib with the kernel headers
> instead of its own headers. It should still work with any
> version of the library from the 2003 onwards which provide
> their own headers for the latest interface.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> --- a/include/linux/soundcard.h
> +++ b/include/linux/soundcard.h
> @@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
>   */
>  #define LOCL_STARTAUDIO		1
>  
> -#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
> +#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
>  /*
>   *	Some convenience macros to simplify programming of the
>   *	/dev/sequencer interface
> @@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
>  
>  void seqbuf_dump(void);	/* This function must be provided by programs */
>  
> -extern int OSS_init(int seqfd, int buflen);
> -extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
> -extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
> -extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
> -extern void OSS_patch_caching(int dev, int chn, int patch,
> -			      int fd, unsigned char *buf, int buflen);
> -extern void OSS_drum_caching(int dev, int chn, int patch,
> -			      int fd, unsigned char *buf, int buflen);
> -extern void OSS_write_patch(int fd, unsigned char *buf, int len);
> -extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
> -
>  #define SEQ_PM_DEFINES int __foo_bar___
> -#ifdef OSSLIB
> -#  define SEQ_USE_EXTBUF() \
> -		extern unsigned char *_seqbuf; \
> -		extern int _seqbuflen;extern int _seqbufptr
> -#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
> -#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
> -#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
> -#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
> -
> -#  define SEQ_LOAD_GMINSTR(dev, instr) \
> -		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
> -#  define SEQ_LOAD_GMDRUM(dev, drum) \
> -		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
> -#else /* !OSSLIB */
> -
> -#  define SEQ_LOAD_GMINSTR(dev, instr)
> -#  define SEQ_LOAD_GMDRUM(dev, drum)
> -
> -#  define SEQ_USE_EXTBUF() \
> -		extern unsigned char _seqbuf[]; \
> -		extern int _seqbuflen;extern int _seqbufptr
> +
> +#define SEQ_LOAD_GMINSTR(dev, instr)
> +#define SEQ_LOAD_GMDRUM(dev, drum)
> +
> +#define _SEQ_EXTERN extern
> +#define SEQ_USE_EXTBUF() \
> +		_SEQ_EXTERN unsigned char _seqbuf[]; \
> +		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr

hmm, you rename snake as rope, but actually snake is still there ;-)

--
JSR


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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 13:44                         ` Jaswinder Singh Rajput
@ 2009-02-04 13:49                           ` Takashi Iwai
  2009-02-04 14:02                           ` Arnd Bergmann
  1 sibling, 0 replies; 20+ messages in thread
From: Takashi Iwai @ 2009-02-04 13:49 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Arnd Bergmann, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

At Wed, 04 Feb 2009 19:14:22 +0530,
Jaswinder Singh Rajput wrote:
> 
> On Wed, 2009-02-04 at 13:51 +0100, Arnd Bergmann wrote:
> 
> > ---
> > This patch breaks building against OSSlib with the kernel headers
> > instead of its own headers. It should still work with any
> > version of the library from the 2003 onwards which provide
> > their own headers for the latest interface.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > --- a/include/linux/soundcard.h
> > +++ b/include/linux/soundcard.h
> > @@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
> >   */
> >  #define LOCL_STARTAUDIO		1
> >  
> > -#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
> > +#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
> >  /*
> >   *	Some convenience macros to simplify programming of the
> >   *	/dev/sequencer interface
> > @@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
> >  
> >  void seqbuf_dump(void);	/* This function must be provided by programs */
> >  
> > -extern int OSS_init(int seqfd, int buflen);
> > -extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
> > -extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
> > -extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
> > -extern void OSS_patch_caching(int dev, int chn, int patch,
> > -			      int fd, unsigned char *buf, int buflen);
> > -extern void OSS_drum_caching(int dev, int chn, int patch,
> > -			      int fd, unsigned char *buf, int buflen);
> > -extern void OSS_write_patch(int fd, unsigned char *buf, int len);
> > -extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
> > -
> >  #define SEQ_PM_DEFINES int __foo_bar___
> > -#ifdef OSSLIB
> > -#  define SEQ_USE_EXTBUF() \
> > -		extern unsigned char *_seqbuf; \
> > -		extern int _seqbuflen;extern int _seqbufptr
> > -#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
> > -#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
> > -#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
> > -#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
> > -
> > -#  define SEQ_LOAD_GMINSTR(dev, instr) \
> > -		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
> > -#  define SEQ_LOAD_GMDRUM(dev, drum) \
> > -		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
> > -#else /* !OSSLIB */
> > -
> > -#  define SEQ_LOAD_GMINSTR(dev, instr)
> > -#  define SEQ_LOAD_GMDRUM(dev, drum)
> > -
> > -#  define SEQ_USE_EXTBUF() \
> > -		extern unsigned char _seqbuf[]; \
> > -		extern int _seqbuflen;extern int _seqbufptr
> > +
> > +#define SEQ_LOAD_GMINSTR(dev, instr)
> > +#define SEQ_LOAD_GMDRUM(dev, drum)
> > +
> > +#define _SEQ_EXTERN extern
> > +#define SEQ_USE_EXTBUF() \
> > +		_SEQ_EXTERN unsigned char _seqbuf[]; \
> > +		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
> 
> hmm, you rename snake as rope, but actually snake is still there ;-)

Yep just because the API requires a snake anyway :)


Takashi

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 13:44                         ` Jaswinder Singh Rajput
  2009-02-04 13:49                           ` Takashi Iwai
@ 2009-02-04 14:02                           ` Arnd Bergmann
  2009-02-09 23:06                             ` Takashi Iwai
  1 sibling, 1 reply; 20+ messages in thread
From: Arnd Bergmann @ 2009-02-04 14:02 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Takashi Iwai, Sam Ravnborg, alsa-devel, Ingo Molnar, LKML

On Wednesday 04 February 2009, Jaswinder Singh Rajput wrote:
> > +#define _SEQ_EXTERN extern
> > +#define SEQ_USE_EXTBUF() \
> > +             _SEQ_EXTERN unsigned char _seqbuf[]; \
> > +             _SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
> 
> hmm, you rename snake as rope, but actually snake is still there ;-)

Yes, that's true.

The alternative would be to remove all those macros entirely, breaking
also the applications from number 2 in my list.

I see this header as another example of the byteorder.h type where
a kernel header provides functionality that is used by existing
applications. While it should have been part of a library to start
with, we cannot change it any more now without breaking stuff.

Maybe a comment should be added to clarify this.

	Arnd <><

--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -1050,7 +1050,17 @@ typedef struct mixer_vol_table {
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
  *
- *	These macros define the API which should be used when possible.
+ *	This is a legacy interface for applications written against
+ *	the OSSlib-3.8 style interface. It is no longer possible
+ *	to actually link against OSSlib with this header, but we
+ *	still provide these macros for programs using them.
+ *
+ *	If you want to use OSSlib, it is recommended that you get
+ *	the GPL version of OSS-4.x and build against that version
+ *	of the header.
+ *
+ *	We redefine the extern keyword so that make headers_check
+ *	does not complain about SEQ_USE_EXTBUF.
  */
 #define SEQ_DECLAREBUF()		SEQ_USE_EXTBUF()
 

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

* Re: usr/include/linux/soundcard.h warnings for 'make headers_check'
  2009-02-04 14:02                           ` Arnd Bergmann
@ 2009-02-09 23:06                             ` Takashi Iwai
  0 siblings, 0 replies; 20+ messages in thread
From: Takashi Iwai @ 2009-02-09 23:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jaswinder Singh Rajput, Sam Ravnborg, alsa-devel, Ingo Molnar,
	LKML

At Wed, 4 Feb 2009 15:02:07 +0100,
Arnd Bergmann wrote:
> 
> On Wednesday 04 February 2009, Jaswinder Singh Rajput wrote:
> > > +#define _SEQ_EXTERN extern
> > > +#define SEQ_USE_EXTBUF() \
> > > +             _SEQ_EXTERN unsigned char _seqbuf[]; \
> > > +             _SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
> > 
> > hmm, you rename snake as rope, but actually snake is still there ;-)
> 
> Yes, that's true.
> 
> The alternative would be to remove all those macros entirely, breaking
> also the applications from number 2 in my list.
> 
> I see this header as another example of the byteorder.h type where
> a kernel header provides functionality that is used by existing
> applications. While it should have been part of a library to start
> with, we cannot change it any more now without breaking stuff.
> 
> Maybe a comment should be added to clarify this.

Yes, that should help understanding, at least.

I applied your previous patch with this change now no sound git tree,
and will include it in the next pull request.


Thanks!

Takashi

> 
> 	Arnd <><
> 
> --- a/include/linux/soundcard.h
> +++ b/include/linux/soundcard.h
> @@ -1050,7 +1050,17 @@ typedef struct mixer_vol_table {
>   *	Some convenience macros to simplify programming of the
>   *	/dev/sequencer interface
>   *
> - *	These macros define the API which should be used when possible.
> + *	This is a legacy interface for applications written against
> + *	the OSSlib-3.8 style interface. It is no longer possible
> + *	to actually link against OSSlib with this header, but we
> + *	still provide these macros for programs using them.
> + *
> + *	If you want to use OSSlib, it is recommended that you get
> + *	the GPL version of OSS-4.x and build against that version
> + *	of the header.
> + *
> + *	We redefine the extern keyword so that make headers_check
> + *	does not complain about SEQ_USE_EXTBUF.
>   */
>  #define SEQ_DECLAREBUF()		SEQ_USE_EXTBUF()
>  
> 

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

end of thread, other threads:[~2009-02-09 23:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-20 15:38 usr/include/linux/soundcard.h warnings for 'make headers_check' Jaswinder Singh Rajput
2009-01-21  0:08 ` Takashi Iwai
2009-01-21  0:25   ` Jaswinder Singh Rajput
2009-01-21  5:41   ` Sam Ravnborg
2009-02-03 20:27     ` Arnd Bergmann
2009-02-04  4:04       ` Jaswinder Singh Rajput
2009-02-04  6:39         ` Takashi Iwai
2009-02-04  8:34           ` Jaswinder Singh Rajput
2009-02-04  9:03             ` Takashi Iwai
2009-02-04 10:37               ` Jaswinder Singh Rajput
2009-02-04 10:52                 ` Takashi Iwai
2009-02-04 11:31                   ` Jaswinder Singh Rajput
2009-02-04 11:43                     ` Takashi Iwai
2009-02-04 12:51                       ` Arnd Bergmann
2009-02-04 12:58                         ` Takashi Iwai
2009-02-04 13:44                         ` Jaswinder Singh Rajput
2009-02-04 13:49                           ` Takashi Iwai
2009-02-04 14:02                           ` Arnd Bergmann
2009-02-09 23:06                             ` Takashi Iwai
2009-01-24  6:50   ` Jaswinder Singh Rajput

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox