]> git.karo-electronics.de Git - linux-beck.git/commitdiff
s390/sclp: move pci related commands to separate file
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Fri, 27 Nov 2015 10:15:36 +0000 (11:15 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 15 Apr 2016 16:16:38 +0000 (18:16 +0200)
sclp commands only used by the PCI code shouldn't be build for
!CONFIG_PCI. Instead of adding more ifdefs to sclp_cmd.c just
move them to a new file.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/char/Makefile
drivers/s390/char/sclp_cmd.c
drivers/s390/char/sclp_pci.c [new file with mode: 0644]

index dd2f7c832e5e38e6b71eb17be632c4c6c81c52ba..41e28b23b26a72d0a12e623db5f63398a2b70d4e 100644 (file)
@@ -18,6 +18,8 @@ obj-$(CONFIG_SCLP_CONSOLE) += sclp_con.o
 obj-$(CONFIG_SCLP_VT220_TTY) += sclp_vt220.o
 obj-$(CONFIG_SCLP_ASYNC) += sclp_async.o
 
+obj-$(CONFIG_PCI) += sclp_pci.o
+
 obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o
 obj-$(CONFIG_VMCP) += vmcp.o
 
index d3947ea3e351316fb0fa37751c96709f3193f150..e3fc7539116b4f2c6ba43c0d1938cf407ebaac9e 100644 (file)
@@ -575,67 +575,6 @@ __initcall(sclp_detect_standby_memory);
 
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
-/*
- * PCI I/O adapter configuration related functions.
- */
-#define SCLP_CMDW_CONFIGURE_PCI                        0x001a0001
-#define SCLP_CMDW_DECONFIGURE_PCI              0x001b0001
-
-#define SCLP_RECONFIG_PCI_ATPYE                        2
-
-struct pci_cfg_sccb {
-       struct sccb_header header;
-       u8 atype;               /* adapter type */
-       u8 reserved1;
-       u16 reserved2;
-       u32 aid;                /* adapter identifier */
-} __packed;
-
-static int do_pci_configure(sclp_cmdw_t cmd, u32 fid)
-{
-       struct pci_cfg_sccb *sccb;
-       int rc;
-
-       if (!SCLP_HAS_PCI_RECONFIG)
-               return -EOPNOTSUPP;
-
-       sccb = (struct pci_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
-       if (!sccb)
-               return -ENOMEM;
-
-       sccb->header.length = PAGE_SIZE;
-       sccb->atype = SCLP_RECONFIG_PCI_ATPYE;
-       sccb->aid = fid;
-       rc = sclp_sync_request(cmd, sccb);
-       if (rc)
-               goto out;
-       switch (sccb->header.response_code) {
-       case 0x0020:
-       case 0x0120:
-               break;
-       default:
-               pr_warn("configure PCI I/O adapter failed: cmd=0x%08x  response=0x%04x\n",
-                       cmd, sccb->header.response_code);
-               rc = -EIO;
-               break;
-       }
-out:
-       free_page((unsigned long) sccb);
-       return rc;
-}
-
-int sclp_pci_configure(u32 fid)
-{
-       return do_pci_configure(SCLP_CMDW_CONFIGURE_PCI, fid);
-}
-EXPORT_SYMBOL(sclp_pci_configure);
-
-int sclp_pci_deconfigure(u32 fid)
-{
-       return do_pci_configure(SCLP_CMDW_DECONFIGURE_PCI, fid);
-}
-EXPORT_SYMBOL(sclp_pci_deconfigure);
-
 /*
  * Channel path configuration related functions.
  */
diff --git a/drivers/s390/char/sclp_pci.c b/drivers/s390/char/sclp_pci.c
new file mode 100644 (file)
index 0000000..943e925
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * PCI I/O adapter configuration related functions.
+ *
+ * Copyright IBM Corp. 2016
+ */
+#define KMSG_COMPONENT "sclp_cmd"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
+#include <linux/completion.h>
+#include <linux/export.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/err.h>
+
+#include <asm/sclp.h>
+
+#include "sclp.h"
+
+#define SCLP_CMDW_CONFIGURE_PCI                        0x001a0001
+#define SCLP_CMDW_DECONFIGURE_PCI              0x001b0001
+
+#define SCLP_RECONFIG_PCI_ATPYE                        2
+
+struct pci_cfg_sccb {
+       struct sccb_header header;
+       u8 atype;               /* adapter type */
+       u8 reserved1;
+       u16 reserved2;
+       u32 aid;                /* adapter identifier */
+} __packed;
+
+static int do_pci_configure(sclp_cmdw_t cmd, u32 fid)
+{
+       struct pci_cfg_sccb *sccb;
+       int rc;
+
+       if (!SCLP_HAS_PCI_RECONFIG)
+               return -EOPNOTSUPP;
+
+       sccb = (struct pci_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+       if (!sccb)
+               return -ENOMEM;
+
+       sccb->header.length = PAGE_SIZE;
+       sccb->atype = SCLP_RECONFIG_PCI_ATPYE;
+       sccb->aid = fid;
+       rc = sclp_sync_request(cmd, sccb);
+       if (rc)
+               goto out;
+       switch (sccb->header.response_code) {
+       case 0x0020:
+       case 0x0120:
+               break;
+       default:
+               pr_warn("configure PCI I/O adapter failed: cmd=0x%08x  response=0x%04x\n",
+                       cmd, sccb->header.response_code);
+               rc = -EIO;
+               break;
+       }
+out:
+       free_page((unsigned long) sccb);
+       return rc;
+}
+
+int sclp_pci_configure(u32 fid)
+{
+       return do_pci_configure(SCLP_CMDW_CONFIGURE_PCI, fid);
+}
+EXPORT_SYMBOL(sclp_pci_configure);
+
+int sclp_pci_deconfigure(u32 fid)
+{
+       return do_pci_configure(SCLP_CMDW_DECONFIGURE_PCI, fid);
+}
+EXPORT_SYMBOL(sclp_pci_deconfigure);