Re: [trivial PATCH] treewide: Convert switch/case fallthrough; to break;

2020-09-10 Thread Matthias Brugger




On 09/09/2020 22:06, Joe Perches wrote:

diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c 
b/drivers/net/wireless/mediatek/mt7601u/dma.c
index 09f931d4598c..778be26d329f 100644
--- a/drivers/net/wireless/mediatek/mt7601u/dma.c
+++ b/drivers/net/wireless/mediatek/mt7601u/dma.c
@@ -193,11 +193,11 @@ static void mt7601u_complete_rx(struct urb *urb)
case -ESHUTDOWN:
case -ENOENT:
return;
+   case 0:
+   break;
default:
dev_err_ratelimited(dev->dev, "rx urb failed: %d\n",
urb->status);
-   fallthrough;
-   case 0:
break;
}
  
@@ -238,11 +238,11 @@ static void mt7601u_complete_tx(struct urb *urb)

case -ESHUTDOWN:
case -ENOENT:
return;
+   case 0:
+   break;
default:
dev_err_ratelimited(dev->dev, "tx urb failed: %d\n",
urb->status);
-   fallthrough;
-   case 0:
break;
    }


Reviewed-by: Matthias Brugger 


Re: [PATCHv2] kernel/crash: make parse_crashkernel()'s return value more indicant

2019-04-24 Thread Matthias Brugger



On 24/04/2019 08:33, Pingfan Liu wrote:
> At present, both return and crash_size should be checked to guarantee the
> success of parse_crashkernel().
> 
> Take a close look at the cases, which causes crash_size=0. Beside syntax
> error, three cases cause parsing to get crash_size=0.
> -1st. in parse_crashkernel_mem(), the demanded crash size is bigger than
>  system ram.
> -2nd. in parse_crashkernel_mem(), the system ram size does not match any
>  item in the range list.
> -3rd. "crashkernel=0MB", which is impractical.
> 
> All these cases can be treated as invalid argument.
> 
> By this way, only need a simple check on return value of
> parse_crashkernel().
> 
> Signed-off-by: Pingfan Liu 
> Cc: Russell King 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: Tony Luck 
> Cc: Fenghua Yu 
> Cc: Ralf Baechle 
> Cc: Paul Burton 
> Cc: James Hogan 
> Cc: Benjamin Herrenschmidt 
> Cc: Paul Mackerras 
> Cc: Michael Ellerman 
> Cc: Martin Schwidefsky 
> Cc: Heiko Carstens 
> Cc: Yoshinori Sato 
> Cc: Rich Felker 
> Cc: Thomas Gleixner 
> Cc: Ingo Molnar 
> Cc: Borislav Petkov 
> Cc: "H. Peter Anvin" 
> Cc: Andrew Morton 
> Cc: Julien Thierry 
> Cc: Palmer Dabbelt 
> Cc: Ard Biesheuvel 
> Cc: Florian Fainelli 
> Cc: Logan Gunthorpe 
> Cc: Robin Murphy 
> Cc: Greg Hackmann 
> Cc: Stefan Agner 
> Cc: Johannes Weiner 
> Cc: David Hildenbrand 
> Cc: Jens Axboe 
> Cc: Thomas Bogendoerfer 
> Cc: Greg Kroah-Hartman 
> Cc: Hari Bathini 
> Cc: Ananth N Mavinakayanahalli 
> Cc: Yangtao Li 
> Cc: Dave Young 
> Cc: Baoquan He 
> Cc: x...@kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-ker...@vger.kernel.org
> Cc: linux-i...@vger.kernel.org
> Cc: linux-m...@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-s...@vger.kernel.org
> Cc: linux...@vger.kernel.org
> ---
> v1 -> v2: On error, return -EINVAL for all failure cases
> 
>  arch/arm/kernel/setup.c |  2 +-
>  arch/arm64/mm/init.c|  2 +-
>  arch/ia64/kernel/setup.c|  2 +-
>  arch/mips/kernel/setup.c|  2 +-
>  arch/powerpc/kernel/fadump.c|  2 +-
>  arch/powerpc/kernel/machine_kexec.c |  2 +-
>  arch/s390/kernel/setup.c|  2 +-
>  arch/sh/kernel/machine_kexec.c  |  2 +-
>  arch/x86/kernel/setup.c |  4 ++--
>  kernel/crash_core.c | 10 +-
>  10 files changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 5d78b6a..2feab13 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -997,7 +997,7 @@ static void __init reserve_crashkernel(void)
>   total_mem = get_total_mem();
>   ret = parse_crashkernel(boot_command_line, total_mem,
>   _size, _base);
> - if (ret)
> + if (ret < 0)
>   return;
>  
>   if (crash_base <= 0) {
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 6bc1350..240918c 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -79,7 +79,7 @@ static void __init reserve_crashkernel(void)
>   ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
>   _size, _base);
>   /* no crashkernel= or invalid value specified */
> - if (ret || !crash_size)
> + if (ret < 0)
>   return;
>  
>   crash_size = PAGE_ALIGN(crash_size);
> diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
> index 583a374..3bbb58b 100644
> --- a/arch/ia64/kernel/setup.c
> +++ b/arch/ia64/kernel/setup.c
> @@ -277,7 +277,7 @@ static void __init setup_crashkernel(unsigned long total, 
> int *n)
>  
>   ret = parse_crashkernel(boot_command_line, total,
>   , );
> - if (ret == 0 && size > 0) {
> + if (!ret) {
>   if (!base) {
>   sort_regions(rsvd_region, *n);
>   *n = merge_regions(rsvd_region, *n);
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index 8d1dc6c..168571b 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -715,7 +715,7 @@ static void __init mips_parse_crashkernel(void)
>   total_mem = get_total_mem();
>   ret = parse_crashkernel(boot_command_line, total_mem,
>   _size, _base);
> - if (ret != 0 || crash_size <= 0)
> + if (ret < 0)
>   return;
>  
>   if (!memory_region_available(crash_base, crash_size)) {
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 45a8d0b..3571504 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -376,7 +376,7 @@ static inline unsigned long 
> fadump_calculate_reserve_size(void)
>*/
>   ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
>   , );
> - if (ret == 0 && size > 0) {
> + if (!ret) {
>   unsigned long max_size;
>  
>   if 

Re: [PATCH v1 6/9] arm64: kexec: no need to ClearPageReserved()

2018-12-16 Thread Matthias Brugger



On 14/12/2018 12:10, David Hildenbrand wrote:
> This will be done by free_reserved_page().
> 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: Bhupesh Sharma 
> Cc: James Morse 
> Cc: Marc Zyngier 
> Cc: Dave Kleikamp 
> Cc: Mark Rutland 
> Cc: Andrew Morton 
> Cc: Michal Hocko 
> Cc: Matthew Wilcox 
> Acked-by: James Morse 
> Signed-off-by: David Hildenbrand 

Reviewed-by: Matthias Brugger 

> ---
>  arch/arm64/kernel/machine_kexec.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/machine_kexec.c 
> b/arch/arm64/kernel/machine_kexec.c
> index aa9c94113700..6f0587b5e941 100644
> --- a/arch/arm64/kernel/machine_kexec.c
> +++ b/arch/arm64/kernel/machine_kexec.c
> @@ -361,7 +361,6 @@ void crash_free_reserved_phys_range(unsigned long begin, 
> unsigned long end)
>  
>   for (addr = begin; addr < end; addr += PAGE_SIZE) {
>   page = phys_to_page(addr);
> - ClearPageReserved(page);
>   free_reserved_page(page);
>   }
>  }
> 


Re: [PATCH v2] watchdog: add SPDX identifiers for watchdog subsystem

2018-02-20 Thread Matthias Brugger


On 02/20/2018 11:45 AM, Marcus Folkesson wrote:
> - Add SPDX identifier
> - Remove boiler plate license text
> - If MODULE_LICENSE and boiler plate does not match, go for boiler plate
>   license
> 
> Signed-off-by: Marcus Folkesson <marcus.folkes...@gmail.com>
> Acked-by: Adam Thomson <adam.thomson.opensou...@diasemi.com>
> Acked-by: Charles Keepax <ckee...@opensource.cirrus.com>
> Acked-by: Nicolas Ferre <nicolas.fe...@microchip.com>
> Acked-by: Michal Simek <michal.si...@xilinx.com>
> ---
> 
> Notes:
> v2:
>   - Put back removed copyright texts for meson_gxbb_wdt and coh901327_wdt
>   - Change to BSD-3-Clause for meson_gxbb_wdt
> v1: Please have an extra look at meson_gxbb_wdt.c
> 
>  drivers/watchdog/acquirewdt.c  |  6 +---

[...]

>  drivers/watchdog/mpc8xxx_wdt.c |  6 +---
>  drivers/watchdog/mt7621_wdt.c  |  5 +---
>  drivers/watchdog/mtk_wdt.c | 11 +---
>  drivers/watchdog/mtx-1_wdt.c   | 11 +---
>  drivers/watchdog/mv64x60_wdt.c |  6 ++--

[...]

> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index 7ed417a765c7..498e7d4e1b66 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0+
>  /*
>   * Mediatek Watchdog Driver
>   *
> @@ -5,16 +6,6 @@
>   *
>   * Matthias Brugger <matthias@gmail.com>
>   *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
>   * Based on sunxi_wdt.c
>   */
>  

Acked-by: Matthias Brugger <matthias@gmail.com>


Re: [PATCH] soc: Convert to using %pOF instead of full_name

2017-07-19 Thread Matthias Brugger



On 07/18/2017 11:43 PM, Rob Herring wrote:

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <r...@kernel.org>
Cc: Scott Wood <o...@buserror.net>
Cc: Qiang Zhao <qiang.z...@nxp.com>
Cc: Matthias Brugger <matthias@gmail.com>
Cc: Simon Horman <ho...@verge.net.au>
Cc: Magnus Damm <magnus.d...@gmail.com>
Cc: Kukjin Kim <kg...@kernel.org>
Cc: Krzysztof Kozlowski <k...@kernel.org>
Cc: Javier Martinez Canillas <jav...@osg.samsung.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-media...@lists.infradead.org
Cc: linux-renesas-...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
---
  drivers/soc/fsl/qbman/bman_ccsr.c| 10 +-
  drivers/soc/fsl/qbman/bman_portal.c  |  8 +++-
  drivers/soc/fsl/qbman/qman_ccsr.c| 12 ++--
  drivers/soc/fsl/qbman/qman_portal.c  | 11 ---
  drivers/soc/fsl/qe/gpio.c|  4 ++--
  drivers/soc/mediatek/mtk-pmic-wrap.c |  4 ++--


For Mediatek:

Acked-by: Matthias Brugger <matthias@gmail.com>


Re: [RFC 02/11] i2c: add quirk checks to core

2015-01-12 Thread Matthias Brugger
2015-01-09 18:21 GMT+01:00 Wolfram Sang w...@the-dreams.de:
 Let the core do the checks if HW quirks prevent a transfer. Saves code
 from drivers and adds consistency.

 Signed-off-by: Wolfram Sang w...@the-dreams.de
 ---
  drivers/i2c/i2c-core.c | 53 
 ++
  1 file changed, 53 insertions(+)

 diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
 index 39d25a8cb1ad..7b10a19abf5b 100644
 --- a/drivers/i2c/i2c-core.c
 +++ b/drivers/i2c/i2c-core.c
 @@ -2063,6 +2063,56 @@ module_exit(i2c_exit);
   * 
   */

 +/* Check if val is exceeding the quirk IFF quirk is non 0 */
 +#define i2c_quirk_exceeded(val, quirk) ((quirk)  ((val)  (quirk)))
 +
 +static int i2c_quirk_error(struct i2c_adapter *adap, struct i2c_msg *msg, 
 char *err_msg)
 +{
 +   dev_err(adap-dev, quirk: %s (addr 0x%04x, size %u)\n, err_msg, 
 msg-addr, msg-len);
 +   return -EOPNOTSUPP;
 +}
 +
 +static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg 
 *msgs, int num)
 +{
 +   struct i2c_adapter_quirks *q = adap-quirks;
 +   u16 max_read = q-max_read_len, max_write = q-max_write_len;
 +   int max_num = q-max_num_msgs, i;
 +
 +   if (q-flags  I2C_ADAPTER_QUIRK_COMB_WRITE_THEN_READ)
 +   max_num = 2;
 +
 +   if (i2c_quirk_exceeded(num, max_num))
 +   return i2c_quirk_error(adap, msgs[0], too many messages);
 +
 +   if (num == 2  q-flags  I2C_ADAPTER_QUIRK_COMB_WRITE_FIRST) {
 +   if (msgs[0].flags  I2C_M_RD)
 +   return i2c_quirk_error(adap, msgs[0], invalid first 
 write msg);
 +
 +   max_write = q-max_comb_write_len;
 +   }
 +
 +   if (num == 2  q-flags  I2C_ADAPTER_QUIRK_COMB_READ_SECOND) {
 +   if (!(msgs[1].flags  I2C_M_RD) || msgs[0].addr != 
 msgs[1].addr)
 +   return i2c_quirk_error(adap, msgs[1], invalid 
 second read msg);
 +
 +   max_read = q-max_comb_read_len;
 +   }
 +
 +   for (i = 0; i  num; i++) {
 +   u16 len = msgs[i].len;
 +
 +   if (msgs[i].flags  I2C_M_RD) {
 +   if (i2c_quirk_exceeded(len, max_read))
 +   return i2c_quirk_error(adap, msgs[i], msg 
 too long);
 +   } else {
 +   if (i2c_quirk_exceeded(len, max_write))
 +   return i2c_quirk_error(adap, msgs[i], msg 
 too long);
 +   }

What about being more verbose in the error message, specifying if it
was a read or a write message that failed?

 +   }
 +
 +   return 0;
 +}
 +
  /**
   * __i2c_transfer - unlocked flavor of i2c_transfer
   * @adap: Handle to I2C bus
 @@ -2080,6 +2130,9 @@ int __i2c_transfer(struct i2c_adapter *adap, struct 
 i2c_msg *msgs, int num)
 unsigned long orig_jiffies;
 int ret, try;

 +   if (adap-quirks  i2c_check_for_quirks(adap, msgs, num))
 +   return -EOPNOTSUPP;
 +
 /* i2c_trace_msg gets enabled when tracepoint i2c_transfer gets
  * enabled.  This is an efficient way of keeping the for-loop from
  * being executed when not needed.
 --
 2.1.3


 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



-- 
motzblog.wordpress.com
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev