Skip to contentSkip to conversation

s390: move s390_root_dev_* out of the cio layer.

PATCH In review Martin Schwidefsky 3 participants 5 messages Dec 9, 2005 – Dec 12, 2005

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

PATCH 3/17 s390: move s390_root_dev_* out of the cio layer.

From: Carsten Otte <[email protected]>

[patch 3/17] s390: move s390_root_dev_* out of the cio layer.

Extract the s390_root_dev_* functions from the common I/O layer as they are also used by non-ccw device drivers.

---

 drivers/s390/Makefile        |    2 -
 drivers/s390/block/dcssblk.c |    2 -
 drivers/s390/cio/css.c       |   41 ---------------------------------
 drivers/s390/net/cu3088.c    |    3 +-
 drivers/s390/net/iucv.c      |    2 -
 drivers/s390/net/qeth_main.c |    1 
 drivers/s390/s390_rdev.c     |   53 +++++++++++++++++++++++++++++++++++++++++++
 include/asm-s390/ccwdev.h    |    3 --
 include/asm-s390/s390_rdev.h |   15 ++++++++++++
 9 files changed, 74 insertions(+), 48 deletions(-)
drivers/s390/block/dcssblk.c +1 -1
diff -urpN linux-2.6/drivers/s390/block/dcssblk.c linux-2.6-patched/drivers/s390/block/dcssblk.c
@@ -15,7 +15,7 @@
 #include <asm/io.h>
 #include <linux/completion.h>
 #include <linux/interrupt.h>
-#include <asm/ccwdev.h> 	// for s390_root_dev_(un)register()
+#include <asm/s390_rdev.h>
 
 //#define DCSSBLK_DEBUG		/* Debug messages on/off */
 #define DCSSBLK_NAME "dcssblk"
drivers/s390/cio/css.c +0 -41

51 lines not on this page · raw message

drivers/s390/Makefile +1 -1
diff -urpN linux-2.6/drivers/s390/Makefile linux-2.6-patched/drivers/s390/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the S/390 specific device drivers
 #
 
-obj-y += s390mach.o sysinfo.o
+obj-y += s390mach.o sysinfo.o s390_rdev.o
 obj-y += cio/ block/ char/ crypto/ net/ scsi/
 
 drivers-y += drivers/s390/built-in.o
drivers/s390/net/cu3088.c +2 -1
diff -urpN linux-2.6/drivers/s390/net/cu3088.c linux-2.6-patched/drivers/s390/net/cu3088.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cu3088.c,v 1.35 2005/03/30 19:28:52 richtera Exp $
+ * $Id: cu3088.c,v 1.36 2005/10/25 14:37:17 cohuck Exp $
  *
  * CTC / LCS ccw_device driver
  *
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/err.h>
 
+#include <asm/s390_rdev.h>
 #include <asm/ccwdev.h>
 #include <asm/ccwgroup.h>
 
drivers/s390/net/iucv.c +1 -1
diff -urpN linux-2.6/drivers/s390/net/iucv.c linux-2.6-patched/drivers/s390/net/iucv.c
@@ -54,7 +54,7 @@
 #include <asm/s390_ext.h>
 #include <asm/ebcdic.h>
 #include <asm/smp.h>
-#include <asm/ccwdev.h> //for root device stuff
+#include <asm/s390_rdev.h>
 
 /* FLAGS:
  * All flags are defined in the field IPFLAGS1 of each function
drivers/s390/net/qeth_main.c +1 -0
diff -urpN linux-2.6/drivers/s390/net/qeth_main.c linux-2.6-patched/drivers/s390/net/qeth_main.c
@@ -65,6 +65,7 @@
 #include <asm/timex.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
+#include <asm/s390_rdev.h>
 
 #include "qeth.h"
 #include "qeth_mpc.h"
drivers/s390/s390_rdev.c +53 -0

53 lines not on this page · raw message

include/asm-s390/ccwdev.h +0 -3
diff -urpN linux-2.6/include/asm-s390/ccwdev.h linux-2.6-patched/include/asm-s390/ccwdev.h
@@ -185,8 +185,5 @@ extern struct ccw_device *ccw_device_pro
 extern int _ccw_device_get_device_number(struct ccw_device *);
 extern int _ccw_device_get_subchannel_number(struct ccw_device *);
 
-extern struct device *s390_root_dev_register(const char *);
-extern void s390_root_dev_unregister(struct device *);
-
 extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
 #endif /* _S390_CCWDEV_H_ */
include/asm-s390/s390_rdev.h +15 -0
diff -urpN linux-2.6/include/asm-s390/s390_rdev.h linux-2.6-patched/include/asm-s390/s390_rdev.h
@@ -0,0 +1,15 @@
+/*
+ *  include/asm-s390/ccwdev.h
+ *
+ *    Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Cornelia Huck <[email protected]>
+ *               Carsten Otte  <[email protected]>
+ *
+ *  Interface for s390 root device
+ */
+
+#ifndef _S390_RDEV_H_
+#define _S390_RDEV_H_
+extern struct device *s390_root_dev_register(const char *);
+extern void s390_root_dev_unregister(struct device *);
+#endif /* _S390_RDEV_H_ */
#1 lore raw
Quoted 19 lines · Martin Schwidefsky

...

drivers/s390/s390_rdev.c +11 -0
...
+static void
+s390_root_dev_release(struct device *dev)
+{
+	kfree(dev);
+}
...
+void
+s390_root_dev_unregister(struct device *dev)
+{
+	if (dev)
+		device_unregister(dev);
+}
...

include/asm-s390/s390_rdev.h line 14

Quoted 4 lines
include/asm-s390/s390_rdev.h +2 -0
...
+extern struct device *s390_root_dev_register(const char *);
+extern void s390_root_dev_unregister(struct device *);
...

If you do _really_ need these wrappers, simply make them "static inline"'s in the header file.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
Quoted 7 lines · Adrian Bunk

include/asm-s390/s390_rdev.h line 14

Quoted 3 lines · Martin Schwidefsky
include/asm-s390/s390_rdev.h +2 -0
+extern struct device *s390_root_dev_register(const char *);
+extern void s390_root_dev_unregister(struct device *);
...

If you do _really_ need these wrappers, simply make them "static inline"'s in the header file.

We can't. The point here is that we need an external release function that is still available after the module has been unloaded that uses these wrappers.

Signature · 6 lines
blue skies,
   Martin

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH
#3 lore raw
Quoted 9 lines · Martin Schwidefsky
Quoted 7 lines · Adrian Bunk

include/asm-s390/s390_rdev.h line 14

Quoted 3 lines · Martin Schwidefsky
include/asm-s390/s390_rdev.h +2 -0
+extern struct device *s390_root_dev_register(const char *);
+extern void s390_root_dev_unregister(struct device *);
...

If you do _really_ need these wrappers, simply make them "static inline"'s in the header file.

Quoted 3 lines

We can't. The point here is that we need an external release function that is still available after the module has been unloaded that uses these wrappers.

release is find and understandable. But the unregister one is just pretty foolish :)

thanks,

greg k-h

#4 lore raw
Quoted 10 lines · Greg KH
Quoted 9 lines · Martin Schwidefsky
Quoted 7 lines · Adrian Bunk

include/asm-s390/s390_rdev.h line 14

Quoted 3 lines · Martin Schwidefsky
include/asm-s390/s390_rdev.h +2 -0
+extern struct device *s390_root_dev_register(const char *);
+extern void s390_root_dev_unregister(struct device *);
...

If you do _really_ need these wrappers, simply make them "static inline"'s in the header file.

Quoted 6 lines
Quoted 3 lines

We can't. The point here is that we need an external release function that is still available after the module has been unloaded that uses these wrappers.

release is find and understandable. But the unregister one is just pretty foolish :)

Well, the alternative is to only have a release function somewhere that calls kfree. Which would be general-purpose "struct device"-kfree wrapper and would be callable by any piece of code. Where is the difference to calling kfree directly then? The additional indirection?

No, the release function should be related to a specific object and then you need the register/unregister functions as well.

Signature · 6 lines
blue skies,
   Martin

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH