Project import generated by Copybara.

GitOrigin-RevId: 4922ac4aca96cf0170e49e95f2aca9fc99444d75
diff --git a/build.config.boreal b/build.config.boreal
index 59fb7d1..19384b3 100644
--- a/build.config.boreal
+++ b/build.config.boreal
@@ -12,7 +12,7 @@
 DEVICETREE_V3_OVERLAY=s4_s805x2_boreal_v3_overlay
 
 #It is a must to set GPU driver's version
-GPU_DRV_VERSION=r43p0
+GPU_DRV_VERSION=r38p2
 
 MAKE_GOALS="
 Image.gz
diff --git a/drivers/amlogic/media/common/resource_mgr/resourcemanage.c b/drivers/amlogic/media/common/resource_mgr/resourcemanage.c
index 39f245e..a572274 100644
--- a/drivers/amlogic/media/common/resource_mgr/resourcemanage.c
+++ b/drivers/amlogic/media/common/resource_mgr/resourcemanage.c
@@ -1927,26 +1927,6 @@
 	return size;
 }
 
-static ssize_t res_report_show(struct class *class,
-			   struct class_attribute *attr,
-			   char *buf)
-{
-	struct resman_session *sess = NULL;
-	struct list_head *pos = NULL;
-	struct list_head *tmp = NULL;
-
-	mutex_lock(&sessions_lock);
-	list_for_each_safe(pos, tmp, &sessions_head) {
-		sess = list_entry(pos, struct resman_session, list);
-		if (sess) {
-			resman_send_event(sess, RESMAN_EVENT_RESREPORT);
-			wake_up_interruptible(&sess->wq_event);
-		}
-	}
-	mutex_unlock(&sessions_lock);
-	return 0;
-}
-
 #undef APPEND_ATTR_BUF
 
 static ssize_t config_store(struct class *class,
@@ -2144,7 +2124,6 @@
 	__ATTR_RW(config),
 	__ATTR_RO(ver),
 	__ATTR_RW(extconfig),
-	__ATTR_RO(res_report),
 	__ATTR_NULL
 };
 
diff --git a/drivers/amlogic/media/common/resource_mgr/resourcemanage.h b/drivers/amlogic/media/common/resource_mgr/resourcemanage.h
index bbf60eb..2d31cb3 100644
--- a/drivers/amlogic/media/common/resource_mgr/resourcemanage.h
+++ b/drivers/amlogic/media/common/resource_mgr/resourcemanage.h
@@ -81,8 +81,7 @@
 enum RESMAN_EVENT {
 	RESMAN_EVENT_REGISTER		= 0x1000,
 	RESMAN_EVENT_UNREGISTER,
-	RESMAN_EVENT_PREEMPT,
-	RESMAN_EVENT_RESREPORT		= 0x1004
+	RESMAN_EVENT_PREEMPT
 };
 
 int resman_init(void);
diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c
index 5d4570a..5af77ae 100644
--- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c
+++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c
@@ -1415,13 +1415,7 @@
 							     &blockbuf[offset]);
 					break;
 				case EXTENSION_COLORMETRY_TAG:
-					if (hdev->hdr_priority == 2)
-						prxcap->colorimetry_data =
-							blockbuf[offset + 2] & 0x1f;
-					else
-						prxcap->colorimetry_data =
-							blockbuf[offset + 2];
-					prxcap->colorimetry_data2 =
+					prxcap->colorimetry_data =
 						blockbuf[offset + 2];
 					break;
 				case EXTENSION_DRM_STATIC_TAG:
diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
index 4e292fa..6e952fe 100644
--- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
+++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
@@ -3527,78 +3527,6 @@
 	return count;
 }
 
-static ssize_t hdr_priority_mode_show(struct device *dev,
-			  struct device_attribute *attr, char *buf)
-{
-	int pos = 0;
-	struct hdmitx_dev *hdev = get_hdmitx_device();
-
-	pos += snprintf(buf + pos, PAGE_SIZE, "%d\r\n",
-		hdev->hdr_priority);
-
-	return pos;
-}
-
-/* hide or enable HDR capabilities.
- * 0 : No HDR capabilities are hidden
- * 1 : DV Capabilities are hidden
- * 2 : All HDR capabilities are hidden
- */
-static ssize_t hdr_priority_mode_store(struct device *dev,
-			   struct device_attribute *attr,
-			   const char *buf, size_t count)
-{
-	struct hdmitx_dev *hdev = get_hdmitx_device();
-	unsigned int val = 0;
-	struct vinfo_s *info = NULL;
-
-	if ((strncmp("0", buf, 1) == 0) || (strncmp("1", buf, 1) == 0) ||
-	    (strncmp("2", buf, 1) == 0)) {
-		val = buf[0] - '0';
-	}
-
-	if (val == hdev->hdr_priority)
-		return count;
-
-	info = hdmitx_get_current_vinfo(NULL);
-
-	mutex_lock(&hdmimode_mutex);
-	hdev->hdr_priority = val;
-	if (hdev->hdr_priority == 1) {
-		//clear dv support
-		memset(&hdev->rxcap.dv_info, 0x00, sizeof(struct dv_info));
-		hdmitx_vdev.dv_info = &dv_dummy;
-		//restore hdr support
-		memcpy(&hdev->rxcap.hdr_info, &hdev->rxcap.hdr_info2, sizeof(struct hdr_info));
-		//restore BT2020 support
-		hdev->rxcap.colorimetry_data = hdev->rxcap.colorimetry_data2;
-		hdrinfo_to_vinfo(&info->hdr_info, hdev);
-	} else if (hdev->hdr_priority == 2) {
-		//clear dv support
-		memset(&hdev->rxcap.dv_info, 0x00, sizeof(struct dv_info));
-		hdmitx_vdev.dv_info = &dv_dummy;
-		//clear hdr support
-		memset(&hdev->rxcap.hdr_info, 0x00, sizeof(struct hdr_info));
-		//clear BT2020 support
-		hdev->rxcap.colorimetry_data = hdev->rxcap.colorimetry_data2 & 0x1F;
-		memset(&info->hdr_info, 0, sizeof(struct hdr_info));
-	} else {
-		//restore dv support
-		memcpy(&hdev->rxcap.dv_info, &hdev->rxcap.dv_info2, sizeof(struct dv_info));
-		//restore hdr support
-		memcpy(&hdev->rxcap.hdr_info, &hdev->rxcap.hdr_info2, sizeof(struct hdr_info));
-		//restore BT2020 support
-		hdev->rxcap.colorimetry_data = hdev->rxcap.colorimetry_data2;
-		edidinfo_attach_to_vinfo(hdev);
-	}
-	/* force trigger plugin event
-	 * hdmitx_set_uevent_state(HDMITX_HPD_EVENT, 0);
-	 * hdmitx_set_uevent(HDMITX_HPD_EVENT, 1);
-	 */
-	mutex_unlock(&hdmimode_mutex);
-	return count;
-}
-
 /**/
 static ssize_t _hdr_cap_show(struct device *dev,
 			     struct device_attribute *attr,
@@ -5557,7 +5485,6 @@
 static DEVICE_ATTR_RO(hdmitx_drm_flag);
 static DEVICE_ATTR_RW(hdr_mute_frame);
 static DEVICE_ATTR_RO(dump_debug_reg);
-static DEVICE_ATTR_RW(hdr_priority_mode);
 
 #ifdef CONFIG_AMLOGIC_VOUT_SERVE
 static struct vinfo_s *hdmitx_get_current_vinfo(void *data)
@@ -7118,7 +7045,6 @@
 	ret = device_create_file(dev, &dev_attr_hdmitx_drm_flag);
 	ret = device_create_file(dev, &dev_attr_hdr_mute_frame);
 	ret = device_create_file(dev, &dev_attr_dump_debug_reg);
-	ret = device_create_file(dev, &dev_attr_hdr_priority_mode);
 
 #ifdef CONFIG_AMLOGIC_VPU
 	hdmitx_device.encp_vpu_dev = vpu_dev_register(VPU_VENCP, DEVICE_NAME);
@@ -7313,7 +7239,6 @@
 	device_remove_file(dev, &dev_attr_hdmitx_drm_flag);
 	device_remove_file(dev, &dev_attr_hdr_mute_frame);
 	device_remove_file(dev, &dev_attr_dump_debug_reg);
-	device_remove_file(dev, &dev_attr_hdr_priority_mode);
 
 	cdev_del(&hdmitx_device.cdev);
 
@@ -7547,8 +7472,7 @@
 {
 	unsigned int val = 0;
 
-	if ((strncmp("0", str, 1) == 0) || (strncmp("1", str, 1) == 0) ||
-		(strncmp("2", str, 1) == 0)) {
+	if ((strncmp("1", str, 1) == 0) || (strncmp("2", str, 1) == 0)) {
 		val = str[0] - '0';
 		hdmitx_device.hdr_priority = val;
 		pr_info("hdmitx boot hdr_priority: %d\n", val);
diff --git a/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_edid.c b/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_edid.c
index fa59368..c5d976b 100644
--- a/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_edid.c
+++ b/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_edid.c
@@ -1884,13 +1884,7 @@
 							     &blockbuf[offset]);
 					break;
 				case EXTENSION_COLORMETRY_TAG:
-					if (hdev->hdr_priority == 2)
-						prxcap->colorimetry_data =
-							blockbuf[offset + 2] & 0x1f;
-					else
-						prxcap->colorimetry_data =
-							blockbuf[offset + 2];
-					prxcap->colorimetry_data2 =
+					prxcap->colorimetry_data =
 						blockbuf[offset + 2];
 					break;
 				case EXTENSION_DRM_STATIC_TAG:
diff --git a/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_main.c
index ae539dd..0be6a61 100644
--- a/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_main.c
+++ b/drivers/amlogic/media/vout/hdmitx21/hdmi_tx_main.c
@@ -2906,78 +2906,6 @@
 	return _hdr_cap_show(dev, attr, buf, info2);
 }
 
-static ssize_t hdr_priority_mode_show(struct device *dev,
-			  struct device_attribute *attr, char *buf)
-{
-	int pos = 0;
-	struct hdmitx_dev *hdev = get_hdmitx21_device();
-
-	pos += snprintf(buf + pos, PAGE_SIZE, "%d\r\n",
-		hdev->hdr_priority);
-
-	return pos;
-}
-
-/* hide or enable HDR capabilities.
- * 0 : No HDR capabilities are hidden
- * 1 : DV Capabilities are hidden
- * 2 : All HDR capabilities are hidden
- */
-static ssize_t hdr_priority_mode_store(struct device *dev,
-			   struct device_attribute *attr,
-			   const char *buf, size_t count)
-{
-	struct hdmitx_dev *hdev = get_hdmitx21_device();
-	unsigned int val = 0;
-	struct vinfo_s *info = NULL;
-
-	if ((strncmp("0", buf, 1) == 0) || (strncmp("1", buf, 1) == 0) ||
-	    (strncmp("2", buf, 1) == 0)) {
-		val = buf[0] - '0';
-	}
-
-	if (val == hdev->hdr_priority)
-		return count;
-
-	/* get current vinfo */
-	info = hdmitx_get_current_vinfo(NULL);
-
-	hdev->hdr_priority = val;
-	if (hdev->hdr_priority == 1) {
-		//clear dv support
-		memset(&hdev->rxcap.dv_info, 0x00, sizeof(struct dv_info));
-		hdmitx_vdev.dv_info = &dv_dummy;
-		//restore hdr support
-		memcpy(&hdev->rxcap.hdr_info, &hdev->rxcap.hdr_info2, sizeof(struct hdr_info));
-		//restore BT2020 support
-		hdev->rxcap.colorimetry_data = hdev->rxcap.colorimetry_data2;
-		hdrinfo_to_vinfo(&info->hdr_info, hdev);
-	} else if (hdev->hdr_priority == 2) {
-		//clear dv support
-		memset(&hdev->rxcap.dv_info, 0x00, sizeof(struct dv_info));
-		hdmitx_vdev.dv_info = &dv_dummy;
-		//clear hdr support
-		memset(&hdev->rxcap.hdr_info, 0x00, sizeof(struct hdr_info));
-		//clear BT2020 support
-		hdev->rxcap.colorimetry_data = hdev->rxcap.colorimetry_data2 & 0x1F;
-		memset(&info->hdr_info, 0, sizeof(struct hdr_info));
-	} else {
-		//restore dv support
-		memcpy(&hdev->rxcap.dv_info, &hdev->rxcap.dv_info2, sizeof(struct dv_info));
-		//restore hdr support
-		memcpy(&hdev->rxcap.hdr_info, &hdev->rxcap.hdr_info2, sizeof(struct hdr_info));
-		//restore BT2020 support
-		hdev->rxcap.colorimetry_data = hdev->rxcap.colorimetry_data2;
-		edidinfo_attach_to_vinfo(hdev);
-	}
-	/* hdmitx21_event_notify(HDMITX_HDR_PRIORITY, &hdev->hdr_priority); */
-	/* force trigger plugin event
-	 * hdmitx21_set_uevent_state(HDMITX_HPD_EVENT, 0);
-	 * hdmitx21_set_uevent(HDMITX_HPD_EVENT, 1);
-	 */
-	return count;
-}
-
 static ssize_t vrr_cap_show(struct device *dev,
 			    struct device_attribute *attr,
 			    char *buf)
@@ -3705,7 +3633,6 @@
 static DEVICE_ATTR_RW(ready);
 static DEVICE_ATTR_RO(support_3d);
 static DEVICE_ATTR_RO(hdmitx21);
-static DEVICE_ATTR_RW(hdr_priority_mode);
 
 #ifdef CONFIG_AMLOGIC_VOUT_SERVE
 static struct vinfo_s *hdmitx_get_current_vinfo(void *data)
@@ -4927,7 +4854,6 @@
 	ret = device_create_file(dev, &dev_attr_contenttype_cap);
 	ret = device_create_file(dev, &dev_attr_contenttype_mode);
 	ret = device_create_file(dev, &dev_attr_hdmitx21);
-	ret = device_create_file(dev, &dev_attr_hdr_priority_mode);
 
 #ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
 	register_early_suspend(&hdmitx_early_suspend_handler);
@@ -5080,7 +5006,6 @@
 	device_remove_file(dev, &dev_attr_hdmi_repeater_tx);
 	device_remove_file(dev, &dev_attr_hdmi_hdr_status);
 	device_remove_file(dev, &dev_attr_hdmitx21);
-	device_remove_file(dev, &dev_attr_hdr_priority_mode);
 
 	cdev_del(&hdev->cdev);
 
@@ -5299,8 +5224,7 @@
 	struct hdmitx_dev *hdev = get_hdmitx21_device();
 	unsigned int val = 0;
 
-	if ((strncmp("0", str, 1) == 0) || (strncmp("1", str, 1) == 0) ||
-		(strncmp("2", str, 1) == 0)) {
+	if ((strncmp("1", str, 1) == 0) || (strncmp("2", str, 1) == 0)) {
 		val = str[0] - '0';
 		hdev->hdr_priority = val;
 		pr_info("hdmitx boot hdr_priority: %d\n", val);
diff --git a/drivers/amlogic/memory_ext/aml_cma.c b/drivers/amlogic/memory_ext/aml_cma.c
index 37ea7a0..a245f74 100644
--- a/drivers/amlogic/memory_ext/aml_cma.c
+++ b/drivers/amlogic/memory_ext/aml_cma.c
@@ -58,7 +58,6 @@
 	struct list_head list;
 	struct completion start;
 	struct completion end;
-	struct task_struct *task;
 	spinlock_t  list_lock;		/* protect job list */
 	int cpu;
 };
@@ -67,7 +66,6 @@
 static DEFINE_PER_CPU(struct cma_pcp, cma_pcp_thread);
 static struct proc_dir_entry *dentry;
 int cma_debug_level;
-static int allow_cma_tasks;
 
 DEFINE_SPINLOCK(cma_iso_lock);
 static atomic_t cma_allocate;
@@ -433,7 +431,6 @@
 		if (!IS_ERR(task)) {
 			kthread_bind(task, cpu);
 			set_user_nice(task, -17);
-			work->task = task;
 			pr_debug("create cma task%p, for cpu %d\n", task, cpu);
 			wake_up_process(task);
 		} else {
@@ -460,10 +457,7 @@
 
 	cpumask_clear(&has_work);
 
-	if (allow_cma_tasks)
-		cpus = allow_cma_tasks;
-	else
-		cpus = num_online_cpus();
+	cpus  = num_online_cpus();
 	cnt   = count;
 	delta = count / cpus;
 	atomic_set(&ok, 0);
@@ -482,10 +476,6 @@
 		spin_unlock(&work->list_lock);
 		complete(&work->start);
 		i++;
-		if (i == cpus) {
-			cma_debug(1, NULL, "sched work to %d cpu\n", i);
-			break;
-		}
 	}
 	local_irq_restore(flags);
 
@@ -827,57 +817,15 @@
 			       size_t count, loff_t *ppos)
 {
 	int arg = 0;
-	int ok = 0;
-	int cpu;
-	struct cma_pcp *work;
-	char *buf;
 
-	buf = kmalloc(count, GFP_KERNEL);
-	if (!buf)
-		return -ENOMEM;
-
-	if (copy_from_user(buf, buffer, count))
-		goto exit;
-
-	if (!strncmp(buf, "cma_task=", 9)) {	/* option for 'cma_task=' */
-		if (sscanf(buf, "cma_task=%d", &arg) < 0)
-			goto exit;
-		if (arg <= num_online_cpus() && arg >= 1) {
-			ok = 1;
-			allow_cma_tasks = arg;
-			pr_info("set allow_cma_tasks to %d\n", allow_cma_tasks);
-		}
-		goto exit;
-	}
-
-	if (!strncmp(buf, "cma_prio=", 9)) {	/* option for 'cma_prio=' */
-		if (sscanf(buf, "cma_prio=%d", &arg) < 0)
-			goto exit;
-		if (arg >= MIN_NICE && arg < MAX_NICE) {
-			for_each_possible_cpu(cpu) {
-				work = &per_cpu(cma_pcp_thread, cpu);
-				set_user_nice(work->task, arg);
-			}
-			ok = 1;
-			pr_info("renice cma task to %d\n", arg);
-		}
-		goto exit;
-	}
-
-	if (kstrtoint(buf, 10, &arg))
+	if (kstrtoint_from_user(buffer, count, 10, &arg))
 		return -EINVAL;
 
 	if (arg > MAX_DEBUG_LEVEL)
 		return -EINVAL;
 
-	ok = 1;
 	cma_debug_level = arg;
-exit:
-	kfree(buf);
-	if (ok)
-		return count;
-	else
-		return -EINVAL;
+	return count;
 }
 
 static int cma_debug_open(struct inode *inode, struct file *file)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index b6eeb90..696beb8 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -16,7 +16,7 @@
 #include <linux/usb/ch9.h>
 
 #ifdef CONFIG_USB_CONFIGFS_F_ACC
-extern int acc_ctrlrequest_composite(struct usb_composite_dev *cdev,
+extern int acc_ctrlrequest(struct usb_composite_dev *cdev,
 				const struct usb_ctrlrequest *ctrl);
 void acc_disconnect(void);
 #endif
@@ -1599,7 +1599,7 @@
 
 #ifdef CONFIG_USB_CONFIGFS_F_ACC
 	if (value < 0)
-		value = acc_ctrlrequest_composite(cdev, c);
+		value = acc_ctrlrequest(cdev, c);
 #endif
 
 	if (value < 0)
diff --git a/drivers/usb/gadget/function/f_accessory.c b/drivers/usb/gadget/function/f_accessory.c
index 78ea5e5..1df7a5e 100644
--- a/drivers/usb/gadget/function/f_accessory.c
+++ b/drivers/usb/gadget/function/f_accessory.c
@@ -1006,26 +1006,6 @@
 }
 EXPORT_SYMBOL_GPL(acc_ctrlrequest);
 
-int acc_ctrlrequest_composite(struct usb_composite_dev *cdev,
-			      const struct usb_ctrlrequest *ctrl)
-{
-	u16 w_length = le16_to_cpu(ctrl->wLength);
-
-	if (w_length > USB_COMP_EP0_BUFSIZ) {
-		if (ctrl->bRequestType & USB_DIR_IN) {
-			/* Cast away the const, we are going to overwrite on purpose. */
-			__le16 *temp = (__le16 *)&ctrl->wLength;
-
-			*temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ);
-			w_length = USB_COMP_EP0_BUFSIZ;
-		} else {
-			return -EINVAL;
-		}
-	}
-	return acc_ctrlrequest(cdev, ctrl);
-}
-EXPORT_SYMBOL_GPL(acc_ctrlrequest_composite);
-
 static int
 __acc_function_bind(struct usb_configuration *c,
 			struct usb_function *f, bool configfs)
diff --git a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h
index 9f1f781..6c9878b 100644
--- a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h
+++ b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h
@@ -155,7 +155,6 @@
 	unsigned int Max_TMDS_Clock2; /* HDMI2.0 TMDS_CLK */
 	/* CEA861-F, Table 56, Colorimetry Data Block */
 	unsigned int colorimetry_data;
-	unsigned int colorimetry_data2;
 	unsigned int scdc_present:1;
 	unsigned int scdc_rr_capable:1; /* SCDC read request */
 	unsigned int lte_340mcsc_scramble:1;
diff --git a/include/linux/amlogic/media/vout/hdmi_tx21/hdmi_tx_module.h b/include/linux/amlogic/media/vout/hdmi_tx21/hdmi_tx_module.h
index 69654eb..b0055ea 100644
--- a/include/linux/amlogic/media/vout/hdmi_tx21/hdmi_tx_module.h
+++ b/include/linux/amlogic/media/vout/hdmi_tx21/hdmi_tx_module.h
@@ -108,7 +108,6 @@
 	u32 Max_TMDS_Clock2; /* HDMI2.0 TMDS_CLK */
 	/* CEA861-F, Table 56, Colorimetry Data Block */
 	u32 colorimetry_data;
-	u32 colorimetry_data2;
 	u32 scdc_present:1;
 	u32 scdc_rr_capable:1; /* SCDC read request */
 	u32 lte_340mcsc_scramble:1;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 98a64ca..90eec19 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5638,9 +5638,6 @@
 	return max_t(long, capacity_of(cpu) - cpu_util_without(cpu, p), 0);
 }
 
-static unsigned long use_spare_thresh = 800;
-core_param(use_spare_thresh, use_spare_thresh, ulong, 0644);
-
 /*
  * find_idlest_group finds and returns the least busy CPU group within the
  * domain.
@@ -5745,16 +5742,12 @@
 	if (sd_flag & SD_BALANCE_FORK)
 		goto skip_spare;
 
-	if (this_spare >= use_spare_thresh) {
-		if (this_spare > task_util(p) / 2 &&
-		    imbalance_scale*this_spare > 100*most_spare)
-			return NULL;
-	}
+	if (this_spare > task_util(p) / 2 &&
+	    imbalance_scale*this_spare > 100*most_spare)
+		return NULL;
 
-	if (most_spare >= use_spare_thresh) {
-		if (most_spare > task_util(p) / 2)
-			return most_spare_sg;
-	}
+	if (most_spare > task_util(p) / 2)
+		return most_spare_sg;
 
 skip_spare:
 	if (!idlest)
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
index ccc7f3d..cca3ed9 100644
--- a/sound/core/control_compat.c
+++ b/sound/core/control_compat.c
@@ -306,9 +306,7 @@
 	err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
 	if (err < 0)
 		goto error;
-	down_read(&card->controls_rwsem);
 	err = snd_ctl_elem_read(card, data);
-	up_read(&card->controls_rwsem);
 	if (err < 0)
 		goto error;
 	err = copy_ctl_value_to_user(userdata, valuep, data, type, count);
@@ -336,9 +334,7 @@
 	err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
 	if (err < 0)
 		goto error;
-	down_write(&card->controls_rwsem);
 	err = snd_ctl_elem_write(card, file, data);
-	up_write(&card->controls_rwsem);
 	if (err < 0)
 		goto error;
 	err = copy_ctl_value_to_user(userdata, valuep, data, type, count);