diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-12-21 19:38:43 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-12-22 02:13:05 -0500 |
commit | 7036b92d303a01477e27a5a9b2d582a5df3cc8ef (patch) | |
tree | 88844df385154f1eb3657137a6b531ca0b3a29ad /sound/pci/asihpi/hpi6000.c | |
parent | 3dad06ac89f4b63fcce5020abbe1b3e5754e26dd (diff) |
ALSA: asihpi - Remove redundant struct members.
Structs hpi_adapter and snd_card_asihpi had members that
duplicate those in underlying hpi_adapter_obj or whose info
can be retrieved using hpi_adapter_get_info().
Print less info in probe function, it can be retrieved from /proc.
Avoid name redundancy: hpi_adapter_obj.adapter_type renamed to .type
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/asihpi/hpi6000.c')
-rw-r--r-- | sound/pci/asihpi/hpi6000.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index 278bec82b6d5..2414d7a2239d 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c | |||
@@ -231,6 +231,8 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr) | |||
231 | static void control_message(struct hpi_adapter_obj *pao, | 231 | static void control_message(struct hpi_adapter_obj *pao, |
232 | struct hpi_message *phm, struct hpi_response *phr) | 232 | struct hpi_message *phm, struct hpi_response *phr) |
233 | { | 233 | { |
234 | struct hpi_hw_obj *phw = pao->priv; | ||
235 | |||
234 | switch (phm->function) { | 236 | switch (phm->function) { |
235 | case HPI_CONTROL_GET_STATE: | 237 | case HPI_CONTROL_GET_STATE: |
236 | if (pao->has_control_cache) { | 238 | if (pao->has_control_cache) { |
@@ -248,17 +250,14 @@ static void control_message(struct hpi_adapter_obj *pao, | |||
248 | break; | 250 | break; |
249 | } | 251 | } |
250 | 252 | ||
251 | if (hpi_check_control_cache(((struct hpi_hw_obj *) | 253 | if (hpi_check_control_cache(phw->p_cache, phm, phr)) |
252 | pao->priv)->p_cache, phm, | ||
253 | phr)) | ||
254 | break; | 254 | break; |
255 | } | 255 | } |
256 | hw_message(pao, phm, phr); | 256 | hw_message(pao, phm, phr); |
257 | break; | 257 | break; |
258 | case HPI_CONTROL_SET_STATE: | 258 | case HPI_CONTROL_SET_STATE: |
259 | hw_message(pao, phm, phr); | 259 | hw_message(pao, phm, phr); |
260 | hpi_cmn_control_cache_sync_to_msg(((struct hpi_hw_obj *)pao-> | 260 | hpi_cmn_control_cache_sync_to_msg(phw->p_cache, phm, phr); |
261 | priv)->p_cache, phm, phr); | ||
262 | break; | 261 | break; |
263 | 262 | ||
264 | case HPI_CONTROL_GET_INFO: | 263 | case HPI_CONTROL_GET_INFO: |
@@ -451,11 +450,11 @@ static void subsys_create_adapter(struct hpi_message *phm, | |||
451 | } | 450 | } |
452 | 451 | ||
453 | for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) { | 452 | for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) { |
454 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 453 | struct hpi_hw_obj *phw = pao->priv; |
455 | phw->ado[dsp_index].pa_parent_adapter = pao; | 454 | phw->ado[dsp_index].pa_parent_adapter = pao; |
456 | } | 455 | } |
457 | 456 | ||
458 | phr->u.s.adapter_type = ao.adapter_type; | 457 | phr->u.s.adapter_type = ao.type; |
459 | phr->u.s.adapter_index = ao.index; | 458 | phr->u.s.adapter_index = ao.index; |
460 | phr->error = 0; | 459 | phr->error = 0; |
461 | } | 460 | } |
@@ -476,7 +475,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, | |||
476 | u32 dsp_index = 0; | 475 | u32 dsp_index = 0; |
477 | u32 control_cache_size = 0; | 476 | u32 control_cache_size = 0; |
478 | u32 control_cache_count = 0; | 477 | u32 control_cache_count = 0; |
479 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 478 | struct hpi_hw_obj *phw = pao->priv; |
480 | 479 | ||
481 | /* The PCI2040 has the following address map */ | 480 | /* The PCI2040 has the following address map */ |
482 | /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ | 481 | /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ |
@@ -559,7 +558,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, | |||
559 | if (error) | 558 | if (error) |
560 | return error; | 559 | return error; |
561 | } | 560 | } |
562 | pao->adapter_type = hr0.u.ax.info.adapter_type; | 561 | pao->type = hr0.u.ax.info.adapter_type; |
563 | pao->index = hr0.u.ax.info.adapter_index; | 562 | pao->index = hr0.u.ax.info.adapter_index; |
564 | } | 563 | } |
565 | 564 | ||
@@ -584,9 +583,8 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, | |||
584 | pao->has_control_cache = 1; | 583 | pao->has_control_cache = 1; |
585 | } | 584 | } |
586 | 585 | ||
587 | HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", | 586 | HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", pao->type, |
588 | pao->adapter_type, pao->index); | 587 | pao->index); |
589 | pao->open = 0; /* upon creation the adapter is closed */ | ||
590 | 588 | ||
591 | if (phw->p_cache) | 589 | if (phw->p_cache) |
592 | phw->p_cache->adap_idx = pao->index; | 590 | phw->p_cache->adap_idx = pao->index; |
@@ -596,7 +594,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, | |||
596 | 594 | ||
597 | static void delete_adapter_obj(struct hpi_adapter_obj *pao) | 595 | static void delete_adapter_obj(struct hpi_adapter_obj *pao) |
598 | { | 596 | { |
599 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 597 | struct hpi_hw_obj *phw = pao->priv; |
600 | 598 | ||
601 | if (pao->has_control_cache) | 599 | if (pao->has_control_cache) |
602 | hpi_free_control_cache(phw->p_cache); | 600 | hpi_free_control_cache(phw->p_cache); |
@@ -639,7 +637,7 @@ static void adapter_get_asserts(struct hpi_adapter_obj *pao, | |||
639 | static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, | 637 | static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, |
640 | u32 *pos_error_code) | 638 | u32 *pos_error_code) |
641 | { | 639 | { |
642 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 640 | struct hpi_hw_obj *phw = pao->priv; |
643 | short error; | 641 | short error; |
644 | u32 timeout; | 642 | u32 timeout; |
645 | u32 read = 0; | 643 | u32 read = 0; |
@@ -1220,8 +1218,8 @@ static void hpi_read_block(struct dsp_obj *pdo, u32 address, u32 *pdata, | |||
1220 | static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, | 1218 | static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, |
1221 | u16 dsp_index, u32 hpi_address, u32 *source, u32 count) | 1219 | u16 dsp_index, u32 hpi_address, u32 *source, u32 count) |
1222 | { | 1220 | { |
1223 | struct dsp_obj *pdo = | 1221 | struct hpi_hw_obj *phw = pao->priv; |
1224 | &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; | 1222 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1225 | u32 time_out = PCI_TIMEOUT; | 1223 | u32 time_out = PCI_TIMEOUT; |
1226 | int c6711_burst_size = 128; | 1224 | int c6711_burst_size = 128; |
1227 | u32 local_hpi_address = hpi_address; | 1225 | u32 local_hpi_address = hpi_address; |
@@ -1258,8 +1256,8 @@ static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, | |||
1258 | static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, | 1256 | static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, |
1259 | u16 dsp_index, u32 hpi_address, u32 *dest, u32 count) | 1257 | u16 dsp_index, u32 hpi_address, u32 *dest, u32 count) |
1260 | { | 1258 | { |
1261 | struct dsp_obj *pdo = | 1259 | struct hpi_hw_obj *phw = pao->priv; |
1262 | &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; | 1260 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1263 | u32 time_out = PCI_TIMEOUT; | 1261 | u32 time_out = PCI_TIMEOUT; |
1264 | int c6711_burst_size = 16; | 1262 | int c6711_burst_size = 16; |
1265 | u32 local_hpi_address = hpi_address; | 1263 | u32 local_hpi_address = hpi_address; |
@@ -1298,7 +1296,7 @@ static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, | |||
1298 | static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, | 1296 | static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, |
1299 | u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) | 1297 | u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) |
1300 | { | 1298 | { |
1301 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 1299 | struct hpi_hw_obj *phw = pao->priv; |
1302 | struct dsp_obj *pdo = &phw->ado[dsp_index]; | 1300 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1303 | u32 timeout; | 1301 | u32 timeout; |
1304 | u16 ack; | 1302 | u16 ack; |
@@ -1414,8 +1412,8 @@ static short hpi6000_send_data_check_adr(u32 address, u32 length_in_dwords) | |||
1414 | static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, | 1412 | static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, |
1415 | struct hpi_message *phm, struct hpi_response *phr) | 1413 | struct hpi_message *phm, struct hpi_response *phr) |
1416 | { | 1414 | { |
1417 | struct dsp_obj *pdo = | 1415 | struct hpi_hw_obj *phw = pao->priv; |
1418 | &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; | 1416 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1419 | u32 data_sent = 0; | 1417 | u32 data_sent = 0; |
1420 | u16 ack; | 1418 | u16 ack; |
1421 | u32 length, address; | 1419 | u32 length, address; |
@@ -1487,8 +1485,8 @@ static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, | |||
1487 | static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index, | 1485 | static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index, |
1488 | struct hpi_message *phm, struct hpi_response *phr) | 1486 | struct hpi_message *phm, struct hpi_response *phr) |
1489 | { | 1487 | { |
1490 | struct dsp_obj *pdo = | 1488 | struct hpi_hw_obj *phw = pao->priv; |
1491 | &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; | 1489 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1492 | u32 data_got = 0; | 1490 | u32 data_got = 0; |
1493 | u16 ack; | 1491 | u16 ack; |
1494 | u32 length, address; | 1492 | u32 length, address; |
@@ -1551,8 +1549,8 @@ static void hpi6000_send_dsp_interrupt(struct dsp_obj *pdo) | |||
1551 | static short hpi6000_send_host_command(struct hpi_adapter_obj *pao, | 1549 | static short hpi6000_send_host_command(struct hpi_adapter_obj *pao, |
1552 | u16 dsp_index, u32 host_cmd) | 1550 | u16 dsp_index, u32 host_cmd) |
1553 | { | 1551 | { |
1554 | struct dsp_obj *pdo = | 1552 | struct hpi_hw_obj *phw = pao->priv; |
1555 | &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; | 1553 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1556 | u32 timeout = TIMEOUT; | 1554 | u32 timeout = TIMEOUT; |
1557 | 1555 | ||
1558 | /* set command */ | 1556 | /* set command */ |
@@ -1577,7 +1575,7 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao, | |||
1577 | { | 1575 | { |
1578 | u32 hPI_error; | 1576 | u32 hPI_error; |
1579 | 1577 | ||
1580 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 1578 | struct hpi_hw_obj *phw = pao->priv; |
1581 | 1579 | ||
1582 | /* read the error bits from the PCI2040 */ | 1580 | /* read the error bits from the PCI2040 */ |
1583 | hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); | 1581 | hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); |
@@ -1597,8 +1595,8 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao, | |||
1597 | static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index, | 1595 | static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index, |
1598 | u32 ack_value) | 1596 | u32 ack_value) |
1599 | { | 1597 | { |
1600 | struct dsp_obj *pdo = | 1598 | struct hpi_hw_obj *phw = pao->priv; |
1601 | &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; | 1599 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1602 | u32 ack = 0L; | 1600 | u32 ack = 0L; |
1603 | u32 timeout; | 1601 | u32 timeout; |
1604 | u32 hPIC = 0L; | 1602 | u32 hPIC = 0L; |
@@ -1640,7 +1638,7 @@ static short hpi6000_update_control_cache(struct hpi_adapter_obj *pao, | |||
1640 | struct hpi_message *phm) | 1638 | struct hpi_message *phm) |
1641 | { | 1639 | { |
1642 | const u16 dsp_index = 0; | 1640 | const u16 dsp_index = 0; |
1643 | struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; | 1641 | struct hpi_hw_obj *phw = pao->priv; |
1644 | struct dsp_obj *pdo = &phw->ado[dsp_index]; | 1642 | struct dsp_obj *pdo = &phw->ado[dsp_index]; |
1645 | u32 timeout; | 1643 | u32 timeout; |
1646 | u32 cache_dirty_flag; | 1644 | u32 cache_dirty_flag; |
@@ -1740,7 +1738,8 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, | |||
1740 | { | 1738 | { |
1741 | u16 error = 0; | 1739 | u16 error = 0; |
1742 | u16 dsp_index = 0; | 1740 | u16 dsp_index = 0; |
1743 | u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; | 1741 | struct hpi_hw_obj *phw = pao->priv; |
1742 | u16 num_dsp = phw->num_dsp; | ||
1744 | 1743 | ||
1745 | if (num_dsp < 2) | 1744 | if (num_dsp < 2) |
1746 | dsp_index = 0; | 1745 | dsp_index = 0; |