diff options
Diffstat (limited to 'sound/pci/riptide/riptide.c')
-rw-r--r-- | sound/pci/riptide/riptide.c | 347 |
1 files changed, 160 insertions, 187 deletions
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index e51a5ef1954d..235a71e5ac8d 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -507,41 +507,19 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip); | |||
507 | */ | 507 | */ |
508 | 508 | ||
509 | static struct pci_device_id snd_riptide_ids[] = { | 509 | static struct pci_device_id snd_riptide_ids[] = { |
510 | { | 510 | { PCI_DEVICE(0x127a, 0x4310) }, |
511 | .vendor = 0x127a,.device = 0x4310, | 511 | { PCI_DEVICE(0x127a, 0x4320) }, |
512 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | 512 | { PCI_DEVICE(0x127a, 0x4330) }, |
513 | }, | 513 | { PCI_DEVICE(0x127a, 0x4340) }, |
514 | { | ||
515 | .vendor = 0x127a,.device = 0x4320, | ||
516 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | ||
517 | }, | ||
518 | { | ||
519 | .vendor = 0x127a,.device = 0x4330, | ||
520 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | ||
521 | }, | ||
522 | { | ||
523 | .vendor = 0x127a,.device = 0x4340, | ||
524 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | ||
525 | }, | ||
526 | {0,}, | 514 | {0,}, |
527 | }; | 515 | }; |
528 | 516 | ||
529 | #ifdef SUPPORT_JOYSTICK | 517 | #ifdef SUPPORT_JOYSTICK |
530 | static struct pci_device_id snd_riptide_joystick_ids[] __devinitdata = { | 518 | static struct pci_device_id snd_riptide_joystick_ids[] __devinitdata = { |
531 | { | 519 | { PCI_DEVICE(0x127a, 0x4312) }, |
532 | .vendor = 0x127a,.device = 0x4312, | 520 | { PCI_DEVICE(0x127a, 0x4322) }, |
533 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | 521 | { PCI_DEVICE(0x127a, 0x4332) }, |
534 | }, | 522 | { PCI_DEVICE(0x127a, 0x4342) }, |
535 | { | ||
536 | .vendor = 0x127a,.device = 0x4322, | ||
537 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | ||
538 | }, | ||
539 | {.vendor = 0x127a,.device = 0x4332, | ||
540 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | ||
541 | }, | ||
542 | {.vendor = 0x127a,.device = 0x4342, | ||
543 | .subvendor = PCI_ANY_ID,.subdevice = PCI_ANY_ID, | ||
544 | }, | ||
545 | {0,}, | 523 | {0,}, |
546 | }; | 524 | }; |
547 | #endif | 525 | #endif |
@@ -1209,12 +1187,79 @@ static int riptide_resume(struct pci_dev *pci) | |||
1209 | } | 1187 | } |
1210 | #endif | 1188 | #endif |
1211 | 1189 | ||
1190 | static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) | ||
1191 | { | ||
1192 | union firmware_version firmware = { .ret = CMDRET_ZERO }; | ||
1193 | int i, timeout, err; | ||
1194 | |||
1195 | for (i = 0; i < 2; i++) { | ||
1196 | WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0); | ||
1197 | WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0); | ||
1198 | } | ||
1199 | SET_GRESET(cif->hwport); | ||
1200 | udelay(100); | ||
1201 | UNSET_GRESET(cif->hwport); | ||
1202 | udelay(100); | ||
1203 | |||
1204 | for (timeout = 100000; --timeout; udelay(10)) { | ||
1205 | if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport)) | ||
1206 | break; | ||
1207 | } | ||
1208 | if (!timeout) { | ||
1209 | snd_printk(KERN_ERR | ||
1210 | "Riptide: device not ready, audio status: 0x%x " | ||
1211 | "ready: %d gerr: %d\n", | ||
1212 | READ_AUDIO_STATUS(cif->hwport), | ||
1213 | IS_READY(cif->hwport), IS_GERR(cif->hwport)); | ||
1214 | return -EIO; | ||
1215 | } else { | ||
1216 | snd_printdd | ||
1217 | ("Riptide: audio status: 0x%x ready: %d gerr: %d\n", | ||
1218 | READ_AUDIO_STATUS(cif->hwport), | ||
1219 | IS_READY(cif->hwport), IS_GERR(cif->hwport)); | ||
1220 | } | ||
1221 | |||
1222 | SEND_GETV(cif, &firmware.ret); | ||
1223 | snd_printdd("Firmware version: ASIC: %d CODEC %d AUXDSP %d PROG %d\n", | ||
1224 | firmware.firmware.ASIC, firmware.firmware.CODEC, | ||
1225 | firmware.firmware.AUXDSP, firmware.firmware.PROG); | ||
1226 | |||
1227 | for (i = 0; i < FIRMWARE_VERSIONS; i++) { | ||
1228 | if (!memcmp(&firmware_versions[i], &firmware, sizeof(firmware))) | ||
1229 | break; | ||
1230 | } | ||
1231 | if (i >= FIRMWARE_VERSIONS) | ||
1232 | return 0; /* no match */ | ||
1233 | |||
1234 | if (!chip) | ||
1235 | return 1; /* OK */ | ||
1236 | |||
1237 | snd_printdd("Writing Firmware\n"); | ||
1238 | if (!chip->fw_entry) { | ||
1239 | err = request_firmware(&chip->fw_entry, "riptide.hex", | ||
1240 | &chip->pci->dev); | ||
1241 | if (err) { | ||
1242 | snd_printk(KERN_ERR | ||
1243 | "Riptide: Firmware not available %d\n", err); | ||
1244 | return -EIO; | ||
1245 | } | ||
1246 | } | ||
1247 | err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size); | ||
1248 | if (err) { | ||
1249 | snd_printk(KERN_ERR | ||
1250 | "Riptide: Could not load firmware %d\n", err); | ||
1251 | return err; | ||
1252 | } | ||
1253 | |||
1254 | chip->firmware = firmware; | ||
1255 | |||
1256 | return 1; /* OK */ | ||
1257 | } | ||
1258 | |||
1212 | static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) | 1259 | static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) |
1213 | { | 1260 | { |
1214 | int timeout, tries; | ||
1215 | union cmdret rptr = CMDRET_ZERO; | 1261 | union cmdret rptr = CMDRET_ZERO; |
1216 | union firmware_version firmware; | 1262 | int err, tries; |
1217 | int i, j, err, has_firmware; | ||
1218 | 1263 | ||
1219 | if (!cif) | 1264 | if (!cif) |
1220 | return -EINVAL; | 1265 | return -EINVAL; |
@@ -1227,75 +1272,11 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) | |||
1227 | cif->is_reset = 0; | 1272 | cif->is_reset = 0; |
1228 | 1273 | ||
1229 | tries = RESET_TRIES; | 1274 | tries = RESET_TRIES; |
1230 | has_firmware = 0; | 1275 | do { |
1231 | while (has_firmware == 0 && tries-- > 0) { | 1276 | err = try_to_load_firmware(cif, chip); |
1232 | for (i = 0; i < 2; i++) { | 1277 | if (err < 0) |
1233 | WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0); | 1278 | return err; |
1234 | WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0); | 1279 | } while (!err && --tries); |
1235 | } | ||
1236 | SET_GRESET(cif->hwport); | ||
1237 | udelay(100); | ||
1238 | UNSET_GRESET(cif->hwport); | ||
1239 | udelay(100); | ||
1240 | |||
1241 | for (timeout = 100000; --timeout; udelay(10)) { | ||
1242 | if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport)) | ||
1243 | break; | ||
1244 | } | ||
1245 | if (timeout == 0) { | ||
1246 | snd_printk(KERN_ERR | ||
1247 | "Riptide: device not ready, audio status: 0x%x ready: %d gerr: %d\n", | ||
1248 | READ_AUDIO_STATUS(cif->hwport), | ||
1249 | IS_READY(cif->hwport), IS_GERR(cif->hwport)); | ||
1250 | return -EIO; | ||
1251 | } else { | ||
1252 | snd_printdd | ||
1253 | ("Riptide: audio status: 0x%x ready: %d gerr: %d\n", | ||
1254 | READ_AUDIO_STATUS(cif->hwport), | ||
1255 | IS_READY(cif->hwport), IS_GERR(cif->hwport)); | ||
1256 | } | ||
1257 | |||
1258 | SEND_GETV(cif, &rptr); | ||
1259 | for (i = 0; i < 4; i++) | ||
1260 | firmware.ret.retwords[i] = rptr.retwords[i]; | ||
1261 | |||
1262 | snd_printdd | ||
1263 | ("Firmware version: ASIC: %d CODEC %d AUXDSP %d PROG %d\n", | ||
1264 | firmware.firmware.ASIC, firmware.firmware.CODEC, | ||
1265 | firmware.firmware.AUXDSP, firmware.firmware.PROG); | ||
1266 | |||
1267 | for (j = 0; j < FIRMWARE_VERSIONS; j++) { | ||
1268 | has_firmware = 1; | ||
1269 | for (i = 0; i < 4; i++) { | ||
1270 | if (firmware_versions[j].ret.retwords[i] != | ||
1271 | firmware.ret.retwords[i]) | ||
1272 | has_firmware = 0; | ||
1273 | } | ||
1274 | if (has_firmware) | ||
1275 | break; | ||
1276 | } | ||
1277 | |||
1278 | if (chip != NULL && has_firmware == 0) { | ||
1279 | snd_printdd("Writing Firmware\n"); | ||
1280 | if (!chip->fw_entry) { | ||
1281 | if ((err = | ||
1282 | request_firmware(&chip->fw_entry, | ||
1283 | "riptide.hex", | ||
1284 | &chip->pci->dev)) != 0) { | ||
1285 | snd_printk(KERN_ERR | ||
1286 | "Riptide: Firmware not available %d\n", | ||
1287 | err); | ||
1288 | return -EIO; | ||
1289 | } | ||
1290 | } | ||
1291 | err = loadfirmware(cif, chip->fw_entry->data, | ||
1292 | chip->fw_entry->size); | ||
1293 | if (err) | ||
1294 | snd_printk(KERN_ERR | ||
1295 | "Riptide: Could not load firmware %d\n", | ||
1296 | err); | ||
1297 | } | ||
1298 | } | ||
1299 | 1280 | ||
1300 | SEND_SACR(cif, 0, AC97_RESET); | 1281 | SEND_SACR(cif, 0, AC97_RESET); |
1301 | SEND_RACR(cif, AC97_RESET, &rptr); | 1282 | SEND_RACR(cif, AC97_RESET, &rptr); |
@@ -1337,11 +1318,6 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) | |||
1337 | SET_AIE(cif->hwport); | 1318 | SET_AIE(cif->hwport); |
1338 | SET_AIACK(cif->hwport); | 1319 | SET_AIACK(cif->hwport); |
1339 | cif->is_reset = 1; | 1320 | cif->is_reset = 1; |
1340 | if (chip) { | ||
1341 | for (i = 0; i < 4; i++) | ||
1342 | chip->firmware.ret.retwords[i] = | ||
1343 | firmware.ret.retwords[i]; | ||
1344 | } | ||
1345 | 1321 | ||
1346 | return 0; | 1322 | return 0; |
1347 | } | 1323 | } |
@@ -2038,14 +2014,12 @@ static int __devinit snd_riptide_mixer(struct snd_riptide *chip) | |||
2038 | } | 2014 | } |
2039 | 2015 | ||
2040 | #ifdef SUPPORT_JOYSTICK | 2016 | #ifdef SUPPORT_JOYSTICK |
2041 | static int have_joystick; | ||
2042 | static struct pci_dev *riptide_gameport_pci; | ||
2043 | static struct gameport *riptide_gameport; | ||
2044 | 2017 | ||
2045 | static int __devinit | 2018 | static int __devinit |
2046 | snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) | 2019 | snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) |
2047 | { | 2020 | { |
2048 | static int dev; | 2021 | static int dev; |
2022 | struct gameport *gameport; | ||
2049 | 2023 | ||
2050 | if (dev >= SNDRV_CARDS) | 2024 | if (dev >= SNDRV_CARDS) |
2051 | return -ENODEV; | 2025 | return -ENODEV; |
@@ -2054,36 +2028,33 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) | |||
2054 | return -ENOENT; | 2028 | return -ENOENT; |
2055 | } | 2029 | } |
2056 | 2030 | ||
2057 | if (joystick_port[dev]) { | 2031 | if (!joystick_port[dev++]) |
2058 | riptide_gameport = gameport_allocate_port(); | 2032 | return 0; |
2059 | if (riptide_gameport) { | 2033 | |
2060 | if (!request_region | 2034 | gameport = gameport_allocate_port(); |
2061 | (joystick_port[dev], 8, "Riptide gameport")) { | 2035 | if (!gameport) |
2062 | snd_printk(KERN_WARNING | 2036 | return -ENOMEM; |
2063 | "Riptide: cannot grab gameport 0x%x\n", | 2037 | if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { |
2064 | joystick_port[dev]); | 2038 | snd_printk(KERN_WARNING |
2065 | gameport_free_port(riptide_gameport); | 2039 | "Riptide: cannot grab gameport 0x%x\n", |
2066 | riptide_gameport = NULL; | 2040 | joystick_port[dev]); |
2067 | } else { | 2041 | gameport_free_port(gameport); |
2068 | riptide_gameport_pci = pci; | 2042 | return -EBUSY; |
2069 | riptide_gameport->io = joystick_port[dev]; | ||
2070 | gameport_register_port(riptide_gameport); | ||
2071 | } | ||
2072 | } | ||
2073 | } | 2043 | } |
2074 | dev++; | 2044 | |
2045 | gameport->io = joystick_port[dev]; | ||
2046 | gameport_register_port(gameport); | ||
2047 | pci_set_drvdata(pci, gameport); | ||
2075 | return 0; | 2048 | return 0; |
2076 | } | 2049 | } |
2077 | 2050 | ||
2078 | static void __devexit snd_riptide_joystick_remove(struct pci_dev *pci) | 2051 | static void __devexit snd_riptide_joystick_remove(struct pci_dev *pci) |
2079 | { | 2052 | { |
2080 | if (riptide_gameport) { | 2053 | struct gameport *gameport = pci_get_drvdata(pci); |
2081 | if (riptide_gameport_pci == pci) { | 2054 | if (gameport) { |
2082 | release_region(riptide_gameport->io, 8); | 2055 | release_region(gameport->io, 8); |
2083 | riptide_gameport_pci = NULL; | 2056 | gameport_unregister_port(gameport); |
2084 | gameport_unregister_port(riptide_gameport); | 2057 | pci_set_drvdata(pci, NULL); |
2085 | riptide_gameport = NULL; | ||
2086 | } | ||
2087 | } | 2058 | } |
2088 | } | 2059 | } |
2089 | #endif | 2060 | #endif |
@@ -2094,8 +2065,8 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2094 | static int dev; | 2065 | static int dev; |
2095 | struct snd_card *card; | 2066 | struct snd_card *card; |
2096 | struct snd_riptide *chip; | 2067 | struct snd_riptide *chip; |
2097 | unsigned short addr; | 2068 | unsigned short val; |
2098 | int err = 0; | 2069 | int err; |
2099 | 2070 | ||
2100 | if (dev >= SNDRV_CARDS) | 2071 | if (dev >= SNDRV_CARDS) |
2101 | return -ENODEV; | 2072 | return -ENODEV; |
@@ -2107,60 +2078,63 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2107 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 2078 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2108 | if (err < 0) | 2079 | if (err < 0) |
2109 | return err; | 2080 | return err; |
2110 | if ((err = snd_riptide_create(card, pci, &chip)) < 0) { | 2081 | err = snd_riptide_create(card, pci, &chip); |
2111 | snd_card_free(card); | 2082 | if (err < 0) |
2112 | return err; | 2083 | goto error; |
2113 | } | ||
2114 | card->private_data = chip; | 2084 | card->private_data = chip; |
2115 | if ((err = snd_riptide_pcm(chip, 0, NULL)) < 0) { | 2085 | err = snd_riptide_pcm(chip, 0, NULL); |
2116 | snd_card_free(card); | 2086 | if (err < 0) |
2117 | return err; | 2087 | goto error; |
2118 | } | 2088 | err = snd_riptide_mixer(chip); |
2119 | if ((err = snd_riptide_mixer(chip)) < 0) { | 2089 | if (err < 0) |
2120 | snd_card_free(card); | 2090 | goto error; |
2121 | return err; | 2091 | |
2122 | } | 2092 | val = LEGACY_ENABLE_ALL; |
2123 | pci_write_config_word(chip->pci, PCI_EXT_Legacy_Mask, LEGACY_ENABLE_ALL | 2093 | if (opl3_port[dev]) |
2124 | | (opl3_port[dev] ? LEGACY_ENABLE_FM : 0) | 2094 | val |= LEGACY_ENABLE_FM; |
2125 | #ifdef SUPPORT_JOYSTICK | 2095 | #ifdef SUPPORT_JOYSTICK |
2126 | | (joystick_port[dev] ? LEGACY_ENABLE_GAMEPORT : | 2096 | if (joystick_port[dev]) |
2127 | 0) | 2097 | val |= LEGACY_ENABLE_GAMEPORT; |
2128 | #endif | 2098 | #endif |
2129 | | (mpu_port[dev] | 2099 | if (mpu_port[dev]) |
2130 | ? (LEGACY_ENABLE_MPU_INT | LEGACY_ENABLE_MPU) : | 2100 | val |= LEGACY_ENABLE_MPU_INT | LEGACY_ENABLE_MPU; |
2131 | 0) | 2101 | val |= (chip->irq << 4) & 0xf0; |
2132 | | ((chip->irq << 4) & 0xF0)); | 2102 | pci_write_config_word(chip->pci, PCI_EXT_Legacy_Mask, val); |
2133 | if ((addr = mpu_port[dev]) != 0) { | 2103 | if (mpu_port[dev]) { |
2134 | pci_write_config_word(chip->pci, PCI_EXT_MPU_Base, addr); | 2104 | val = mpu_port[dev]; |
2135 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_RIPTIDE, | 2105 | pci_write_config_word(chip->pci, PCI_EXT_MPU_Base, val); |
2136 | addr, 0, chip->irq, 0, | 2106 | err = snd_mpu401_uart_new(card, 0, MPU401_HW_RIPTIDE, |
2137 | &chip->rmidi)) < 0) | 2107 | val, 0, chip->irq, 0, |
2108 | &chip->rmidi); | ||
2109 | if (err < 0) | ||
2138 | snd_printk(KERN_WARNING | 2110 | snd_printk(KERN_WARNING |
2139 | "Riptide: Can't Allocate MPU at 0x%x\n", | 2111 | "Riptide: Can't Allocate MPU at 0x%x\n", |
2140 | addr); | 2112 | val); |
2141 | else | 2113 | else |
2142 | chip->mpuaddr = addr; | 2114 | chip->mpuaddr = val; |
2143 | } | 2115 | } |
2144 | if ((addr = opl3_port[dev]) != 0) { | 2116 | if (opl3_port[dev]) { |
2145 | pci_write_config_word(chip->pci, PCI_EXT_FM_Base, addr); | 2117 | val = opl3_port[dev]; |
2146 | if ((err = snd_opl3_create(card, addr, addr + 2, | 2118 | pci_write_config_word(chip->pci, PCI_EXT_FM_Base, val); |
2147 | OPL3_HW_RIPTIDE, 0, | 2119 | err = snd_opl3_create(card, val, val + 2, |
2148 | &chip->opl3)) < 0) | 2120 | OPL3_HW_RIPTIDE, 0, &chip->opl3); |
2121 | if (err < 0) | ||
2149 | snd_printk(KERN_WARNING | 2122 | snd_printk(KERN_WARNING |
2150 | "Riptide: Can't Allocate OPL3 at 0x%x\n", | 2123 | "Riptide: Can't Allocate OPL3 at 0x%x\n", |
2151 | addr); | 2124 | val); |
2152 | else { | 2125 | else { |
2153 | chip->opladdr = addr; | 2126 | chip->opladdr = val; |
2154 | if ((err = | 2127 | err = snd_opl3_hwdep_new(chip->opl3, 0, 1, NULL); |
2155 | snd_opl3_hwdep_new(chip->opl3, 0, 1, NULL)) < 0) | 2128 | if (err < 0) |
2156 | snd_printk(KERN_WARNING | 2129 | snd_printk(KERN_WARNING |
2157 | "Riptide: Can't Allocate OPL3-HWDEP\n"); | 2130 | "Riptide: Can't Allocate OPL3-HWDEP\n"); |
2158 | } | 2131 | } |
2159 | } | 2132 | } |
2160 | #ifdef SUPPORT_JOYSTICK | 2133 | #ifdef SUPPORT_JOYSTICK |
2161 | if ((addr = joystick_port[dev]) != 0) { | 2134 | if (joystick_port[dev]) { |
2162 | pci_write_config_word(chip->pci, PCI_EXT_Game_Base, addr); | 2135 | val = joystick_port[dev]; |
2163 | chip->gameaddr = addr; | 2136 | pci_write_config_word(chip->pci, PCI_EXT_Game_Base, val); |
2137 | chip->gameaddr = val; | ||
2164 | } | 2138 | } |
2165 | #endif | 2139 | #endif |
2166 | 2140 | ||
@@ -2178,13 +2152,16 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2178 | chip->opladdr); | 2152 | chip->opladdr); |
2179 | #endif | 2153 | #endif |
2180 | snd_riptide_proc_init(chip); | 2154 | snd_riptide_proc_init(chip); |
2181 | if ((err = snd_card_register(card)) < 0) { | 2155 | err = snd_card_register(card); |
2182 | snd_card_free(card); | 2156 | if (err < 0) |
2183 | return err; | 2157 | goto error; |
2184 | } | ||
2185 | pci_set_drvdata(pci, card); | 2158 | pci_set_drvdata(pci, card); |
2186 | dev++; | 2159 | dev++; |
2187 | return 0; | 2160 | return 0; |
2161 | |||
2162 | error: | ||
2163 | snd_card_free(card); | ||
2164 | return err; | ||
2188 | } | 2165 | } |
2189 | 2166 | ||
2190 | static void __devexit snd_card_riptide_remove(struct pci_dev *pci) | 2167 | static void __devexit snd_card_riptide_remove(struct pci_dev *pci) |
@@ -2216,14 +2193,11 @@ static struct pci_driver joystick_driver = { | |||
2216 | static int __init alsa_card_riptide_init(void) | 2193 | static int __init alsa_card_riptide_init(void) |
2217 | { | 2194 | { |
2218 | int err; | 2195 | int err; |
2219 | if ((err = pci_register_driver(&driver)) < 0) | 2196 | err = pci_register_driver(&driver); |
2197 | if (err < 0) | ||
2220 | return err; | 2198 | return err; |
2221 | #if defined(SUPPORT_JOYSTICK) | 2199 | #if defined(SUPPORT_JOYSTICK) |
2222 | if (pci_register_driver(&joystick_driver) < 0) { | 2200 | pci_register_driver(&joystick_driver); |
2223 | have_joystick = 0; | ||
2224 | snd_printk(KERN_INFO "no joystick found\n"); | ||
2225 | } else | ||
2226 | have_joystick = 1; | ||
2227 | #endif | 2201 | #endif |
2228 | return 0; | 2202 | return 0; |
2229 | } | 2203 | } |
@@ -2232,8 +2206,7 @@ static void __exit alsa_card_riptide_exit(void) | |||
2232 | { | 2206 | { |
2233 | pci_unregister_driver(&driver); | 2207 | pci_unregister_driver(&driver); |
2234 | #if defined(SUPPORT_JOYSTICK) | 2208 | #if defined(SUPPORT_JOYSTICK) |
2235 | if (have_joystick) | 2209 | pci_unregister_driver(&joystick_driver); |
2236 | pci_unregister_driver(&joystick_driver); | ||
2237 | #endif | 2210 | #endif |
2238 | } | 2211 | } |
2239 | 2212 | ||