diff options
author | frank.blaschka@de.ibm.com <frank.blaschka@de.ibm.com> | 2012-07-24 18:34:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-25 18:24:13 -0400 |
commit | 0b945293c4fa89347b295ccb355e5faad1585039 (patch) | |
tree | a149bf30858869e50ea17f85dfaf664a71b2abb1 /drivers/s390 | |
parent | 9fafbd4d5f97dfbabe0650a920f7a33b0b71b5d0 (diff) |
netiucv: cleanup attribute usage
Let the driver core handle device attribute creation and removal. This
will simplify the code and eliminates races between attribute
availability and userspace notification via uevents.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Acked-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/netiucv.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 8160591913f9..4ffa66c87ea5 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1854,26 +1854,11 @@ static struct attribute_group netiucv_stat_attr_group = { | |||
1854 | .attrs = netiucv_stat_attrs, | 1854 | .attrs = netiucv_stat_attrs, |
1855 | }; | 1855 | }; |
1856 | 1856 | ||
1857 | static int netiucv_add_files(struct device *dev) | 1857 | static const struct attribute_group *netiucv_attr_groups[] = { |
1858 | { | 1858 | &netiucv_stat_attr_group, |
1859 | int ret; | 1859 | &netiucv_attr_group, |
1860 | 1860 | NULL, | |
1861 | IUCV_DBF_TEXT(trace, 3, __func__); | 1861 | }; |
1862 | ret = sysfs_create_group(&dev->kobj, &netiucv_attr_group); | ||
1863 | if (ret) | ||
1864 | return ret; | ||
1865 | ret = sysfs_create_group(&dev->kobj, &netiucv_stat_attr_group); | ||
1866 | if (ret) | ||
1867 | sysfs_remove_group(&dev->kobj, &netiucv_attr_group); | ||
1868 | return ret; | ||
1869 | } | ||
1870 | |||
1871 | static void netiucv_remove_files(struct device *dev) | ||
1872 | { | ||
1873 | IUCV_DBF_TEXT(trace, 3, __func__); | ||
1874 | sysfs_remove_group(&dev->kobj, &netiucv_stat_attr_group); | ||
1875 | sysfs_remove_group(&dev->kobj, &netiucv_attr_group); | ||
1876 | } | ||
1877 | 1862 | ||
1878 | static int netiucv_register_device(struct net_device *ndev) | 1863 | static int netiucv_register_device(struct net_device *ndev) |
1879 | { | 1864 | { |
@@ -1887,6 +1872,7 @@ static int netiucv_register_device(struct net_device *ndev) | |||
1887 | dev_set_name(dev, "net%s", ndev->name); | 1872 | dev_set_name(dev, "net%s", ndev->name); |
1888 | dev->bus = &iucv_bus; | 1873 | dev->bus = &iucv_bus; |
1889 | dev->parent = iucv_root; | 1874 | dev->parent = iucv_root; |
1875 | dev->groups = netiucv_attr_groups; | ||
1890 | /* | 1876 | /* |
1891 | * The release function could be called after the | 1877 | * The release function could be called after the |
1892 | * module has been unloaded. It's _only_ task is to | 1878 | * module has been unloaded. It's _only_ task is to |
@@ -1904,22 +1890,14 @@ static int netiucv_register_device(struct net_device *ndev) | |||
1904 | put_device(dev); | 1890 | put_device(dev); |
1905 | return ret; | 1891 | return ret; |
1906 | } | 1892 | } |
1907 | ret = netiucv_add_files(dev); | ||
1908 | if (ret) | ||
1909 | goto out_unreg; | ||
1910 | priv->dev = dev; | 1893 | priv->dev = dev; |
1911 | dev_set_drvdata(dev, priv); | 1894 | dev_set_drvdata(dev, priv); |
1912 | return 0; | 1895 | return 0; |
1913 | |||
1914 | out_unreg: | ||
1915 | device_unregister(dev); | ||
1916 | return ret; | ||
1917 | } | 1896 | } |
1918 | 1897 | ||
1919 | static void netiucv_unregister_device(struct device *dev) | 1898 | static void netiucv_unregister_device(struct device *dev) |
1920 | { | 1899 | { |
1921 | IUCV_DBF_TEXT(trace, 3, __func__); | 1900 | IUCV_DBF_TEXT(trace, 3, __func__); |
1922 | netiucv_remove_files(dev); | ||
1923 | device_unregister(dev); | 1901 | device_unregister(dev); |
1924 | } | 1902 | } |
1925 | 1903 | ||