powerpc: struct device - replace bus_id with dev_name(), dev_set_name()
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
committed by
Paul Mackerras
parent
f63837f058
commit
aab0d375e0
@@ -47,7 +47,7 @@
|
|||||||
#include <asm/abs_addr.h>
|
#include <asm/abs_addr.h>
|
||||||
|
|
||||||
static struct device ibmebus_bus_device = { /* fake "parent" device */
|
static struct device ibmebus_bus_device = { /* fake "parent" device */
|
||||||
.bus_id = "ibmebus",
|
.init_name = "ibmebus",
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bus_type ibmebus_bus_type;
|
struct bus_type ibmebus_bus_type;
|
||||||
|
@@ -14,7 +14,6 @@ static void of_device_make_bus_id(struct of_device *dev)
|
|||||||
{
|
{
|
||||||
static atomic_t bus_no_reg_magic;
|
static atomic_t bus_no_reg_magic;
|
||||||
struct device_node *node = dev->node;
|
struct device_node *node = dev->node;
|
||||||
char *name = dev->dev.bus_id;
|
|
||||||
const u32 *reg;
|
const u32 *reg;
|
||||||
u64 addr;
|
u64 addr;
|
||||||
int magic;
|
int magic;
|
||||||
@@ -27,14 +26,12 @@ static void of_device_make_bus_id(struct of_device *dev)
|
|||||||
reg = of_get_property(node, "dcr-reg", NULL);
|
reg = of_get_property(node, "dcr-reg", NULL);
|
||||||
if (reg) {
|
if (reg) {
|
||||||
#ifdef CONFIG_PPC_DCR_NATIVE
|
#ifdef CONFIG_PPC_DCR_NATIVE
|
||||||
snprintf(name, BUS_ID_SIZE, "d%x.%s",
|
dev_set_name(&dev->dev, "d%x.%s", *reg, node->name);
|
||||||
*reg, node->name);
|
|
||||||
#else /* CONFIG_PPC_DCR_NATIVE */
|
#else /* CONFIG_PPC_DCR_NATIVE */
|
||||||
addr = of_translate_dcr_address(node, *reg, NULL);
|
addr = of_translate_dcr_address(node, *reg, NULL);
|
||||||
if (addr != OF_BAD_ADDR) {
|
if (addr != OF_BAD_ADDR) {
|
||||||
snprintf(name, BUS_ID_SIZE,
|
dev_set_name(&dev->dev, "D%llx.%s",
|
||||||
"D%llx.%s", (unsigned long long)addr,
|
(unsigned long long)addr, node->name);
|
||||||
node->name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* !CONFIG_PPC_DCR_NATIVE */
|
#endif /* !CONFIG_PPC_DCR_NATIVE */
|
||||||
@@ -48,9 +45,8 @@ static void of_device_make_bus_id(struct of_device *dev)
|
|||||||
if (reg) {
|
if (reg) {
|
||||||
addr = of_translate_address(node, reg);
|
addr = of_translate_address(node, reg);
|
||||||
if (addr != OF_BAD_ADDR) {
|
if (addr != OF_BAD_ADDR) {
|
||||||
snprintf(name, BUS_ID_SIZE,
|
dev_set_name(&dev->dev, "%llx.%s",
|
||||||
"%llx.%s", (unsigned long long)addr,
|
(unsigned long long)addr, node->name);
|
||||||
node->name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +56,7 @@ static void of_device_make_bus_id(struct of_device *dev)
|
|||||||
* counter (and pray...)
|
* counter (and pray...)
|
||||||
*/
|
*/
|
||||||
magic = atomic_add_return(1, &bus_no_reg_magic);
|
magic = atomic_add_return(1, &bus_no_reg_magic);
|
||||||
snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
|
dev_set_name(&dev->dev, "%s.%d", node->name, magic - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct of_device *of_device_alloc(struct device_node *np,
|
struct of_device *of_device_alloc(struct device_node *np,
|
||||||
@@ -80,7 +76,7 @@ struct of_device *of_device_alloc(struct device_node *np,
|
|||||||
dev->dev.archdata.of_node = np;
|
dev->dev.archdata.of_node = np;
|
||||||
|
|
||||||
if (bus_id)
|
if (bus_id)
|
||||||
strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
|
dev_set_name(&dev->dev, bus_id);
|
||||||
else
|
else
|
||||||
of_device_make_bus_id(dev);
|
of_device_make_bus_id(dev);
|
||||||
|
|
||||||
|
@@ -41,9 +41,9 @@
|
|||||||
static struct bus_type vio_bus_type;
|
static struct bus_type vio_bus_type;
|
||||||
|
|
||||||
static struct vio_dev vio_bus_device = { /* fake "parent" device */
|
static struct vio_dev vio_bus_device = { /* fake "parent" device */
|
||||||
.name = vio_bus_device.dev.bus_id,
|
.name = "vio",
|
||||||
.type = "",
|
.type = "",
|
||||||
.dev.bus_id = "vio",
|
.dev.init_name = "vio",
|
||||||
.dev.bus = &vio_bus_type,
|
.dev.bus = &vio_bus_type,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1216,7 +1216,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
|
|||||||
|
|
||||||
viodev->irq = irq_of_parse_and_map(of_node, 0);
|
viodev->irq = irq_of_parse_and_map(of_node, 0);
|
||||||
|
|
||||||
snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
|
dev_set_name(&viodev->dev, "%x", *unit_address);
|
||||||
viodev->name = of_node->name;
|
viodev->name = of_node->name;
|
||||||
viodev->type = of_node->type;
|
viodev->type = of_node->type;
|
||||||
viodev->unit_address = *unit_address;
|
viodev->unit_address = *unit_address;
|
||||||
@@ -1243,7 +1243,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
|
|||||||
/* register with generic device framework */
|
/* register with generic device framework */
|
||||||
if (device_register(&viodev->dev)) {
|
if (device_register(&viodev->dev)) {
|
||||||
printk(KERN_ERR "%s: failed to register device %s\n",
|
printk(KERN_ERR "%s: failed to register device %s\n",
|
||||||
__func__, viodev->dev.bus_id);
|
__func__, dev_name(&viodev->dev));
|
||||||
/* XXX free TCE table */
|
/* XXX free TCE table */
|
||||||
kfree(viodev);
|
kfree(viodev);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1400,13 +1400,13 @@ static struct vio_dev *vio_find_name(const char *name)
|
|||||||
struct vio_dev *vio_find_node(struct device_node *vnode)
|
struct vio_dev *vio_find_node(struct device_node *vnode)
|
||||||
{
|
{
|
||||||
const uint32_t *unit_address;
|
const uint32_t *unit_address;
|
||||||
char kobj_name[BUS_ID_SIZE];
|
char kobj_name[20];
|
||||||
|
|
||||||
/* construct the kobject name from the device node */
|
/* construct the kobject name from the device node */
|
||||||
unit_address = of_get_property(vnode, "reg", NULL);
|
unit_address = of_get_property(vnode, "reg", NULL);
|
||||||
if (!unit_address)
|
if (!unit_address)
|
||||||
return NULL;
|
return NULL;
|
||||||
snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
|
snprintf(kobj_name, sizeof(kobj_name), "%x", *unit_address);
|
||||||
|
|
||||||
return vio_find_name(kobj_name);
|
return vio_find_name(kobj_name);
|
||||||
}
|
}
|
||||||
|
@@ -231,7 +231,7 @@ static void __init mpc85xx_mds_setup_arch(void)
|
|||||||
|
|
||||||
static int __init board_fixups(void)
|
static int __init board_fixups(void)
|
||||||
{
|
{
|
||||||
char phy_id[BUS_ID_SIZE];
|
char phy_id[20];
|
||||||
char *compstrs[2] = {"fsl,gianfar-mdio", "fsl,ucc-mdio"};
|
char *compstrs[2] = {"fsl,gianfar-mdio", "fsl,ucc-mdio"};
|
||||||
struct device_node *mdio;
|
struct device_node *mdio;
|
||||||
struct resource res;
|
struct resource res;
|
||||||
@@ -241,14 +241,14 @@ static int __init board_fixups(void)
|
|||||||
mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
|
mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
|
||||||
|
|
||||||
of_address_to_resource(mdio, 0, &res);
|
of_address_to_resource(mdio, 0, &res);
|
||||||
snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x",
|
snprintf(phy_id, sizeof(phy_id), "%llx:%02x",
|
||||||
(unsigned long long)res.start, 1);
|
(unsigned long long)res.start, 1);
|
||||||
|
|
||||||
phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock);
|
phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock);
|
||||||
phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
|
phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
|
||||||
|
|
||||||
/* Register a workaround for errata */
|
/* Register a workaround for errata */
|
||||||
snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x",
|
snprintf(phy_id, sizeof(phy_id), "%llx:%02x",
|
||||||
(unsigned long long)res.start, 7);
|
(unsigned long long)res.start, 7);
|
||||||
phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
|
phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
static struct device ps3_system_bus = {
|
static struct device ps3_system_bus = {
|
||||||
.bus_id = "ps3_system",
|
.init_name = "ps3_system",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME: need device usage counters! */
|
/* FIXME: need device usage counters! */
|
||||||
@@ -356,12 +356,12 @@ static int ps3_system_bus_match(struct device *_dev,
|
|||||||
if (result)
|
if (result)
|
||||||
pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
|
pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
|
||||||
__func__, __LINE__,
|
__func__, __LINE__,
|
||||||
dev->match_id, dev->match_sub_id, dev->core.bus_id,
|
dev->match_id, dev->match_sub_id, dev_name(&dev->core),
|
||||||
drv->match_id, drv->match_sub_id, drv->core.name);
|
drv->match_id, drv->match_sub_id, drv->core.name);
|
||||||
else
|
else
|
||||||
pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
|
pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
|
||||||
__func__, __LINE__,
|
__func__, __LINE__,
|
||||||
dev->match_id, dev->match_sub_id, dev->core.bus_id,
|
dev->match_id, dev->match_sub_id, dev_name(&dev->core),
|
||||||
drv->match_id, drv->match_sub_id, drv->core.name);
|
drv->match_id, drv->match_sub_id, drv->core.name);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -383,9 +383,9 @@ static int ps3_system_bus_probe(struct device *_dev)
|
|||||||
result = drv->probe(dev);
|
result = drv->probe(dev);
|
||||||
else
|
else
|
||||||
pr_debug("%s:%d: %s no probe method\n", __func__, __LINE__,
|
pr_debug("%s:%d: %s no probe method\n", __func__, __LINE__,
|
||||||
dev->core.bus_id);
|
dev_name(&dev->core));
|
||||||
|
|
||||||
pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
|
pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ static int ps3_system_bus_remove(struct device *_dev)
|
|||||||
dev_dbg(&dev->core, "%s:%d %s: no remove method\n",
|
dev_dbg(&dev->core, "%s:%d %s: no remove method\n",
|
||||||
__func__, __LINE__, drv->core.name);
|
__func__, __LINE__, drv->core.name);
|
||||||
|
|
||||||
pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
|
pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ static void ps3_system_bus_shutdown(struct device *_dev)
|
|||||||
BUG_ON(!drv);
|
BUG_ON(!drv);
|
||||||
|
|
||||||
dev_dbg(&dev->core, "%s:%d: %s -> %s\n", __func__, __LINE__,
|
dev_dbg(&dev->core, "%s:%d: %s -> %s\n", __func__, __LINE__,
|
||||||
dev->core.bus_id, drv->core.name);
|
dev_name(&dev->core), drv->core.name);
|
||||||
|
|
||||||
if (drv->shutdown)
|
if (drv->shutdown)
|
||||||
drv->shutdown(dev);
|
drv->shutdown(dev);
|
||||||
@@ -744,22 +744,18 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
|
|||||||
switch (dev->dev_type) {
|
switch (dev->dev_type) {
|
||||||
case PS3_DEVICE_TYPE_IOC0:
|
case PS3_DEVICE_TYPE_IOC0:
|
||||||
dev->core.archdata.dma_ops = &ps3_ioc0_dma_ops;
|
dev->core.archdata.dma_ops = &ps3_ioc0_dma_ops;
|
||||||
snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
|
dev_set_name(&dev->core, "ioc0_%02x", ++dev_ioc0_count);
|
||||||
"ioc0_%02x", ++dev_ioc0_count);
|
|
||||||
break;
|
break;
|
||||||
case PS3_DEVICE_TYPE_SB:
|
case PS3_DEVICE_TYPE_SB:
|
||||||
dev->core.archdata.dma_ops = &ps3_sb_dma_ops;
|
dev->core.archdata.dma_ops = &ps3_sb_dma_ops;
|
||||||
snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
|
dev_set_name(&dev->core, "sb_%02x", ++dev_sb_count);
|
||||||
"sb_%02x", ++dev_sb_count);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PS3_DEVICE_TYPE_VUART:
|
case PS3_DEVICE_TYPE_VUART:
|
||||||
snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
|
dev_set_name(&dev->core, "vuart_%02x", ++dev_vuart_count);
|
||||||
"vuart_%02x", ++dev_vuart_count);
|
|
||||||
break;
|
break;
|
||||||
case PS3_DEVICE_TYPE_LPM:
|
case PS3_DEVICE_TYPE_LPM:
|
||||||
snprintf(dev->core.bus_id, sizeof(dev->core.bus_id),
|
dev_set_name(&dev->core, "lpm_%02x", ++dev_lpm_count);
|
||||||
"lpm_%02x", ++dev_lpm_count);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BUG();
|
BUG();
|
||||||
@@ -768,7 +764,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
|
|||||||
dev->core.archdata.of_node = NULL;
|
dev->core.archdata.of_node = NULL;
|
||||||
set_dev_node(&dev->core, 0);
|
set_dev_node(&dev->core, 0);
|
||||||
|
|
||||||
pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id);
|
pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));
|
||||||
|
|
||||||
result = device_register(&dev->core);
|
result = device_register(&dev->core);
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user