[brcm63xx] also include the SPI driver in the gw6x00 profile
[openwrt.git] / target / linux / ps3 / patches-2.6.28 / 0005-powerpc-struct-device-replace-bus_id-with-dev_nam.patch
1 From aab0d375e01d8c16e7e5b9bd915dfaa0a815418f Mon Sep 17 00:00:00 2001
2 From: Kay Sievers <kay.sievers@vrfy.org>
3 Date: Thu, 4 Dec 2008 10:02:56 -0800
4 Subject: [PATCH] powerpc: struct device - replace bus_id with dev_name(), dev_set_name()
5
6 Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
7 Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
8 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
9 Signed-off-by: Paul Mackerras <paulus@samba.org>
10 ---
11 arch/powerpc/kernel/ibmebus.c | 2 +-
12 arch/powerpc/kernel/of_device.c | 18 +++++++-----------
13 arch/powerpc/kernel/vio.c | 12 ++++++------
14 arch/powerpc/platforms/85xx/mpc85xx_mds.c | 6 +++---
15 arch/powerpc/platforms/ps3/system-bus.c | 28 ++++++++++++----------------
16 5 files changed, 29 insertions(+), 37 deletions(-)
17
18 diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
19 index 7c65377..6e3f624 100644
20 --- a/arch/powerpc/kernel/ibmebus.c
21 +++ b/arch/powerpc/kernel/ibmebus.c
22 @@ -47,7 +47,7 @@
23 #include <asm/abs_addr.h>
24
25 static struct device ibmebus_bus_device = { /* fake "parent" device */
26 - .bus_id = "ibmebus",
27 + .init_name = "ibmebus",
28 };
29
30 struct bus_type ibmebus_bus_type;
31 diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
32 index f3c9cae..fa983a5 100644
33 --- a/arch/powerpc/kernel/of_device.c
34 +++ b/arch/powerpc/kernel/of_device.c
35 @@ -14,7 +14,6 @@ static void of_device_make_bus_id(struct of_device *dev)
36 {
37 static atomic_t bus_no_reg_magic;
38 struct device_node *node = dev->node;
39 - char *name = dev->dev.bus_id;
40 const u32 *reg;
41 u64 addr;
42 int magic;
43 @@ -27,14 +26,12 @@ static void of_device_make_bus_id(struct of_device *dev)
44 reg = of_get_property(node, "dcr-reg", NULL);
45 if (reg) {
46 #ifdef CONFIG_PPC_DCR_NATIVE
47 - snprintf(name, BUS_ID_SIZE, "d%x.%s",
48 - *reg, node->name);
49 + dev_set_name(&dev->dev, "d%x.%s", *reg, node->name);
50 #else /* CONFIG_PPC_DCR_NATIVE */
51 addr = of_translate_dcr_address(node, *reg, NULL);
52 if (addr != OF_BAD_ADDR) {
53 - snprintf(name, BUS_ID_SIZE,
54 - "D%llx.%s", (unsigned long long)addr,
55 - node->name);
56 + dev_set_name(&dev->dev, "D%llx.%s",
57 + (unsigned long long)addr, node->name);
58 return;
59 }
60 #endif /* !CONFIG_PPC_DCR_NATIVE */
61 @@ -48,9 +45,8 @@ static void of_device_make_bus_id(struct of_device *dev)
62 if (reg) {
63 addr = of_translate_address(node, reg);
64 if (addr != OF_BAD_ADDR) {
65 - snprintf(name, BUS_ID_SIZE,
66 - "%llx.%s", (unsigned long long)addr,
67 - node->name);
68 + dev_set_name(&dev->dev, "%llx.%s",
69 + (unsigned long long)addr, node->name);
70 return;
71 }
72 }
73 @@ -60,7 +56,7 @@ static void of_device_make_bus_id(struct of_device *dev)
74 * counter (and pray...)
75 */
76 magic = atomic_add_return(1, &bus_no_reg_magic);
77 - snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
78 + dev_set_name(&dev->dev, "%s.%d", node->name, magic - 1);
79 }
80
81 struct of_device *of_device_alloc(struct device_node *np,
82 @@ -80,7 +76,7 @@ struct of_device *of_device_alloc(struct device_node *np,
83 dev->dev.archdata.of_node = np;
84
85 if (bus_id)
86 - strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
87 + dev_set_name(&dev->dev, bus_id);
88 else
89 of_device_make_bus_id(dev);
90
91 diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
92 index a11e6bc..94aa7b0 100644
93 --- a/arch/powerpc/kernel/vio.c
94 +++ b/arch/powerpc/kernel/vio.c
95 @@ -41,9 +41,9 @@
96 static struct bus_type vio_bus_type;
97
98 static struct vio_dev vio_bus_device = { /* fake "parent" device */
99 - .name = vio_bus_device.dev.bus_id,
100 + .name = "vio",
101 .type = "",
102 - .dev.bus_id = "vio",
103 + .dev.init_name = "vio",
104 .dev.bus = &vio_bus_type,
105 };
106
107 @@ -1216,7 +1216,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
108
109 viodev->irq = irq_of_parse_and_map(of_node, 0);
110
111 - snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
112 + dev_set_name(&viodev->dev, "%x", *unit_address);
113 viodev->name = of_node->name;
114 viodev->type = of_node->type;
115 viodev->unit_address = *unit_address;
116 @@ -1243,7 +1243,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
117 /* register with generic device framework */
118 if (device_register(&viodev->dev)) {
119 printk(KERN_ERR "%s: failed to register device %s\n",
120 - __func__, viodev->dev.bus_id);
121 + __func__, dev_name(&viodev->dev));
122 /* XXX free TCE table */
123 kfree(viodev);
124 return NULL;
125 @@ -1400,13 +1400,13 @@ static struct vio_dev *vio_find_name(const char *name)
126 struct vio_dev *vio_find_node(struct device_node *vnode)
127 {
128 const uint32_t *unit_address;
129 - char kobj_name[BUS_ID_SIZE];
130 + char kobj_name[20];
131
132 /* construct the kobject name from the device node */
133 unit_address = of_get_property(vnode, "reg", NULL);
134 if (!unit_address)
135 return NULL;
136 - snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
137 + snprintf(kobj_name, sizeof(kobj_name), "%x", *unit_address);
138
139 return vio_find_name(kobj_name);
140 }
141 diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
142 index d3da1e6..ee0d229 100644
143 --- a/arch/powerpc/platforms/ps3/system-bus.c
144 +++ b/arch/powerpc/platforms/ps3/system-bus.c
145 @@ -31,7 +31,7 @@
146 #include "platform.h"
147
148 static struct device ps3_system_bus = {
149 - .bus_id = "ps3_system",
150 + .init_name = "ps3_system",
151 };
152
153 /* FIXME: need device usage counters! */
154 @@ -356,12 +356,12 @@ static int ps3_system_bus_match(struct device *_dev,
155 if (result)
156 pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
157 __func__, __LINE__,
158 - dev->match_id, dev->match_sub_id, dev->core.bus_id,
159 + dev->match_id, dev->match_sub_id, dev_name(&dev->core),
160 drv->match_id, drv->match_sub_id, drv->core.name);
161 else
162 pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
163 __func__, __LINE__,
164 - dev->match_id, dev->match_sub_id, dev->core.bus_id,
165 + dev->match_id, dev->match_sub_id, dev_name(&dev->core),
166 drv->match_id, drv->match_sub_id, drv->core.name);
167
168 return result;
169 @@ -383,9 +383,9 @@ static int ps3_system_bus_probe(struct device *_dev)
170 result = drv->probe(dev);
171 else
172 pr_debug("%s:%d: %s no probe method\n", __func__, __LINE__,
173 - dev->core.bus_id);
174 + dev_name(&dev->core));
175
176 - pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
177 + pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
178 return result;
179 }
180
181 @@ -407,7 +407,7 @@ static int ps3_system_bus_remove(struct device *_dev)
182 dev_dbg(&dev->core, "%s:%d %s: no remove method\n",
183 __func__, __LINE__, drv->core.name);
184
185 - pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
186 + pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
187 return result;
188 }
189
190 @@ -432,7 +432,7 @@ static void ps3_system_bus_shutdown(struct device *_dev)
191 BUG_ON(!drv);
192
193 dev_dbg(&dev->core, "%s:%d: %s -> %s\n", __func__, __LINE__,
194 - dev->core.bus_id, drv->core.name);
195 + dev_name(&dev->core), drv->core.name);
196
197 if (drv->shutdown)
198 drv->shutdown(dev);
199 @@ -744,22 +744,18 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
200 switch (dev->dev_type) {
201 case PS3_DEVICE_TYPE_IOC0:
202 dev->core.archdata.dma_ops = &ps3_ioc0_dma_ops;
203 - snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
204 - "ioc0_%02x", ++dev_ioc0_count);
205 + dev_set_name(&dev->core, "ioc0_%02x", ++dev_ioc0_count);
206 break;
207 case PS3_DEVICE_TYPE_SB:
208 dev->core.archdata.dma_ops = &ps3_sb_dma_ops;
209 - snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
210 - "sb_%02x", ++dev_sb_count);
211 + dev_set_name(&dev->core, "sb_%02x", ++dev_sb_count);
212
213 break;
214 case PS3_DEVICE_TYPE_VUART:
215 - snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
216 - "vuart_%02x", ++dev_vuart_count);
217 + dev_set_name(&dev->core, "vuart_%02x", ++dev_vuart_count);
218 break;
219 case PS3_DEVICE_TYPE_LPM:
220 - snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
221 - "lpm_%02x", ++dev_lpm_count);
222 + dev_set_name(&dev->core, "lpm_%02x", ++dev_lpm_count);
223 break;
224 default:
225 BUG();
226 @@ -768,7 +764,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
227 dev->core.archdata.of_node = NULL;
228 set_dev_node(&dev->core, 0);
229
230 - pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id);
231 + pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));
232
233 result = device_register(&dev->core);
234 return result;
235 --
236 1.6.0.4
237
This page took 0.093338 seconds and 5 git commands to generate.