diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2009-10-25 06:10:01 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-10-30 07:46:39 -0400 |
commit | b14f5de731ae657d498d18d713c6431bfbeefb4b (patch) | |
tree | a3e1febe4a01a391d95c65b5db244330e0afcb04 /sound/isa | |
parent | 3c76b4d69bedde5b9e7e42612a7d2ede4ab7fd8d (diff) |
ALSA: es18xx: remove snd_audiodrive structure
Remove intermediate snd_audiodrive structure between
snd_card structure and snd_es18xx. This reduces size of
source code and binary driver.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/es18xx.c | 71 |
1 files changed, 25 insertions, 46 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 160752bc2e8e..5cf42b4d65fd 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -139,10 +139,6 @@ struct snd_es18xx { | |||
139 | #ifdef CONFIG_PM | 139 | #ifdef CONFIG_PM |
140 | unsigned char pm_reg; | 140 | unsigned char pm_reg; |
141 | #endif | 141 | #endif |
142 | }; | ||
143 | |||
144 | struct snd_audiodrive { | ||
145 | struct snd_es18xx *chip; | ||
146 | #ifdef CONFIG_PNP | 142 | #ifdef CONFIG_PNP |
147 | struct pnp_dev *dev; | 143 | struct pnp_dev *dev; |
148 | struct pnp_dev *devc; | 144 | struct pnp_dev *devc; |
@@ -755,8 +751,7 @@ static int snd_es18xx_playback_trigger(struct snd_pcm_substream *substream, | |||
755 | static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) | 751 | static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) |
756 | { | 752 | { |
757 | struct snd_card *card = dev_id; | 753 | struct snd_card *card = dev_id; |
758 | struct snd_audiodrive *acard = card->private_data; | 754 | struct snd_es18xx *chip = card->private_data; |
759 | struct snd_es18xx *chip = acard->chip; | ||
760 | unsigned char status; | 755 | unsigned char status; |
761 | 756 | ||
762 | if (chip->caps & ES18XX_CONTROL) { | 757 | if (chip->caps & ES18XX_CONTROL) { |
@@ -1699,8 +1694,7 @@ static struct snd_pcm_ops snd_es18xx_capture_ops = { | |||
1699 | static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, | 1694 | static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, |
1700 | struct snd_pcm **rpcm) | 1695 | struct snd_pcm **rpcm) |
1701 | { | 1696 | { |
1702 | struct snd_audiodrive *acard = card->private_data; | 1697 | struct snd_es18xx *chip = card->private_data; |
1703 | struct snd_es18xx *chip = acard->chip; | ||
1704 | struct snd_pcm *pcm; | 1698 | struct snd_pcm *pcm; |
1705 | char str[16]; | 1699 | char str[16]; |
1706 | int err; | 1700 | int err; |
@@ -1742,8 +1736,7 @@ static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, | |||
1742 | #ifdef CONFIG_PM | 1736 | #ifdef CONFIG_PM |
1743 | static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) | 1737 | static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) |
1744 | { | 1738 | { |
1745 | struct snd_audiodrive *acard = card->private_data; | 1739 | struct snd_es18xx *chip = card->private_data; |
1746 | struct snd_es18xx *chip = acard->chip; | ||
1747 | 1740 | ||
1748 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1741 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1749 | 1742 | ||
@@ -1760,8 +1753,7 @@ static int snd_es18xx_suspend(struct snd_card *card, pm_message_t state) | |||
1760 | 1753 | ||
1761 | static int snd_es18xx_resume(struct snd_card *card) | 1754 | static int snd_es18xx_resume(struct snd_card *card) |
1762 | { | 1755 | { |
1763 | struct snd_audiodrive *acard = card->private_data; | 1756 | struct snd_es18xx *chip = card->private_data; |
1764 | struct snd_es18xx *chip = acard->chip; | ||
1765 | 1757 | ||
1766 | /* restore PM register, we won't wake till (not 0x07) i/o activity though */ | 1758 | /* restore PM register, we won't wake till (not 0x07) i/o activity though */ |
1767 | snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); | 1759 | snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); |
@@ -1773,8 +1765,7 @@ static int snd_es18xx_resume(struct snd_card *card) | |||
1773 | 1765 | ||
1774 | static int snd_es18xx_free(struct snd_card *card) | 1766 | static int snd_es18xx_free(struct snd_card *card) |
1775 | { | 1767 | { |
1776 | struct snd_audiodrive *acard = card->private_data; | 1768 | struct snd_es18xx *chip = card->private_data; |
1777 | struct snd_es18xx *chip = acard->chip; | ||
1778 | 1769 | ||
1779 | release_and_free_resource(chip->res_port); | 1770 | release_and_free_resource(chip->res_port); |
1780 | release_and_free_resource(chip->res_ctrl_port); | 1771 | release_and_free_resource(chip->res_ctrl_port); |
@@ -1789,7 +1780,6 @@ static int snd_es18xx_free(struct snd_card *card) | |||
1789 | disable_dma(chip->dma2); | 1780 | disable_dma(chip->dma2); |
1790 | free_dma(chip->dma2); | 1781 | free_dma(chip->dma2); |
1791 | } | 1782 | } |
1792 | kfree(chip); | ||
1793 | return 0; | 1783 | return 0; |
1794 | } | 1784 | } |
1795 | 1785 | ||
@@ -1802,19 +1792,14 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, | |||
1802 | unsigned long port, | 1792 | unsigned long port, |
1803 | unsigned long mpu_port, | 1793 | unsigned long mpu_port, |
1804 | unsigned long fm_port, | 1794 | unsigned long fm_port, |
1805 | int irq, int dma1, int dma2, | 1795 | int irq, int dma1, int dma2) |
1806 | struct snd_es18xx ** rchip) | ||
1807 | { | 1796 | { |
1808 | struct snd_es18xx *chip; | 1797 | struct snd_es18xx *chip = card->private_data; |
1809 | static struct snd_device_ops ops = { | 1798 | static struct snd_device_ops ops = { |
1810 | .dev_free = snd_es18xx_dev_free, | 1799 | .dev_free = snd_es18xx_dev_free, |
1811 | }; | 1800 | }; |
1812 | int err; | 1801 | int err; |
1813 | 1802 | ||
1814 | *rchip = NULL; | ||
1815 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
1816 | if (chip == NULL) | ||
1817 | return -ENOMEM; | ||
1818 | spin_lock_init(&chip->reg_lock); | 1803 | spin_lock_init(&chip->reg_lock); |
1819 | spin_lock_init(&chip->mixer_lock); | 1804 | spin_lock_init(&chip->mixer_lock); |
1820 | spin_lock_init(&chip->ctrl_lock); | 1805 | spin_lock_init(&chip->ctrl_lock); |
@@ -1865,14 +1850,12 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, | |||
1865 | snd_es18xx_free(card); | 1850 | snd_es18xx_free(card); |
1866 | return err; | 1851 | return err; |
1867 | } | 1852 | } |
1868 | *rchip = chip; | ||
1869 | return 0; | 1853 | return 0; |
1870 | } | 1854 | } |
1871 | 1855 | ||
1872 | static int __devinit snd_es18xx_mixer(struct snd_card *card) | 1856 | static int __devinit snd_es18xx_mixer(struct snd_card *card) |
1873 | { | 1857 | { |
1874 | struct snd_audiodrive *acard = card->private_data; | 1858 | struct snd_es18xx *chip = card->private_data; |
1875 | struct snd_es18xx *chip = acard->chip; | ||
1876 | int err; | 1859 | int err; |
1877 | unsigned int idx; | 1860 | unsigned int idx; |
1878 | 1861 | ||
@@ -2074,11 +2057,11 @@ static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev) | |||
2074 | return 0; | 2057 | return 0; |
2075 | } | 2058 | } |
2076 | 2059 | ||
2077 | static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, | 2060 | static int __devinit snd_audiodrive_pnp(int dev, struct snd_es18xx *chip, |
2078 | struct pnp_dev *pdev) | 2061 | struct pnp_dev *pdev) |
2079 | { | 2062 | { |
2080 | acard->dev = pdev; | 2063 | chip->dev = pdev; |
2081 | if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) | 2064 | if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) |
2082 | return -EBUSY; | 2065 | return -EBUSY; |
2083 | return 0; | 2066 | return 0; |
2084 | } | 2067 | } |
@@ -2104,26 +2087,26 @@ static struct pnp_card_device_id snd_audiodrive_pnpids[] = { | |||
2104 | 2087 | ||
2105 | MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); | 2088 | MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); |
2106 | 2089 | ||
2107 | static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, | 2090 | static int __devinit snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip, |
2108 | struct pnp_card_link *card, | 2091 | struct pnp_card_link *card, |
2109 | const struct pnp_card_device_id *id) | 2092 | const struct pnp_card_device_id *id) |
2110 | { | 2093 | { |
2111 | acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); | 2094 | chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); |
2112 | if (acard->dev == NULL) | 2095 | if (chip->dev == NULL) |
2113 | return -EBUSY; | 2096 | return -EBUSY; |
2114 | 2097 | ||
2115 | acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL); | 2098 | chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL); |
2116 | if (acard->devc == NULL) | 2099 | if (chip->devc == NULL) |
2117 | return -EBUSY; | 2100 | return -EBUSY; |
2118 | 2101 | ||
2119 | /* Control port initialization */ | 2102 | /* Control port initialization */ |
2120 | if (pnp_activate_dev(acard->devc) < 0) { | 2103 | if (pnp_activate_dev(chip->devc) < 0) { |
2121 | snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); | 2104 | snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); |
2122 | return -EAGAIN; | 2105 | return -EAGAIN; |
2123 | } | 2106 | } |
2124 | snd_printdd("pnp: port=0x%llx\n", | 2107 | snd_printdd("pnp: port=0x%llx\n", |
2125 | (unsigned long long)pnp_port_start(acard->devc, 0)); | 2108 | (unsigned long long)pnp_port_start(chip->devc, 0)); |
2126 | if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) | 2109 | if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) |
2127 | return -EBUSY; | 2110 | return -EBUSY; |
2128 | 2111 | ||
2129 | return 0; | 2112 | return 0; |
@@ -2139,24 +2122,20 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, | |||
2139 | static int snd_es18xx_card_new(int dev, struct snd_card **cardp) | 2122 | static int snd_es18xx_card_new(int dev, struct snd_card **cardp) |
2140 | { | 2123 | { |
2141 | return snd_card_create(index[dev], id[dev], THIS_MODULE, | 2124 | return snd_card_create(index[dev], id[dev], THIS_MODULE, |
2142 | sizeof(struct snd_audiodrive), cardp); | 2125 | sizeof(struct snd_es18xx), cardp); |
2143 | } | 2126 | } |
2144 | 2127 | ||
2145 | static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | 2128 | static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) |
2146 | { | 2129 | { |
2147 | struct snd_audiodrive *acard = card->private_data; | 2130 | struct snd_es18xx *chip = card->private_data; |
2148 | struct snd_es18xx *chip; | ||
2149 | struct snd_opl3 *opl3; | 2131 | struct snd_opl3 *opl3; |
2150 | int err; | 2132 | int err; |
2151 | 2133 | ||
2152 | if ((err = snd_es18xx_new_device(card, | 2134 | err = snd_es18xx_new_device(card, |
2153 | port[dev], | 2135 | port[dev], mpu_port[dev], fm_port[dev], |
2154 | mpu_port[dev], | 2136 | irq[dev], dma1[dev], dma2[dev]); |
2155 | fm_port[dev], | 2137 | if (err < 0) |
2156 | irq[dev], dma1[dev], dma2[dev], | ||
2157 | &chip)) < 0) | ||
2158 | return err; | 2138 | return err; |
2159 | acard->chip = chip; | ||
2160 | 2139 | ||
2161 | sprintf(card->driver, "ES%x", chip->version); | 2140 | sprintf(card->driver, "ES%x", chip->version); |
2162 | 2141 | ||