{
u32 *index;
char *name;
- int rc = 1;
+ int rc = -EINVAL;
struct slot *slot = NULL;
+ rc = rpaphp_get_drc_props(dn, NULL, &name, NULL, NULL);
+ if (rc < 0)
+ goto exit_rc;
index = (u32 *) get_property(dn, "ibm,my-drc-index", NULL);
if (!index)
goto exit_rc;
- name = get_property(dn, "ibm,loc-code", NULL);
- if (!name)
- goto exit_rc;
if (!(slot = alloc_slot_struct(dn, *index, name, 0))) {
rc = -ENOMEM;
goto exit_rc;
}
slot->dev_type = VIO_DEV;
slot->dev.vio_dev = vio_find_node(dn);
- if (!slot->dev.vio_dev)
- slot->dev.vio_dev = vio_register_device(dn);
+ if (slot->dev.vio_dev) {
+ /*
+ * rpaphp is the only owner of vio devices and
+ * does not need extra reference taken by
+ * vio_find_node
+ */
+ put_device(&slot->dev.vio_dev->dev);
+ } else
+ slot->dev.vio_dev = vio_register_device_node(dn);
if (slot->dev.vio_dev)
slot->state = CONFIGURED;
else
{
int retval = 0;
- if ((slot->dev.vio_dev = vio_register_device(slot->dn))) {
+ if ((slot->dev.vio_dev = vio_register_device_node(slot->dn))) {
info("%s: VIO adapter %s in slot[%s] has been configured\n",
__FUNCTION__, slot->dn->name, slot->name);
slot->state = CONFIGURED;