Skip to content

Commit 9dd7c46

Browse files
rddunlaptiwai
authored andcommitted
sound/oss/dmasound: fix build when drivers are mixed =y/=m
When CONFIG_DMASOUND_ATARI=m and CONFIG_DMASOUND_Q40=y (or vice versa), dmasound_core.o can be built without dmasound_deinit() being defined, causing a build error: ERROR: modpost: "dmasound_deinit" [sound/oss/dmasound/dmasound_atari.ko] undefined! Modify dmasound_core.c and dmasound.h so that dmasound_deinit() is always available. The mixed modes (=y/=m) also mean that several variables and structs have to be declared in all cases. Suggested-by: Arnd Bergmann <arnd@arndb.de> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Link: lore.kernel.org/r/202204032138.EFT9qGEd-lkp@intel.com Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Link: https://lore.kernel.org/r/20220405234118.24830-1-rdunlap@infradead.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 9eb6f5c commit 9dd7c46

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

sound/oss/dmasound/dmasound.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ static inline int ioctl_return(int __user *addr, int value)
8888
*/
8989

9090
extern int dmasound_init(void);
91-
#ifdef MODULE
9291
extern void dmasound_deinit(void);
93-
#else
94-
#define dmasound_deinit() do { } while (0)
95-
#endif
9692

9793
/* description of the set-up applies to either hard or soft settings */
9894

@@ -114,9 +110,7 @@ typedef struct {
114110
void *(*dma_alloc)(unsigned int, gfp_t);
115111
void (*dma_free)(void *, unsigned int);
116112
int (*irqinit)(void);
117-
#ifdef MODULE
118113
void (*irqcleanup)(void);
119-
#endif
120114
void (*init)(void);
121115
void (*silence)(void);
122116
int (*setFormat)(int);

sound/oss/dmasound/dmasound_core.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,10 @@ module_param(writeBufSize, int, 0);
206206

207207
MODULE_LICENSE("GPL");
208208

209-
#ifdef MODULE
210209
static int sq_unit = -1;
211210
static int mixer_unit = -1;
212211
static int state_unit = -1;
213212
static int irq_installed;
214-
#endif /* MODULE */
215213

216214
/* control over who can modify resources shared between play/record */
217215
static fmode_t shared_resource_owner;
@@ -391,9 +389,6 @@ static const struct file_operations mixer_fops =
391389

392390
static void mixer_init(void)
393391
{
394-
#ifndef MODULE
395-
int mixer_unit;
396-
#endif
397392
mixer_unit = register_sound_mixer(&mixer_fops, -1);
398393
if (mixer_unit < 0)
399394
return;
@@ -1171,9 +1166,6 @@ static const struct file_operations sq_fops =
11711166
static int sq_init(void)
11721167
{
11731168
const struct file_operations *fops = &sq_fops;
1174-
#ifndef MODULE
1175-
int sq_unit;
1176-
#endif
11771169

11781170
sq_unit = register_sound_dsp(fops, -1);
11791171
if (sq_unit < 0) {
@@ -1366,9 +1358,6 @@ static const struct file_operations state_fops = {
13661358

13671359
static int state_init(void)
13681360
{
1369-
#ifndef MODULE
1370-
int state_unit;
1371-
#endif
13721361
state_unit = register_sound_special(&state_fops, SND_DEV_STATUS);
13731362
if (state_unit < 0)
13741363
return state_unit ;
@@ -1386,10 +1375,9 @@ static int state_init(void)
13861375
int dmasound_init(void)
13871376
{
13881377
int res ;
1389-
#ifdef MODULE
1378+
13901379
if (irq_installed)
13911380
return -EBUSY;
1392-
#endif
13931381

13941382
/* Set up sound queue, /dev/audio and /dev/dsp. */
13951383

@@ -1408,9 +1396,7 @@ int dmasound_init(void)
14081396
printk(KERN_ERR "DMA sound driver: Interrupt initialization failed\n");
14091397
return -ENODEV;
14101398
}
1411-
#ifdef MODULE
14121399
irq_installed = 1;
1413-
#endif
14141400

14151401
printk(KERN_INFO "%s DMA sound driver rev %03d installed\n",
14161402
dmasound.mach.name, (DMASOUND_CORE_REVISION<<4) +
@@ -1424,8 +1410,6 @@ int dmasound_init(void)
14241410
return 0;
14251411
}
14261412

1427-
#ifdef MODULE
1428-
14291413
void dmasound_deinit(void)
14301414
{
14311415
if (irq_installed) {
@@ -1444,8 +1428,6 @@ void dmasound_deinit(void)
14441428
unregister_sound_dsp(sq_unit);
14451429
}
14461430

1447-
#else /* !MODULE */
1448-
14491431
static int dmasound_setup(char *str)
14501432
{
14511433
int ints[6], size;
@@ -1489,8 +1471,6 @@ static int dmasound_setup(char *str)
14891471

14901472
__setup("dmasound=", dmasound_setup);
14911473

1492-
#endif /* !MODULE */
1493-
14941474
/*
14951475
* Conversion tables
14961476
*/
@@ -1577,9 +1557,7 @@ char dmasound_alaw2dma8[] = {
15771557

15781558
EXPORT_SYMBOL(dmasound);
15791559
EXPORT_SYMBOL(dmasound_init);
1580-
#ifdef MODULE
15811560
EXPORT_SYMBOL(dmasound_deinit);
1582-
#endif
15831561
EXPORT_SYMBOL(dmasound_write_sq);
15841562
EXPORT_SYMBOL(dmasound_catchRadius);
15851563
#ifdef HAS_8BIT_TABLES

0 commit comments

Comments
 (0)