Skip to content

Commit

Permalink
[ALSA] sound/isa: kill pnp_resource_change
Browse files Browse the repository at this point in the history
This removes the pnp_resource_change use from the ALSA ISAPnP drivers. In
2.4 these were useful in providing an easy path to setting the resources,
but in 2.6 they retain function as a layering violation only.
This makes for a nice cleanup (-550 lines) of ALSA but moreover, ALSA is the
only remaining user of pnp_init_resource_table(), pnp_resource_change() and
pnp_manual_config_dev() (and, in fact, of 'struct pnp_resource_table') in
the tree outide of drivers/pnp itself meaning it makes for more cleanup
potential inside the PnP layer.
Thomas Renninger acked their removal from that side, you did from the ALSA
side (CC list just copied from that thread).
Against current alsa-kernel HG. Many more potential cleanups in there, but
this _only_ removes the pnp_resource_change code. Compile tested against
current alsa-kernel HG and compile- and use-tested against 2.6.23.x (few
offsets).
Cc: Thomas Renninger <trenn@suse.de>

Signed-off-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
Rene Herman authored and Jaroslav Kysela committed Jan 31, 2008
1 parent df1deb6 commit 109c53f
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 610 deletions.
35 changes: 0 additions & 35 deletions Documentation/sound/alsa/ALSA-Configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

Module for sound cards based on Analog Devices AD1816A/AD1815 ISA chips.

port - port # for AD1816A chip (PnP setup)
mpu_port - port # for MPU-401 UART (PnP setup)
fm_port - port # for OPL3 (PnP setup)
irq - IRQ # for AD1816A chip (PnP setup)
mpu_irq - IRQ # for MPU-401 UART (PnP setup)
dma1 - first DMA # for AD1816A chip (PnP setup)
dma2 - second DMA # for AD1816A chip (PnP setup)
clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz)

This module supports multiple cards, autoprobe and PnP.
Expand Down Expand Up @@ -203,14 +196,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

Module for sound cards based on Avance Logic ALS100/ALS120 ISA chips.

port - port # for ALS100 (SB16) chip (PnP setup)
irq - IRQ # for ALS100 (SB16) chip (PnP setup)
dma8 - 8-bit DMA # for ALS100 (SB16) chip (PnP setup)
dma16 - 16-bit DMA # for ALS100 (SB16) chip (PnP setup)
mpu_port - port # for MPU-401 UART (PnP setup)
mpu_irq - IRQ # for MPU-401 (PnP setup)
fm_port - port # for OPL3 FM (PnP setup)

This module supports multiple cards, autoprobe and PnP.

The power-management is supported.
Expand Down Expand Up @@ -304,15 +289,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

Module for sound cards based on Aztech System AZT2320 ISA chip (PnP only).

port - port # for AZT2320 chip (PnP setup)
wss_port - port # for WSS (PnP setup)
mpu_port - port # for MPU-401 UART (PnP setup)
fm_port - FM port # for AZT2320 chip (PnP setup)
irq - IRQ # for AZT2320 (WSS) chip (PnP setup)
mpu_irq - IRQ # for MPU-401 UART (PnP setup)
dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup)
dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup)

This module supports multiple cards, PnP and autoprobe.

The power-management is supported.
Expand Down Expand Up @@ -505,13 +481,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
Module for Diamond Technologies DT-019X / Avance Logic ALS-007 (PnP
only)

port - Port # (PnP setup)
mpu_port - Port # for MPU-401 (PnP setup)
fm_port - Port # for FM OPL-3 (PnP setup)
irq - IRQ # (PnP setup)
mpu_irq - IRQ # for MPU-401 (PnP setup)
dma8 - DMA # (PnP setup)

This module supports multiple cards. This module is enabled only with
ISA PnP support.

Expand Down Expand Up @@ -609,10 +578,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

Module for sound cards based on ESS ES968 chip (PnP only).

port - port # for ES968 (SB8) chip (PnP setup)
irq - IRQ # for ES968 (SB8) chip (PnP setup)
dma1 - DMA # for ES968 (SB8) chip (PnP setup)

This module supports multiple cards, PnP and autoprobe.

The power-management is supported.
Expand Down
53 changes: 5 additions & 48 deletions sound/isa/ad1816a/ad1816a.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@ module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard.");
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard.");
module_param_array(port, long, NULL, 0444);
MODULE_PARM_DESC(port, "Port # for ad1816a driver.");
module_param_array(mpu_port, long, NULL, 0444);
MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ad1816a driver.");
module_param_array(fm_port, long, NULL, 0444);
MODULE_PARM_DESC(fm_port, "FM port # for ad1816a driver.");
module_param_array(irq, int, NULL, 0444);
MODULE_PARM_DESC(irq, "IRQ # for ad1816a driver.");
module_param_array(mpu_irq, int, NULL, 0444);
MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ad1816a driver.");
module_param_array(dma1, int, NULL, 0444);
MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver.");
module_param_array(dma2, int, NULL, 0444);
MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver.");
module_param_array(clockfreq, int, NULL, 0444);
MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0).");

Expand Down Expand Up @@ -117,42 +103,23 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
const struct pnp_card_device_id *id)
{
struct pnp_dev *pdev;
struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
int err;

if (!cfg)
return -ENOMEM;
acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
if (acard->dev == NULL) {
kfree(cfg);
if (acard->dev == NULL)
return -EBUSY;
}

acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);
if (acard->devmpu == NULL) {
mpu_port[dev] = -1;
snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n");
}

pdev = acard->dev;
pnp_init_resource_table(cfg);

if (port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[2], port[dev], 16);
if (fm_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
if (dma1[dev] != SNDRV_AUTO_DMA)
pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
if (dma2[dev] != SNDRV_AUTO_DMA)
pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
if (irq[dev] != SNDRV_AUTO_IRQ)
pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);

if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");

err = pnp_activate_dev(pdev);
if (err < 0) {
printk(KERN_ERR PFX "AUDIO PnP configure failure\n");
kfree(cfg);
return -EBUSY;
}

Expand All @@ -162,20 +129,11 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
dma2[dev] = pnp_dma(pdev, 1);
irq[dev] = pnp_irq(pdev, 0);

if (acard->devmpu == NULL) {
kfree(cfg);
if (acard->devmpu == NULL)
return 0;
}
pdev = acard->devmpu;
pnp_init_resource_table(cfg);

if (mpu_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
pdev = acard->devmpu;

if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
err = pnp_activate_dev(pdev);
if (err < 0) {
printk(KERN_ERR PFX "MPU401 PnP configure failure\n");
Expand All @@ -186,7 +144,6 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
mpu_irq[dev] = pnp_irq(pdev, 0);
}

kfree(cfg);
return 0;
}

Expand Down
49 changes: 2 additions & 47 deletions sound/isa/als100.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,6 @@ module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for als100 based soundcard.");
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable als100 based soundcard.");
module_param_array(port, long, NULL, 0444);
MODULE_PARM_DESC(port, "Port # for als100 driver.");
module_param_array(mpu_port, long, NULL, 0444);
MODULE_PARM_DESC(mpu_port, "MPU-401 port # for als100 driver.");
module_param_array(fm_port, long, NULL, 0444);
MODULE_PARM_DESC(fm_port, "FM port # for als100 driver.");
module_param_array(irq, int, NULL, 0444);
MODULE_PARM_DESC(irq, "IRQ # for als100 driver.");
module_param_array(mpu_irq, int, NULL, 0444);
MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for als100 driver.");
module_param_array(dma8, int, NULL, 0444);
MODULE_PARM_DESC(dma8, "8-bit DMA # for als100 driver.");
module_param_array(dma16, int, NULL, 0444);
MODULE_PARM_DESC(dma16, "16-bit DMA # for als100 driver.");

struct snd_card_als100 {
int dev_no;
Expand Down Expand Up @@ -111,38 +97,20 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
const struct pnp_card_device_id *id)
{
struct pnp_dev *pdev;
struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
int err;

if (!cfg)
return -ENOMEM;
acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
if (acard->dev == NULL) {
kfree(cfg);
if (acard->dev == NULL)
return -ENODEV;
}

acard->devmpu = pnp_request_card_device(card, id->devs[1].id, acard->dev);
acard->devopl = pnp_request_card_device(card, id->devs[2].id, acard->dev);

pdev = acard->dev;

pnp_init_resource_table(cfg);

/* override resources */
if (port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
if (dma8[dev] != SNDRV_AUTO_DMA)
pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
if (dma16[dev] != SNDRV_AUTO_DMA)
pnp_resource_change(&cfg->dma_resource[1], dma16[dev], 1);
if (irq[dev] != SNDRV_AUTO_IRQ)
pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
err = pnp_activate_dev(pdev);
if (err < 0) {
snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
kfree(cfg);
return err;
}
port[dev] = pnp_port_start(pdev, 0);
Expand All @@ -152,13 +120,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,

pdev = acard->devmpu;
if (pdev != NULL) {
pnp_init_resource_table(cfg);
if (mpu_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
snd_printk(KERN_ERR PFX "MPU401 the requested resources are invalid, using auto config\n");
err = pnp_activate_dev(pdev);
if (err < 0)
goto __mpu_error;
Expand All @@ -176,11 +137,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,

pdev = acard->devopl;
if (pdev != NULL) {
pnp_init_resource_table(cfg);
if (fm_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[0], fm_port[dev], 4);
if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
snd_printk(KERN_ERR PFX "OPL3 the requested resources are invalid, using auto config\n");
err = pnp_activate_dev(pdev);
if (err < 0)
goto __fm_error;
Expand All @@ -195,7 +151,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
fm_port[dev] = -1;
}

kfree(cfg);
return 0;
}

Expand Down
50 changes: 1 addition & 49 deletions sound/isa/azt2320.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,6 @@ module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for azt2320 based soundcard.");
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable azt2320 based soundcard.");
module_param_array(port, long, NULL, 0444);
MODULE_PARM_DESC(port, "Port # for azt2320 driver.");
module_param_array(wss_port, long, NULL, 0444);
MODULE_PARM_DESC(wss_port, "WSS Port # for azt2320 driver.");
module_param_array(mpu_port, long, NULL, 0444);
MODULE_PARM_DESC(mpu_port, "MPU-401 port # for azt2320 driver.");
module_param_array(fm_port, long, NULL, 0444);
MODULE_PARM_DESC(fm_port, "FM port # for azt2320 driver.");
module_param_array(irq, int, NULL, 0444);
MODULE_PARM_DESC(irq, "IRQ # for azt2320 driver.");
module_param_array(mpu_irq, int, NULL, 0444);
MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for azt2320 driver.");
module_param_array(dma1, int, NULL, 0444);
MODULE_PARM_DESC(dma1, "1st DMA # for azt2320 driver.");
module_param_array(dma2, int, NULL, 0444);
MODULE_PARM_DESC(dma2, "2nd DMA # for azt2320 driver.");

struct snd_card_azt2320 {
int dev_no;
Expand Down Expand Up @@ -121,43 +105,19 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
const struct pnp_card_device_id *id)
{
struct pnp_dev *pdev;
struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
int err;

if (!cfg)
return -ENOMEM;

acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
if (acard->dev == NULL) {
kfree(cfg);
if (acard->dev == NULL)
return -ENODEV;
}

acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);

pdev = acard->dev;
pnp_init_resource_table(cfg);

/* override resources */
if (port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
if (fm_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
if (wss_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[2], wss_port[dev], 4);
if (dma1[dev] != SNDRV_AUTO_DMA)
pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
if (dma2[dev] != SNDRV_AUTO_DMA)
pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
if (irq[dev] != SNDRV_AUTO_IRQ)
pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");

err = pnp_activate_dev(pdev);
if (err < 0) {
snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
kfree(cfg);
return err;
}
port[dev] = pnp_port_start(pdev, 0);
Expand All @@ -169,13 +129,6 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar

pdev = acard->devmpu;
if (pdev != NULL) {
pnp_init_resource_table(cfg);
if (mpu_port[dev] != SNDRV_AUTO_PORT)
pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
snd_printk(KERN_ERR PFX "MPU401 the requested resources are invalid, using auto config\n");
err = pnp_activate_dev(pdev);
if (err < 0)
goto __mpu_error;
Expand All @@ -191,7 +144,6 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
mpu_port[dev] = -1;
}

kfree (cfg);
return 0;
}

Expand Down
Loading

0 comments on commit 109c53f

Please sign in to comment.