mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ARM: boards: protonic-imx6: fix file system access warning
@ 2022-03-28 12:09 Oleksij Rempel
  2022-04-01 13:03 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2022-03-28 12:09 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] ARM: boards: protonic-imx6: fix file system access warning
  2022-03-28 12:09 [PATCH v1 1/1] ARM: boards: protonic-imx6: fix file system access warning Oleksij Rempel
@ 2022-04-01 13:03 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-04-01 13:03 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: barebox

On Mon, Mar 28, 2022 at 02:09:56PM +0200, Oleksij Rempel wrote:
> 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@pengutronix.de>
> ---
>  arch/arm/boards/protonic-imx6/board.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-01 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 12:09 [PATCH v1 1/1] ARM: boards: protonic-imx6: fix file system access warning Oleksij Rempel
2022-04-01 13:03 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox