Skip to content

Commit 504d877

Browse files
author
Fox Snowpatch
committed
1 parent 182544a commit 504d877

2 files changed

Lines changed: 17 additions & 27 deletions

File tree

arch/powerpc/platforms/ps3/system-bus.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
#include "platform.h"
2222

23-
static struct device ps3_system_bus = {
24-
.init_name = "ps3_system",
25-
};
23+
static struct device *ps3_system_bus;
2624

2725
/* FIXME: need device usage counters! */
2826
static struct {
@@ -486,8 +484,8 @@ static int __init ps3_system_bus_init(void)
486484

487485
mutex_init(&usage_hack.mutex);
488486

489-
result = device_register(&ps3_system_bus);
490-
BUG_ON(result);
487+
ps3_system_bus = root_device_register("ps3_system");
488+
BUG_ON(IS_ERR(ps3_system_bus));
491489

492490
result = bus_register(&ps3_system_bus_type);
493491
BUG_ON(result);
@@ -744,7 +742,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
744742
static unsigned int dev_lpm_count;
745743

746744
if (!dev->core.parent)
747-
dev->core.parent = &ps3_system_bus;
745+
dev->core.parent = ps3_system_bus;
748746
dev->core.bus = &ps3_system_bus_type;
749747
dev->core.release = ps3_system_bus_release_device;
750748

arch/powerpc/platforms/pseries/ibmebus.c

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@
5151
#include <asm/ibmebus.h>
5252
#include <asm/machdep.h>
5353

54-
static struct device ibmebus_bus_device = { /* fake "parent" device */
55-
.init_name = "ibmebus",
56-
};
54+
static struct device *ibmebus_bus_device; /* fake "parent" device */
5755

5856
const struct bus_type ibmebus_bus_type;
5957

@@ -171,7 +169,7 @@ static int ibmebus_create_device(struct device_node *dn)
171169
struct platform_device *dev;
172170
int ret;
173171

174-
dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
172+
dev = of_device_alloc(dn, NULL, ibmebus_bus_device);
175173
if (!dev)
176174
return -ENOMEM;
177175

@@ -205,8 +203,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
205203

206204
ret = ibmebus_create_device(child);
207205
if (ret) {
208-
printk(KERN_ERR "%s: failed to create device (%i)",
209-
__func__, ret);
206+
pr_err("%s: failed to create device: %d\n", __func__, ret);
210207
of_node_put(child);
211208
break;
212209
}
@@ -284,8 +281,7 @@ static ssize_t probe_store(const struct bus_type *bus, const char *buf, size_t c
284281
ibmebus_match_path);
285282
if (dev) {
286283
put_device(dev);
287-
printk(KERN_WARNING "%s: %s has already been probed\n",
288-
__func__, path);
284+
pr_warn("%s: %s has already been probed\n", __func__, path);
289285
rc = -EEXIST;
290286
goto out;
291287
}
@@ -294,8 +290,7 @@ static ssize_t probe_store(const struct bus_type *bus, const char *buf, size_t c
294290
rc = ibmebus_create_device(dn);
295291
of_node_put(dn);
296292
} else {
297-
printk(KERN_WARNING "%s: no such device node: %s\n",
298-
__func__, path);
293+
pr_warn("%s: no such device node: %s\n", __func__, path);
299294
rc = -ENODEV;
300295
}
301296

@@ -324,8 +319,7 @@ static ssize_t remove_store(const struct bus_type *bus, const char *buf, size_t
324319
kfree(path);
325320
return count;
326321
} else {
327-
printk(KERN_WARNING "%s: %s not on the bus\n",
328-
__func__, path);
322+
pr_warn("%s: %s not on the bus\n", __func__, path);
329323

330324
kfree(path);
331325
return -ENODEV;
@@ -449,28 +443,26 @@ static int __init ibmebus_bus_init(void)
449443
{
450444
int err;
451445

452-
printk(KERN_INFO "IBM eBus Device Driver\n");
446+
pr_info("IBM eBus Device Driver\n");
453447

454448
err = bus_register(&ibmebus_bus_type);
455449
if (err) {
456-
printk(KERN_ERR "%s: failed to register IBM eBus.\n",
457-
__func__);
450+
pr_err("%s: failed to register IBM eBus\n", __func__);
458451
return err;
459452
}
460453

461-
err = device_register(&ibmebus_bus_device);
462-
if (err) {
463-
printk(KERN_WARNING "%s: device_register returned %i\n",
464-
__func__, err);
465-
put_device(&ibmebus_bus_device);
454+
ibmebus_bus_device = root_device_register("ibmebus");
455+
if (IS_ERR(ibmebus_bus_device)) {
456+
err = PTR_ERR(ibmebus_bus_device);
457+
pr_err("%s: failed to register root device: %d\n", __func__, err);
466458
bus_unregister(&ibmebus_bus_type);
467459

468460
return err;
469461
}
470462

471463
err = ibmebus_create_devices(ibmebus_matches);
472464
if (err) {
473-
device_unregister(&ibmebus_bus_device);
465+
root_device_unregister(ibmebus_bus_device);
474466
bus_unregister(&ibmebus_bus_type);
475467
return err;
476468
}

0 commit comments

Comments
 (0)