mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
To: Eddie James <eajames@linux.ibm.com>
Cc: Ninad Palsule <ninad@linux.ibm.com>,
	linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 06/12] fsi: Make fsi_bus_type a private variable to the core
Date: Sat, 29 Nov 2025 17:57:42 +0100	[thread overview]
Message-ID: <ca576c19f0a0738ef762ad48afca644cf5c111f6.1764434226.git.ukleinek@kernel.org> (raw)
In-Reply-To: <cover.1764434226.git.ukleinek@kernel.org>

There are no users of fsi_bus_type outside of fsi-core.c, so make that
variable static, don't export it and drop the declaration from the public
header file.

As there is a usage of fsi_bus_type in fsi_create_device() the definition
of that variable must happen further up in the file to not have to add a
local declaration.
---
 drivers/fsi/fsi-core.c | 67 +++++++++++++++++++++---------------------
 include/linux/fsi.h    |  1 -
 2 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index e1ea1124282e..4e60d4b17c11 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -100,6 +100,39 @@ static int fsi_master_write(struct fsi_master *master, int link,
 		uint8_t slave_id, uint32_t addr, const void *val, size_t size);
 static int fsi_master_break(struct fsi_master *master, int link);
 
+/* FSI core & Linux bus type definitions */
+
+static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
+{
+	struct fsi_device *fsi_dev = to_fsi_dev(dev);
+	const struct fsi_driver *fsi_drv = to_fsi_drv(drv);
+	const struct fsi_device_id *id;
+
+	if (!fsi_drv->id_table)
+		return 0;
+
+	for (id = fsi_drv->id_table; id->engine_type; id++) {
+		if (id->engine_type != fsi_dev->engine_type)
+			continue;
+		if (id->version == FSI_VERSION_ANY ||
+		    id->version == fsi_dev->version) {
+			if (drv->of_match_table) {
+				if (of_driver_match_device(dev, drv))
+					return 1;
+			} else {
+				return 1;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static const struct bus_type fsi_bus_type = {
+	.name = "fsi",
+	.match = fsi_bus_match,
+};
+
 /*
  * fsi_device_read() / fsi_device_write() / fsi_device_peek()
  *
@@ -1359,34 +1392,6 @@ void fsi_master_unregister(struct fsi_master *master)
 }
 EXPORT_SYMBOL_GPL(fsi_master_unregister);
 
-/* FSI core & Linux bus type definitions */
-
-static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
-{
-	struct fsi_device *fsi_dev = to_fsi_dev(dev);
-	const struct fsi_driver *fsi_drv = to_fsi_drv(drv);
-	const struct fsi_device_id *id;
-
-	if (!fsi_drv->id_table)
-		return 0;
-
-	for (id = fsi_drv->id_table; id->engine_type; id++) {
-		if (id->engine_type != fsi_dev->engine_type)
-			continue;
-		if (id->version == FSI_VERSION_ANY ||
-		    id->version == fsi_dev->version) {
-			if (drv->of_match_table) {
-				if (of_driver_match_device(dev, drv))
-					return 1;
-			} else {
-				return 1;
-			}
-		}
-	}
-
-	return 0;
-}
-
 int fsi_driver_register(struct fsi_driver *fsi_drv)
 {
 	if (!fsi_drv)
@@ -1406,12 +1411,6 @@ void fsi_driver_unregister(struct fsi_driver *fsi_drv)
 }
 EXPORT_SYMBOL_GPL(fsi_driver_unregister);
 
-const struct bus_type fsi_bus_type = {
-	.name		= "fsi",
-	.match		= fsi_bus_match,
-};
-EXPORT_SYMBOL_GPL(fsi_bus_type);
-
 static int __init fsi_init(void)
 {
 	int rc;
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index 05be75869a69..3e3a8f3adac3 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -78,7 +78,6 @@ extern int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
 extern int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
 		const void *val, size_t size);
 
-extern const struct bus_type fsi_bus_type;
 extern const struct device_type fsi_cdev_type;
 
 enum fsi_dev_type {
-- 
2.47.3


  parent reply	other threads:[~2025-11-29 16:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-29 16:57 [PATCH 00/12] fsi: Convert to bus probe mechanism Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 01/12] fsi: Make use of module_fsi_driver() Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 02/12] fsi: Assign driver's bus in fsi_driver_register() Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 03/12] fsi: Provide thin wrappers around dev_[gs]et_data() for fsi devices Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 04/12] i2c: fsi: Drop assigning fsi bus Uwe Kleine-König
2025-12-03 17:07   ` Andi Shyti
2025-12-04 11:18     ` Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 05/12] spi: " Uwe Kleine-König
2025-12-02 17:46   ` Mark Brown
2025-11-29 16:57 ` Uwe Kleine-König [this message]
2025-11-29 16:57 ` [PATCH 07/12] fsi: Create bus specific probe and remove functions Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 08/12] fsi: master: Convert to fsi bus probe mechanism Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 09/12] fsi: sbefifo: " Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 10/12] fsi: scom: " Uwe Kleine-König
2025-11-29 16:57 ` [PATCH 11/12] i2c: fsi: " Uwe Kleine-König
2025-12-03 17:12   ` Andi Shyti
2025-11-29 16:57 ` [PATCH 12/12] spi: " Uwe Kleine-König
2025-12-02 17:46   ` Mark Brown
2025-12-05 15:30 ` [PATCH 00/12] fsi: Convert to " Uwe Kleine-König

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=ca576c19f0a0738ef762ad48afca644cf5c111f6.1764434226.git.ukleinek@kernel.org \
    --to=u.kleine-koenig@baylibre.com \
    --cc=eajames@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ninad@linux.ibm.com \
    /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

Powered by JetHome