Skip to contentSkip to conversation

s390 (7/19): sysfs_create_group.

PATCH New Martin Schwidefsky 1 participant 1 message Sep 25, 2003

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 (7/19): sysfs_create_group.

Make use of sysfs_create_group in s390 device drivers.

diffstat:

 drivers/s390/block/dasd.c  |   24 ++++---
 drivers/s390/cio/device.c  |   50 ++++++++++-----
 drivers/s390/net/ctcmain.c |   15 +++-
 drivers/s390/net/lcs.c     |   12 +++
 drivers/s390/net/netiucv.c |   60 ++++++++++++------
 drivers/s390/net/qeth.c    |  146 +++++++++++++--------------------------------
 6 files changed, 155 insertions(+), 152 deletions(-)
drivers/s390/block/dasd.c +13 -11
diff -urN linux-2.6/drivers/s390/block/dasd.c linux-2.6-s390/drivers/s390/block/dasd.c
@@ -1996,20 +1996,22 @@
 
 static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
 
+static struct attribute * dasd_attrs[] = {
+	//&dev_attr_dasd.attr,
+	&dev_attr_readonly.attr,
+	&dev_attr_discipline.attr,
+	&dev_attr_use_diag.attr,
+	NULL,
+};
+
+static struct attribute_group dasd_attr_group = {
+	.attrs = dasd_attrs,
+};
+
 static int
 dasd_add_sysfs_files(struct ccw_device *cdev)
 {
-	int ret;
-
-	if (/* (ret = device_create_file(&cdev->dev, &dev_attr_dasd)) || */
-	    (ret = device_create_file(&cdev->dev, &dev_attr_readonly)) ||
-	    (ret = device_create_file(&cdev->dev, &dev_attr_discipline)) ||
-	    (ret = device_create_file(&cdev->dev, &dev_attr_use_diag))) {
-		device_remove_file(&cdev->dev, &dev_attr_discipline);
-		device_remove_file(&cdev->dev, &dev_attr_readonly);
-		/* device_remove_file(&cdev->dev, &dev_attr_dasd); */
-	}
-	return ret;
+	return sysfs_create_group(&cdev->dev.kobj, &dasd_attr_group);
 }
 
 static int __init
drivers/s390/cio/device.c +34 -16

71 lines not on this page · raw message

drivers/s390/net/ctcmain.c +11 -4
diff -urN linux-2.6/drivers/s390/net/ctcmain.c linux-2.6-s390/drivers/s390/net/ctcmain.c
@@ -2786,18 +2786,25 @@
 
 static DEVICE_ATTR(protocol, 0644, ctc_proto_show, ctc_proto_store);
 
+static struct attribute *ctc_attr[] = {
+	&dev_attr_protocol.attr,
+	NULL,
+};
+
+static struct attribute_group ctc_attr_group = {
+	.attrs = ctc_attr,
+};
+
 static int
 ctc_add_files(struct device *dev)
 {
-	return device_create_file(dev, &dev_attr_protocol);
-
+	return sysfs_create_group(&dev->kobj, &ctc_attr_group);
 }
 
 static void
 ctc_remove_files(struct device *dev)
 {
-	device_remove_file(dev, &dev_attr_protocol);
-
+	sysfs_remove_group(&dev->kobj, &ctc_attr_group);
 }
 
 /**
drivers/s390/net/lcs.c +11 -1
diff -urN linux-2.6/drivers/s390/net/lcs.c linux-2.6-s390/drivers/s390/net/lcs.c
@@ -1675,6 +1675,15 @@
 
 static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store);
 
+static struct attribute * lcs_attrs[] = {
+	&dev_attr_portno.attr,
+	NULL,
+};
+
+static struct attribute_group lcs_attr_group = {
+	.attrs = lcs_attrs,
+};
+
 /**
  * lcs_probe_device is called on establishing a new ccwgroup_device.
  */
@@ -1694,7 +1703,7 @@
 		put_device(&ccwgdev->dev);
                 return -ENOMEM;
         }
-	ret = device_create_file(&ccwgdev->dev, &dev_attr_portno);
+	ret = sysfs_create_group(&ccwgdev->dev.kobj, &lcs_attr_group);
 	if (ret) {
                 PRINT_ERR("Creating attributes failed");
 		lcs_free_card(card);
@@ -1826,6 +1835,7 @@
 	card = (struct lcs_card *)ccwgdev->dev.driver_data;
 	if (!card)
 		return 0;
+	sysfs_remove_group(&ccwgdev->dev.kobj, &lcs_attr_group);
 	lcs_cleanup_card(card);
 	lcs_free_card(card);
 	put_device(&ccwgdev->dev);
drivers/s390/net/netiucv.c +41 -19

79 lines not on this page · raw message

drivers/s390/net/qeth.c +45 -101

166 lines not on this page · raw message