Explorar o código

msm: camera: req_mgr: Update list_head to const

Starting with kernel 5.14+ callbacks using list_head structs need to
be const qualified.

CRs-Fixed: 3048249
Change-Id: I80611317b5a69fee8bb0901697d8a6df1bd4aab8
Signed-off-by: Karthik Jayakumar <[email protected]>
Karthik Jayakumar %!s(int64=3) %!d(string=hai) anos
pai
achega
523de2982c

+ 1 - 19
drivers/cam_req_mgr/cam_req_mgr_dev.c

@@ -17,7 +17,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/cam_req_mgr.h>
 #include <media/cam_defs.h>
-#include <linux/list_sort.h>
 
 #include "cam_req_mgr_dev.h"
 #include "cam_req_mgr_util.h"
@@ -28,6 +27,7 @@
 #include "cam_common_util.h"
 #include "cam_compat.h"
 #include "cam_cpas_hw.h"
+#include "cam_compat.h"
 
 #define CAM_REQ_MGR_EVENT_MAX 30
 
@@ -685,24 +685,6 @@ void cam_subdev_notify_message(u32 subdev_type,
 }
 EXPORT_SYMBOL(cam_subdev_notify_message);
 
-
-static int cam_req_mgr_ordered_list_cmp(void *priv,
-	struct list_head *head_1, struct list_head *head_2)
-{
-	struct cam_subdev *entry_1 =
-		list_entry(head_1, struct cam_subdev, list);
-	struct cam_subdev *entry_2 =
-		list_entry(head_2, struct cam_subdev, list);
-	int ret = -1;
-
-	if (entry_1->close_seq_prior > entry_2->close_seq_prior)
-		return 1;
-	else if (entry_1->close_seq_prior < entry_2->close_seq_prior)
-		return ret;
-	else
-		return 0;
-}
-
 bool cam_req_mgr_is_open(void)
 {
 	bool crm_status = false;

+ 24 - 0
drivers/cam_utils/cam_compat.c

@@ -283,7 +283,24 @@ void cam_check_iommu_faults(struct iommu_domain *domain,
 }
 #endif
 
+static int inline cam_subdev_list_cmp(struct cam_subdev *entry_1, struct cam_subdev *entry_2)
+{
+	if (entry_1->close_seq_prior > entry_2->close_seq_prior)
+		return 1;
+	else if (entry_1->close_seq_prior < entry_2->close_seq_prior)
+		return -1;
+	else
+		return 0;
+}
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+int cam_req_mgr_ordered_list_cmp(void *priv,
+	const struct list_head *head_1, const struct list_head *head_2)
+{
+	return cam_subdev_list_cmp(list_entry(head_1, struct cam_subdev, list),
+		list_entry(head_2, struct cam_subdev, list));
+}
+
 int cam_get_ddr_type(void)
 {
 	/* We assume all chipsets running kernel version 5.15+
@@ -292,6 +309,13 @@ int cam_get_ddr_type(void)
 	return DDR_TYPE_LPDDR5;
 }
 #else
+int cam_req_mgr_ordered_list_cmp(void *priv,
+	struct list_head *head_1, struct list_head *head_2)
+{
+	return cam_subdev_list_cmp(list_entry(head_1, struct cam_subdev, list),
+		list_entry(head_2, struct cam_subdev, list));
+}
+
 int cam_get_ddr_type(void)
 {
 	return of_fdt_get_ddrtype();

+ 9 - 0
drivers/cam_utils/cam_compat.h

@@ -11,6 +11,7 @@
 #include <linux/component.h>
 #include <linux/iommu.h>
 #include <linux/qcom_scm.h>
+#include <linux/list_sort.h>
 
 #include "cam_csiphy_dev.h"
 #include "cam_cpastop_hw.h"
@@ -47,4 +48,12 @@ void cam_check_iommu_faults(struct iommu_domain *domain,
 	struct cam_smmu_pf_info *pf_info);
 int cam_get_ddr_type(void);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+int cam_req_mgr_ordered_list_cmp(void *priv,
+	const struct list_head *head_1, const struct list_head *head_2);
+#else
+int cam_req_mgr_ordered_list_cmp(void *priv,
+	struct list_head *head_1, struct list_head *head_2);
+#endif
+
 #endif /* _CAM_COMPAT_H_ */