summaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/claw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/claw.c')
-rw-r--r--drivers/s390/net/claw.c82
1 files changed, 72 insertions, 10 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index c63babefb69..3c77bfe0764 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -90,7 +90,6 @@
#include <linux/timer.h>
#include <linux/types.h>
-#include "cu3088.h"
#include "claw.h"
/*
@@ -258,6 +257,9 @@ static int claw_pm_prepare(struct ccwgroup_device *gdev)
return -EPERM;
}
+/* the root device for claw group devices */
+static struct device *claw_root_dev;
+
/* ccwgroup table */
static struct ccwgroup_driver claw_group_driver = {
@@ -272,6 +274,47 @@ static struct ccwgroup_driver claw_group_driver = {
.prepare = claw_pm_prepare,
};
+static struct ccw_device_id claw_ids[] = {
+ {CCW_DEVICE(0x3088, 0x61), .driver_info = claw_channel_type_claw},
+ {},
+};
+MODULE_DEVICE_TABLE(ccw, claw_ids);
+
+static struct ccw_driver claw_ccw_driver = {
+ .owner = THIS_MODULE,
+ .name = "claw",
+ .ids = claw_ids,
+ .probe = ccwgroup_probe_ccwdev,
+ .remove = ccwgroup_remove_ccwdev,
+};
+
+static ssize_t
+claw_driver_group_store(struct device_driver *ddrv, const char *buf,
+ size_t count)
+{
+ int err;
+ err = ccwgroup_create_from_string(claw_root_dev,
+ claw_group_driver.driver_id,
+ &claw_ccw_driver, 3, buf);
+ return err ? err : count;
+}
+
+static DRIVER_ATTR(group, 0200, NULL, claw_driver_group_store);
+
+static struct attribute *claw_group_attrs[] = {
+ &driver_attr_group.attr,
+ NULL,
+};
+
+static struct attribute_group claw_group_attr_group = {
+ .attrs = claw_group_attrs,
+};
+
+static const struct attribute_group *claw_group_attr_groups[] = {
+ &claw_group_attr_group,
+ NULL,
+};
+
/*
* Key functions
*/
@@ -3326,7 +3369,11 @@ claw_remove_files(struct device *dev)
static void __exit
claw_cleanup(void)
{
- unregister_cu3088_discipline(&claw_group_driver);
+ driver_remove_file(&claw_group_driver.driver,
+ &driver_attr_group);
+ ccwgroup_driver_unregister(&claw_group_driver);
+ ccw_driver_unregister(&claw_ccw_driver);
+ root_device_unregister(claw_root_dev);
claw_unregister_debug_facility();
pr_info("Driver unloaded\n");
@@ -3348,16 +3395,31 @@ claw_init(void)
if (ret) {
pr_err("Registering with the S/390 debug feature"
" failed with error code %d\n", ret);
- return ret;
+ goto out_err;
}
CLAW_DBF_TEXT(2, setup, "init_mod");
- ret = register_cu3088_discipline(&claw_group_driver);
- if (ret) {
- CLAW_DBF_TEXT(2, setup, "init_bad");
- claw_unregister_debug_facility();
- pr_err("Registering with the cu3088 device driver failed "
- "with error code %d\n", ret);
- }
+ claw_root_dev = root_device_register("qeth");
+ ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0;
+ if (ret)
+ goto register_err;
+ ret = ccw_driver_register(&claw_ccw_driver);
+ if (ret)
+ goto ccw_err;
+ claw_group_driver.driver.groups = claw_group_attr_groups;
+ ret = ccwgroup_driver_register(&claw_group_driver);
+ if (ret)
+ goto ccwgroup_err;
+ return 0;
+
+ccwgroup_err:
+ ccw_driver_unregister(&claw_ccw_driver);
+ccw_err:
+ root_device_unregister(claw_root_dev);
+register_err:
+ CLAW_DBF_TEXT(2, setup, "init_bad");
+ claw_unregister_debug_facility();
+out_err:
+ pr_err("Initializing the claw device driver failed\n");
return ret;
}