Changeset 703 for GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c
- Timestamp:
- Sep 26, 2021, 6:18:40 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-next merged: 696-702
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c
r695 r703 77 77 if (io_port == 1) { 78 78 /* auto-detect */ 79 if (!(io_port = pci_resource_start(chip->pci, 2))) 79 io_port = pci_resource_start(chip->pci, 2); 80 if (!io_port) 80 81 return -ENODEV; 81 82 } … … 86 87 if (io_port == 0x203) 87 88 continue; 88 if ((r = request_region(io_port, 1, "YMFPCI gameport")) != NULL) 89 r = request_region(io_port, 1, "YMFPCI gameport"); 90 if (r) 89 91 break; 90 92 } … … 107 109 } 108 110 109 if (!r && !(r = request_region(io_port, 1, "YMFPCI gameport"))) { 110 dev_err(chip->card->dev, 111 "joystick port %#x is in use.\n", io_port); 112 return -EBUSY; 111 if (!r) { 112 r = request_region(io_port, 1, "YMFPCI gameport"); 113 if (!r) { 114 dev_err(chip->card->dev, 115 "joystick port %#x is in use.\n", io_port); 116 return -EBUSY; 117 } 113 118 } 114 119 … … 198 203 fm_port[dev] = pci_resource_start(pci, 1); 199 204 } 200 if (fm_port[dev] > 0 && 201 (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) { 205 if (fm_port[dev] > 0) 206 fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3"); 207 if (fm_res) { 202 208 legacy_ctrl |= YMFPCI_LEGACY_FMEN; 203 209 pci_write_config_word(pci, PCIR_DSXG_FMBASE, fm_port[dev]); … … 207 213 mpu_port[dev] = pci_resource_start(pci, 1) + 0x20; 208 214 } 209 if (mpu_port[dev] > 0 && 210 (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) { 215 if (mpu_port[dev] > 0) 216 mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401"); 217 if (mpu_res) { 211 218 legacy_ctrl |= YMFPCI_LEGACY_MEN; 212 219 pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, mpu_port[dev]); … … 220 227 default: fm_port[dev] = 0; break; 221 228 } 222 if (fm_port[dev] > 0 && 223 (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) { 229 if (fm_port[dev] > 0) 230 fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3"); 231 if (fm_res) { 224 232 legacy_ctrl |= YMFPCI_LEGACY_FMEN; 225 233 } else { … … 234 242 default: mpu_port[dev] = 0; break; 235 243 } 236 if (mpu_port[dev] > 0 && 237 (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) { 244 if (mpu_port[dev] > 0) 245 mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401"); 246 if (mpu_res) { 238 247 legacy_ctrl |= YMFPCI_LEGACY_MEN; 239 248 } else { … … 249 258 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); 250 259 pci_write_config_word(pci, PCIR_DSXG_ELEGACY, legacy_ctrl2); 251 if ((err = snd_ymfpci_create(card, pci, 252 old_legacy_ctrl, 253 &chip)) < 0) { 260 err = snd_ymfpci_create(card, pci, old_legacy_ctrl, &chip); 261 if (err < 0) { 254 262 release_and_free_resource(mpu_res); 255 263 release_and_free_resource(fm_res); … … 292 300 293 301 if (chip->mpu_res) { 294 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, 295 mpu_port[dev], 296 MPU401_INFO_INTEGRATED | 297 MPU401_INFO_IRQ_HOOK, 298 -1, &chip->rawmidi)) < 0) { 302 err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, 303 mpu_port[dev], 304 MPU401_INFO_INTEGRATED | 305 MPU401_INFO_IRQ_HOOK, 306 -1, &chip->rawmidi); 307 if (err < 0) { 299 308 dev_warn(card->dev, 300 309 "cannot initialize MPU401 at 0x%lx, skipping...\n", … … 305 314 } 306 315 if (chip->fm_res) { 307 if ((err = snd_opl3_create(card, 308 fm_port[dev], 309 fm_port[dev] + 2, 310 OPL3_HW_OPL3, 1, &opl3)) < 0) { 316 err = snd_opl3_create(card, 317 fm_port[dev], 318 fm_port[dev] + 2, 319 OPL3_HW_OPL3, 1, &opl3); 320 if (err < 0) { 311 321 dev_warn(card->dev, 312 322 "cannot initialize FM OPL3 at 0x%lx, skipping...\n", … … 314 324 legacy_ctrl &= ~YMFPCI_LEGACY_FMEN; 315 325 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); 316 } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 317 dev_err(card->dev, "cannot create opl3 hwdep\n"); 318 goto free_card; 326 } else { 327 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); 328 if (err < 0) { 329 dev_err(card->dev, "cannot create opl3 hwdep\n"); 330 goto free_card; 331 } 319 332 } 320 333 }
Note:
See TracChangeset
for help on using the changeset viewer.