Skip to contentSkip to conversation

Add arch specific dev_sysdata to struct device

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages Nov 10, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add arch specific dev_sysdata to struct device

Adds an arch specific struct dev_sysdata to struct device. This enables architecture to add specific fields to every device in the system, like DMA operation pointers, NUMA node ID, firmware specific data, etc...

include/asm-alpha/device.h new file +14 -0
Index: linux-cell/include/asm-alpha/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-arm/device.h new file +14 -0
Index: linux-cell/include/asm-arm/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-arm26/device.h new file +14 -0
Index: linux-cell/include/asm-arm26/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-avr32/device.h new file +14 -0
Index: linux-cell/include/asm-avr32/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-cris/device.h new file +14 -0
Index: linux-cell/include/asm-cris/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-frv/device.h new file +14 -0
Index: linux-cell/include/asm-frv/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-generic/device.h new file +14 -0
Index: linux-cell/include/asm-generic/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-h8300/device.h new file +14 -0
Index: linux-cell/include/asm-h8300/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-i386/device.h new file +14 -0
Index: linux-cell/include/asm-i386/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-ia64/device.h new file +14 -0
Index: linux-cell/include/asm-ia64/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-m32r/device.h new file +14 -0
Index: linux-cell/include/asm-m32r/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-m68k/device.h new file +14 -0
Index: linux-cell/include/asm-m68k/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-m68knommu/device.h new file +14 -0
Index: linux-cell/include/asm-m68knommu/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-mips/device.h new file +14 -0
Index: linux-cell/include/asm-mips/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-parisc/device.h new file +14 -0
Index: linux-cell/include/asm-parisc/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-powerpc/device.h new file +14 -0
Index: linux-cell/include/asm-powerpc/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-ppc/device.h new file +14 -0
Index: linux-cell/include/asm-ppc/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-s390/device.h new file +14 -0
Index: linux-cell/include/asm-s390/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-sh/device.h new file +14 -0
Index: linux-cell/include/asm-sh/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-sh64/device.h new file +14 -0
Index: linux-cell/include/asm-sh64/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-sparc/device.h new file +14 -0
Index: linux-cell/include/asm-sparc/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-sparc64/device.h new file +14 -0
Index: linux-cell/include/asm-sparc64/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-um/device.h new file +14 -0
Index: linux-cell/include/asm-um/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-v850/device.h new file +14 -0
Index: linux-cell/include/asm-v850/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-x86_64/device.h new file +14 -0
Index: linux-cell/include/asm-x86_64/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/asm-xtensa/device.h new file +14 -0
Index: linux-cell/include/asm-xtensa/device.h
===================================================================
@@ -0,0 +1,14 @@
+/*
+ * Arch specific extensions to struct device
+ *
+ * This file is released under the GPLv2
+ *
+ * See Documentation/driver-model/ for more information.
+ */
+#ifndef _ASM_DEVICE_H
+#define _ASM_DEVICE_H
+
+struct dev_sysdata {
+};
+
+#endif /* _ASM_DEVICE_H */
include/linux/device.h +3 -0
Index: linux-cell/include/linux/device.h
===================================================================
@@ -21,6 +21,7 @@
 #include <linux/pm.h>
 #include <asm/semaphore.h>
 #include <asm/atomic.h>
+#include <asm/device.h>
 
 #define DEVICE_NAME_SIZE	50
 #define DEVICE_NAME_HALF	__stringify(20)	/* Less than half to accommodate slop */
@@ -382,6 +383,8 @@ struct device {
 
 	struct dma_coherent_mem	*dma_mem; /* internal for coherent mem
 					     override */
+	/* arch specific additions */
+	struct dev_sysdata	sysdata;
 
 	/* class_device migration path */
 	struct list_head	node;
#1 lore raw
Quoted 6 lines · On Fri, 10 Nov 2006 17:58:50 +1100 Benjamin Herrenschmidt…

Adds an arch specific struct dev_sysdata to struct device. This enables architecture to add specific fields to every device in the system, like DMA operation pointers, NUMA node ID, firmware specific data, etc...

I would have done this by creating a single line asm-xxx/device.h containing

#include <asm-generic/device.h>

(except for asm-generic, of course) and then as each architecture implements its own dev_sysdata, it can flesh out its asm/device.h.

Also, I would use _ASM_<ARCH>_DEVICE_H, but thats just my preference.

Just suggestions.

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/

#2 lore raw
Quoted 11 lines · Stephen Rothwell
Quoted 6 lines · On Fri, 10 Nov 2006 17:58:50 +1100 Benjamin Herrenschmidt…

Adds an arch specific struct dev_sysdata to struct device. This enables architecture to add specific fields to every device in the system, like DMA operation pointers, NUMA node ID, firmware specific data, etc...

I would have done this by creating a single line asm-xxx/device.h containing

#include <asm-generic/device.h>

A lot of archs will add custome things, so I felt it simpler that way, but I can do it via asm-generic... Anybody else preferring it that way ?

Quoted 4 lines

(except for asm-generic, of course) and then as each architecture implements its own dev_sysdata, it can flesh out its asm/device.h.

Also, I would use _ASM_<ARCH>_DEVICE_H, but thats just my preference.

Because I'm overly lazy, I prefer just cp'ing an identical file to all asm-* dirs :-) Now I suppose it should be easy to do a little script to get it "right". I'll look into it for the patch renaming it to arch_data, I'll try to get that out later this morning.

Ben.