Commit 37608eea authored by Roland Dreier's avatar Roland Dreier

mlx4_core: Fix confusion between mlx4_event and mlx4_dev_event enums

The struct mlx4_interface.event() method was supposed to get an enum
mlx4_dev_event, but the driver code was actually passing in the
hardware enum mlx4_event values.  Fix up the callers of
mlx4_dispatch_event() so that they pass in the right type of value,
and fix up the event method in mlx4_ib so that it can handle the enum
mlx4_dev_event values.

This eliminates the need for the subtype parameter to the event
method, so remove it.

This also fixes the sparse warning

    drivers/net/mlx4/intf.c:127:48: warning: mixing different enum types
    drivers/net/mlx4/intf.c:127:48:     int enum mlx4_event  versus
    drivers/net/mlx4/intf.c:127:48:     int enum mlx4_dev_event
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 26c4fc26
...@@ -675,18 +675,20 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) ...@@ -675,18 +675,20 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr)
} }
static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
enum mlx4_dev_event event, int subtype, enum mlx4_dev_event event, int port)
int port)
{ {
struct ib_event ibev; struct ib_event ibev;
switch (event) { switch (event) {
case MLX4_EVENT_TYPE_PORT_CHANGE: case MLX4_DEV_EVENT_PORT_UP:
ibev.event = subtype == MLX4_PORT_CHANGE_SUBTYPE_ACTIVE ? ibev.event = IB_EVENT_PORT_ACTIVE;
IB_EVENT_PORT_ACTIVE : IB_EVENT_PORT_ERR;
break; break;
case MLX4_EVENT_TYPE_LOCAL_CATAS_ERROR: case MLX4_DEV_EVENT_PORT_DOWN:
ibev.event = IB_EVENT_PORT_ERR;
break;
case MLX4_DEV_EVENT_CATASTROPHIC_ERROR:
ibev.event = IB_EVENT_DEVICE_FATAL; ibev.event = IB_EVENT_DEVICE_FATAL;
break; break;
......
...@@ -69,7 +69,7 @@ static void poll_catas(unsigned long dev_ptr) ...@@ -69,7 +69,7 @@ static void poll_catas(unsigned long dev_ptr)
if (readl(priv->catas_err.map)) { if (readl(priv->catas_err.map)) {
dump_err_buf(dev); dump_err_buf(dev);
mlx4_dispatch_event(dev, MLX4_EVENT_TYPE_LOCAL_CATAS_ERROR, 0, 0); mlx4_dispatch_event(dev, MLX4_DEV_EVENT_CATASTROPHIC_ERROR, 0);
if (internal_err_reset) { if (internal_err_reset) {
spin_lock(&catas_lock); spin_lock(&catas_lock);
......
...@@ -202,7 +202,10 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq) ...@@ -202,7 +202,10 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
break; break;
case MLX4_EVENT_TYPE_PORT_CHANGE: case MLX4_EVENT_TYPE_PORT_CHANGE:
mlx4_dispatch_event(dev, eqe->type, eqe->subtype, mlx4_dispatch_event(dev,
eqe->subtype == MLX4_PORT_CHANGE_SUBTYPE_ACTIVE ?
MLX4_DEV_EVENT_PORT_UP :
MLX4_DEV_EVENT_PORT_DOWN,
be32_to_cpu(eqe->event.port_change.port) >> 28); be32_to_cpu(eqe->event.port_change.port) >> 28);
break; break;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include <linux/mlx4/driver.h>
#include "mlx4.h" #include "mlx4.h"
struct mlx4_device_context { struct mlx4_device_context {
...@@ -113,8 +111,7 @@ void mlx4_unregister_interface(struct mlx4_interface *intf) ...@@ -113,8 +111,7 @@ void mlx4_unregister_interface(struct mlx4_interface *intf)
} }
EXPORT_SYMBOL_GPL(mlx4_unregister_interface); EXPORT_SYMBOL_GPL(mlx4_unregister_interface);
void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_event type, void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_dev_event type, int port)
int subtype, int port)
{ {
struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_device_context *dev_ctx; struct mlx4_device_context *dev_ctx;
...@@ -124,8 +121,7 @@ void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_event type, ...@@ -124,8 +121,7 @@ void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_event type,
list_for_each_entry(dev_ctx, &priv->ctx_list, list) list_for_each_entry(dev_ctx, &priv->ctx_list, list)
if (dev_ctx->intf->event) if (dev_ctx->intf->event)
dev_ctx->intf->event(dev, dev_ctx->context, type, dev_ctx->intf->event(dev, dev_ctx->context, type, port);
subtype, port);
spin_unlock_irqrestore(&priv->ctx_lock, flags); spin_unlock_irqrestore(&priv->ctx_lock, flags);
} }
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/mlx4/device.h> #include <linux/mlx4/device.h>
#include <linux/mlx4/driver.h>
#include <linux/mlx4/doorbell.h> #include <linux/mlx4/doorbell.h>
#define DRV_NAME "mlx4_core" #define DRV_NAME "mlx4_core"
...@@ -313,8 +314,7 @@ void mlx4_catas_cleanup(void); ...@@ -313,8 +314,7 @@ void mlx4_catas_cleanup(void);
int mlx4_restart_one(struct pci_dev *pdev); int mlx4_restart_one(struct pci_dev *pdev);
int mlx4_register_device(struct mlx4_dev *dev); int mlx4_register_device(struct mlx4_dev *dev);
void mlx4_unregister_device(struct mlx4_dev *dev); void mlx4_unregister_device(struct mlx4_dev *dev);
void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_event type, void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_dev_event type, int port);
int subtype, int port);
struct mlx4_dev_cap; struct mlx4_dev_cap;
struct mlx4_init_hca_param; struct mlx4_init_hca_param;
......
...@@ -48,8 +48,7 @@ struct mlx4_interface { ...@@ -48,8 +48,7 @@ struct mlx4_interface {
void * (*add) (struct mlx4_dev *dev); void * (*add) (struct mlx4_dev *dev);
void (*remove)(struct mlx4_dev *dev, void *context); void (*remove)(struct mlx4_dev *dev, void *context);
void (*event) (struct mlx4_dev *dev, void *context, void (*event) (struct mlx4_dev *dev, void *context,
enum mlx4_dev_event event, int subtype, enum mlx4_dev_event event, int port);
int port);
struct list_head list; struct list_head list;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment