Linux kernel staging patches
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dave Penkler <dpenkler@gmail.com>
Cc: linux-staging@lists.linux.dev, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 4/7] staging: gpib: make port I/O code conditional
Date: Wed, 16 Oct 2024 11:15:18 +0000	[thread overview]
Message-ID: <20241016111521.1143191-5-arnd@kernel.org> (raw)
In-Reply-To: <20241016111521.1143191-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

A few of the helper modules contain functions for both IORESOURCE_MEM
and IORESOURCE_IO type access, with the latter not being supported
on all architectures but also not used by all the drivers.

Add #ifdef checks around these to allow building the library code
and use it on MMIO-only configurations.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/gpib/common/gpib_os.c  |  2 ++
 drivers/staging/gpib/nec7210/nec7210.c | 38 ++++++++++++++------------
 drivers/staging/gpib/tms9914/tms9914.c |  2 ++
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c
index e9dd7b2d1569..e93a45132a40 100644
--- a/drivers/staging/gpib/common/gpib_os.c
+++ b/drivers/staging/gpib/common/gpib_os.c
@@ -140,6 +140,7 @@ unsigned int readw_wrapper(void *address)
 };
 EXPORT_SYMBOL(readw_wrapper);
 
+#ifdef CONFIG_HAS_IOPORT
 void outb_wrapper(unsigned int value, void *address)
 {
 	outb(value, (unsigned long)(address));
@@ -163,6 +164,7 @@ unsigned int inw_wrapper(void *address)
 	return inw((unsigned long)(address));
 };
 EXPORT_SYMBOL(inw_wrapper);
+#endif
 
 /* this is a function instead of a constant because of Suse
  * defining HZ to be a function call to get_hz()
diff --git a/drivers/staging/gpib/nec7210/nec7210.c b/drivers/staging/gpib/nec7210/nec7210.c
index 632322799ed2..1330743d05fd 100644
--- a/drivers/staging/gpib/nec7210/nec7210.c
+++ b/drivers/staging/gpib/nec7210/nec7210.c
@@ -1031,6 +1031,7 @@ void nec7210_board_online(struct nec7210_priv *priv, const gpib_board_t *board)
 }
 EXPORT_SYMBOL(nec7210_board_online);
 
+#ifdef CONFIG_HAS_IOPORT
 /* wrappers for io */
 uint8_t nec7210_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num)
 {
@@ -1050,24 +1051,6 @@ void nec7210_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned
 }
 EXPORT_SYMBOL(nec7210_ioport_write_byte);
 
-uint8_t nec7210_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num)
-{
-	return readb(priv->iobase + register_num * priv->offset);
-}
-EXPORT_SYMBOL(nec7210_iomem_read_byte);
-
-void nec7210_iomem_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned int register_num)
-{
-	if (register_num == AUXMR)
-		/* locking makes absolutely sure noone accesses the
-		 * AUXMR register faster than once per microsecond
-		 */
-		nec7210_locking_iomem_write_byte(priv, data, register_num);
-	else
-		writeb(data, priv->iobase + register_num * priv->offset);
-}
-EXPORT_SYMBOL(nec7210_iomem_write_byte);
-
 /* locking variants of io wrappers, for chips that page-in registers */
 uint8_t nec7210_locking_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num)
 {
@@ -1093,6 +1076,25 @@ void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, uint8_t data,
 	spin_unlock_irqrestore(&priv->register_page_lock, flags);
 }
 EXPORT_SYMBOL(nec7210_locking_ioport_write_byte);
+#endif
+
+uint8_t nec7210_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num)
+{
+	return readb(priv->iobase + register_num * priv->offset);
+}
+EXPORT_SYMBOL(nec7210_iomem_read_byte);
+
+void nec7210_iomem_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned int register_num)
+{
+	if (register_num == AUXMR)
+		/* locking makes absolutely sure noone accesses the
+		 * AUXMR register faster than once per microsecond
+		 */
+		nec7210_locking_iomem_write_byte(priv, data, register_num);
+	else
+		writeb(data, priv->iobase + register_num * priv->offset);
+}
+EXPORT_SYMBOL(nec7210_iomem_write_byte);
 
 uint8_t nec7210_locking_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num)
 {
diff --git a/drivers/staging/gpib/tms9914/tms9914.c b/drivers/staging/gpib/tms9914/tms9914.c
index a85a796de024..b4a8ab55c5ec 100644
--- a/drivers/staging/gpib/tms9914/tms9914.c
+++ b/drivers/staging/gpib/tms9914/tms9914.c
@@ -862,6 +862,7 @@ void tms9914_online(gpib_board_t *board, struct tms9914_priv *priv)
 }
 EXPORT_SYMBOL_GPL(tms9914_online);
 
+#ifdef CONFIG_HAS_IOPORT
 // wrapper for inb
 uint8_t tms9914_ioport_read_byte(struct tms9914_priv *priv, unsigned int register_num)
 {
@@ -877,6 +878,7 @@ void tms9914_ioport_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned
 		udelay(1);
 }
 EXPORT_SYMBOL_GPL(tms9914_ioport_write_byte);
+#endif
 
 // wrapper for readb
 uint8_t tms9914_iomem_read_byte(struct tms9914_priv *priv, unsigned int register_num)
-- 
2.39.5


  parent reply	other threads:[~2024-10-16 11:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 11:15 [PATCH 0/7] staging: gpib: randconfig build fixes Arnd Bergmann
2024-10-16 11:15 ` [PATCH 1/7] staging: gpib: add module descriptions Arnd Bergmann
2024-10-16 11:15 ` [PATCH 2/7] staging: gpib: avoid unused const variables Arnd Bergmann
2024-10-16 11:15 ` [PATCH 3/7] staging: gpib: pc2: avoid calling undefined dma_free() Arnd Bergmann
2024-10-16 11:15 ` Arnd Bergmann [this message]
2024-11-08 19:29   ` [PATCH 4/7] staging: gpib: make port I/O code conditional Nathan Chancellor
2024-10-16 11:15 ` [PATCH 5/7] staging: gpib: add bus specific Kconfig dependencies Arnd Bergmann
2024-10-16 11:15 ` [PATCH 6/7] staging: gpib: use proper format string in request_module Arnd Bergmann
2024-10-16 11:15 ` [PATCH 7/7] staging: gpib: cb7210: select NEC7210 library Arnd Bergmann
2024-10-16 12:33 ` [PATCH 0/7] staging: gpib: randconfig build fixes Dave Penkler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241016111521.1143191-5-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dpenkler@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox