Re: [PATCH v2 09/11] gunyah: rsc_mgr: Add auxiliary devices for console

From
Dmitry Baryshkov <hidden>
Date
2022-08-02 08:38:57
Also in
linux-arm-msm, linux-devicetree, linux-doc
Reply to
Elliot Berman, 2022-08-01
On 02/08/2022 00:12, Elliot Berman wrote:
quoted hunk ↗ jump to hunk
Gunyah resource manager exposes a concrete functionalities which
complicate a single resource manager driver. Use auxiliary bus
to help split high level functions for the resource manager and keep the
primary resource manager driver focused on the RPC with RM itself.
Delegate Resource Manager's console functionality to the auxiliary bus.

Signed-off-by: Elliot Berman <redacted>
---
  drivers/virt/gunyah/rsc_mgr.c | 61 ++++++++++++++++++++++++++++++++++-
  1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/drivers/virt/gunyah/rsc_mgr.c b/drivers/virt/gunyah/rsc_mgr.c
index b8268ee02fab..44b22cef7d44 100644
--- a/drivers/virt/gunyah/rsc_mgr.c
+++ b/drivers/virt/gunyah/rsc_mgr.c
@@ -91,6 +91,11 @@ struct gh_rm_notif_complete {
  	struct work_struct work;
  };
  
+struct gh_rsc_mgr_adev {
+	struct auxiliary_device adev;
+	struct list_head list;
+};
+
  struct gh_rsc_mgr {
  	struct task_struct *recv_task;
  	struct gunyah_device *msgq_tx, *msgq_rx;
@@ -99,6 +104,13 @@ struct gh_rsc_mgr {
  	struct mutex call_idr_lock;
  
  	struct mutex send_lock;
+
+	struct list_head adevs;
+};
+
+/* List of auxiliary devices which resource manager creates */
+static const char * const adev_names[] = {
+	"console",
  };
Which other auxilliary devices do you expect at this moment?
quoted hunk ↗ jump to hunk
  
  static struct gh_rsc_mgr *__rsc_mgr;
@@ -516,6 +528,14 @@ int gh_rm_unregister_notifier(struct notifier_block *nb)
  }
  EXPORT_SYMBOL_GPL(gh_rm_unregister_notifier);
  
+static void gh_rm_adev_release(struct device *dev)
+{
+	struct gh_rsc_mgr_adev *rm_adev = container_of(dev, struct gh_rsc_mgr_adev, adev.dev);
+
+	list_del(&rm_adev->list);
is there a race for the rsc_mgr->list? Can multiple release functions be called in parallel?
Rather than having a list, it would be easier to have an array of devices. Less race conditions, simpler code.

Or just add gh_rsc_msg->console_adev and use it directly without any additional bells and whistles.
quoted hunk ↗ jump to hunk
+	kfree(rm_adev);
+}
+
  static struct gunyah_device *gh_msgq_platform_probe_direction(struct platform_device *pdev,
  				u8 gh_type, int idx)
  {
-- 
With best wishes
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (49 messages) 49 messages, 9 authors, last reply 2022-08-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help