lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1443942594-7189-2-git-send-email-itai.katz@freescale.com>
Date:	Sun, 4 Oct 2015 10:09:50 +0300
From:	<itai.katz@...escale.com>
To:	<gregkh@...uxfoundation.org>, <arnd@...db.de>,
	<devel@...verdev.osuosl.org>, <linux-kernel@...r.kernel.org>
CC:	<stuart.yoder@...escale.com>, <german.rivera@...escale.com>,
	<lijun.pan@...escale.com>, <scottwood@...escale.com>,
	<agraf@...e.de>, <bhamciu1@...escale.com>, <R89243@...escale.com>,
	<bhupesh.sharma@...escale.com>, <nir.erez@...escale.com>,
	<richard.schmitt@...escale.com>, <dan.carpenter@...cle.com>,
	Itai Katz <itai.katz@...escale.com>
Subject: [PATCH 1/5] staging: fsl-mc: abstract test for existence of fsl-mc bus

From: Itai Katz <itai.katz@...escale.com>

Add function to test for existence of an fsl-mc bus instance
instead of doing this by looking directly at a field in the
bus type struct.

Signed-off-by: Itai Katz <itai.katz@...escale.com>
---
 drivers/staging/fsl-mc/bus/mc-bus.c |   13 +++++++++++--
 drivers/staging/fsl-mc/include/mc.h |    2 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c
index 92e0702..2aaeb3a 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -39,7 +39,7 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv)
 	bool major_version_mismatch = false;
 	bool minor_version_mismatch = false;
 
-	if (WARN_ON(!fsl_mc_bus_type.dev_root))
+	if (WARN_ON(!fsl_mc_bus_exists()))
 		goto out;
 
 	if (!mc_drv->match_id_table)
@@ -206,6 +206,15 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver)
 }
 EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
 
+/**
+ * fsl_mc_bus_exists - check if a root dprc exists
+ */
+bool fsl_mc_bus_exists(void)
+{
+	return fsl_mc_bus_type.dev_root;
+}
+EXPORT_SYMBOL_GPL(fsl_mc_bus_exists);
+
 static int get_dprc_icid(struct fsl_mc_io *mc_io,
 			 int container_id, u16 *icid)
 {
@@ -407,7 +416,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
 
 			mc_io2 = mc_io;
 
-			if (!fsl_mc_bus_type.dev_root)
+			if (!fsl_mc_bus_exists())
 				fsl_mc_bus_type.dev_root = &mc_dev->dev;
 		}
 
diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h
index 860bf26..a933291 100644
--- a/drivers/staging/fsl-mc/include/mc.h
+++ b/drivers/staging/fsl-mc/include/mc.h
@@ -182,6 +182,8 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver,
 
 void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
 
+bool fsl_mc_bus_exists(void);
+
 int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
 					u16 mc_io_flags,
 					struct fsl_mc_io **new_mc_io);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ