From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT: drivers/net/ethernet/mellanox/mlxfw/mlxfw.h

Change-Id: Id941a185c88fe64081d2874aac2cddb34e3c7e3a
---
 drivers/net/ethernet/mellanox/mlxfw/mlxfw.h | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw.h
+++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw.h
@@ -19,7 +19,11 @@ struct mlxfw_dev {
 static inline
 struct device *mlxfw_dev_dev(struct mlxfw_dev *mlxfw_dev)
 {
+#ifdef HAVE_DEVLINK_TO_DEV
 	return devlink_to_dev(mlxfw_dev->devlink);
+#else
+	return mlxfw_dev->devlink->dev;
+#endif
 }
 
 #define MLXFW_PRFX "mlxfw: "
@@ -96,19 +100,26 @@ struct mlxfw_dev_ops {
 	void (*fsm_cancel)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle);
 
 	void (*fsm_release)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle);
+
+#ifndef HAVE_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY
+	void (*status_notify)(struct mlxfw_dev *mlxfw_dev,
+			const char *msg, const char *comp_name,
+			u32 done_bytes, u32 total_bytes);
+#endif
+
 };
 
 #if IS_REACHABLE(CONFIG_MLXFW)
 int mlxfw_firmware_flash(struct mlxfw_dev *mlxfw_dev,
-			 const struct firmware *firmware,
-			 struct netlink_ext_ack *extack);
+                         const struct firmware *firmware
+                         , struct netlink_ext_ack *extack);
 #else
 static inline
 int mlxfw_firmware_flash(struct mlxfw_dev *mlxfw_dev,
-			 const struct firmware *firmware,
-			 struct netlink_ext_ack *extack)
+                         const struct firmware *firmware
+                         , struct netlink_ext_ack *extack)
 {
-	return -EOPNOTSUPP;
+        return -EOPNOTSUPP;
 }
 #endif
 
