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: Roland Dreier <rolandd@cisco.com>
			
			
This commit is contained in:
		
							parent
							
								
									26c4fc26d0
								
							
						
					
					
						commit
						37608eea86
					
				| @ -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; | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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; | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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; | ||||
| }; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user