Skip to content

Commit

Permalink
vxge: sparse and other clean-ups
Browse files Browse the repository at this point in the history
Correct issues found by running sparse on the vxge driver, as well as
other miscellaneous cleanups.

Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Mason authored and David S. Miller committed Nov 11, 2010
1 parent 1901d04 commit 2c91308
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 153 deletions.
100 changes: 23 additions & 77 deletions drivers/net/vxge/vxge-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@
#include "vxge-config.h"
#include "vxge-main.h"

static enum vxge_hw_status
__vxge_hw_fifo_create(
struct __vxge_hw_vpath_handle *vpath_handle,
struct vxge_hw_fifo_attr *attr);

static enum vxge_hw_status
__vxge_hw_fifo_abort(
struct __vxge_hw_fifo *fifoh);

static enum vxge_hw_status
__vxge_hw_fifo_reset(
struct __vxge_hw_fifo *ringh);

static enum vxge_hw_status
__vxge_hw_fifo_delete(
struct __vxge_hw_vpath_handle *vpath_handle);
Expand Down Expand Up @@ -72,44 +59,15 @@ __vxge_hw_blockpool_free(struct __vxge_hw_device *hldev,
u32 size,
struct vxge_hw_mempool_dma *dma_object);


static struct __vxge_hw_channel*
__vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
enum __vxge_hw_channel_type type, u32 length,
u32 per_dtr_space, void *userdata);

static void
__vxge_hw_channel_free(
struct __vxge_hw_channel *channel);

static enum vxge_hw_status
__vxge_hw_channel_initialize(
struct __vxge_hw_channel *channel);

static enum vxge_hw_status
__vxge_hw_channel_reset(
struct __vxge_hw_channel *channel);

static enum vxge_hw_status __vxge_hw_ring_delete(struct __vxge_hw_vpath_handle *vp);

static enum vxge_hw_status
__vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config);

static enum vxge_hw_status
__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config);

static void
__vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev);

static enum vxge_hw_status
__vxge_hw_device_initialize(struct __vxge_hw_device *hldev);

static void
__vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev);

static enum vxge_hw_status
__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev);

static enum vxge_hw_status
__vxge_hw_device_register_poll(
void __iomem *reg,
Expand All @@ -130,9 +88,10 @@ __vxge_hw_pio_mem_write64(u64 val64, void __iomem *addr,

static struct vxge_hw_mempool*
__vxge_hw_mempool_create(struct __vxge_hw_device *devh, u32 memblock_size,
u32 item_size, u32 private_size, u32 items_initial,
u32 items_max, struct vxge_hw_mempool_cbs *mp_callback,
void *userdata);
u32 item_size, u32 private_size, u32 items_initial,
u32 items_max, struct vxge_hw_mempool_cbs *mp_callback,
void *userdata);

static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool);

static enum vxge_hw_status
Expand All @@ -145,23 +104,9 @@ vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vpath_handle);
static enum vxge_hw_status
__vxge_hw_legacy_swapper_set(struct vxge_hw_legacy_reg __iomem *legacy_reg);

static enum vxge_hw_status
__vxge_hw_vpath_reset_check(struct __vxge_hw_virtualpath *vpath);


static enum vxge_hw_status
__vxge_hw_vpath_sw_reset(struct __vxge_hw_device *devh, u32 vp_id);

static enum vxge_hw_status
__vxge_hw_vpath_mac_configure(struct __vxge_hw_device *devh, u32 vp_id);

static void
__vxge_hw_vp_terminate(struct __vxge_hw_device *devh, u32 vp_id);

static enum vxge_hw_status
__vxge_hw_vpath_stats_access(struct __vxge_hw_virtualpath *vpath,
u32 operation, u32 offset, u64 *stat);

static enum vxge_hw_status
__vxge_hw_vpath_xmac_tx_stats_get(struct __vxge_hw_virtualpath *vpath,
struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats);
Expand Down Expand Up @@ -505,7 +450,7 @@ vxge_hw_vpath_eprom_img_ver_get(struct __vxge_hw_device *hldev,
* This function allocates required memory for the channel and various arrays
* in the channel
*/
struct __vxge_hw_channel*
static struct __vxge_hw_channel *
__vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
enum __vxge_hw_channel_type type,
u32 length, u32 per_dtr_space, void *userdata)
Expand Down Expand Up @@ -576,7 +521,7 @@ __vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
* This function deallocates memory from the channel and various arrays
* in the channel
*/
void __vxge_hw_channel_free(struct __vxge_hw_channel *channel)
static void __vxge_hw_channel_free(struct __vxge_hw_channel *channel)
{
kfree(channel->work_arr);
kfree(channel->free_arr);
Expand All @@ -590,7 +535,7 @@ void __vxge_hw_channel_free(struct __vxge_hw_channel *channel)
* This function initializes a channel by properly setting the
* various references
*/
enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_channel_initialize(struct __vxge_hw_channel *channel)
{
u32 i;
Expand Down Expand Up @@ -625,7 +570,7 @@ __vxge_hw_channel_initialize(struct __vxge_hw_channel *channel)
* __vxge_hw_channel_reset - Resets a channel
* This function resets a channel by properly setting the various references
*/
enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_channel_reset(struct __vxge_hw_channel *channel)
{
u32 i;
Expand All @@ -652,8 +597,7 @@ __vxge_hw_channel_reset(struct __vxge_hw_channel *channel)
* Initialize certain PCI/PCI-X configuration registers
* with recommended values. Save config space for future hw resets.
*/
void
__vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
static void __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
{
u16 cmd = 0;

Expand Down Expand Up @@ -742,7 +686,7 @@ __vxge_hw_device_toc_get(void __iomem *bar0)
* register location pointers in the device object. It waits until the ric is
* completed initializing registers.
*/
enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_device_reg_addr_get(struct __vxge_hw_device *hldev)
{
u64 val64;
Expand Down Expand Up @@ -938,7 +882,8 @@ __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev)
* __vxge_hw_device_initialize
* Initialize Titan-V hardware.
*/
enum vxge_hw_status __vxge_hw_device_initialize(struct __vxge_hw_device *hldev)
static enum vxge_hw_status
__vxge_hw_device_initialize(struct __vxge_hw_device *hldev)
{
enum vxge_hw_status status = VXGE_HW_OK;

Expand Down Expand Up @@ -2337,7 +2282,7 @@ static void __vxge_hw_mempool_destroy(struct vxge_hw_mempool *mempool)
* __vxge_hw_device_fifo_config_check - Check fifo configuration.
* Check the fifo configuration
*/
enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_device_fifo_config_check(struct vxge_hw_fifo_config *fifo_config)
{
if ((fifo_config->fifo_blocks < VXGE_HW_MIN_FIFO_BLOCKS) ||
Expand Down Expand Up @@ -2385,7 +2330,7 @@ __vxge_hw_device_vpath_config_check(struct vxge_hw_vp_config *vp_config)
* __vxge_hw_device_config_check - Check device configuration.
* Check the device configuration
*/
enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config)
{
u32 i;
Expand Down Expand Up @@ -2945,7 +2890,7 @@ __vxge_hw_fifo_mempool_item_alloc(
* __vxge_hw_fifo_create - Create a FIFO
* This function creates FIFO and initializes it.
*/
enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_fifo_create(struct __vxge_hw_vpath_handle *vp,
struct vxge_hw_fifo_attr *attr)
{
Expand Down Expand Up @@ -3109,7 +3054,8 @@ static enum vxge_hw_status __vxge_hw_fifo_reset(struct __vxge_hw_fifo *fifo)
* __vxge_hw_fifo_delete - Removes the FIFO
* This function freeup the memory pool and removes the FIFO
*/
enum vxge_hw_status __vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp)
static enum vxge_hw_status
__vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp)
{
struct __vxge_hw_fifo *fifo = vp->vpath->fifoh;

Expand Down Expand Up @@ -4897,7 +4843,7 @@ static void vxge_os_dma_free(struct pci_dev *pdev, const void *vaddr,
* __vxge_hw_blockpool_create - Create block pool
*/

enum vxge_hw_status
static enum vxge_hw_status
__vxge_hw_blockpool_create(struct __vxge_hw_device *hldev,
struct __vxge_hw_blockpool *blockpool,
u32 pool_size,
Expand Down Expand Up @@ -4997,7 +4943,7 @@ __vxge_hw_blockpool_create(struct __vxge_hw_device *hldev,
* __vxge_hw_blockpool_destroy - Deallocates the block pool
*/

void __vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool)
static void __vxge_hw_blockpool_destroy(struct __vxge_hw_blockpool *blockpool)
{

struct __vxge_hw_device *hldev;
Expand Down Expand Up @@ -5163,7 +5109,7 @@ static void vxge_hw_blockpool_block_add(struct __vxge_hw_device *devh,
* Allocates a block of memory of given size, either from block pool
* or by calling vxge_os_dma_malloc()
*/
void *
static void *
__vxge_hw_blockpool_malloc(struct __vxge_hw_device *devh, u32 size,
struct vxge_hw_mempool_dma *dma_object)
{
Expand Down Expand Up @@ -5227,7 +5173,7 @@ __vxge_hw_blockpool_malloc(struct __vxge_hw_device *devh, u32 size,
* __vxge_hw_blockpool_free - Frees the memory allcoated with
__vxge_hw_blockpool_malloc
*/
void
static void
__vxge_hw_blockpool_free(struct __vxge_hw_device *devh,
void *memblock, u32 size,
struct vxge_hw_mempool_dma *dma_object)
Expand Down Expand Up @@ -5279,7 +5225,7 @@ __vxge_hw_blockpool_free(struct __vxge_hw_device *devh,
* __vxge_hw_blockpool_block_allocate - Allocates a block from block pool
* This function allocates a block from block pool or from the system
*/
struct __vxge_hw_blockpool_entry *
static struct __vxge_hw_blockpool_entry *
__vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size)
{
struct __vxge_hw_blockpool_entry *entry = NULL;
Expand Down Expand Up @@ -5314,7 +5260,7 @@ __vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size)
*
* This function frees a block from block pool
*/
void
static void
__vxge_hw_blockpool_block_free(struct __vxge_hw_device *devh,
struct __vxge_hw_blockpool_entry *entry)
{
Expand Down
35 changes: 14 additions & 21 deletions drivers/net/vxge/vxge-ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Virtualized Server Adapter.
* Copyright(c) 2002-2010 Exar Corp.
******************************************************************************/
#include<linux/ethtool.h>
#include <linux/ethtool.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/etherdevice.h>
Expand All @@ -29,7 +29,6 @@
* Return value:
* 0 on success.
*/

static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info)
{
/* We currently only support 10Gb/FULL */
Expand Down Expand Up @@ -79,10 +78,9 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
* Returns driver specefic information like name, version etc.. to ethtool.
*/
static void vxge_ethtool_gdrvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
struct ethtool_drvinfo *info)
{
struct vxgedev *vdev;
vdev = (struct vxgedev *)netdev_priv(dev);
struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME));
strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION));
strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN);
Expand All @@ -104,15 +102,14 @@ static void vxge_ethtool_gdrvinfo(struct net_device *dev,
* buffer area.
*/
static void vxge_ethtool_gregs(struct net_device *dev,
struct ethtool_regs *regs, void *space)
struct ethtool_regs *regs, void *space)
{
int index, offset;
enum vxge_hw_status status;
u64 reg;
u64 *reg_space = (u64 *) space;
u64 *reg_space = (u64 *)space;
struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
pci_get_drvdata(vdev->pdev);
struct __vxge_hw_device *hldev = vdev->devh;

regs->len = sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath;
regs->version = vdev->pdev->subsystem_device;
Expand Down Expand Up @@ -148,8 +145,7 @@ static void vxge_ethtool_gregs(struct net_device *dev,
static int vxge_ethtool_idnic(struct net_device *dev, u32 data)
{
struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
pci_get_drvdata(vdev->pdev);
struct __vxge_hw_device *hldev = vdev->devh;

vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_ON);
msleep_interruptible(data ? (data * HZ) : VXGE_MAX_FLICKER_TIME);
Expand All @@ -168,11 +164,10 @@ static int vxge_ethtool_idnic(struct net_device *dev, u32 data)
* void
*/
static void vxge_ethtool_getpause_data(struct net_device *dev,
struct ethtool_pauseparam *ep)
struct ethtool_pauseparam *ep)
{
struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
pci_get_drvdata(vdev->pdev);
struct __vxge_hw_device *hldev = vdev->devh;

vxge_hw_device_getpause_data(hldev, 0, &ep->tx_pause, &ep->rx_pause);
}
Expand All @@ -188,11 +183,10 @@ static void vxge_ethtool_getpause_data(struct net_device *dev,
* int, returns 0 on Success
*/
static int vxge_ethtool_setpause_data(struct net_device *dev,
struct ethtool_pauseparam *ep)
struct ethtool_pauseparam *ep)
{
struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
pci_get_drvdata(vdev->pdev);
struct __vxge_hw_device *hldev = vdev->devh;

vxge_hw_device_setpause_data(hldev, 0, ep->tx_pause, ep->rx_pause);

Expand All @@ -209,9 +203,8 @@ static void vxge_get_ethtool_stats(struct net_device *dev,
enum vxge_hw_status status;
enum vxge_hw_status swstatus;
struct vxge_vpath *vpath = NULL;

struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
struct __vxge_hw_device *hldev = vdev->devh;
struct __vxge_hw_device *hldev = vdev->devh;
struct vxge_hw_xmac_stats *xmac_stats;
struct vxge_hw_device_stats_sw_info *sw_stats;
struct vxge_hw_device_stats_hw_info *hw_stats;
Expand Down Expand Up @@ -574,8 +567,8 @@ static void vxge_get_ethtool_stats(struct net_device *dev,
kfree(hw_stats);
}

static void vxge_ethtool_get_strings(struct net_device *dev,
u32 stringset, u8 *data)
static void vxge_ethtool_get_strings(struct net_device *dev, u32 stringset,
u8 *data)
{
int stat_size = 0;
int i, j;
Expand Down
Loading

0 comments on commit 2c91308

Please sign in to comment.