Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1298841 > unrolled thread
| Started by | Boqun Feng <boqun.feng@gmail.com> |
|---|---|
| First post | 2015-12-29 05:20 +0100 |
| Last post | 2015-12-29 10:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[RFC v2 0/3] sparse: Introduce __private to privatize members of structs Boqun Feng <boqun.feng@gmail.com> - 2015-12-29 05:20 +0100
[RFC v2 3/3] irq: Privatize irq_common_data::state_use_accessors Boqun Feng <boqun.feng@gmail.com> - 2015-12-29 05:30 +0100
Re: [RFC v2 3/3] irq: Privatize irq_common_data::state_use_accessors Thomas Gleixner <tglx@linutronix.de> - 2015-12-29 10:50 +0100
| From | Boqun Feng <boqun.feng@gmail.com> |
|---|---|
| Date | 2015-12-29 05:20 +0100 |
| Subject | [RFC v2 0/3] sparse: Introduce __private to privatize members of structs |
| Message-ID | <qKTVo-3Lv-5@gated-at.bofh.it> |
Hi all, This is v2 of __private. Link for v1: http://marc.info/?l=linux-sparse&m=144988906932520&w=2 Change since v1: * #undef __irqd_to_state after used (Peter Zijlstra) This patchset introduces a __private modifier for sparse to detect misuses of private members of structs. This could make maintenace a little easier and prevent some potential bugs. This patchset consists of three patches: 1. Introduce __private and related macro, also improve compiler.h a litte bit 2. Privatize rcu_node::lock 3. Privatize irq_common_data::state_use_accessors This patchset is against -rcu/rcu/next c95a158356397844a5a6deb0bd58758084f891df because it depends on commits: "rcu: Create transitive rnp->lock acquisition functions" and "rcu: Add transitivity to remaining rcu_node ->lock acquisitions Tested by 0day. Looking forward to any suggestion, question and comment ;-) Regards, Boqun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Boqun Feng <boqun.feng@gmail.com> |
|---|---|
| Date | 2015-12-29 05:30 +0100 |
| Subject | [RFC v2 3/3] irq: Privatize irq_common_data::state_use_accessors |
| Message-ID | <qKU53-3OR-3@gated-at.bofh.it> |
| In reply to | #1298841 |
irq_common_data::state_use_accessors is not designed for public use.
Therefore make it private so that people who write code accessing it
directly will get blamed by sparse. Also #undef the macro
__irqd_to_state after used in header files, so that the macro can't be
misused.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
include/linux/irq.h | 6 ++++--
kernel/irq/internals.h | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 3c1c967..cd14cd4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -137,7 +137,7 @@ struct irq_domain;
* @msi_desc: MSI descriptor
*/
struct irq_common_data {
- unsigned int state_use_accessors;
+ unsigned int __private state_use_accessors;
#ifdef CONFIG_NUMA
unsigned int node;
#endif
@@ -208,7 +208,7 @@ enum {
IRQD_FORWARDED_TO_VCPU = (1 << 20),
};
-#define __irqd_to_state(d) ((d)->common->state_use_accessors)
+#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
{
@@ -299,6 +299,8 @@ static inline void irqd_clr_forwarded_to_vcpu(struct irq_data *d)
__irqd_to_state(d) &= ~IRQD_FORWARDED_TO_VCPU;
}
+#undef __irqd_to_state
+
static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
{
return d->hwirq;
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index fcab63c..3d18293 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -160,6 +160,8 @@ irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags)
__irq_put_desc_unlock(desc, flags, false);
}
+#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
+
/*
* Manipulation functions for irq_data.state
*/
@@ -188,6 +190,8 @@ static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
return __irqd_to_state(d) & mask;
}
+#undef __irqd_to_state
+
static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc)
{
__this_cpu_inc(*desc->kstat_irqs);
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2015-12-29 10:50 +0100 |
| Subject | Re: [RFC v2 3/3] irq: Privatize irq_common_data::state_use_accessors |
| Message-ID | <qKZ4K-76v-19@gated-at.bofh.it> |
| In reply to | #1298843 |
On Tue, 29 Dec 2015, Boqun Feng wrote: > irq_common_data::state_use_accessors is not designed for public use. > Therefore make it private so that people who write code accessing it > directly will get blamed by sparse. Also #undef the macro > __irqd_to_state after used in header files, so that the macro can't be > misused. > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web