mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
staging: octeon: ethernet-mem: replace pr_warn with dev_warn in free functions
Add struct platform_device parameter to cvm_oct_free_hw_skbuff, cvm_oct_free_hw_memory and cvm_oct_mem_empty_fpa. Replace pr_warn calls with dev_warn, using &pdev->dev for device-aware logging. Signed-off-by: Ayush Mukkanwar <ayushmukkanwar@gmail.com> Link: https://patch.msgid.link/20260511150931.93382-2-ayushmukkanwar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6abf0b2df0
commit
be5e8d5f61
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (c) 2003-2010 Cavium Networks
|
||||
*/
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -40,11 +41,13 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
|
|||
|
||||
/**
|
||||
* cvm_oct_free_hw_skbuff- free hardware pool skbuffs
|
||||
* @pdev: Platform device for logging
|
||||
* @pool: Pool to allocate an skbuff for
|
||||
* @size: Size of the buffer needed for the pool
|
||||
* @elements: Number of buffers to allocate
|
||||
*/
|
||||
static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
|
||||
static void cvm_oct_free_hw_skbuff(struct platform_device *pdev,
|
||||
int pool, int size, int elements)
|
||||
{
|
||||
char *memory;
|
||||
|
||||
|
|
@ -59,11 +62,11 @@ static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
|
|||
} while (memory);
|
||||
|
||||
if (elements < 0)
|
||||
pr_warn("Freeing of pool %u had too many skbuffs (%d)\n",
|
||||
pool, elements);
|
||||
dev_warn(&pdev->dev, "Freeing of pool %u had too many skbuffs (%d)\n",
|
||||
pool, elements);
|
||||
else if (elements > 0)
|
||||
pr_warn("Freeing of pool %u is missing %d skbuffs\n",
|
||||
pool, elements);
|
||||
dev_warn(&pdev->dev, "Freeing of pool %u is missing %d skbuffs\n",
|
||||
pool, elements);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -107,11 +110,13 @@ static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
|
|||
|
||||
/**
|
||||
* cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
|
||||
* @pdev: Platform device for logging
|
||||
* @pool: FPA pool to free
|
||||
* @size: Size of each buffer in the pool
|
||||
* @elements: Number of buffers that should be in the pool
|
||||
*/
|
||||
static void cvm_oct_free_hw_memory(int pool, int size, int elements)
|
||||
static void cvm_oct_free_hw_memory(struct platform_device *pdev,
|
||||
int pool, int size, int elements)
|
||||
{
|
||||
char *memory;
|
||||
char *fpa;
|
||||
|
|
@ -127,11 +132,11 @@ static void cvm_oct_free_hw_memory(int pool, int size, int elements)
|
|||
} while (fpa);
|
||||
|
||||
if (elements < 0)
|
||||
pr_warn("Freeing of pool %u had too many buffers (%d)\n",
|
||||
pool, elements);
|
||||
dev_warn(&pdev->dev, "Freeing of pool %u had too many buffers (%d)\n",
|
||||
pool, elements);
|
||||
else if (elements > 0)
|
||||
pr_warn("Warning: Freeing of pool %u is missing %d buffers\n",
|
||||
pool, elements);
|
||||
dev_warn(&pdev->dev, "Freeing of pool %u is missing %d buffers\n",
|
||||
pool, elements);
|
||||
}
|
||||
|
||||
int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
|
||||
|
|
@ -145,10 +150,10 @@ int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
|
|||
return freed;
|
||||
}
|
||||
|
||||
void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
|
||||
void cvm_oct_mem_empty_fpa(struct platform_device *pdev, int pool, int size, int elements)
|
||||
{
|
||||
if (pool == CVMX_FPA_PACKET_POOL)
|
||||
cvm_oct_free_hw_skbuff(pool, size, elements);
|
||||
cvm_oct_free_hw_skbuff(pdev, pool, size, elements);
|
||||
else
|
||||
cvm_oct_free_hw_memory(pool, size, elements);
|
||||
cvm_oct_free_hw_memory(pdev, pool, size, elements);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,4 +6,7 @@
|
|||
*/
|
||||
|
||||
int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
|
||||
void cvm_oct_mem_empty_fpa(int pool, int size, int elements);
|
||||
struct platform_device;
|
||||
|
||||
void cvm_oct_mem_empty_fpa(struct platform_device *pdev, int pool, int size,
|
||||
int elements);
|
||||
|
|
|
|||
|
|
@ -958,12 +958,12 @@ static void cvm_oct_remove(struct platform_device *pdev)
|
|||
cvmx_ipd_free_ptr();
|
||||
|
||||
/* Free the HW pools */
|
||||
cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
|
||||
cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
|
||||
num_packet_buffers);
|
||||
cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
|
||||
cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
|
||||
num_packet_buffers);
|
||||
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
|
||||
cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
|
||||
cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_OUTPUT_BUFFER_POOL,
|
||||
CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user