Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1672624
| From | Zoltán Böszörményi <zboszor@pr.hu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/5 v2] Modify behaviour of request_*muxed_region() |
| Date | 2017-06-22 15:30 +0200 |
| Message-ID | <tValk-5i5-17@gated-at.bofh.it> (permalink) |
| References | <tUF7P-16O-1@gated-at.bofh.it> <tValj-5i5-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
v2: Fixed checkpatch.pl warnings and extended the comment
about request_declared_muxed_region.
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
---
kernel/resource.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 2be7029..5df2731 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1125,6 +1125,7 @@ resource_size_t resource_alignment(struct resource *res)
*
* request_declared_muxed_region creates a new shared busy region
* described in an existing resource descriptor.
+ * It only returns if it succeeded.
*
* release_region releases a matching busy region.
* The region is only freed if it was allocated.
@@ -1191,7 +1192,10 @@ struct resource *__request_declared_region(struct resource *parent,
continue;
}
}
- if (conflict->flags & flags & IORESOURCE_MUXED) {
+ if (flags & IORESOURCE_MUXED) {
+ if (!(conflict->flags & IORESOURCE_MUXED))
+ pr_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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5 v3] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-21 06:10 +0200
[PATCH 3/5] usb: pci-quirks: Protect the I/O port pair of SB800 Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-21 06:10 +0200
[PATCH 2/5] Modify behaviour of request_*muxed_region() Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-21 06:10 +0200
[PATCH 5/5] watchdog: sp5100_tco: Use request_declared_muxed_region() Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-21 06:10 +0200
Re: [PATCH 5/5] watchdog: sp5100_tco: Use request_declared_muxed_region() Guenter Roeck <linux@roeck-us.net> - 2017-06-21 17:10 +0200
[PATCH 1/5] Extend the request_region() infrastructure Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-21 06:10 +0200
[PATCH 4/5] i2c: i2c-piix4: Use request_declared_muxed_region() Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-21 06:10 +0200
[PATCH 1/5 v2] Extend the request_region() infrastructure Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-22 15:30 +0200
[PATCH 0/5 v4] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-22 15:30 +0200
[PATCH 2/5 v2] Modify behaviour of request_*muxed_region() Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-22 15:30 +0200
[PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800 Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-22 15:30 +0200
[PATCH 4/5 v4] i2c: i2c-piix4: Use request_declared_muxed_region() Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-22 15:30 +0200
[PATCH 5/5 v4] watchdog: sp5100_tco: Use request_declared_muxed_region() Zoltán Böszörményi <zboszor@pr.hu> - 2017-06-22 15:30 +0200
csiph-web