diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-02-09 23:26:15 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-02-10 12:49:36 -0500 |
commit | 827492acb0bc1262e2d93f3b3b0e33b00a7365ad (patch) | |
tree | 2155fc51cc2b275b32a937d4fcfde38e2ea0dfae /sound/pci | |
parent | ba3a909962650d81e9c3731d87b8653652869685 (diff) |
ALSA: asihpi - Use consistent err return variable, change some bad variable names.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/asihpi/hpifunc.c | 143 |
1 files changed, 75 insertions, 68 deletions
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c index 3aa1f09a4954..c38fc9487560 100644 --- a/sound/pci/asihpi/hpifunc.c +++ b/sound/pci/asihpi/hpifunc.c | |||
@@ -310,7 +310,7 @@ u16 hpi_adapter_enumerate_property(u16 adapter_index, u16 index, | |||
310 | u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, | 310 | u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, |
311 | u32 sample_rate, u32 bit_rate, u32 attributes) | 311 | u32 sample_rate, u32 bit_rate, u32 attributes) |
312 | { | 312 | { |
313 | u16 error = 0; | 313 | u16 err = 0; |
314 | struct hpi_msg_format fmt; | 314 | struct hpi_msg_format fmt; |
315 | 315 | ||
316 | switch (channels) { | 316 | switch (channels) { |
@@ -322,8 +322,8 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, | |||
322 | case 16: | 322 | case 16: |
323 | break; | 323 | break; |
324 | default: | 324 | default: |
325 | error = HPI_ERROR_INVALID_CHANNELS; | 325 | err = HPI_ERROR_INVALID_CHANNELS; |
326 | return error; | 326 | return err; |
327 | } | 327 | } |
328 | fmt.channels = channels; | 328 | fmt.channels = channels; |
329 | 329 | ||
@@ -346,17 +346,17 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, | |||
346 | case HPI_FORMAT_OEM2: | 346 | case HPI_FORMAT_OEM2: |
347 | break; | 347 | break; |
348 | default: | 348 | default: |
349 | error = HPI_ERROR_INVALID_FORMAT; | 349 | err = HPI_ERROR_INVALID_FORMAT; |
350 | return error; | 350 | return err; |
351 | } | 351 | } |
352 | fmt.format = format; | 352 | fmt.format = format; |
353 | 353 | ||
354 | if (sample_rate < 8000L) { | 354 | if (sample_rate < 8000L) { |
355 | error = HPI_ERROR_INCOMPATIBLE_SAMPLERATE; | 355 | err = HPI_ERROR_INCOMPATIBLE_SAMPLERATE; |
356 | sample_rate = 8000L; | 356 | sample_rate = 8000L; |
357 | } | 357 | } |
358 | if (sample_rate > 200000L) { | 358 | if (sample_rate > 200000L) { |
359 | error = HPI_ERROR_INCOMPATIBLE_SAMPLERATE; | 359 | err = HPI_ERROR_INCOMPATIBLE_SAMPLERATE; |
360 | sample_rate = 200000L; | 360 | sample_rate = 200000L; |
361 | } | 361 | } |
362 | fmt.sample_rate = sample_rate; | 362 | fmt.sample_rate = sample_rate; |
@@ -387,10 +387,10 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, | |||
387 | if ((channels == 1) | 387 | if ((channels == 1) |
388 | && (attributes != HPI_MPEG_MODE_DEFAULT)) { | 388 | && (attributes != HPI_MPEG_MODE_DEFAULT)) { |
389 | attributes = HPI_MPEG_MODE_DEFAULT; | 389 | attributes = HPI_MPEG_MODE_DEFAULT; |
390 | error = HPI_ERROR_INVALID_FORMAT; | 390 | err = HPI_ERROR_INVALID_FORMAT; |
391 | } else if (attributes > HPI_MPEG_MODE_DUALCHANNEL) { | 391 | } else if (attributes > HPI_MPEG_MODE_DUALCHANNEL) { |
392 | attributes = HPI_MPEG_MODE_DEFAULT; | 392 | attributes = HPI_MPEG_MODE_DEFAULT; |
393 | error = HPI_ERROR_INVALID_FORMAT; | 393 | err = HPI_ERROR_INVALID_FORMAT; |
394 | } | 394 | } |
395 | fmt.attributes = attributes; | 395 | fmt.attributes = attributes; |
396 | break; | 396 | break; |
@@ -399,7 +399,7 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format, | |||
399 | } | 399 | } |
400 | 400 | ||
401 | hpi_msg_to_format(p_format, &fmt); | 401 | hpi_msg_to_format(p_format, &fmt); |
402 | return error; | 402 | return err; |
403 | } | 403 | } |
404 | 404 | ||
405 | u16 hpi_stream_estimate_buffer_size(struct hpi_format *p_format, | 405 | u16 hpi_stream_estimate_buffer_size(struct hpi_format *p_format, |
@@ -1567,13 +1567,13 @@ u16 hpi_aesebu_receiver_get_channel_status(u32 h_control, u16 index, | |||
1567 | u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data) | 1567 | u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data) |
1568 | { | 1568 | { |
1569 | u32 error_data = 0; | 1569 | u32 error_data = 0; |
1570 | u16 error = 0; | 1570 | u16 err = 0; |
1571 | 1571 | ||
1572 | error = hpi_control_param1_get(h_control, HPI_AESEBURX_ERRORSTATUS, | 1572 | err = hpi_control_param1_get(h_control, HPI_AESEBURX_ERRORSTATUS, |
1573 | &error_data); | 1573 | &error_data); |
1574 | if (pw_error_data) | 1574 | if (pw_error_data) |
1575 | *pw_error_data = (u16)error_data; | 1575 | *pw_error_data = (u16)error_data; |
1576 | return error; | 1576 | return err; |
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate) | 1579 | u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate) |
@@ -1680,11 +1680,11 @@ u16 hpi_channel_mode_set(u32 h_control, u16 mode) | |||
1680 | u16 hpi_channel_mode_get(u32 h_control, u16 *mode) | 1680 | u16 hpi_channel_mode_get(u32 h_control, u16 *mode) |
1681 | { | 1681 | { |
1682 | u32 mode32 = 0; | 1682 | u32 mode32 = 0; |
1683 | u16 error = hpi_control_param1_get(h_control, | 1683 | u16 err = hpi_control_param1_get(h_control, |
1684 | HPI_CHANNEL_MODE_MODE, &mode32); | 1684 | HPI_CHANNEL_MODE_MODE, &mode32); |
1685 | if (mode) | 1685 | if (mode) |
1686 | *mode = (u16)mode32; | 1686 | *mode = (u16)mode32; |
1687 | return error; | 1687 | return err; |
1688 | } | 1688 | } |
1689 | 1689 | ||
1690 | u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, | 1690 | u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, |
@@ -1785,9 +1785,9 @@ u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address) | |||
1785 | { | 1785 | { |
1786 | u32 byte_count; | 1786 | u32 byte_count; |
1787 | u32 iP; | 1787 | u32 iP; |
1788 | u16 error; | 1788 | u16 err; |
1789 | 1789 | ||
1790 | error = hpi_cobranet_hmi_read(h_control, | 1790 | err = hpi_cobranet_hmi_read(h_control, |
1791 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count, | 1791 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count, |
1792 | (u8 *)&iP); | 1792 | (u8 *)&iP); |
1793 | 1793 | ||
@@ -1795,26 +1795,26 @@ u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address) | |||
1795 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & | 1795 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & |
1796 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); | 1796 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); |
1797 | 1797 | ||
1798 | if (error) | 1798 | if (err) |
1799 | *pdw_ip_address = 0; | 1799 | *pdw_ip_address = 0; |
1800 | 1800 | ||
1801 | return error; | 1801 | return err; |
1802 | 1802 | ||
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address) | 1805 | u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address) |
1806 | { | 1806 | { |
1807 | u32 iP; | 1807 | u32 iP; |
1808 | u16 error; | 1808 | u16 err; |
1809 | 1809 | ||
1810 | iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address & | 1810 | iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address & |
1811 | 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >> | 1811 | 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >> |
1812 | 8) | ((dw_ip_address & 0x000000ff) << 8); | 1812 | 8) | ((dw_ip_address & 0x000000ff) << 8); |
1813 | 1813 | ||
1814 | error = hpi_cobranet_hmi_write(h_control, | 1814 | err = hpi_cobranet_hmi_write(h_control, |
1815 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP); | 1815 | HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP); |
1816 | 1816 | ||
1817 | return error; | 1817 | return err; |
1818 | 1818 | ||
1819 | } | 1819 | } |
1820 | 1820 | ||
@@ -1822,8 +1822,8 @@ u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address) | |||
1822 | { | 1822 | { |
1823 | u32 byte_count; | 1823 | u32 byte_count; |
1824 | u32 iP; | 1824 | u32 iP; |
1825 | u16 error; | 1825 | u16 err; |
1826 | error = hpi_cobranet_hmi_read(h_control, | 1826 | err = hpi_cobranet_hmi_read(h_control, |
1827 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count, | 1827 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count, |
1828 | (u8 *)&iP); | 1828 | (u8 *)&iP); |
1829 | 1829 | ||
@@ -1831,55 +1831,62 @@ u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address) | |||
1831 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & | 1831 | ((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP & |
1832 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); | 1832 | 0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8); |
1833 | 1833 | ||
1834 | if (error) | 1834 | if (err) |
1835 | *pdw_ip_address = 0; | 1835 | *pdw_ip_address = 0; |
1836 | 1836 | ||
1837 | return error; | 1837 | return err; |
1838 | 1838 | ||
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address) | 1841 | u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address) |
1842 | { | 1842 | { |
1843 | u32 iP; | 1843 | u32 iP; |
1844 | u16 error; | 1844 | u16 err; |
1845 | 1845 | ||
1846 | iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address & | 1846 | iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address & |
1847 | 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >> | 1847 | 0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >> |
1848 | 8) | ((dw_ip_address & 0x000000ff) << 8); | 1848 | 8) | ((dw_ip_address & 0x000000ff) << 8); |
1849 | 1849 | ||
1850 | error = hpi_cobranet_hmi_write(h_control, | 1850 | err = hpi_cobranet_hmi_write(h_control, |
1851 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP); | 1851 | HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP); |
1852 | 1852 | ||
1853 | return error; | 1853 | return err; |
1854 | 1854 | ||
1855 | } | 1855 | } |
1856 | 1856 | ||
1857 | u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *pmAC_MS_bs, | 1857 | u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *p_mac_msbs, |
1858 | u32 *pmAC_LS_bs) | 1858 | u32 *p_mac_lsbs) |
1859 | { | 1859 | { |
1860 | u32 byte_count; | 1860 | u32 byte_count; |
1861 | u16 error; | 1861 | u16 err; |
1862 | u32 mAC; | 1862 | u32 mac; |
1863 | 1863 | ||
1864 | error = hpi_cobranet_hmi_read(h_control, | 1864 | err = hpi_cobranet_hmi_read(h_control, |
1865 | HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count, | 1865 | HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count, |
1866 | (u8 *)&mAC); | 1866 | (u8 *)&mac); |
1867 | *pmAC_MS_bs = | 1867 | |
1868 | ((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC | 1868 | if (!err) { |
1869 | & 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8); | 1869 | *p_mac_msbs = |
1870 | error += hpi_cobranet_hmi_read(h_control, | 1870 | ((mac & 0xff000000) >> 8) | ((mac & 0x00ff0000) << 8) |
1871 | HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4, &byte_count, | 1871 | | ((mac & 0x0000ff00) >> 8) | ((mac & 0x000000ff) << |
1872 | (u8 *)&mAC); | 1872 | 8); |
1873 | *pmAC_LS_bs = | 1873 | |
1874 | ((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC | 1874 | err = hpi_cobranet_hmi_read(h_control, |
1875 | & 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8); | 1875 | HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4, |
1876 | 1876 | &byte_count, (u8 *)&mac); | |
1877 | if (error) { | ||
1878 | *pmAC_MS_bs = 0; | ||
1879 | *pmAC_LS_bs = 0; | ||
1880 | } | 1877 | } |
1881 | 1878 | ||
1882 | return error; | 1879 | if (!err) { |
1880 | *p_mac_lsbs = | ||
1881 | ((mac & 0xff000000) >> 8) | ((mac & 0x00ff0000) << 8) | ||
1882 | | ((mac & 0x0000ff00) >> 8) | ((mac & 0x000000ff) << | ||
1883 | 8); | ||
1884 | } else { | ||
1885 | *p_mac_msbs = 0; | ||
1886 | *p_mac_lsbs = 0; | ||
1887 | } | ||
1888 | |||
1889 | return err; | ||
1883 | } | 1890 | } |
1884 | 1891 | ||
1885 | u16 hpi_compander_set_enable(u32 h_control, u32 enable) | 1892 | u16 hpi_compander_set_enable(u32 h_control, u32 enable) |
@@ -2158,14 +2165,14 @@ u16 hpi_multiplexer_get_source(u32 h_control, u16 *source_node_type, | |||
2158 | u16 *source_node_index) | 2165 | u16 *source_node_index) |
2159 | { | 2166 | { |
2160 | u32 node, index; | 2167 | u32 node, index; |
2161 | u16 error = hpi_control_param2_get(h_control, | 2168 | u16 err = hpi_control_param2_get(h_control, |
2162 | HPI_MULTIPLEXER_SOURCE, &node, | 2169 | HPI_MULTIPLEXER_SOURCE, &node, |
2163 | &index); | 2170 | &index); |
2164 | if (source_node_type) | 2171 | if (source_node_type) |
2165 | *source_node_type = (u16)node; | 2172 | *source_node_type = (u16)node; |
2166 | if (source_node_index) | 2173 | if (source_node_index) |
2167 | *source_node_index = (u16)index; | 2174 | *source_node_index = (u16)index; |
2168 | return error; | 2175 | return err; |
2169 | } | 2176 | } |
2170 | 2177 | ||
2171 | u16 hpi_multiplexer_query_source(u32 h_control, u16 index, | 2178 | u16 hpi_multiplexer_query_source(u32 h_control, u16 index, |
@@ -2304,14 +2311,14 @@ u16 hpi_sample_clock_set_source(u32 h_control, u16 source) | |||
2304 | 2311 | ||
2305 | u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source) | 2312 | u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source) |
2306 | { | 2313 | { |
2307 | u16 error = 0; | 2314 | u16 err = 0; |
2308 | u32 source = 0; | 2315 | u32 source = 0; |
2309 | error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE, | 2316 | err = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE, |
2310 | &source); | 2317 | &source); |
2311 | if (!error) | 2318 | if (!err) |
2312 | if (pw_source) | 2319 | if (pw_source) |
2313 | *pw_source = (u16)source; | 2320 | *pw_source = (u16)source; |
2314 | return error; | 2321 | return err; |
2315 | } | 2322 | } |
2316 | 2323 | ||
2317 | u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index, | 2324 | u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index, |
@@ -2334,14 +2341,14 @@ u16 hpi_sample_clock_set_source_index(u32 h_control, u16 source_index) | |||
2334 | 2341 | ||
2335 | u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index) | 2342 | u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index) |
2336 | { | 2343 | { |
2337 | u16 error = 0; | 2344 | u16 err = 0; |
2338 | u32 source_index = 0; | 2345 | u32 source_index = 0; |
2339 | error = hpi_control_param1_get(h_control, | 2346 | err = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE_INDEX, |
2340 | HPI_SAMPLECLOCK_SOURCE_INDEX, &source_index); | 2347 | &source_index); |
2341 | if (!error) | 2348 | if (!err) |
2342 | if (pw_source_index) | 2349 | if (pw_source_index) |
2343 | *pw_source_index = (u16)source_index; | 2350 | *pw_source_index = (u16)source_index; |
2344 | return error; | 2351 | return err; |
2345 | } | 2352 | } |
2346 | 2353 | ||
2347 | u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index, | 2354 | u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index, |
@@ -2362,26 +2369,26 @@ u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate) | |||
2362 | 2369 | ||
2363 | u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate) | 2370 | u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate) |
2364 | { | 2371 | { |
2365 | u16 error = 0; | 2372 | u16 err = 0; |
2366 | u32 sample_rate = 0; | 2373 | u32 sample_rate = 0; |
2367 | error = hpi_control_param1_get(h_control, | 2374 | err = hpi_control_param1_get(h_control, |
2368 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate); | 2375 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate); |
2369 | if (!error) | 2376 | if (!err) |
2370 | if (psample_rate) | 2377 | if (psample_rate) |
2371 | *psample_rate = sample_rate; | 2378 | *psample_rate = sample_rate; |
2372 | return error; | 2379 | return err; |
2373 | } | 2380 | } |
2374 | 2381 | ||
2375 | u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate) | 2382 | u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate) |
2376 | { | 2383 | { |
2377 | u16 error = 0; | 2384 | u16 err = 0; |
2378 | u32 sample_rate = 0; | 2385 | u32 sample_rate = 0; |
2379 | error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SAMPLERATE, | 2386 | err = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SAMPLERATE, |
2380 | &sample_rate); | 2387 | &sample_rate); |
2381 | if (!error) | 2388 | if (!err) |
2382 | if (psample_rate) | 2389 | if (psample_rate) |
2383 | *psample_rate = sample_rate; | 2390 | *psample_rate = sample_rate; |
2384 | return error; | 2391 | return err; |
2385 | } | 2392 | } |
2386 | 2393 | ||
2387 | u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable) | 2394 | u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable) |