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>] [day] [month] [year] [list]
Message-ID: <BYAPR20MB2472E58CDDC6B56773A050FABCF79@BYAPR20MB2472.namprd20.prod.outlook.com>
Date:   Sat, 23 Apr 2022 00:02:30 +0800
From:   icenowy@...look.com
To:     Marcel Holtmann <marcel@...tmann.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Luiz Augusto von Dentz <luiz.dentz@...il.com>
Cc:     linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-sunxi@...ts.linux.dev, Icenowy Zheng <icenowy@...eed.com>
Subject: [PATCH 2/3] Bluetooth: btrtl: use board DT compatible string as config postfix

From: Icenowy Zheng <icenowy@...eed.com>

Mimic the behavior of brcmfmac driver, which uses the DT compatible
string of the board as the NVRAM postfix.

Signed-off-by: Icenowy Zheng <icenowy@...eed.com>
---
 drivers/bluetooth/hci_h5.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index c5a0409ef84f..d1f90b23a5e0 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -817,6 +817,7 @@ static int h5_serdev_probe(struct serdev_device *serdev)
 {
 	struct device *dev = &serdev->dev;
 	struct h5 *h5;
+	struct device_node *root;
 	const struct h5_device_data *data;
 
 	h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL);
@@ -847,6 +848,32 @@ static int h5_serdev_probe(struct serdev_device *serdev)
 			return -ENODEV;
 
 		h5->vnd = data->vnd;
+
+		/* Set id to the first string of the machine compatible prop */
+		root = of_find_node_by_path("/");
+		if (root) {
+			int i, len;
+			char *id;
+			const char *tmp;
+
+			of_property_read_string_index(root, "compatible", 0,
+						      &tmp);
+
+			/*
+			 * get rid of '/' in the compatible string to be able
+			 * to find the FW
+			 */
+			len = strlen(tmp) + 1;
+			id = devm_kzalloc(dev, len, GFP_KERNEL);
+			strscpy(id, tmp, len);
+			for (i = 0; i < id[i]; i++) {
+				if (id[i] == '/')
+					id[i] = '-';
+			}
+			h5->id = id;
+
+			of_node_put(root);
+		}
 	}
 
 	if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ