From 0b40261256a71184c6bca487b91e6b748b077709 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Sat, 18 Mar 2023 09:27:08 -0400 Subject: ALSA: ymfpci: remove unused snd_ymfpci_readb function clang with W=1 reports sound/pci/ymfpci/ymfpci_main.c:34:18: error: unused function 'snd_ymfpci_readb' [-Werror,-Wunused-function] static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset) ^ This static function is not used, so remove it. Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20230318132708.1684504-1-trix@redhat.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci_main.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index c80114c0ad7b..2858736ed20a 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -31,11 +31,6 @@ static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip); -static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset) -{ - return readb(chip->reg_area_virt + offset); -} - static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val) { writeb(val, chip->reg_area_virt + offset); -- cgit v1.2.3 From f09467e06b8add14fa294d38a1a2e91e36c97157 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 06:42:04 +0300 Subject: ALSA: ymfpci: Add error messages for abritrary IO ports on older chips As an end user, it can be confusing to request an arbitrary IO port be used only to find out that it doesn't work without an obvious reason, especially since /sys/module/snd_ymfpci/parameters/{fm,joystick,mpu}_port indicate 0 after the module has been loaded. In my case, I was unaware that the YMF724 did not support such usage, and thus ended up spending time attempting to debug the issue. Now, when a user attempts to request an IO port that isn't supported by the hardware, the following message is printed: [ 25.549530] snd_ymfpci 0000:06:05.0: The Yamaha DS-1 (YMF724F) does not support arbitrary IO ports for FM (requested 0x1234) Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329034204.171901-1-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 1e198e4d57b8..de5dc5337c40 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c @@ -98,8 +98,10 @@ static int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev, case 0x204: legacy_ctrl2 |= 2 << 6; break; case 0x205: legacy_ctrl2 |= 3 << 6; break; default: - dev_err(chip->card->dev, - "invalid joystick port %#x", io_port); + if (io_port > 0) + dev_err(chip->card->dev, + "The %s does not support arbitrary IO ports for the game port (requested 0x%x)\n", + chip->card->shortname, (unsigned int)io_port); return -EINVAL; } } @@ -186,6 +188,13 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, default: model = str = "???"; break; } + strcpy(card->driver, str); + sprintf(card->shortname, "Yamaha %s (%s)", model, str); + sprintf(card->longname, "%s at 0x%lx, irq %i", + card->shortname, + chip->reg_area_phys, + chip->irq); + legacy_ctrl = 0; legacy_ctrl2 = 0x0800; /* SBEN = 0, SMOD = 01, LAD = 0 */ @@ -218,7 +227,13 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, case 0x398: legacy_ctrl2 |= 1; break; case 0x3a0: legacy_ctrl2 |= 2; break; case 0x3a8: legacy_ctrl2 |= 3; break; - default: fm_port[dev] = 0; break; + default: + if (fm_port[dev] > 0) + dev_err(card->dev, + "The %s does not support arbitrary IO ports for FM (requested 0x%x)\n", + card->shortname, (unsigned int)fm_port[dev]); + fm_port[dev] = 0; + break; } if (fm_port[dev] > 0) fm_res = devm_request_region(&pci->dev, fm_port[dev], @@ -234,7 +249,13 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, case 0x300: legacy_ctrl2 |= 1 << 4; break; case 0x332: legacy_ctrl2 |= 2 << 4; break; case 0x334: legacy_ctrl2 |= 3 << 4; break; - default: mpu_port[dev] = 0; break; + default: + if (mpu_port[dev] > 0) + dev_err(card->dev, + "The %s does not support arbitrary IO ports for MPU-401 (requested 0x%x)\n", + card->shortname, (unsigned int)mpu_port[dev]); + mpu_port[dev] = 0; + break; } if (mpu_port[dev] > 0) mpu_res = devm_request_region(&pci->dev, mpu_port[dev], @@ -257,12 +278,6 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, if (err < 0) return err; - strcpy(card->driver, str); - sprintf(card->shortname, "Yamaha %s (%s)", model, str); - sprintf(card->longname, "%s at 0x%lx, irq %i", - card->shortname, - chip->reg_area_phys, - chip->irq); err = snd_ymfpci_pcm(chip, 0); if (err < 0) return err; -- cgit v1.2.3 From 081364d7039395d5759dda17f6904d7e99d39f4b Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 07:14:37 +0300 Subject: ALSA: ymfpci: Switch to DEFINE_SIMPLE_DEV_PM_OPS() Since commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old ones") SIMPLE_DEV_PM_OPS has been marked deprecated. The intent is to remove CONFIG_PM_SLEEP guards for PM callbacks. As such the ifdefs are now removed. Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329041440.177363-2-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci.c | 4 +--- sound/pci/ymfpci/ymfpci.h | 2 -- sound/pci/ymfpci/ymfpci_main.c | 6 +----- 3 files changed, 2 insertions(+), 10 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index de5dc5337c40..03f880f2e282 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c @@ -352,11 +352,9 @@ static struct pci_driver ymfpci_driver = { .name = KBUILD_MODNAME, .id_table = snd_ymfpci_ids, .probe = snd_card_ymfpci_probe, -#ifdef CONFIG_PM_SLEEP .driver = { - .pm = &snd_ymfpci_pm, + .pm = pm_sleep_ptr(&snd_ymfpci_pm), }, -#endif }; module_pci_driver(ymfpci_driver); diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index 66968776478a..2103654c650f 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h @@ -345,12 +345,10 @@ struct snd_ymfpci { const struct firmware *dsp_microcode; const struct firmware *controller_microcode; -#ifdef CONFIG_PM_SLEEP u32 *saved_regs; u32 saved_ydsxgr_mode; u16 saved_dsxg_legacy; u16 saved_dsxg_elegacy; -#endif }; int snd_ymfpci_create(struct snd_card *card, diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 2858736ed20a..6d13f41527dd 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2220,7 +2220,6 @@ static void snd_ymfpci_free(struct snd_card *card) release_firmware(chip->controller_microcode); } -#ifdef CONFIG_PM_SLEEP static const int saved_regs_index[] = { /* spdif */ YDSXGR_SPDIFOUTCTRL, @@ -2304,8 +2303,7 @@ static int snd_ymfpci_resume(struct device *dev) return 0; } -SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); -#endif /* CONFIG_PM_SLEEP */ +DEFINE_SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); int snd_ymfpci_create(struct snd_card *card, struct pci_dev *pci, @@ -2374,12 +2372,10 @@ int snd_ymfpci_create(struct snd_card *card, if (err < 0) return err; -#ifdef CONFIG_PM_SLEEP chip->saved_regs = devm_kmalloc_array(&pci->dev, YDSXGR_NUM_SAVED_REGS, sizeof(u32), GFP_KERNEL); if (!chip->saved_regs) return -ENOMEM; -#endif snd_ymfpci_proc_init(card, chip); -- cgit v1.2.3 From 69a6c1ba4238ef5ce01afb6f9e1b9be79b765d5f Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 07:14:38 +0300 Subject: ALSA: ymfpci: Move allocation of saved registers to struct snd_ymfpci The registers were previously allocated when CONFIG_PM_SLEEP was set, however this only saved an insignificant amount of memory otherwise. Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329041440.177363-3-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci.h | 31 ++++++++++++++++++++++++++++++- sound/pci/ymfpci/ymfpci_main.c | 34 ---------------------------------- 2 files changed, 30 insertions(+), 35 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index 2103654c650f..04e2800049cd 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h @@ -268,6 +268,35 @@ struct snd_ymfpci_pcm { u32 shift; }; +static const int saved_regs_index[] = { + /* spdif */ + YDSXGR_SPDIFOUTCTRL, + YDSXGR_SPDIFOUTSTATUS, + YDSXGR_SPDIFINCTRL, + /* volumes */ + YDSXGR_PRIADCLOOPVOL, + YDSXGR_NATIVEDACINVOL, + YDSXGR_NATIVEDACOUTVOL, + YDSXGR_BUF441OUTVOL, + YDSXGR_NATIVEADCINVOL, + YDSXGR_SPDIFLOOPVOL, + YDSXGR_SPDIFOUTVOL, + YDSXGR_ZVOUTVOL, + YDSXGR_LEGACYOUTVOL, + /* address bases */ + YDSXGR_PLAYCTRLBASE, + YDSXGR_RECCTRLBASE, + YDSXGR_EFFCTRLBASE, + YDSXGR_WORKBASE, + /* capture set up */ + YDSXGR_MAPOFREC, + YDSXGR_RECFORMAT, + YDSXGR_RECSLOTSR, + YDSXGR_ADCFORMAT, + YDSXGR_ADCSLOTSR, +}; +#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) + struct snd_ymfpci { int irq; @@ -345,7 +374,7 @@ struct snd_ymfpci { const struct firmware *dsp_microcode; const struct firmware *controller_microcode; - u32 *saved_regs; + u32 saved_regs[YDSXGR_NUM_SAVED_REGS]; u32 saved_ydsxgr_mode; u16 saved_dsxg_legacy; u16 saved_dsxg_elegacy; diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 6d13f41527dd..8bf647824db2 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2220,35 +2220,6 @@ static void snd_ymfpci_free(struct snd_card *card) release_firmware(chip->controller_microcode); } -static const int saved_regs_index[] = { - /* spdif */ - YDSXGR_SPDIFOUTCTRL, - YDSXGR_SPDIFOUTSTATUS, - YDSXGR_SPDIFINCTRL, - /* volumes */ - YDSXGR_PRIADCLOOPVOL, - YDSXGR_NATIVEDACINVOL, - YDSXGR_NATIVEDACOUTVOL, - YDSXGR_BUF441OUTVOL, - YDSXGR_NATIVEADCINVOL, - YDSXGR_SPDIFLOOPVOL, - YDSXGR_SPDIFOUTVOL, - YDSXGR_ZVOUTVOL, - YDSXGR_LEGACYOUTVOL, - /* address bases */ - YDSXGR_PLAYCTRLBASE, - YDSXGR_RECCTRLBASE, - YDSXGR_EFFCTRLBASE, - YDSXGR_WORKBASE, - /* capture set up */ - YDSXGR_MAPOFREC, - YDSXGR_RECFORMAT, - YDSXGR_RECSLOTSR, - YDSXGR_ADCFORMAT, - YDSXGR_ADCSLOTSR, -}; -#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) - static int snd_ymfpci_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); @@ -2372,11 +2343,6 @@ int snd_ymfpci_create(struct snd_card *card, if (err < 0) return err; - chip->saved_regs = devm_kmalloc_array(&pci->dev, YDSXGR_NUM_SAVED_REGS, - sizeof(u32), GFP_KERNEL); - if (!chip->saved_regs) - return -ENOMEM; - snd_ymfpci_proc_init(card, chip); return 0; -- cgit v1.2.3 From 39fef76ce533dd1fe3b55e929cdceb3269a91c99 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 07:14:39 +0300 Subject: ALSA: ymfpci: Store saved legacy registers in an array In preparation for storing more than two legacy PCI registers, the existing ones are moved into a new array. Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329041440.177363-4-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci.h | 9 +++++++-- sound/pci/ymfpci/ymfpci_main.c | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index 04e2800049cd..192f6ce9b9fa 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h @@ -297,6 +297,12 @@ static const int saved_regs_index[] = { }; #define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) +static const int pci_saved_regs_index[] = { + PCIR_DSXG_LEGACY, + PCIR_DSXG_ELEGACY, +}; +#define DSXG_PCI_NUM_SAVED_REGS ARRAY_SIZE(pci_saved_regs_index) + struct snd_ymfpci { int irq; @@ -376,8 +382,7 @@ struct snd_ymfpci { u32 saved_regs[YDSXGR_NUM_SAVED_REGS]; u32 saved_ydsxgr_mode; - u16 saved_dsxg_legacy; - u16 saved_dsxg_elegacy; + u16 saved_dsxg_pci_regs[DSXG_PCI_NUM_SAVED_REGS]; }; int snd_ymfpci_create(struct snd_card *card, diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 8bf647824db2..02c9e454c2e6 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2228,13 +2228,16 @@ static int snd_ymfpci_suspend(struct device *dev) snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_ac97_suspend(chip->ac97); + for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++) chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]); + chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE); - pci_read_config_word(chip->pci, PCIR_DSXG_LEGACY, - &chip->saved_dsxg_legacy); - pci_read_config_word(chip->pci, PCIR_DSXG_ELEGACY, - &chip->saved_dsxg_elegacy); + + for (i = 0; i < DSXG_PCI_NUM_SAVED_REGS; i++) + pci_read_config_word(chip->pci, pci_saved_regs_index[i], + chip->saved_dsxg_pci_regs + i); + snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); snd_ymfpci_disable_dsp(chip); @@ -2258,10 +2261,9 @@ static int snd_ymfpci_resume(struct device *dev) snd_ac97_resume(chip->ac97); - pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY, - chip->saved_dsxg_legacy); - pci_write_config_word(chip->pci, PCIR_DSXG_ELEGACY, - chip->saved_dsxg_elegacy); + for (i = 0; i < DSXG_PCI_NUM_SAVED_REGS; i++) + pci_write_config_word(chip->pci, pci_saved_regs_index[i], + chip->saved_dsxg_pci_regs[i]); /* start hw again */ if (chip->start_count > 0) { -- cgit v1.2.3 From 4fa4a14773fbf1cd848aaec4f7cf129816d7b2f1 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 07:14:40 +0300 Subject: ALSA: ymfpci: Store additional legacy registers on suspend YMF744 and newer store the base IO ports in separate PCI config registers. Since these registers were not restored, when set to a non-default value, features that rely on them (FM, MPU401, gameport) were not functional after restore, as their respective IO ports were reset to their defaults. Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329041440.177363-5-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci.h | 8 ++++++++ sound/pci/ymfpci/ymfpci_main.c | 16 +++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index 192f6ce9b9fa..d5dd0e5ae5ba 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h @@ -298,10 +298,18 @@ static const int saved_regs_index[] = { #define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) static const int pci_saved_regs_index[] = { + /* All Chips */ PCIR_DSXG_LEGACY, PCIR_DSXG_ELEGACY, + /* YMF 744/754 */ + PCIR_DSXG_FMBASE, + PCIR_DSXG_SBBASE, + PCIR_DSXG_MPU401BASE, + PCIR_DSXG_JOYBASE, }; #define DSXG_PCI_NUM_SAVED_REGS ARRAY_SIZE(pci_saved_regs_index) +#define DSXG_PCI_NUM_SAVED_LEGACY_REGS 2 +static_assert(DSXG_PCI_NUM_SAVED_LEGACY_REGS <= DSXG_PCI_NUM_SAVED_REGS); struct snd_ymfpci { int irq; diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 02c9e454c2e6..0963f3ae3dc1 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2224,8 +2224,11 @@ static int snd_ymfpci_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); struct snd_ymfpci *chip = card->private_data; - unsigned int i; - + unsigned int i, legacy_reg_count = DSXG_PCI_NUM_SAVED_LEGACY_REGS; + + if (chip->pci->device >= 0x0010) /* YMF 744/754 */ + legacy_reg_count = DSXG_PCI_NUM_SAVED_REGS; + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_ac97_suspend(chip->ac97); @@ -2234,7 +2237,7 @@ static int snd_ymfpci_suspend(struct device *dev) chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE); - for (i = 0; i < DSXG_PCI_NUM_SAVED_REGS; i++) + for (i = 0; i < legacy_reg_count; i++) pci_read_config_word(chip->pci, pci_saved_regs_index[i], chip->saved_dsxg_pci_regs + i); @@ -2249,7 +2252,10 @@ static int snd_ymfpci_resume(struct device *dev) struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); struct snd_ymfpci *chip = card->private_data; - unsigned int i; + unsigned int i, legacy_reg_count = DSXG_PCI_NUM_SAVED_LEGACY_REGS; + + if (chip->pci->device >= 0x0010) /* YMF 744/754 */ + legacy_reg_count = DSXG_PCI_NUM_SAVED_REGS; snd_ymfpci_aclink_reset(pci); snd_ymfpci_codec_ready(chip, 0); @@ -2261,7 +2267,7 @@ static int snd_ymfpci_resume(struct device *dev) snd_ac97_resume(chip->ac97); - for (i = 0; i < DSXG_PCI_NUM_SAVED_REGS; i++) + for (i = 0; i < legacy_reg_count; i++) pci_write_config_word(chip->pci, pci_saved_regs_index[i], chip->saved_dsxg_pci_regs[i]); -- cgit v1.2.3 From a8752868b74c0ce4491d0b62805fc99b0f6c3b15 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 07:36:27 +0300 Subject: ALSA: ymfpci: Use u16 consistently for old_legacy_ctrl There's no need to switch between unsigned short and u16, especially since all the functions that end up using old_legacy_ctrl specify u16 anyway. Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329043627.178899-1-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci.h | 4 ++-- sound/pci/ymfpci/ymfpci_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index d5dd0e5ae5ba..a408785cfa1b 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h @@ -319,7 +319,7 @@ struct snd_ymfpci { unsigned long reg_area_phys; void __iomem *reg_area_virt; - unsigned short old_legacy_ctrl; + u16 old_legacy_ctrl; #ifdef SUPPORT_JOYSTICK struct gameport *gameport; #endif @@ -395,7 +395,7 @@ struct snd_ymfpci { int snd_ymfpci_create(struct snd_card *card, struct pci_dev *pci, - unsigned short old_legacy_ctrl); + u16 old_legacy_ctrl); void snd_ymfpci_free_gameport(struct snd_ymfpci *chip); extern const struct dev_pm_ops snd_ymfpci_pm; diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 0963f3ae3dc1..92a0ac40fd02 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2286,7 +2286,7 @@ DEFINE_SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); int snd_ymfpci_create(struct snd_card *card, struct pci_dev *pci, - unsigned short old_legacy_ctrl) + u16 old_legacy_ctrl) { struct snd_ymfpci *chip = card->private_data; int err; -- cgit v1.2.3 From 2fa98a4283c165715e6d36f5cd3acbc6f3c029f2 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Wed, 29 Mar 2023 07:39:18 +0300 Subject: ALSA: ymfpci: Use register macro in place of integer literal The macro for said register already exists, so just use it, to make the code more readable. Signed-off-by: Tasos Sahanidis Link: https://lore.kernel.org/r/20230329043918.179352-1-tasos@tasossah.com Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci/ymfpci') diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 92a0ac40fd02..5f1a201754fa 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2214,7 +2214,7 @@ static void snd_ymfpci_free(struct snd_card *card) snd_ymfpci_free_gameport(chip); - pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl); + pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY, chip->old_legacy_ctrl); release_firmware(chip->dsp_microcode); release_firmware(chip->controller_microcode); -- cgit v1.2.3