}
-static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
{
int retval, value, cmdf = cmd & 0xff;
+ int __user *p = (int __user *)arg;
opl3sa2_state_t* devc = &opl3sa2_state[dev];
if (_SIOC_DIR (cmd) & _SIOC_WRITE) {
switch (cmdf) {
case SOUND_MIXER_VOLUME:
- retval = get_user(value, (unsigned int *) arg);
+ retval = get_user(value, (unsigned __user *) arg);
if (retval)
break;
arg_to_vol_stereo(value, &devc->volume_l, &devc->volume_r);
opl3sa2_set_volume(devc, devc->volume_l, devc->volume_r);
value = ret_vol_stereo(devc->volume_l, devc->volume_r);
- retval = put_user(value, (int *) arg);
+ retval = put_user(value, p);
break;
case SOUND_MIXER_MIC:
- retval = get_user(value, (unsigned int *) arg);
+ retval = get_user(value, (unsigned __user *) arg);
if (retval)
break;
arg_to_vol_mono(value, &devc->mic);
opl3sa2_set_mic(devc, devc->mic);
value = ret_vol_mono(devc->mic);
- retval = put_user(value, (int *) arg);
+ retval = put_user(value, p);
break;
default:
*/
switch (cmdf) {
case SOUND_MIXER_DEVMASK:
- retval = put_user(SOUND_MASK_VOLUME | SOUND_MASK_MIC, (int *) arg);
+ retval = put_user(SOUND_MASK_VOLUME | SOUND_MASK_MIC, p);
break;
case SOUND_MIXER_STEREODEVS:
- retval = put_user(SOUND_MASK_VOLUME, (int *) arg);
+ retval = put_user(SOUND_MASK_VOLUME, p);
break;
case SOUND_MIXER_RECMASK:
/* No recording devices */
- retval = put_user(0, (int *) arg);
+ retval = put_user(0, p);
break;
case SOUND_MIXER_CAPS:
- retval = put_user(SOUND_CAP_EXCL_INPUT, (int *) arg);
+ retval = put_user(SOUND_CAP_EXCL_INPUT, p);
break;
case SOUND_MIXER_RECSRC:
/* No recording source */
- retval = put_user(0, (int *) arg);
+ retval = put_user(0, p);
break;
case SOUND_MIXER_VOLUME:
value = ret_vol_stereo(devc->volume_l, devc->volume_r);
- retval = put_user(value, (int *) arg);
+ retval = put_user(value, p);
break;
case SOUND_MIXER_MIC:
value = ret_vol_mono(devc->mic);
- put_user(value, (int *) arg);
+ put_user(value, p);
break;
default:
/* opl3sa2_mixer_ioctl end */
-static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, void __user * arg)
{
int value, retval, cmdf = cmd & 0xff;
switch (cmdf) {
case SOUND_MIXER_BASS:
value = ret_vol_stereo(devc->bass_l, devc->bass_r);
- retval = put_user(value, (int *) arg);
+ retval = put_user(value, (int __user *) arg);
break;
case SOUND_MIXER_TREBLE:
value = ret_vol_stereo(devc->treble_l, devc->treble_r);
- retval = put_user(value, (int *) arg);
+ retval = put_user(value, (int __user *) arg);
break;
case SOUND_MIXER_DIGITAL1:
value = ret_vol_stereo(devc->wide_l, devc->wide_r);
- retval = put_user(value, (int *) arg);
+ retval = put_user(value, (int __user *) arg);
break;
default:
* Component probe, attach, unload functions
*/
-static inline int __init probe_opl3sa2_mpu(struct address_info* hw_config)
-{
- return probe_mpu401(hw_config);
-}
-
-
-static inline int __init attach_opl3sa2_mpu(struct address_info* hw_config)
-{
- return attach_mpu401(hw_config, THIS_MODULE);
-}
-
-
static inline void __exit unload_opl3sa2_mpu(struct address_info *hw_config)
{
unload_mpu401(hw_config);
}
-static inline int __init probe_opl3sa2_mss(struct address_info* hw_config)
-{
- return probe_ms_sound(hw_config);
-}
-
-
-static void __init attach_opl3sa2_mss(struct address_info* hw_config)
+static void __init attach_opl3sa2_mss(struct address_info* hw_config, struct resource *ports)
{
int initial_mixers;
initial_mixers = num_mixers;
- attach_ms_sound(hw_config, THIS_MODULE); /* Slot 0 */
+ attach_ms_sound(hw_config, ports, THIS_MODULE); /* Slot 0 */
if (hw_config->slots[0] != -1) {
/* Did the MSS driver install? */
if(num_mixers == (initial_mixers + 1)) {
for (card = 0; card < max; card++) {
/* If a user wants an I/O then assume they meant it */
+ struct resource *ports;
+ int base;
if (!isapnp) {
if (io == -1 || irq == -1 || dma == -1 ||
opl3sa2_clear_slots(&opl3sa2_state[card].cfg_mpu);
}
+ /* FIXME: leak */
if (probe_opl3sa2(&opl3sa2_state[card].cfg, card))
return -ENODEV;
+ base = opl3sa2_state[card].cfg_mss.io_base;
- if (!probe_opl3sa2_mss(&opl3sa2_state[card].cfg_mss)) {
+ if (!request_region(base, 4, "WSS config"))
+ goto failed;
+
+ ports = request_region(base + 4, 4, "ad1848");
+ if (!ports)
+ goto failed2;
+
+ if (!probe_ms_sound(&opl3sa2_state[card].cfg_mss, ports)) {
/*
* If one or more cards are already registered, don't
* return an error but print a warning. Note, this
* should never really happen unless the hardware or
* ISA PnP screwed up.
*/
+ release_region(base + 4, 4);
+ failed2:
+ release_region(base, 4);
+ failed:
release_region(opl3sa2_state[card].cfg.io_base, 2);
if (opl3sa2_cards_num) {
attach_opl3sa2(&opl3sa2_state[card].cfg, card);
conf_printf(opl3sa2_state[card].chipset_name, &opl3sa2_state[card].cfg);
attach_opl3sa2_mixer(&opl3sa2_state[card].cfg, card);
- attach_opl3sa2_mss(&opl3sa2_state[card].cfg_mss);
+ attach_opl3sa2_mss(&opl3sa2_state[card].cfg_mss, ports);
/* ewww =) */
opl3sa2_state[card].card = card;
/* Attach MPU if we've been asked to do so, failure isn't fatal */
if (opl3sa2_state[card].cfg_mpu.io_base != -1) {
- if (probe_opl3sa2_mpu(&opl3sa2_state[card].cfg_mpu)) {
- if (attach_opl3sa2_mpu(&opl3sa2_state[card].cfg_mpu)) {
- printk(KERN_ERR PFX "failed to attach MPU401\n");
- opl3sa2_state[card].cfg_mpu.slots[1] = -1;
- }
+ int base = opl3sa2_state[card].cfg_mpu.io_base;
+ struct resource *ports;
+ ports = request_region(base, 2, "mpu401");
+ if (!ports)
+ goto out;
+ if (!probe_mpu401(&opl3sa2_state[card].cfg_mpu, ports)) {
+ release_region(base, 2);
+ goto out;
+ }
+ if (attach_mpu401(&opl3sa2_state[card].cfg_mpu, THIS_MODULE)) {
+ printk(KERN_ERR PFX "failed to attach MPU401\n");
+ opl3sa2_state[card].cfg_mpu.slots[1] = -1;
}
}
}
+out:
if (isapnp) {
printk(KERN_NOTICE PFX "%d PnP card(s) found.\n", opl3sa2_cards_num);
}