From: Takashi Iwai Subject: Re: [PATCH] azt3328.c: add suspend/resume support Date: Tue, 11 Apr 2006 11:46:37 +0200 Message-ID: References: <20060411082956.GA20725@rhlx01.fht-esslingen.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20060411082956.GA20725@rhlx01.fht-esslingen.de> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: andi@lisas.de Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Tue, 11 Apr 2006 10:29:56 +0200, Andreas Mohr wrote: > > +#ifdef CONFIG_PM > +static int > +snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state) > +{ > + struct snd_card *card = pci_get_drvdata(pci); > + struct snd_azf3328 *chip = card->private_data; > + int reg; > + > + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); > + > + snd_pcm_suspend_all(chip->pcm); > + > + /* FIXME: this suspend function doesn't fully prevent looping sound. > + * I suspect it might be due to a kernel PM problem, but possibly > + * this function is still not entirely correct. */ > + > + for (reg = 0; reg < AZF_IO_SIZE_MIXER_PM; reg += 2) > + *(u16 *)&chip->saved_regs_mixer[reg] = inw(chip->mixer_port + reg); That's a bad style. Rather define u16 saved_regs_mixer[AZF_IO_SIZE_CODEC_PM / 2]; and for (reg = 0; reg < AZF_IO_SIZE_MIXER_PM / 2; reg++) chip->saved_regs_mixer[reg] = inw(chip->mixer_port + reg * 2); than type-punning. Or, you can use ARRAY_SIZE() in the loop, too. Takashi ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642