From 34f26b35839d7c0c09d48176c4ec33197344643c Mon Sep 17 00:00:00 2001
From: Saikrishna Arcot <sarcot@microsoft.com>
Date: Wed, 9 Nov 2022 12:23:50 -0800
Subject: [PATCH] Linux 5.10.140 update (#297)

* Update to linux 5.10.140

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

* Removed 0014 mlx patch since it is present in 140

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
Co-authored-by: Vivek Reddy <vkarri@nvidia.com>
---
 Makefile                                      |   4 +-
 ...vers-core-Use-a-char-pointer-for-the.patch | 138 ------------------
 ...le-building-linux-source-deb-package.patch |   4 +-
 .../preconfig/packaging-update-abiname.patch  |   8 +-
 patch/series                                  |   1 -
 5 files changed, 8 insertions(+), 147 deletions(-)
 delete mode 100644 patch/0014-thermal-drivers-core-Use-a-char-pointer-for-the.patch

diff --git a/Makefile b/Makefile
index be23e3847..839e89e47 100644
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,9 @@ SHELL = /bin/bash
 .SHELLFLAGS += -e
 
 KERNEL_ABI_MINOR_VERSION = 2
-KVERSION_SHORT ?= 5.10.0-12-$(KERNEL_ABI_MINOR_VERSION)
+KVERSION_SHORT ?= 5.10.0-18-$(KERNEL_ABI_MINOR_VERSION)
 KVERSION ?= $(KVERSION_SHORT)-amd64
-KERNEL_VERSION ?= 5.10.103
+KERNEL_VERSION ?= 5.10.140
 KERNEL_SUBVERSION ?= 1
 kernel_procure_method ?= build
 CONFIGURED_ARCH ?= amd64
diff --git a/patch/0014-thermal-drivers-core-Use-a-char-pointer-for-the.patch b/patch/0014-thermal-drivers-core-Use-a-char-pointer-for-the.patch
deleted file mode 100644
index a5cc45f81..000000000
--- a/patch/0014-thermal-drivers-core-Use-a-char-pointer-for-the.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From: Daniel Lezcano <daniel.lezcano@linaro.org>
-Date: Sun, 14 Mar 2021 12:13:29 +0100
-Subject: 0014 thermal/drivers/core: Use a char pointer for the
- cooling device name
-
-We want to have any kind of name for the cooling devices as we do no
-longer want to rely on auto-numbering. Let's replace the cooling
-device's fixed array by a char pointer to be allocated dynamically
-when registering the cooling device, so we don't limit the length of
-the name.
-
-Rework the error path at the same time as we have to rollback the
-allocations in case of error.
-
-Tested with a dummy device having the name:
- "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch"
-
-A village on the island of Anglesey (Wales), known to have the longest
-name in Europe.
-
-Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
-Tested-by: Ido Schimmel <idosch@nvidia.com>
-Link: https://lore.kernel.org/r/20210314111333.16551-1-daniel.lezcano@linaro.org
----
- .../ethernet/mellanox/mlxsw/core_thermal.c    |  2 +-
- drivers/thermal/thermal_core.c                | 38 +++++++++++--------
- include/linux/thermal.h                       |  2 +-
- 3 files changed, 24 insertions(+), 18 deletions(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
-index 7ec1d0ee9bee..ecd1856bef5e 100644
---- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
-+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
-@@ -133,7 +133,7 @@ static int mlxsw_get_cooling_device_idx(struct mlxsw_thermal *thermal,
- 	/* Allow mlxsw thermal zone binding to an external cooling device */
- 	for (i = 0; i < ARRAY_SIZE(mlxsw_thermal_external_allowed_cdev); i++) {
- 		if (strnstr(cdev->type, mlxsw_thermal_external_allowed_cdev[i],
--			    sizeof(cdev->type)))
-+			    strlen(cdev->type)))
- 			return 0;
- 	}
- 
-diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
-index d9e34ac37662..1abef64ccb5f 100644
---- a/drivers/thermal/thermal_core.c
-+++ b/drivers/thermal/thermal_core.c
-@@ -1092,10 +1092,7 @@ __thermal_cooling_device_register(struct device_node *np,
- {
- 	struct thermal_cooling_device *cdev;
- 	struct thermal_zone_device *pos = NULL;
--	int result;
--
--	if (type && strlen(type) >= THERMAL_NAME_LENGTH)
--		return ERR_PTR(-EINVAL);
-+	int ret;
- 
- 	if (!ops || !ops->get_max_state || !ops->get_cur_state ||
- 	    !ops->set_cur_state)
-@@ -1105,14 +1102,17 @@ __thermal_cooling_device_register(struct device_node *np,
- 	if (!cdev)
- 		return ERR_PTR(-ENOMEM);
- 
--	result = ida_simple_get(&thermal_cdev_ida, 0, 0, GFP_KERNEL);
--	if (result < 0) {
--		kfree(cdev);
--		return ERR_PTR(result);
-+	ret = ida_simple_get(&thermal_cdev_ida, 0, 0, GFP_KERNEL);
-+	if (ret < 0)
-+		goto out_kfree_cdev;
-+	cdev->id = ret;
-+
-+	cdev->type = kstrdup(type ? type : "", GFP_KERNEL);
-+	if (!cdev->type) {
-+		ret = -ENOMEM;
-+		goto out_ida_remove;
- 	}
- 
--	cdev->id = result;
--	strlcpy(cdev->type, type ? : "", sizeof(cdev->type));
- 	mutex_init(&cdev->lock);
- 	INIT_LIST_HEAD(&cdev->thermal_instances);
- 	cdev->np = np;
-@@ -1122,12 +1122,9 @@ __thermal_cooling_device_register(struct device_node *np,
- 	cdev->devdata = devdata;
- 	thermal_cooling_device_setup_sysfs(cdev);
- 	dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
--	result = device_register(&cdev->device);
--	if (result) {
--		ida_simple_remove(&thermal_cdev_ida, cdev->id);
--		put_device(&cdev->device);
--		return ERR_PTR(result);
--	}
-+	ret = device_register(&cdev->device);
-+	if (ret)
-+		goto out_kfree_type;
- 
- 	/* Add 'this' new cdev to the global cdev list */
- 	mutex_lock(&thermal_list_lock);
-@@ -1145,6 +1142,14 @@ __thermal_cooling_device_register(struct device_node *np,
- 	mutex_unlock(&thermal_list_lock);
- 
- 	return cdev;
-+
-+out_kfree_type:
-+	kfree(cdev->type);
-+	put_device(&cdev->device);
-+out_ida_remove:
-+	ida_simple_remove(&thermal_cdev_ida, cdev->id);
-+out_kfree_cdev:
-+	return ERR_PTR(ret);
- }
- 
- /**
-@@ -1303,6 +1308,7 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
- 	ida_simple_remove(&thermal_cdev_ida, cdev->id);
- 	device_del(&cdev->device);
- 	thermal_cooling_device_destroy_sysfs(cdev);
-+	kfree(cdev->type);
- 	put_device(&cdev->device);
- }
- EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister);
-diff --git a/include/linux/thermal.h b/include/linux/thermal.h
-index 176d9454e8f3..7097d4dcfdd0 100644
---- a/include/linux/thermal.h
-+++ b/include/linux/thermal.h
-@@ -92,7 +92,7 @@ struct thermal_cooling_device_ops {
- 
- struct thermal_cooling_device {
- 	int id;
--	char type[THERMAL_NAME_LENGTH];
-+	char *type;
- 	struct device device;
- 	struct device_node *np;
- 	void *devdata;
--- 
-2.17.1
-
diff --git a/patch/preconfig/disable-building-linux-source-deb-package.patch b/patch/preconfig/disable-building-linux-source-deb-package.patch
index 9479f6c62..a1b96c13e 100644
--- a/patch/preconfig/disable-building-linux-source-deb-package.patch
+++ b/patch/preconfig/disable-building-linux-source-deb-package.patch
@@ -19,8 +19,8 @@ index b6dae911b..50787e0e6 100644
  381bc892fd36ef7ea5327f649b99cb98  debian/templates/sourcebin.meta.maintscript.in
  814dda166c7e3ef02e6e259e805ac66a  debian/templates/tests-control.image.in
  33d71bfd398d2f9b3bc5c0193b67d17e  debian/templates/tests-control.main.in
--d54c376df16977677abfa95bf70cc6b6  debian/config/defines
-+74cca3ef177fb4f21b189a32a3b97b1e  debian/config/defines
+-8d7d8384c63c762538f8a76b60f6ca01  debian/config/defines
++d2c3e206c4cfe309bacbea8692b9acae  debian/config/defines
  59a811890d2e7129bec940075850f11f  debian/config/alpha/defines
  026ce5cdad7814c28f4fd87589786719  debian/config/amd64/defines
  44bff3917069a99eeb20ceff24609dda  debian/config/arm64/defines
diff --git a/patch/preconfig/packaging-update-abiname.patch b/patch/preconfig/packaging-update-abiname.patch
index f35b00d43..ccda629cd 100644
--- a/patch/preconfig/packaging-update-abiname.patch
+++ b/patch/preconfig/packaging-update-abiname.patch
@@ -14,8 +14,8 @@ index cd4938ecc..e54c10256 100644
 +++ b/debian/config/defines
 @@ -1,5 +1,5 @@
  [abi]
--abiname: 12
-+abiname: 12-2
+-abiname: 18
++abiname: 18-2
  ignore-changes:
   __cpuhp_*
   __udp_gso_segment
@@ -27,8 +27,8 @@ index e86f5f1db..caddd5360 100644
  381bc892fd36ef7ea5327f649b99cb98  debian/templates/sourcebin.meta.maintscript.in
  814dda166c7e3ef02e6e259e805ac66a  debian/templates/tests-control.image.in
  33d71bfd398d2f9b3bc5c0193b67d17e  debian/templates/tests-control.main.in
--601c2559d4800fd0180a6a944c9f74f1  debian/config/defines
-+d54c376df16977677abfa95bf70cc6b6  debian/config/defines
+-eb1d16e5a614c12118ccc36e18c54a69  debian/config/defines
++8d7d8384c63c762538f8a76b60f6ca01  debian/config/defines
  59a811890d2e7129bec940075850f11f  debian/config/alpha/defines
  026ce5cdad7814c28f4fd87589786719  debian/config/amd64/defines
  44bff3917069a99eeb20ceff24609dda  debian/config/arm64/defines
diff --git a/patch/series b/patch/series
index 19f8657be..c0c5e9a86 100755
--- a/patch/series
+++ b/patch/series
@@ -69,7 +69,6 @@ kernel-compat-always-include-linux-compat.h-from-net-compat.patch
 0011-i2c-mux-mlxcpld-Add-callback-to-notify-mux-crea.patch
 0012-hwmon-mlxreg-fan-Add-support-for-fan-drawers-ca.patch
 0013-hwmon-pmbus-shrink-code-and-remove-pmbus_do_rem.patch
-0014-thermal-drivers-core-Use-a-char-pointer-for-the.patch
 0015-mlxsw-core-Remove-critical-trip-points-from-the.patch
 0016-net-don-t-include-ethtool.h-from-netdevice.h.patch
 0017-mlxsw-reg-Extend-MTMP-register-with-new-thresho.patch