]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mlx4_core: Fix confusion between mlx4_event and mlx4_dev_event enums
authorRoland Dreier <rolandd@cisco.com>
Thu, 17 Apr 2008 04:01:08 +0000 (21:01 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 17 Apr 2008 04:01:08 +0000 (21:01 -0700)
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: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mlx4/main.c
drivers/net/mlx4/catas.c
drivers/net/mlx4/eq.c
drivers/net/mlx4/intf.c
drivers/net/mlx4/mlx4.h
include/linux/mlx4/driver.h

index 96a39b5c9254491a6e0b0aae227f7fb327ad0df9..d5512011999c071281bc68179b96119b661747e3 100644 (file)
@@ -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,
-                         enum mlx4_dev_event event, int subtype,
-                         int port)
+                         enum mlx4_dev_event event, int port)
 {
        struct ib_event ibev;
 
        switch (event) {
-       case MLX4_EVENT_TYPE_PORT_CHANGE:
-               ibev.event = subtype == MLX4_PORT_CHANGE_SUBTYPE_ACTIVE ?
-                       IB_EVENT_PORT_ACTIVE : IB_EVENT_PORT_ERR;
+       case MLX4_DEV_EVENT_PORT_UP:
+               ibev.event = IB_EVENT_PORT_ACTIVE;
                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;
                break;
 
index 6b32ec94b3a8b8d63c3d3f87b13d7423f597b837..aa95287790442e83e623e8a5f4895db5f5c1dcf5 100644 (file)
@@ -69,7 +69,7 @@ static void poll_catas(unsigned long dev_ptr)
        if (readl(priv->catas_err.map)) {
                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) {
                        spin_lock(&catas_lock);
index 9c36c2034030afbfd5250e7817f865968d02e73b..e141a1513f079427e6e7e881b587c3cf317ab500 100644 (file)
@@ -202,7 +202,10 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
                        break;
 
                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);
                        break;
 
index be5d9e90ccf2bd8a58766c2991abe004f326f119..4a6c4d526f1b51e72dad933fed05558faf8f57e5 100644 (file)
@@ -30,8 +30,6 @@
  * SOFTWARE.
  */
 
-#include <linux/mlx4/driver.h>
-
 #include "mlx4.h"
 
 struct mlx4_device_context {
@@ -113,8 +111,7 @@ void mlx4_unregister_interface(struct mlx4_interface *intf)
 }
 EXPORT_SYMBOL_GPL(mlx4_unregister_interface);
 
-void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_event type,
-                        int subtype, int port)
+void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_dev_event type, int port)
 {
        struct mlx4_priv *priv = mlx4_priv(dev);
        struct mlx4_device_context *dev_ctx;
@@ -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)
                if (dev_ctx->intf->event)
-                       dev_ctx->intf->event(dev, dev_ctx->context, type,
-                                            subtype, port);
+                       dev_ctx->intf->event(dev, dev_ctx->context, type, port);
 
        spin_unlock_irqrestore(&priv->ctx_lock, flags);
 }
index 53a1cdddfc13b1e4a40a37abfa630b60a942301f..73336810e6528124005cc576fd74d04b0aeed26e 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/timer.h>
 
 #include <linux/mlx4/device.h>
+#include <linux/mlx4/driver.h>
 #include <linux/mlx4/doorbell.h>
 
 #define DRV_NAME       "mlx4_core"
@@ -313,8 +314,7 @@ void mlx4_catas_cleanup(void);
 int mlx4_restart_one(struct pci_dev *pdev);
 int mlx4_register_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,
-                        int subtype, int port);
+void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_dev_event type, int port);
 
 struct mlx4_dev_cap;
 struct mlx4_init_hca_param;
index 1b835ca49df162b6a0c72420cfaf931b76f7c473..53c5fdb6eac48cae01caa030700d3817538de7f0 100644 (file)
@@ -48,8 +48,7 @@ struct mlx4_interface {
        void *                  (*add)   (struct mlx4_dev *dev);
        void                    (*remove)(struct mlx4_dev *dev, void *context);
        void                    (*event) (struct mlx4_dev *dev, void *context,
-                                         enum mlx4_dev_event event, int subtype,
-                                         int port);
+                                         enum mlx4_dev_event event, int port);
        struct list_head        list;
 };