The recent refactoring of es1688 object creation with the use of
devres caused a problem with the non-PnP probe of GUS driver, as it
tries to probe multiple times with different parameters That is, this
object needs the immediate resource release and the devres doesn't fit
for it.
This patch reverts partially the commit for restoring the classic
resource management for es1688 object.
Fixes:
1bb11c1c7f6e ("ALSA: es1688: Allocate resources with device-managed APIs")
Reported-by: kernel test robot <oliver.sang@intel.com>
Link: https://lore.kernel.org/r/20210805032513.GA30485@xsang-OptiPlex-9020
Link: https://lore.kernel.org/r/20210805062148.30951-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
struct snd_es1688 {
unsigned long port; /* port of ESS chip */
struct snd_es1688 {
unsigned long port; /* port of ESS chip */
+ struct resource *res_port;
unsigned long mpu_port; /* MPU-401 port of ESS chip */
int irq; /* IRQ number of ESS chip */
int mpu_irq; /* MPU IRQ */
unsigned long mpu_port; /* MPU-401 port of ESS chip */
int irq; /* IRQ number of ESS chip */
int mpu_irq; /* MPU IRQ */
{
if (chip->hardware != ES1688_HW_UNDEF)
snd_es1688_init(chip, 0);
{
if (chip->hardware != ES1688_HW_UNDEF)
snd_es1688_init(chip, 0);
+ release_and_free_resource(chip->res_port);
+ if (chip->irq >= 0)
+ free_irq(chip->irq, (void *) chip);
+ if (chip->dma8 >= 0) {
+ disable_dma(chip->dma8);
+ free_dma(chip->dma8);
+ }
chip->dma8 = -1;
chip->hardware = ES1688_HW_UNDEF;
chip->dma8 = -1;
chip->hardware = ES1688_HW_UNDEF;
- if (!devm_request_region(card->dev, port + 4, 12, "ES1688")) {
+ chip->res_port = request_region(port + 4, 12, "ES1688");
+ if (chip->res_port == NULL) {
snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
+ err = -EBUSY;
+ goto exit;
- err = devm_request_irq(card->dev, irq, snd_es1688_interrupt, 0,
- "ES1688", (void *) chip);
+ err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip);
if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
}
chip->irq = irq;
card->sync_irq = chip->irq;
}
chip->irq = irq;
card->sync_irq = chip->irq;
- err = snd_devm_request_dma(card->dev, dma8, "ES1688");
+ err = request_dma(dma8, "ES1688");
if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
err = snd_es1688_probe(chip);
if (err < 0)
err = snd_es1688_probe(chip);
if (err < 0)
err = snd_es1688_init(chip, 1);
if (err < 0)
err = snd_es1688_init(chip, 1);
if (err < 0)
/* Register device */
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
/* Register device */
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+exit:
+ if (err)
+ snd_es1688_free(chip);