Skip to contentSkip to conversation

stm/intel_th: Fix compilation warnings

PATCH New Alexander Shishkin 1 participant 3 messages Oct 6, 2015

Subsystems (4)
lore
Share & tools
lore

Alexander Shishkin

author maintainer
#0 lore raw

cover stm/intel_th: Fix compilation warnings

Hi Greg,

Here are the fixes for char-misc-testing warnings introduced by my STM/Intel TH patchset.

Alexander Shishkin (2):
stm class: Mark src::link __rcu
intel_th: Fix integer mismatch warnings

 drivers/hwtracing/intel_th/msu.c | 2 +-
 drivers/hwtracing/stm/core.c     | 9 ++++++---
 drivers/hwtracing/stm/stm.h      | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.5.3
author maintainer
#1 lore raw

PATCH 1/2 stm class: Mark src::link __rcu

Source device's link is protected with srcu, mark it as such to have proper build-time validation of accesses to this field. The update side that's dereferencing it under an update lock also needs an accessor to dereference this field to keep sparse happy.

---
 drivers/hwtracing/stm/core.c | 9 ++++++---
 drivers/hwtracing/stm/stm.h  | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/hwtracing/stm/core.c +6 -3
index b79c42c625..b6445d9e54 100644
@@ -781,17 +781,20 @@ fail_detach:
 static void __stm_source_link_drop(struct stm_source_device *src,
 				   struct stm_device *stm)
 {
+	struct stm_device *link;
+
 	spin_lock(&src->link_lock);
-	if (WARN_ON_ONCE(src->link != stm)) {
+	link = srcu_dereference_check(src->link, &stm_source_srcu, 1);
+	if (WARN_ON_ONCE(link != stm)) {
 		spin_unlock(&src->link_lock);
 		return;
 	}
 
-	stm_output_free(src->link, &src->output);
+	stm_output_free(link, &src->output);
 	/* caller must hold stm::link_lock */
 	list_del_init(&src->link_entry);
 	/* matches stm_find_device() from stm_source_link_store() */
-	stm_put_device(src->link);
+	stm_put_device(link);
 	rcu_assign_pointer(src->link, NULL);
 
 	spin_unlock(&src->link_lock);
drivers/hwtracing/stm/stm.h +1 -1
index cf33bf976a..95ece0292c 100644
@@ -74,7 +74,7 @@ struct stm_source_device {
 	struct device		dev;
 	struct stm_source_data	*data;
 	spinlock_t		link_lock;
-	struct stm_device	*link;
+	struct stm_device __rcu	*link;
 	struct list_head	link_entry;
 	/* one output per stm_source device */
 	struct stp_policy_node	*policy_node;
Signature · 1 line
2.5.3
author maintainer
#2 lore raw

PATCH 2/2 intel_th: Fix integer mismatch warnings

In reply to Alexander Shishkin

Use unsigned long in place of size_t to operate on buffer sizes and offsets to clean up the 32 bit build.

---
 drivers/hwtracing/intel_th/msu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/intel_th/msu.c +1 -1
index 99f7662e27..80a12384ed 100644
@@ -1056,7 +1056,7 @@ static int intel_th_msc_release(struct inode *inode, struct file *file)
 static ssize_t
 msc_single_to_user(struct msc *msc, char __user *buf, loff_t off, size_t len)
 {
-	size_t size = msc->nr_pages << PAGE_SHIFT, rem = len;
+	unsigned long size = msc->nr_pages << PAGE_SHIFT, rem = len;
 	unsigned long start = off, tocopy = 0;
 
 	if (msc->single_wrap) {
Signature · 1 line
2.5.3