diff mbox series

[RFC,5/5] bluetooth: hci_mrvl: allow waiting for firmware load using notify-device

Message ID fa9cdbe5906fdcfcb37dbe682f3f46ce4b2e1b73.1666786471.git.matthias.schiffer@ew.tq-group.com (mailing list archive)
State New, archived
Headers show
Series "notify-device" for cross-driver readiness notification | expand

Commit Message

Matthias Schiffer Oct. 26, 2022, 1:15 p.m. UTC
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---
 drivers/bluetooth/hci_mrvl.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Krzysztof Kozlowski Oct. 26, 2022, 5:22 p.m. UTC | #1
On 26/10/2022 09:15, Matthias Schiffer wrote:
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> ---
>  drivers/bluetooth/hci_mrvl.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c
> index b7d764e6010f..dc55053574a9 100644
> --- a/drivers/bluetooth/hci_mrvl.c
> +++ b/drivers/bluetooth/hci_mrvl.c
> @@ -12,6 +12,7 @@
>  #include <linux/skbuff.h>
>  #include <linux/firmware.h>
>  #include <linux/module.h>
> +#include <linux/notify-device.h>
>  #include <linux/tty.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> @@ -433,9 +434,25 @@ static int mrvl_serdev_probe(struct serdev_device *serdev)
>  		return -ENOMEM;
>  
>  	if (IS_ENABLED(CONFIG_OF)) {
> +		struct device_node *firmware_ready_node;
> +		struct device *firmware_ready;
> +
>  		mrvldev->info = of_device_get_match_data(&serdev->dev);
>  		if (!mrvldev->info)
>  			return -ENODEV;
> +
> +		firmware_ready_node = of_parse_phandle(serdev->dev.of_node,
> +						       "firmware-ready", 0);

So you want us to go through five patches, find properties and OF-code,
create in our minds bindings you think about and comment on that
imaginary bindings.

I think it should work otherwise - send bindings for all of your DT
properties.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c
index b7d764e6010f..dc55053574a9 100644
--- a/drivers/bluetooth/hci_mrvl.c
+++ b/drivers/bluetooth/hci_mrvl.c
@@ -12,6 +12,7 @@ 
 #include <linux/skbuff.h>
 #include <linux/firmware.h>
 #include <linux/module.h>
+#include <linux/notify-device.h>
 #include <linux/tty.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -433,9 +434,25 @@  static int mrvl_serdev_probe(struct serdev_device *serdev)
 		return -ENOMEM;
 
 	if (IS_ENABLED(CONFIG_OF)) {
+		struct device_node *firmware_ready_node;
+		struct device *firmware_ready;
+
 		mrvldev->info = of_device_get_match_data(&serdev->dev);
 		if (!mrvldev->info)
 			return -ENODEV;
+
+		firmware_ready_node = of_parse_phandle(serdev->dev.of_node,
+						       "firmware-ready", 0);
+		if (firmware_ready_node) {
+			firmware_ready =
+				notify_device_find_by_of_node(firmware_ready_node);
+			if (!firmware_ready)
+				return -EPROBE_DEFER;
+			if (IS_ERR(firmware_ready))
+				return PTR_ERR(firmware_ready);
+			put_device(firmware_ready);
+		}
+
 	}
 
 	mrvldev->hu.serdev = serdev;