cmedia: enable -Werror

Errors are now enabled for all audio drivers.

Change-Id: Ia4e986f0ed8965376c3bbefc3d9f04bcd68ad561
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7621
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>
This commit is contained in:
PulkoMandy 2024-04-13 14:32:38 +02:00 committed by waddlesplash
parent 99351a72d3
commit 5ea01a50c2
5 changed files with 37 additions and 38 deletions

View File

@ -674,21 +674,12 @@ rule ArchitectureSetupWarnings architecture
EnableWerror src add-ons kernel console ;
EnableWerror src add-ons kernel cpu ;
EnableWerror src add-ons kernel debugger ;
EnableWerror src add-ons kernel drivers audio ac97 ;
# EnableWerror src add-ons kernel drivers audio cmedia ;
EnableWerror src add-ons kernel drivers audio echo ;
EnableWerror src add-ons kernel drivers audio emuxki ;
EnableWerror src add-ons kernel drivers audio generic ;
EnableWerror src add-ons kernel drivers audio hda ;
EnableWerror src add-ons kernel drivers audio ice1712 ;
EnableWerror src add-ons kernel drivers audio null ;
EnableWerror src add-ons kernel drivers audio sb16 ;
EnableWerror src add-ons kernel drivers audio usb ;
EnableWerror src add-ons kernel drivers audio virtio ;
EnableWerror src add-ons kernel drivers audio ;
EnableWerror src add-ons kernel drivers bluetooth ;
EnableWerror src add-ons kernel drivers bus ;
EnableWerror src add-ons kernel drivers common ;
EnableWerror src add-ons kernel drivers disk ;
# EnableWerror src add-ons kernel drivers display ;
EnableWerror src add-ons kernel drivers dvb ;
# EnableWerror src add-ons kernel drivers graphics ;
EnableWerror src add-ons kernel drivers graphics intel_extreme ;
@ -731,10 +722,11 @@ rule ArchitectureSetupWarnings architecture
EnableWerror src add-ons kernel drivers network wwan ;
EnableWerror src add-ons kernel drivers ports ;
EnableWerror src add-ons kernel drivers power ;
EnableWerror src add-ons kernel drivers printer ;
EnableWerror src add-ons kernel drivers random ;
EnableWerror src add-ons kernel drivers tty ;
# EnableWerror src add-ons kernel drivers pty ;
# EnableWerror src add-ons kernel drivers sensor ;
# EnableWerror src add-ons kernel drivers timer ;
EnableWerror src add-ons kernel drivers video ;
# EnableWerror src add-ons kernel drivers wmi ;
EnableWerror src add-ons kernel file_systems bfs ;
EnableWerror src add-ons kernel file_systems cdda ;
EnableWerror src add-ons kernel file_systems ext2 ;

View File

@ -187,8 +187,9 @@ uchar get_indirect(cmedia_pci_dev * card,int regno)
}
void dump_card(cmedia_pci_dev* card);
#if 0
void dump_card(cmedia_pci_dev * card)
void dump_card(cmedia_pci_dev* card)
{
int ix;
dprintf("\n");
@ -207,7 +208,7 @@ void dump_card(cmedia_pci_dev * card)
dprintf("\n");
}
#else
void dump_card(cmedia_pci_dev * card)
void dump_card(cmedia_pci_dev* card)
{
}
#endif
@ -285,7 +286,7 @@ make_device_names(cmedia_pci_dev * card)
#if DO_PCM
/* cmedia_pci DMA doesn't work when physical NULL isn't NULL from PCI */
/* this is a hack to not export bad devices on BeBox hardware */
if ((*pci->ram_address)(NULL) == NULL) {
if ((*pci->ram_address)(0) == 0) {
sprintf(card->pcm.name, "audio/raw/%s", name);
names[num_names++] = card->pcm.name;
sprintf(card->pcm.oldname, "audio/old/%s", name);
@ -401,7 +402,7 @@ a_o_k:
ddprintf(("cmedia_pci: successfully found or created low area!\n"));
card->low_size = low_size;
card->low_mem = addr;
card->low_phys = (vuchar *)(addr_t)where.address;
card->low_phys = where.address;
card->map_low = curarea;
return B_OK;
}
@ -486,12 +487,13 @@ debug_cmedia(int argc, char * argv[])
}
dprintf("%s: enhanced registers at 0x%x\n", cards[ix].name,
cards[ix].enhanced);
dprintf("%s: open %ld dma_a at 0x%x dma_c 0x%x\n", cards[ix].pcm.name,
dprintf("%s: open %" B_PRId32 " dma_a at 0x%x dma_c 0x%x\n", cards[ix].pcm.name,
cards[ix].pcm.open_count, cards[ix].pcm.dma_a, cards[ix].pcm.dma_c);
if (cards[ix].pcm.open_count) {
dprintf(" dma_a: 0x%lx+0x%lx dma_c: 0x%lx+0x%lx\n",
PCI_IO_RD_32((int)cards[ix].pcm.dma_a), PCI_IO_RD_32((int)cards[ix].pcm.dma_a+4),
PCI_IO_RD_32((int)cards[ix].pcm.dma_c), PCI_IO_RD_32((int)cards[ix].pcm.dma_c+4));
dprintf(" dma_a: 0x%" B_PRIu32 "+0x%" B_PRIu32 " dma_c: 0x%" B_PRIu32 "+0x%" B_PRIu32
"\n",
PCI_IO_RD_32((int)cards[ix].pcm.dma_a), PCI_IO_RD_32((int)cards[ix].pcm.dma_a + 4),
PCI_IO_RD_32((int)cards[ix].pcm.dma_c), PCI_IO_RD_32((int)cards[ix].pcm.dma_c + 4));
}
return 0;
}
@ -546,7 +548,7 @@ init_driver(void)
}
#endif
if (setup_cmedia_pci(&cards[num_cards])) {
dprintf("Setup of C-Media %ld failed\n", num_cards+1);
dprintf("Setup of C-Media %d failed\n", num_cards + 1);
#ifdef __HAIKU__
(*pci->unreserve_device)(info.bus, info.device, info.function,
DRIVER_NAME, &cards[num_cards]);

View File

@ -20,7 +20,7 @@
#define DEVNAME 32
#define EXPORT __declspec(dllexport)
#define EXPORT __attribute__((visibility("default")))
#if defined(__POWERPC__)
#define EIEIO() __eieio()
@ -153,7 +153,7 @@ typedef struct _cmedia_pci_dev
int dma_base;
size_t low_size; /* size of low memory */
vuchar * low_mem;
vuchar * low_phys; /* physical address */
phys_addr_t low_phys; /* physical address */
area_id map_low; /* area pointing to low memory */
pci_info info;
midi_dev midi;

View File

@ -44,6 +44,7 @@ typedef struct {
int mutemask;
} mixer_info;
/* mute is special -- when it's 0x01, it means enable... */
mixer_info the_mixers[] = {
{CMEDIA_PCI_LEFT_ADC_INPUT_G, 0, 1.5, 0.0, 0, 15, 0, 0x0f, 0x00},
@ -65,15 +66,19 @@ mixer_info the_mixers[] = {
{CMEDIA_PCI_RIGHT_PCM_OUTPUT_GAM, 0x11, -1.5, 0.0, 0, 63, 0, 0x3f, 0x80},
{CMEDIA_PCI_DIGITAL_LOOPBACK_AM, 0x16, -1.5, 0.0, 0, 63, 2, 0xfc, 0x01},
};
#define N_MIXERS (sizeof(the_mixers) / sizeof(the_mixers[0]))
static int
map_mixer(int selector) {
int i;
for (i = 0; i < N_MIXERS; i++)
if (the_mixers[i].selector == selector)
return i;
return -1;
uint32 i;
for (i = 0; i < N_MIXERS; i++) {
if (the_mixers[i].selector == selector)
return i;
}
return -1;
}

View File

@ -718,7 +718,6 @@ pcm_control(
size_t len)
{
// declarations for SPDIF settings I/O
static int32 chipinfo[] = { 0,0 };
uchar reg_value;
char DriverVersion[] = "1.3.2 (Jul 17, 2001)";
@ -1087,12 +1086,12 @@ pcm_control(
err = B_OK;
break;
case SOUND_SET_PLAYBACK_PREFERRED_BUF_SIZE:
config.play_buf_size = (int32)data;
config.play_buf_size = (intptr_t)data;
configure = true;
err = B_OK;
break;
case SOUND_SET_CAPTURE_PREFERRED_BUF_SIZE:
config.rec_buf_size = (int32)data;
config.rec_buf_size = (intptr_t)data;
configure = true;
err = B_OK;
break;
@ -1244,8 +1243,9 @@ pcm_control(
// *(int32*)data.vendor_id = cards[0].info.vendor_id;
// *(int32*)data.device_id = cards[0].info.device_id;
// static int32 chipinfo[] = { 0,0 };
// chipinfo[0] = cards[0].info.vendor_id;
*(int32 *)data = cards[0].info.device_id;
*(int32*)data = cards[0].info.device_id;
// memcpy(data, &chipinfo, sizeof(chipinfo));
err = B_OK;
@ -1351,7 +1351,7 @@ pcm_read(
pcm_dev * port = (pcm_dev *)cookie;
size_t to_read = *nread;
status_t err;
int block;
size_t block;
cpu_status cp;
int bytes_xferred;
void * hdrptr = data;
@ -1433,9 +1433,9 @@ first_time: /* we need to check whether anything's available first */
*nread += hdrsize;
hdr.capture_size = *nread;
hdr.sample_rate = port->config.sample_rate;
if (hdrsize > sizeof(hdr)) {
if ((uint32)hdrsize > sizeof(hdr))
hdrsize = sizeof(hdr);
}
memcpy(hdrptr, &hdr, hdrsize);
}
@ -1635,7 +1635,7 @@ ddprintf(("cmedia_pci: dma_a 0x%x+0x%x\n", PCI_IO_RD_32((int)port->dma_a), PCI_I
else {
atomic_add(&port->write_waiting, 1);
/* if none there, fill with silence */
if (port->wr_silence < port->config.play_buf_size*2) {
if (port->wr_silence < (int32)port->config.play_buf_size * 2) {
if (port->config.format == 0x11) {
memset((void *)ptr, 0x80, port->wr_size);
}