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-next>] [day] [month] [year] [list]
Message-Id: <20220814080416.7531-1-khalid.masum.92@gmail.com>
Date:   Sun, 14 Aug 2022 14:04:15 +0600
From:   Khalid Masum <khalid.masum.92@...il.com>
To:     alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        linux-acpi@...r.kernel.org,
        linux-kernel-mentees@...ts.linuxfoundation.org
Cc:     Vinod Koul <vkoul@...nel.org>,
        Bard Liao <yung-chuan.liao@...ux.intel.com>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Sanyog Kale <sanyog.r.kale@...el.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Daniel Scally <djrscally@...il.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>,
        Khalid Masum <khalid.masum.92@...il.com>
Subject: [RFC PATCH] Soundwire: Initialize multi_link with fwnode props

According to the TODO, In sw_bus_master_add, bus->multi_link is to be
populated with properties from FW node props. Make this happen by 
creating a new fwnode_handle flag FWNODE_FLAG_MULTI_LINKED and use 
the flag to store the multi_link value from intel_link_startup. Use 
this flag to initialize bus->multi_link.

Signed-off-by: Khalid Masum <khalid.masum.92@...il.com>
---
I do not think adding a new flag for fwnode_handle is a good idea.
So, what would be the best way to initialize bus->multilink with 
fwnode props?

  -- Khalid Masum

 drivers/soundwire/bus.c   | 4 ++--
 drivers/soundwire/intel.c | 1 +
 include/linux/fwnode.h    | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index a2bfb0434a67..80df1672c60b 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -74,9 +74,9 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
 
 	/*
 	 * Initialize multi_link flag
-	 * TODO: populate this flag by reading property from FW node
 	 */
-	bus->multi_link = false;
+	bus->multi_link = (fwnode->flags & FWNODE_FLAG_MULTI_LINKED)
+		== FWNODE_FLAG_MULTI_LINKED;
 	if (bus->ops->read_prop) {
 		ret = bus->ops->read_prop(bus);
 		if (ret < 0) {
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 505c5ef061e3..034d1c523ddf 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1347,6 +1347,7 @@ int intel_link_startup(struct auxiliary_device *auxdev)
 		 */
 		bus->multi_link = true;
 		bus->hw_sync_min_links = 1;
+		dev->fwnode->flags |= FWNODE_FLAG_MULTI_LINKED;
 	}
 
 	/* Initialize shim, controller */
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 9a81c4410b9f..446a52744953 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -32,6 +32,7 @@ struct device;
 #define FWNODE_FLAG_NOT_DEVICE			BIT(1)
 #define FWNODE_FLAG_INITIALIZED			BIT(2)
 #define FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD	BIT(3)
+#define FWNODE_FLAG_MULTI_LINKED		BIT(4)
 
 struct fwnode_handle {
 	struct fwnode_handle *secondary;
-- 
2.37.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ