[PATCH v1 1/1] ARM: boards: protonic-imx6: fix file system access warning

Oleksij Rempel o.rempel at pengutronix.de
Mon Mar 28 05:09:56 PDT 2022


We should not access a file system from the poller. So, do it from the
worker. This patch will fix warning on FS access for Protonic board
code.

Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
---
 arch/arm/boards/protonic-imx6/board.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c
index def155e6ba..c2706f92ff 100644
--- a/arch/arm/boards/protonic-imx6/board.c
+++ b/arch/arm/boards/protonic-imx6/board.c
@@ -21,6 +21,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <usb/usb.h>
+#include <work.h>
 
 #define GPIO_HW_REV_ID  {\
 	{IMX_GPIO_NR(2, 8), GPIOF_DIR_IN | GPIOF_ACTIVE_LOW, "rev_id0"}, \
@@ -85,9 +86,10 @@ struct prt_imx6_priv {
 	unsigned int hw_id;
 	unsigned int hw_rev;
 	const char *name;
-	struct poller_async poller;
 	unsigned int usb_delay;
 	unsigned int no_usb_check;
+	struct work_queue wq;
+	struct work_struct work;
 };
 
 struct prti6q_rfid_contents {
@@ -290,9 +292,9 @@ exit_usb_mount:
 
 #define OTG_PORTSC1 (MX6_OTG_BASE_ADDR+0x184)
 
-static void prt_imx6_check_usb_boot(void *data)
+static void prt_imx6_check_usb_boot_do_work(struct work_struct *w)
 {
-	struct prt_imx6_priv *priv = data;
+	struct prt_imx6_priv *priv = container_of(w, struct prt_imx6_priv, work);
 	struct device_d *dev = priv->dev;
 	char *second_word, *bootsrc, *usbdisk;
 	char buf[sizeof("vicut1q recovery")] = {};
@@ -371,6 +373,7 @@ exit_usb_boot:
 	free(usbdisk);
 
 	return;
+
 }
 
 static int prt_imx6_env_init(struct prt_imx6_priv *priv)
@@ -462,7 +465,6 @@ exit_bbu:
 static int prt_imx6_devices_init(void)
 {
 	struct prt_imx6_priv *priv = prt_priv;
-	int ret;
 
 	if (!priv)
 		return 0;
@@ -477,14 +479,12 @@ static int prt_imx6_devices_init(void)
 	prt_imx6_env_init(priv);
 
 	if (!priv->no_usb_check) {
-		ret = poller_async_register(&priv->poller, "usb-boot");
-		if (ret) {
-			dev_err(priv->dev, "can't setup poller\n");
-			return ret;
-		}
+		priv->wq.fn = prt_imx6_check_usb_boot_do_work;
+
+		wq_register(&priv->wq);
 
-		poller_call_async(&priv->poller, priv->usb_delay * SECOND,
-				  &prt_imx6_check_usb_boot, priv);
+		wq_queue_delayed_work(&priv->wq, &priv->work,
+				      priv->usb_delay * SECOND);
 	}
 
 	return 0;
-- 
2.30.2




More information about the barebox mailing list