Kobject: convert drivers/net/iseries_veth.c to use kobject_init/add_ng()

This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Kyle A. Lucke <klucke@us.ibm.com>
Cc: David Gibson <dwg@au1.ibm.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2007-12-17 23:05:35 -07:00
Родитель 9990513c1e
Коммит 78be3d2f57
1 изменённых файлов: 6 добавлений и 13 удалений

Просмотреть файл

@ -815,7 +815,7 @@ static int veth_init_connection(u8 rlp)
{ {
struct veth_lpar_connection *cnx; struct veth_lpar_connection *cnx;
struct veth_msg *msgs; struct veth_msg *msgs;
int i, rc; int i;
if ( (rlp == this_lp) if ( (rlp == this_lp)
|| ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) )
@ -844,11 +844,7 @@ static int veth_init_connection(u8 rlp)
/* This gets us 1 reference, which is held on behalf of the driver /* This gets us 1 reference, which is held on behalf of the driver
* infrastructure. It's released at module unload. */ * infrastructure. It's released at module unload. */
kobject_init(&cnx->kobject); kobject_init_ng(&cnx->kobject, &veth_lpar_connection_ktype);
cnx->kobject.ktype = &veth_lpar_connection_ktype;
rc = kobject_set_name(&cnx->kobject, "cnx%.2d", rlp);
if (rc != 0)
return rc;
msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL);
if (! msgs) { if (! msgs) {
@ -1087,11 +1083,8 @@ static struct net_device * __init veth_probe_one(int vlan,
return NULL; return NULL;
} }
kobject_init(&port->kobject); kobject_init_ng(&port->kobject, &veth_port_ktype);
port->kobject.parent = &dev->dev.kobj; if (0 != kobject_add_ng(&port->kobject, &dev->dev.kobj, "veth_port"))
port->kobject.ktype = &veth_port_ktype;
kobject_set_name(&port->kobject, "veth_port");
if (0 != kobject_add(&port->kobject))
veth_error("Failed adding port for %s to sysfs.\n", dev->name); veth_error("Failed adding port for %s to sysfs.\n", dev->name);
veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n",
@ -1711,9 +1704,9 @@ static int __init veth_module_init(void)
continue; continue;
kobj = &veth_cnx[i]->kobject; kobj = &veth_cnx[i]->kobject;
kobj->parent = &veth_driver.driver.kobj;
/* If the add failes, complain but otherwise continue */ /* If the add failes, complain but otherwise continue */
if (0 != kobject_add(kobj)) if (0 != kobject_add_ng(kobj, &veth_driver.driver.kobj,
"cnx%.2d", veth_cnx[i]->remote_lp))
veth_error("cnx %d: Failed adding to sysfs.\n", i); veth_error("cnx %d: Failed adding to sysfs.\n", i);
} }