w1: struct device - replace bus_id with dev_name(), dev_set_name()

CC: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Kay Sievers 2009-01-06 10:44:34 -08:00 committed by Greg Kroah-Hartman
parent 2a678cc539
commit 40f91de6a1
2 changed files with 10 additions and 12 deletions

View file

@ -197,7 +197,7 @@ struct device_driver w1_master_driver = {
struct device w1_master_device = { struct device w1_master_device = {
.parent = NULL, .parent = NULL,
.bus = &w1_bus_type, .bus = &w1_bus_type,
.bus_id = "w1 bus master", .init_name = "w1 bus master",
.driver = &w1_master_driver, .driver = &w1_master_driver,
.release = &w1_master_release .release = &w1_master_release
}; };
@ -211,7 +211,7 @@ static struct device_driver w1_slave_driver = {
struct device w1_slave_device = { struct device w1_slave_device = {
.parent = NULL, .parent = NULL,
.bus = &w1_bus_type, .bus = &w1_bus_type,
.bus_id = "w1 bus slave", .init_name = "w1 bus slave",
.driver = &w1_slave_driver, .driver = &w1_slave_driver,
.release = &w1_slave_release .release = &w1_slave_release
}; };
@ -573,7 +573,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
} }
dev_dbg(dev, "Hotplug event for %s %s, bus_id=%s.\n", dev_dbg(dev, "Hotplug event for %s %s, bus_id=%s.\n",
event_owner, name, dev->bus_id); event_owner, name, dev_name(dev));
if (dev->driver != &w1_slave_driver || !sl) if (dev->driver != &w1_slave_driver || !sl)
return 0; return 0;
@ -605,8 +605,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
sl->dev.bus = &w1_bus_type; sl->dev.bus = &w1_bus_type;
sl->dev.release = &w1_slave_release; sl->dev.release = &w1_slave_release;
snprintf(&sl->dev.bus_id[0], sizeof(sl->dev.bus_id), dev_set_name(&sl->dev, "%02x-%012llx",
"%02x-%012llx",
(unsigned int) sl->reg_num.family, (unsigned int) sl->reg_num.family,
(unsigned long long) sl->reg_num.id); (unsigned long long) sl->reg_num.id);
snprintf(&sl->name[0], sizeof(sl->name), snprintf(&sl->name[0], sizeof(sl->name),
@ -615,13 +614,13 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
(unsigned long long) sl->reg_num.id); (unsigned long long) sl->reg_num.id);
dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__, dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__,
&sl->dev.bus_id[0], sl); dev_name(&sl->dev), sl);
err = device_register(&sl->dev); err = device_register(&sl->dev);
if (err < 0) { if (err < 0) {
dev_err(&sl->dev, dev_err(&sl->dev,
"Device registration [%s] failed. err=%d\n", "Device registration [%s] failed. err=%d\n",
sl->dev.bus_id, err); dev_name(&sl->dev), err);
return err; return err;
} }
@ -630,7 +629,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
if (err < 0) { if (err < 0) {
dev_err(&sl->dev, dev_err(&sl->dev,
"sysfs file creation for [%s] failed. err=%d\n", "sysfs file creation for [%s] failed. err=%d\n",
sl->dev.bus_id, err); dev_name(&sl->dev), err);
goto out_unreg; goto out_unreg;
} }
@ -639,7 +638,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
if (err < 0) { if (err < 0) {
dev_err(&sl->dev, dev_err(&sl->dev,
"sysfs file creation for [%s] failed. err=%d\n", "sysfs file creation for [%s] failed. err=%d\n",
sl->dev.bus_id, err); dev_name(&sl->dev), err);
goto out_rem1; goto out_rem1;
} }
@ -648,7 +647,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
((err = sl->family->fops->add_slave(sl)) < 0)) { ((err = sl->family->fops->add_slave(sl)) < 0)) {
dev_err(&sl->dev, dev_err(&sl->dev,
"sysfs file creation for [%s] failed. err=%d\n", "sysfs file creation for [%s] failed. err=%d\n",
sl->dev.bus_id, err); dev_name(&sl->dev), err);
goto out_rem2; goto out_rem2;
} }

View file

@ -75,8 +75,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
mutex_init(&dev->mutex); mutex_init(&dev->mutex);
memcpy(&dev->dev, device, sizeof(struct device)); memcpy(&dev->dev, device, sizeof(struct device));
snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), dev_set_name(&dev->dev, "w1_bus_master%u", dev->id);
"w1_bus_master%u", dev->id);
snprintf(dev->name, sizeof(dev->name), "w1_bus_master%u", dev->id); snprintf(dev->name, sizeof(dev->name), "w1_bus_master%u", dev->id);
dev->driver = driver; dev->driver = driver;