Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sun, 30 Jun 2002 16:31:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sun, 30 Jun 2002 16:31:27 -0400 Received: from macker.loria.fr ([152.81.1.70]:53975 "EHLO macker.loria.fr") by vger.kernel.org with ESMTP id ; Sun, 30 Jun 2002 16:31:25 -0400 X-Amavix: Anti-spam check done by SpamAssassin X-Amavix: Anti-virus check done by McAfee X-Amavix: Scanned by Amavix Date: Sun, 30 Jun 2002 22:33:43 +0200 (CEST) From: Samuel Thibault X-X-Sender: samy@localhost.localdomain Reply-To: Samuel Thibault To: zab@zabbo.net, Cc: torvalds@transmeta.com, Subject: [PATCH] 2.4.18 drivers/sound/maestro.c Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1841 Lines: 60 Hi ! maestro.c:3537 takes care about volume button pressing when requesting irq (maestro_probe) : if((ret=request_irq(card->irq, ess_interrupt, SA_SHIRQ, card_names[card_type], card))) { } /* Turn on hardware volume control interrupt. This has to come after we grab the IRQ above, or a crash will result on installation if a button has been pressed, because in that case we'll get an immediate interrupt. */ n = inw(iobase+0x18); n|=(1<<6); outw(n, iobase+0x18); but not when unloading module : in fact, this bit is never cleared. Indeed, loading the module, unloading it, and pressing a volume button immediately crashes. This cures the problem : diff -urN linux-2.4.18/drivers/sound/maestro.c linux-2.4.18-cor/drivers/sound/maestro.c --- linux-2.4.18/drivers/sound/maestro.c Sun Jun 30 22:00:22 2002 +++ linux-2.4.18-cor/drivers/sound/maestro.c Sun Jun 30 22:02:11 2002 @@ -3569,9 +3569,18 @@ static void maestro_remove(struct pci_dev *pcidev) { struct ess_card *card = pci_get_drvdata(pcidev); int i; + u32 n; /* XXX maybe should force stop bob, but should be all stopped by _release by now */ + + /* Turn off hardware volume control interrupt. + This has to come before we leave the IRQ below, + or a crash results if a button is pressed ! */ + n = inw(card->iobase+0x18); + n&=~(1<<6); + outw(n, card->iobase+0x18); + free_irq(card->irq, card); unregister_sound_mixer(card->dev_mixer); for(i=0;i