From 4d4258d24b82ac4316702d173c1e3aaf3d361c35 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 21 Oct 2019 14:20:46 +0200 Subject: hwrng: dev-random: always use /dev/urandom /dev/random can block long after boot time. It seems there's a consensus that /dev/urandom is safe to use except for very early boot, which isn't when barebox sandbox is usually run. To make the HWRNG more useful, always use /dev/urandom. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- drivers/hw_random/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/hw_random/Kconfig b/drivers/hw_random/Kconfig index c57928204d..242a7ef278 100644 --- a/drivers/hw_random/Kconfig +++ b/drivers/hw_random/Kconfig @@ -15,11 +15,11 @@ config HWRNG_MXC_RNGC Generator hardware found on some Freescale i.MX processors. config HWRNG_DEV_RANDOM - tristate "Linux /dev/random and /dev/urandom RNG" + tristate "Linux /dev/urandom RNG" depends on SANDBOX default y help - This driver allows use of the host provided /dev/random - and /dev/urandom as barebox HWRNGs. + This driver allows use of the host provided /dev/urandom + as barebox HWRNGs. endif -- cgit v1.2.3 From ea7fa7c272320344b653e0d90a8b3d666e561493 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 28 Oct 2019 11:12:57 +0100 Subject: mfd: superio: use strerrorp helper instead of open-coding Apparently, we have a helper for strerror(-PTR_ERR(regmap)). Use it. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- drivers/mfd/superio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mfd/superio.c b/drivers/mfd/superio.c index 0f08d56cb3..12d74b40f6 100644 --- a/drivers/mfd/superio.c +++ b/drivers/mfd/superio.c @@ -88,7 +88,7 @@ void superio_chip_add(struct superio_chip *siochip) &superio_regmap_config); if (IS_ERR(regmap)) pr_warn("creating %s regmap failed: %s\n", - chipname, strerror(-PTR_ERR(regmap))); + chipname, strerrorp(regmap)); ret = regmap_register_cdev(regmap, chipname); if (ret) -- cgit v1.2.3 From 660041ba309268c3f5404da4ae1b7eba201f4c4c Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 30 Oct 2019 10:48:34 +0100 Subject: OF: gpio: don't warn if ignored GPIO flag matches the behavior Port of the upstream accepted change to the Linux kernel. Some devicetrees specify the ACTIVE_LOW flag in the fixed regulator GPIO handle. While this has always been ignored, it's consistent with the behavior of the regulator binding in the absence of the "enable-active-high" DT property. It doesn't make much sense to print a user visible warning for a configuration which is consistent, so only print the warning if the GPIO flag contradicts the behavior dictated by by the enable-active-high property. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- drivers/of/of_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/of/of_gpio.c b/drivers/of/of_gpio.c index 9a8331ed18..7cbeeaf69e 100644 --- a/drivers/of/of_gpio.c +++ b/drivers/of/of_gpio.c @@ -19,18 +19,20 @@ static void of_gpio_flags_quirks(struct device_node *np, (!(strcmp(propname, "enable-gpio") && strcmp(propname, "enable-gpios")) && of_device_is_compatible(np, "regulator-gpio")))) { + bool active_low = !of_property_read_bool(np, + "enable-active-high"); /* * The regulator GPIO handles are specified such that the * presence or absence of "enable-active-high" solely controls * the polarity of the GPIO line. Any phandle flags must * be actively ignored. */ - if (*flags & OF_GPIO_ACTIVE_LOW) { + if ((*flags & OF_GPIO_ACTIVE_LOW) && !active_low) { pr_warn("%s GPIO handle specifies active low - ignored\n", np->full_name); *flags &= ~OF_GPIO_ACTIVE_LOW; } - if (!of_property_read_bool(np, "enable-active-high")) + if (active_low) *flags |= OF_GPIO_ACTIVE_LOW; } } -- cgit v1.2.3 From cd6b02211852fa753b6a527af227aafd9d5088d4 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Wed, 30 Oct 2019 18:04:55 +0100 Subject: of: of_path: fix return in case of EPROBE_DEFER As said in commit 82eb3dff10 ("of_path: handle no driver for device") this case happens if the driver isn't probed yet. So we should return -EPROBE_DEFER to signal that. Signed-off-by: Marco Felsch Signed-off-by: Sascha Hauer --- drivers/of/of_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c index f8bbf2cba1..5c3a020345 100644 --- a/drivers/of/of_path.c +++ b/drivers/of/of_path.c @@ -83,7 +83,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **out } if (dev->bus && !dev->driver) - return -ENODEV; + return -EPROBE_DEFER; device_detect(dev); -- cgit v1.2.3 From 31227a94238830a16767d207e0668015d297e9fa Mon Sep 17 00:00:00 2001 From: Robert Karszniewicz Date: Fri, 25 Oct 2019 17:56:08 +0200 Subject: usb: storage: Increase retries for usb_stor_transport() This should make writing and reading more reliable. Also: - change loop condition to make "retries" semantically correct - add a debug message in case of fatal failure Signed-off-by: Sascha Hauer --- drivers/usb/storage/usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 63d624e91b..e0ef4f5ef3 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -87,8 +87,7 @@ static int usb_stor_transport(struct us_blk_dev *usb_blkdev, struct device_d *dev = &us->pusb_dev->dev; int i, ret; - - for (i = 0; i < retries; i++) { + for (i = 0; i <= retries; i++) { dev_dbg(dev, "%s\n", usb_stor_opcode_name(cmd[0])); ret = us->transport(usb_blkdev, cmd, cmdlen, data, datalen); dev_dbg(dev, "%s returns %d\n", usb_stor_opcode_name(cmd[0]), @@ -105,6 +104,8 @@ static int usb_stor_transport(struct us_blk_dev *usb_blkdev, mdelay(request_sense_delay_ms); } + dev_dbg(dev, "Retried %s %d times, and failed.\n", usb_stor_opcode_name(cmd[0]), retries); + return -EIO; } @@ -194,7 +195,7 @@ static int usb_stor_io_10(struct us_blk_dev *usb_blkdev, u8 opcode, put_unaligned_be16(blocks, &cmd[7]); return usb_stor_transport(usb_blkdev, cmd, sizeof(cmd), data, - blocks * SECTOR_SIZE, 2, 0); + blocks * SECTOR_SIZE, 10, 0); } /*********************************************************************** -- cgit v1.2.3