diff options
author | Timur Tabi <timur@freescale.com> | 2007-05-08 15:46:36 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-05-10 00:01:43 -0400 |
commit | 4c35630ccda56ed494f6102d2e147fefe14b78d2 (patch) | |
tree | 4f04754fb0ec6978923b3c1e0318997e420f6551 /drivers/net/ucc_geth.c | |
parent | 742226c579c573c24386aaf41969a01ee058b97e (diff) |
[POWERPC] Change rheap functions to use ulongs instead of pointers
The rheap allocation functions return a pointer, but the actual value is based
on how the heap was initialized, and so it can be anything, e.g. an offset
into a buffer. A ulong is a better representation of the value returned by
the allocation functions.
This patch changes all of the relevant rheap functions to use a unsigned long
integers instead of a pointer. In case of an error, the value returned is
a negative error code that has been cast to an unsigned long. The caller can
use the IS_ERR_VALUE() macro to check for this.
All code which calls the rheap functions is updated accordingly. Macros
IS_MURAM_ERR() and IS_DPERR(), have been deleted in favor of IS_ERR_VALUE().
Also added error checking to rh_attach_region().
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r-- | drivers/net/ucc_geth.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index d7aff8189377..0f667652fda9 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -293,7 +293,7 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
293 | else { | 293 | else { |
294 | init_enet_offset = | 294 | init_enet_offset = |
295 | qe_muram_alloc(thread_size, thread_alignment); | 295 | qe_muram_alloc(thread_size, thread_alignment); |
296 | if (IS_MURAM_ERR(init_enet_offset)) { | 296 | if (IS_ERR_VALUE(init_enet_offset)) { |
297 | ugeth_err | 297 | ugeth_err |
298 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); | 298 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); |
299 | qe_put_snum((u8) snum); | 299 | qe_put_snum((u8) snum); |
@@ -2594,7 +2594,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2594 | ugeth->tx_bd_ring_offset[j] = | 2594 | ugeth->tx_bd_ring_offset[j] = |
2595 | qe_muram_alloc(length, | 2595 | qe_muram_alloc(length, |
2596 | UCC_GETH_TX_BD_RING_ALIGNMENT); | 2596 | UCC_GETH_TX_BD_RING_ALIGNMENT); |
2597 | if (!IS_MURAM_ERR(ugeth->tx_bd_ring_offset[j])) | 2597 | if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j])) |
2598 | ugeth->p_tx_bd_ring[j] = | 2598 | ugeth->p_tx_bd_ring[j] = |
2599 | (u8 *) qe_muram_addr(ugeth-> | 2599 | (u8 *) qe_muram_addr(ugeth-> |
2600 | tx_bd_ring_offset[j]); | 2600 | tx_bd_ring_offset[j]); |
@@ -2629,7 +2629,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2629 | ugeth->rx_bd_ring_offset[j] = | 2629 | ugeth->rx_bd_ring_offset[j] = |
2630 | qe_muram_alloc(length, | 2630 | qe_muram_alloc(length, |
2631 | UCC_GETH_RX_BD_RING_ALIGNMENT); | 2631 | UCC_GETH_RX_BD_RING_ALIGNMENT); |
2632 | if (!IS_MURAM_ERR(ugeth->rx_bd_ring_offset[j])) | 2632 | if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j])) |
2633 | ugeth->p_rx_bd_ring[j] = | 2633 | ugeth->p_rx_bd_ring[j] = |
2634 | (u8 *) qe_muram_addr(ugeth-> | 2634 | (u8 *) qe_muram_addr(ugeth-> |
2635 | rx_bd_ring_offset[j]); | 2635 | rx_bd_ring_offset[j]); |
@@ -2713,7 +2713,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2713 | ugeth->tx_glbl_pram_offset = | 2713 | ugeth->tx_glbl_pram_offset = |
2714 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), | 2714 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), |
2715 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); | 2715 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); |
2716 | if (IS_MURAM_ERR(ugeth->tx_glbl_pram_offset)) { | 2716 | if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { |
2717 | ugeth_err | 2717 | ugeth_err |
2718 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", | 2718 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", |
2719 | __FUNCTION__); | 2719 | __FUNCTION__); |
@@ -2735,7 +2735,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2735 | sizeof(struct ucc_geth_thread_data_tx) + | 2735 | sizeof(struct ucc_geth_thread_data_tx) + |
2736 | 32 * (numThreadsTxNumerical == 1), | 2736 | 32 * (numThreadsTxNumerical == 1), |
2737 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2737 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2738 | if (IS_MURAM_ERR(ugeth->thread_dat_tx_offset)) { | 2738 | if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { |
2739 | ugeth_err | 2739 | ugeth_err |
2740 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", | 2740 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", |
2741 | __FUNCTION__); | 2741 | __FUNCTION__); |
@@ -2763,7 +2763,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2763 | qe_muram_alloc(ug_info->numQueuesTx * | 2763 | qe_muram_alloc(ug_info->numQueuesTx * |
2764 | sizeof(struct ucc_geth_send_queue_qd), | 2764 | sizeof(struct ucc_geth_send_queue_qd), |
2765 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); | 2765 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); |
2766 | if (IS_MURAM_ERR(ugeth->send_q_mem_reg_offset)) { | 2766 | if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { |
2767 | ugeth_err | 2767 | ugeth_err |
2768 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", | 2768 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", |
2769 | __FUNCTION__); | 2769 | __FUNCTION__); |
@@ -2806,7 +2806,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2806 | ugeth->scheduler_offset = | 2806 | ugeth->scheduler_offset = |
2807 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), | 2807 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), |
2808 | UCC_GETH_SCHEDULER_ALIGNMENT); | 2808 | UCC_GETH_SCHEDULER_ALIGNMENT); |
2809 | if (IS_MURAM_ERR(ugeth->scheduler_offset)) { | 2809 | if (IS_ERR_VALUE(ugeth->scheduler_offset)) { |
2810 | ugeth_err | 2810 | ugeth_err |
2811 | ("%s: Can not allocate DPRAM memory for p_scheduler.", | 2811 | ("%s: Can not allocate DPRAM memory for p_scheduler.", |
2812 | __FUNCTION__); | 2812 | __FUNCTION__); |
@@ -2854,7 +2854,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2854 | qe_muram_alloc(sizeof | 2854 | qe_muram_alloc(sizeof |
2855 | (struct ucc_geth_tx_firmware_statistics_pram), | 2855 | (struct ucc_geth_tx_firmware_statistics_pram), |
2856 | UCC_GETH_TX_STATISTICS_ALIGNMENT); | 2856 | UCC_GETH_TX_STATISTICS_ALIGNMENT); |
2857 | if (IS_MURAM_ERR(ugeth->tx_fw_statistics_pram_offset)) { | 2857 | if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { |
2858 | ugeth_err | 2858 | ugeth_err |
2859 | ("%s: Can not allocate DPRAM memory for" | 2859 | ("%s: Can not allocate DPRAM memory for" |
2860 | " p_tx_fw_statistics_pram.", __FUNCTION__); | 2860 | " p_tx_fw_statistics_pram.", __FUNCTION__); |
@@ -2893,7 +2893,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2893 | ugeth->rx_glbl_pram_offset = | 2893 | ugeth->rx_glbl_pram_offset = |
2894 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), | 2894 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), |
2895 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); | 2895 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); |
2896 | if (IS_MURAM_ERR(ugeth->rx_glbl_pram_offset)) { | 2896 | if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { |
2897 | ugeth_err | 2897 | ugeth_err |
2898 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", | 2898 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", |
2899 | __FUNCTION__); | 2899 | __FUNCTION__); |
@@ -2914,7 +2914,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2914 | qe_muram_alloc(numThreadsRxNumerical * | 2914 | qe_muram_alloc(numThreadsRxNumerical * |
2915 | sizeof(struct ucc_geth_thread_data_rx), | 2915 | sizeof(struct ucc_geth_thread_data_rx), |
2916 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2916 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2917 | if (IS_MURAM_ERR(ugeth->thread_dat_rx_offset)) { | 2917 | if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { |
2918 | ugeth_err | 2918 | ugeth_err |
2919 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", | 2919 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", |
2920 | __FUNCTION__); | 2920 | __FUNCTION__); |
@@ -2937,7 +2937,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2937 | qe_muram_alloc(sizeof | 2937 | qe_muram_alloc(sizeof |
2938 | (struct ucc_geth_rx_firmware_statistics_pram), | 2938 | (struct ucc_geth_rx_firmware_statistics_pram), |
2939 | UCC_GETH_RX_STATISTICS_ALIGNMENT); | 2939 | UCC_GETH_RX_STATISTICS_ALIGNMENT); |
2940 | if (IS_MURAM_ERR(ugeth->rx_fw_statistics_pram_offset)) { | 2940 | if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { |
2941 | ugeth_err | 2941 | ugeth_err |
2942 | ("%s: Can not allocate DPRAM memory for" | 2942 | ("%s: Can not allocate DPRAM memory for" |
2943 | " p_rx_fw_statistics_pram.", __FUNCTION__); | 2943 | " p_rx_fw_statistics_pram.", __FUNCTION__); |
@@ -2959,7 +2959,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2959 | qe_muram_alloc(ug_info->numQueuesRx * | 2959 | qe_muram_alloc(ug_info->numQueuesRx * |
2960 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) | 2960 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) |
2961 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); | 2961 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); |
2962 | if (IS_MURAM_ERR(ugeth->rx_irq_coalescing_tbl_offset)) { | 2962 | if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { |
2963 | ugeth_err | 2963 | ugeth_err |
2964 | ("%s: Can not allocate DPRAM memory for" | 2964 | ("%s: Can not allocate DPRAM memory for" |
2965 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | 2965 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); |
@@ -3027,7 +3027,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3027 | (sizeof(struct ucc_geth_rx_bd_queues_entry) + | 3027 | (sizeof(struct ucc_geth_rx_bd_queues_entry) + |
3028 | sizeof(struct ucc_geth_rx_prefetched_bds)), | 3028 | sizeof(struct ucc_geth_rx_prefetched_bds)), |
3029 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); | 3029 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); |
3030 | if (IS_MURAM_ERR(ugeth->rx_bd_qs_tbl_offset)) { | 3030 | if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { |
3031 | ugeth_err | 3031 | ugeth_err |
3032 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", | 3032 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", |
3033 | __FUNCTION__); | 3033 | __FUNCTION__); |
@@ -3116,7 +3116,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3116 | ugeth->exf_glbl_param_offset = | 3116 | ugeth->exf_glbl_param_offset = |
3117 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), | 3117 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), |
3118 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); | 3118 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); |
3119 | if (IS_MURAM_ERR(ugeth->exf_glbl_param_offset)) { | 3119 | if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { |
3120 | ugeth_err | 3120 | ugeth_err |
3121 | ("%s: Can not allocate DPRAM memory for" | 3121 | ("%s: Can not allocate DPRAM memory for" |
3122 | " p_exf_glbl_param.", __FUNCTION__); | 3122 | " p_exf_glbl_param.", __FUNCTION__); |
@@ -3258,7 +3258,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3258 | 3258 | ||
3259 | /* Allocate InitEnet command parameter structure */ | 3259 | /* Allocate InitEnet command parameter structure */ |
3260 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); | 3260 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); |
3261 | if (IS_MURAM_ERR(init_enet_pram_offset)) { | 3261 | if (IS_ERR_VALUE(init_enet_pram_offset)) { |
3262 | ugeth_err | 3262 | ugeth_err |
3263 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", | 3263 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", |
3264 | __FUNCTION__); | 3264 | __FUNCTION__); |