[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170621035349.4125-3-zboszor@pr.hu>
Date: Wed, 21 Jun 2017 05:53:46 +0200
From: Zoltán Böszörményi
<zboszor@...hu>
To: linux-kernel@...r.kernel.org
Cc: linux-usb@...r.kernel.org, linux-watchdog@...r.kernel.org,
linux-i2c@...r.kernel.org,
Paul Menzel <paulepanter@...rs.sourceforge.net>,
Christian Fetzer <fetzer.ch@...il.com>,
Jean Delvare <jdelvare@...e.com>,
Nehal Shah <nehal-bakulchandra.shah@....com>,
Tim Small <tim@...ss.co.uk>,
Guenter Roeck <linux@...ck-us.net>, kernel@...ss.net,
wim@...ana.be, jlayton@...chiereds.net, marc.2377@...il.com,
cshorler@...glemail.com, wsa@...-dreams.de,
regressions@...mhuis.info,
Zoltán Böszörményi
<zboszor@...hu>
Subject: [PATCH 2/5] Modify behaviour of request_*muxed_region()
In order to make request_*muxed_region() behave more like mutex_lock(),
a possible failure case needs to be eliminated. When drivers do not
properly share the same I/O region, e.g. one is using request_region()
and the other is using request_muxed_region(), the kernel didn't
warn the user about it. This change modifies IORESOURCE_MUXED behaviour
so it always goes to sleep waiting for the resuorce to be freed
and the inconsistent resource flag usage is logged with KERN_ERR.
Signed-off-by: Zoltán Böszörményi <zboszor@...hu>
---
kernel/resource.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 220f695..59fa426 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1150,7 +1150,9 @@ struct resource * __request_declared_region(struct resource *parent,
continue;
}
}
- if (conflict->flags & flags & IORESOURCE_MUXED) {
+ if (flags & IORESOURCE_MUXED) {
+ if (!(conflict->flags & IORESOURCE_MUXED))
+ printk(KERN_ERR "Resource conflict between muxed \"%s\" and non-muxed \"%s\" I/O regions!\n", res->name, conflict->name);
add_wait_queue(&muxed_resource_wait, &wait);
write_unlock(&resource_lock);
set_current_state(TASK_UNINTERRUPTIBLE);
--
2.9.4
Powered by blists - more mailing lists