diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-12-18 01:05:35 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:30 -0500 |
commit | 78be3d2f574bf8a9886550ad07b8124b194badb8 (patch) | |
tree | 0584e2ab5190e11297534db1e6bb7671fd756483 /drivers | |
parent | 9990513c1ef040528c4e38163a073089d39c7903 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/iseries_veth.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 97bd9dc2e52e..90ff4ec5f6fc 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -815,7 +815,7 @@ static int veth_init_connection(u8 rlp) | |||
815 | { | 815 | { |
816 | struct veth_lpar_connection *cnx; | 816 | struct veth_lpar_connection *cnx; |
817 | struct veth_msg *msgs; | 817 | struct veth_msg *msgs; |
818 | int i, rc; | 818 | int i; |
819 | 819 | ||
820 | if ( (rlp == this_lp) | 820 | if ( (rlp == this_lp) |
821 | || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) | 821 | || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) |
@@ -844,11 +844,7 @@ static int veth_init_connection(u8 rlp) | |||
844 | 844 | ||
845 | /* This gets us 1 reference, which is held on behalf of the driver | 845 | /* This gets us 1 reference, which is held on behalf of the driver |
846 | * infrastructure. It's released at module unload. */ | 846 | * infrastructure. It's released at module unload. */ |
847 | kobject_init(&cnx->kobject); | 847 | kobject_init_ng(&cnx->kobject, &veth_lpar_connection_ktype); |
848 | cnx->kobject.ktype = &veth_lpar_connection_ktype; | ||
849 | rc = kobject_set_name(&cnx->kobject, "cnx%.2d", rlp); | ||
850 | if (rc != 0) | ||
851 | return rc; | ||
852 | 848 | ||
853 | msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); | 849 | msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); |
854 | if (! msgs) { | 850 | if (! msgs) { |
@@ -1087,11 +1083,8 @@ static struct net_device * __init veth_probe_one(int vlan, | |||
1087 | return NULL; | 1083 | return NULL; |
1088 | } | 1084 | } |
1089 | 1085 | ||
1090 | kobject_init(&port->kobject); | 1086 | kobject_init_ng(&port->kobject, &veth_port_ktype); |
1091 | port->kobject.parent = &dev->dev.kobj; | 1087 | if (0 != kobject_add_ng(&port->kobject, &dev->dev.kobj, "veth_port")) |
1092 | port->kobject.ktype = &veth_port_ktype; | ||
1093 | kobject_set_name(&port->kobject, "veth_port"); | ||
1094 | if (0 != kobject_add(&port->kobject)) | ||
1095 | veth_error("Failed adding port for %s to sysfs.\n", dev->name); | 1088 | veth_error("Failed adding port for %s to sysfs.\n", dev->name); |
1096 | 1089 | ||
1097 | veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", | 1090 | veth_info("%s attached to iSeries vlan %d (LPAR map = 0x%.4X)\n", |
@@ -1711,9 +1704,9 @@ static int __init veth_module_init(void) | |||
1711 | continue; | 1704 | continue; |
1712 | 1705 | ||
1713 | kobj = &veth_cnx[i]->kobject; | 1706 | kobj = &veth_cnx[i]->kobject; |
1714 | kobj->parent = &veth_driver.driver.kobj; | ||
1715 | /* If the add failes, complain but otherwise continue */ | 1707 | /* If the add failes, complain but otherwise continue */ |
1716 | if (0 != kobject_add(kobj)) | 1708 | if (0 != kobject_add_ng(kobj, &veth_driver.driver.kobj, |
1709 | "cnx%.2d", veth_cnx[i]->remote_lp)) | ||
1717 | veth_error("cnx %d: Failed adding to sysfs.\n", i); | 1710 | veth_error("cnx %d: Failed adding to sysfs.\n", i); |
1718 | } | 1711 | } |
1719 | 1712 | ||