ALSA: fm801 - Clean up redundant reference to snd_fm801_tea575x_gpios[]
Use macro to improve readability. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
272a487056
commit
8e699d2cc2
|
@ -729,11 +729,14 @@ static struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] = {
|
||||||
{ .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" },
|
{ .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define get_tea575x_gpio(chip) \
|
||||||
|
(&snd_fm801_tea575x_gpios[((chip)->tea575x_tuner & TUNER_TYPE_MASK) - 1])
|
||||||
|
|
||||||
static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
|
static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
|
||||||
{
|
{
|
||||||
struct fm801 *chip = tea->private_data;
|
struct fm801 *chip = tea->private_data;
|
||||||
unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
|
unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
|
||||||
struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1];
|
struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
|
||||||
|
|
||||||
reg &= ~(FM801_GPIO_GP(gpio.data) |
|
reg &= ~(FM801_GPIO_GP(gpio.data) |
|
||||||
FM801_GPIO_GP(gpio.clk) |
|
FM801_GPIO_GP(gpio.clk) |
|
||||||
|
@ -751,7 +754,7 @@ static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea)
|
||||||
{
|
{
|
||||||
struct fm801 *chip = tea->private_data;
|
struct fm801 *chip = tea->private_data;
|
||||||
unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
|
unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
|
||||||
struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1];
|
struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
|
||||||
|
|
||||||
return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 |
|
return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 |
|
||||||
(reg & FM801_GPIO_GP(gpio.most)) ? TEA575X_MOST : 0;
|
(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
|
||||||
{
|
{
|
||||||
struct fm801 *chip = tea->private_data;
|
struct fm801 *chip = tea->private_data;
|
||||||
unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
|
unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
|
||||||
struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1];
|
struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
|
||||||
|
|
||||||
/* use GPIO lines and set write enable bit */
|
/* use GPIO lines and set write enable bit */
|
||||||
reg |= FM801_GPIO_GS(gpio.data) |
|
reg |= FM801_GPIO_GS(gpio.data) |
|
||||||
|
@ -1246,7 +1249,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
|
||||||
chip->tea575x_tuner = tea575x_tuner;
|
chip->tea575x_tuner = tea575x_tuner;
|
||||||
if (!snd_tea575x_init(&chip->tea)) {
|
if (!snd_tea575x_init(&chip->tea)) {
|
||||||
snd_printk(KERN_INFO "detected TEA575x radio type %s\n",
|
snd_printk(KERN_INFO "detected TEA575x radio type %s\n",
|
||||||
snd_fm801_tea575x_gpios[tea575x_tuner - 1].name);
|
get_tea575x_gpio(chip)->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1256,9 +1259,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(chip->tea575x_tuner & TUNER_DISABLED)) {
|
if (!(chip->tea575x_tuner & TUNER_DISABLED)) {
|
||||||
strlcpy(chip->tea.card,
|
strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name,
|
||||||
snd_fm801_tea575x_gpios[(tea575x_tuner &
|
|
||||||
TUNER_TYPE_MASK) - 1].name,
|
|
||||||
sizeof(chip->tea.card));
|
sizeof(chip->tea.card));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue