diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-06-05 10:34:10 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-05 10:44:24 -0400 |
commit | 2a36f67f8c81f0babda0e811c760b7bfa971010b (patch) | |
tree | ef95d02a3b468132f83f0a63077b4f33d3cff2a7 /sound/pci/ctxfi/ctatc.c | |
parent | 775ffa1d3e5a550dd2c9d947d773021c61531b36 (diff) |
ALSA: ctxfi - Clean up / optimize
- Use static tables instead of assigining each funciton pointer
- Add __devinit* to appropriate places; pcm, mixer and timer cannot be
marked because they are kept in the function table that lives long
- Move create_alsa_devs function out of struct ct_atc to mark it
__devinit
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ctxfi/ctatc.c')
-rw-r--r-- | sound/pci/ctxfi/ctatc.c | 82 |
1 files changed, 39 insertions, 43 deletions
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 10b741977dd7..9b1324544db0 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -1202,7 +1202,7 @@ static int atc_dev_free(struct snd_device *dev) | |||
1202 | return ct_atc_destroy(atc); | 1202 | return ct_atc_destroy(atc); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | static int atc_identify_card(struct ct_atc *atc) | 1205 | static int __devinit atc_identify_card(struct ct_atc *atc) |
1206 | { | 1206 | { |
1207 | u16 subsys; | 1207 | u16 subsys; |
1208 | u8 revision; | 1208 | u8 revision; |
@@ -1243,7 +1243,7 @@ static int atc_identify_card(struct ct_atc *atc) | |||
1243 | return 0; | 1243 | return 0; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | static int ct_create_alsa_devs(struct ct_atc *atc) | 1246 | int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc) |
1247 | { | 1247 | { |
1248 | enum CTALSADEVS i; | 1248 | enum CTALSADEVS i; |
1249 | struct hw *hw = atc->hw; | 1249 | struct hw *hw = atc->hw; |
@@ -1277,7 +1277,7 @@ static int ct_create_alsa_devs(struct ct_atc *atc) | |||
1277 | return 0; | 1277 | return 0; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | static int atc_create_hw_devs(struct ct_atc *atc) | 1280 | static int __devinit atc_create_hw_devs(struct ct_atc *atc) |
1281 | { | 1281 | { |
1282 | struct hw *hw = NULL; | 1282 | struct hw *hw = NULL; |
1283 | struct card_conf info = {0}; | 1283 | struct card_conf info = {0}; |
@@ -1313,7 +1313,7 @@ static int atc_create_hw_devs(struct ct_atc *atc) | |||
1313 | return 0; | 1313 | return 0; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | static int atc_get_resources(struct ct_atc *atc) | 1316 | static int __devinit atc_get_resources(struct ct_atc *atc) |
1317 | { | 1317 | { |
1318 | struct daio_desc da_desc = {0}; | 1318 | struct daio_desc da_desc = {0}; |
1319 | struct daio_mgr *daio_mgr = NULL; | 1319 | struct daio_mgr *daio_mgr = NULL; |
@@ -1423,7 +1423,7 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1423 | return 0; | 1423 | return 0; |
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | static void | 1426 | static void __devinit |
1427 | atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai, | 1427 | atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai, |
1428 | struct src **srcs, struct srcimp **srcimps) | 1428 | struct src **srcs, struct srcimp **srcimps) |
1429 | { | 1429 | { |
@@ -1462,7 +1462,7 @@ atc_connect_dai(struct src_mgr *src_mgr, struct dai *dai, | |||
1462 | src_mgr->commit_write(src_mgr); /* Synchronously enable SRCs */ | 1462 | src_mgr->commit_write(src_mgr); /* Synchronously enable SRCs */ |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | static void atc_connect_resources(struct ct_atc *atc) | 1465 | static void __devinit atc_connect_resources(struct ct_atc *atc) |
1466 | { | 1466 | { |
1467 | struct dai *dai = NULL; | 1467 | struct dai *dai = NULL; |
1468 | struct dao *dao = NULL; | 1468 | struct dao *dao = NULL; |
@@ -1508,37 +1508,35 @@ static void atc_connect_resources(struct ct_atc *atc) | |||
1508 | } | 1508 | } |
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | static void atc_set_ops(struct ct_atc *atc) | 1511 | static struct ct_atc atc_preset __devinitdata = { |
1512 | { | 1512 | .map_audio_buffer = ct_map_audio_buffer, |
1513 | /* Set operations */ | 1513 | .unmap_audio_buffer = ct_unmap_audio_buffer, |
1514 | atc->map_audio_buffer = ct_map_audio_buffer; | 1514 | .pcm_playback_prepare = atc_pcm_playback_prepare, |
1515 | atc->unmap_audio_buffer = ct_unmap_audio_buffer; | 1515 | .pcm_release_resources = atc_pcm_release_resources, |
1516 | atc->pcm_playback_prepare = atc_pcm_playback_prepare; | 1516 | .pcm_playback_start = atc_pcm_playback_start, |
1517 | atc->pcm_release_resources = atc_pcm_release_resources; | 1517 | .pcm_playback_stop = atc_pcm_stop, |
1518 | atc->pcm_playback_start = atc_pcm_playback_start; | 1518 | .pcm_playback_position = atc_pcm_playback_position, |
1519 | atc->pcm_playback_stop = atc_pcm_stop; | 1519 | .pcm_capture_prepare = atc_pcm_capture_prepare, |
1520 | atc->pcm_playback_position = atc_pcm_playback_position; | 1520 | .pcm_capture_start = atc_pcm_capture_start, |
1521 | atc->pcm_capture_prepare = atc_pcm_capture_prepare; | 1521 | .pcm_capture_stop = atc_pcm_stop, |
1522 | atc->pcm_capture_start = atc_pcm_capture_start; | 1522 | .pcm_capture_position = atc_pcm_capture_position, |
1523 | atc->pcm_capture_stop = atc_pcm_stop; | 1523 | .spdif_passthru_playback_prepare = spdif_passthru_playback_prepare, |
1524 | atc->pcm_capture_position = atc_pcm_capture_position; | 1524 | .get_ptp_phys = atc_get_ptp_phys, |
1525 | atc->spdif_passthru_playback_prepare = spdif_passthru_playback_prepare; | 1525 | .select_line_in = atc_select_line_in, |
1526 | atc->get_ptp_phys = atc_get_ptp_phys; | 1526 | .select_mic_in = atc_select_mic_in, |
1527 | atc->select_line_in = atc_select_line_in; | 1527 | .select_digit_io = atc_select_digit_io, |
1528 | atc->select_mic_in = atc_select_mic_in; | 1528 | .line_front_unmute = atc_line_front_unmute, |
1529 | atc->select_digit_io = atc_select_digit_io; | 1529 | .line_surround_unmute = atc_line_surround_unmute, |
1530 | atc->line_front_unmute = atc_line_front_unmute; | 1530 | .line_clfe_unmute = atc_line_clfe_unmute, |
1531 | atc->line_surround_unmute = atc_line_surround_unmute; | 1531 | .line_rear_unmute = atc_line_rear_unmute, |
1532 | atc->line_clfe_unmute = atc_line_clfe_unmute; | 1532 | .line_in_unmute = atc_line_in_unmute, |
1533 | atc->line_rear_unmute = atc_line_rear_unmute; | 1533 | .spdif_out_unmute = atc_spdif_out_unmute, |
1534 | atc->line_in_unmute = atc_line_in_unmute; | 1534 | .spdif_in_unmute = atc_spdif_in_unmute, |
1535 | atc->spdif_out_unmute = atc_spdif_out_unmute; | 1535 | .spdif_out_get_status = atc_spdif_out_get_status, |
1536 | atc->spdif_in_unmute = atc_spdif_in_unmute; | 1536 | .spdif_out_set_status = atc_spdif_out_set_status, |
1537 | atc->spdif_out_get_status = atc_spdif_out_get_status; | 1537 | .spdif_out_passthru = atc_spdif_out_passthru, |
1538 | atc->spdif_out_set_status = atc_spdif_out_set_status; | 1538 | .have_digit_io_switch = atc_have_digit_io_switch, |
1539 | atc->spdif_out_passthru = atc_spdif_out_passthru; | 1539 | }; |
1540 | atc->have_digit_io_switch = atc_have_digit_io_switch; | ||
1541 | } | ||
1542 | 1540 | ||
1543 | /** | 1541 | /** |
1544 | * ct_atc_create - create and initialize a hardware manager | 1542 | * ct_atc_create - create and initialize a hardware manager |
@@ -1552,7 +1550,7 @@ static void atc_set_ops(struct ct_atc *atc) | |||
1552 | * Returns 0 if suceeds, or negative error code if fails. | 1550 | * Returns 0 if suceeds, or negative error code if fails. |
1553 | */ | 1551 | */ |
1554 | 1552 | ||
1555 | int ct_atc_create(struct snd_card *card, struct pci_dev *pci, | 1553 | int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, |
1556 | unsigned int rsr, unsigned int msr, struct ct_atc **ratc) | 1554 | unsigned int rsr, unsigned int msr, struct ct_atc **ratc) |
1557 | { | 1555 | { |
1558 | struct ct_atc *atc = NULL; | 1556 | struct ct_atc *atc = NULL; |
@@ -1567,14 +1565,14 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci, | |||
1567 | if (NULL == atc) | 1565 | if (NULL == atc) |
1568 | return -ENOMEM; | 1566 | return -ENOMEM; |
1569 | 1567 | ||
1568 | /* Set operations */ | ||
1569 | *atc = atc_preset; | ||
1570 | |||
1570 | atc->card = card; | 1571 | atc->card = card; |
1571 | atc->pci = pci; | 1572 | atc->pci = pci; |
1572 | atc->rsr = rsr; | 1573 | atc->rsr = rsr; |
1573 | atc->msr = msr; | 1574 | atc->msr = msr; |
1574 | 1575 | ||
1575 | /* Set operations */ | ||
1576 | atc_set_ops(atc); | ||
1577 | |||
1578 | spin_lock_init(&atc->atc_lock); | 1576 | spin_lock_init(&atc->atc_lock); |
1579 | 1577 | ||
1580 | /* Find card model */ | 1578 | /* Find card model */ |
@@ -1606,8 +1604,6 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci, | |||
1606 | if (!atc->timer) | 1604 | if (!atc->timer) |
1607 | goto error1; | 1605 | goto error1; |
1608 | 1606 | ||
1609 | atc->create_alsa_devs = ct_create_alsa_devs; | ||
1610 | |||
1611 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, atc, &ops); | 1607 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, atc, &ops); |
1612 | if (err < 0) | 1608 | if (err < 0) |
1613 | goto error1; | 1609 | goto error1; |