diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-09-22 10:54:23 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-09-23 01:18:22 -0400 |
commit | 8e699d2cc286506c00ce8ecc67c3d7d6cca9e814 (patch) | |
tree | e00f7d75e156087d1b881c612f55b91df2d2524c /sound/pci | |
parent | 272a487056ac2f39fe57fb54a55556b30c1522ba (diff) |
ALSA: fm801 - Clean up redundant reference to snd_fm801_tea575x_gpios[]
Use macro to improve readability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/fm801.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 76465f5d9f58..136f7232bb7c 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -729,11 +729,14 @@ static struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] = { | |||
729 | { .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" }, | 729 | { .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" }, |
730 | }; | 730 | }; |
731 | 731 | ||
732 | #define get_tea575x_gpio(chip) \ | ||
733 | (&snd_fm801_tea575x_gpios[((chip)->tea575x_tuner & TUNER_TYPE_MASK) - 1]) | ||
734 | |||
732 | static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) | 735 | static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) |
733 | { | 736 | { |
734 | struct fm801 *chip = tea->private_data; | 737 | struct fm801 *chip = tea->private_data; |
735 | unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); | 738 | unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); |
736 | struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1]; | 739 | struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip); |
737 | 740 | ||
738 | reg &= ~(FM801_GPIO_GP(gpio.data) | | 741 | reg &= ~(FM801_GPIO_GP(gpio.data) | |
739 | FM801_GPIO_GP(gpio.clk) | | 742 | FM801_GPIO_GP(gpio.clk) | |
@@ -751,7 +754,7 @@ static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea) | |||
751 | { | 754 | { |
752 | struct fm801 *chip = tea->private_data; | 755 | struct fm801 *chip = tea->private_data; |
753 | unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); | 756 | unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); |
754 | struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1]; | 757 | struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip); |
755 | 758 | ||
756 | return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 | | 759 | return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 | |
757 | (reg & FM801_GPIO_GP(gpio.most)) ? TEA575X_MOST : 0; | 760 | (reg & FM801_GPIO_GP(gpio.most)) ? TEA575X_MOST : 0; |
@@ -761,7 +764,7 @@ static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output | |||
761 | { | 764 | { |
762 | struct fm801 *chip = tea->private_data; | 765 | struct fm801 *chip = tea->private_data; |
763 | unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); | 766 | unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); |
764 | struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1]; | 767 | struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip); |
765 | 768 | ||
766 | /* use GPIO lines and set write enable bit */ | 769 | /* use GPIO lines and set write enable bit */ |
767 | reg |= FM801_GPIO_GS(gpio.data) | | 770 | reg |= FM801_GPIO_GS(gpio.data) | |
@@ -1246,7 +1249,7 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1246 | chip->tea575x_tuner = tea575x_tuner; | 1249 | chip->tea575x_tuner = tea575x_tuner; |
1247 | if (!snd_tea575x_init(&chip->tea)) { | 1250 | if (!snd_tea575x_init(&chip->tea)) { |
1248 | snd_printk(KERN_INFO "detected TEA575x radio type %s\n", | 1251 | snd_printk(KERN_INFO "detected TEA575x radio type %s\n", |
1249 | snd_fm801_tea575x_gpios[tea575x_tuner - 1].name); | 1252 | get_tea575x_gpio(chip)->name); |
1250 | break; | 1253 | break; |
1251 | } | 1254 | } |
1252 | } | 1255 | } |
@@ -1256,9 +1259,7 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1256 | } | 1259 | } |
1257 | } | 1260 | } |
1258 | if (!(chip->tea575x_tuner & TUNER_DISABLED)) { | 1261 | if (!(chip->tea575x_tuner & TUNER_DISABLED)) { |
1259 | strlcpy(chip->tea.card, | 1262 | strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name, |
1260 | snd_fm801_tea575x_gpios[(tea575x_tuner & | ||
1261 | TUNER_TYPE_MASK) - 1].name, | ||
1262 | sizeof(chip->tea.card)); | 1263 | sizeof(chip->tea.card)); |
1263 | } | 1264 | } |
1264 | #endif | 1265 | #endif |