linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (nct6883) Support NCT6686D
@ 2021-03-03  3:20 Jiqi Li
  2021-03-03  5:47 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Jiqi Li @ 2021-03-03  3:20 UTC (permalink / raw)
  To: jdelvare, linux, linux-hwmon, linux-kernel; +Cc: markpearson, Jiqi Li

Add support for NCT6686D chip used in the Lenovo P620.

Signed-off-by: Jiqi Li <lijq9@lenovo.com>
Reviewed-by: Mark Pearson <markpearson@lenovo.com>
---
 drivers/hwmon/nct6683.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index a23047a3bfe2..256e8d62f858 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * nct6683 - Driver for the hardware monitoring functionality of
- *	     Nuvoton NCT6683D/NCT6687D eSIO
+ *	     Nuvoton NCT6683D/NCT6686D/NCT6687D eSIO
  *
  * Copyright (C) 2013  Guenter Roeck <linux@roeck-us.net>
  *
@@ -12,6 +12,7 @@
  *
  * Chip        #vin    #fan    #pwm    #temp  chip ID
  * nct6683d     21(1)   16      8       32(1) 0xc730
+ * nct6686d     21(1)   16      8       32(1) 0xd440
  * nct6687d     21(1)   16      8       32(1) 0xd590
  *
  * Notes:
@@ -33,7 +34,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
-enum kinds { nct6683, nct6687 };
+enum kinds { nct6683, nct6686, nct6687 };
 
 static bool force;
 module_param(force, bool, 0);
@@ -41,11 +42,13 @@ MODULE_PARM_DESC(force, "Set to one to enable support for unknown vendors");
 
 static const char * const nct6683_device_names[] = {
 	"nct6683",
+	"nct6686",
 	"nct6687",
 };
 
 static const char * const nct6683_chip_names[] = {
 	"NCT6683D",
+	"NCT6686D",
 	"NCT6687D",
 };
 
@@ -66,6 +69,7 @@ static const char * const nct6683_chip_names[] = {
 
 #define SIO_NCT6681_ID		0xb270	/* for later */
 #define SIO_NCT6683_ID		0xc730
+#define SIO_NCT6686_ID		0xd440
 #define SIO_NCT6687_ID		0xd590
 #define SIO_ID_MASK		0xFFF0
 
@@ -1362,6 +1366,9 @@ static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data)
 	case SIO_NCT6683_ID:
 		sio_data->kind = nct6683;
 		break;
+	case SIO_NCT6686_ID:
+		sio_data->kind = nct6686;
+		break;
 	case SIO_NCT6687_ID:
 		sio_data->kind = nct6687;
 		break;
-- 
2.18.2


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

* Re: [PATCH] hwmon: (nct6883) Support NCT6686D
  2021-03-03  3:20 [PATCH] hwmon: (nct6883) Support NCT6686D Jiqi Li
@ 2021-03-03  5:47 ` Guenter Roeck
  2021-03-03  6:58   ` 回复: [External] " Jiqi JQ9 Li
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2021-03-03  5:47 UTC (permalink / raw)
  To: Jiqi Li, jdelvare, linux-hwmon, linux-kernel; +Cc: markpearson

On 3/2/21 7:20 PM, Jiqi Li wrote:
> Add support for NCT6686D chip used in the Lenovo P620.
> 
> Signed-off-by: Jiqi Li <lijq9@lenovo.com>
> Reviewed-by: Mark Pearson <markpearson@lenovo.com

Please version your patches, and provide change logs.

Guenter

> ---
>  drivers/hwmon/nct6683.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
> index a23047a3bfe2..256e8d62f858 100644
> --- a/drivers/hwmon/nct6683.c
> +++ b/drivers/hwmon/nct6683.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * nct6683 - Driver for the hardware monitoring functionality of
> - *	     Nuvoton NCT6683D/NCT6687D eSIO
> + *	     Nuvoton NCT6683D/NCT6686D/NCT6687D eSIO
>   *
>   * Copyright (C) 2013  Guenter Roeck <linux@roeck-us.net>
>   *
> @@ -12,6 +12,7 @@
>   *
>   * Chip        #vin    #fan    #pwm    #temp  chip ID
>   * nct6683d     21(1)   16      8       32(1) 0xc730
> + * nct6686d     21(1)   16      8       32(1) 0xd440
>   * nct6687d     21(1)   16      8       32(1) 0xd590
>   *
>   * Notes:
> @@ -33,7 +34,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  
> -enum kinds { nct6683, nct6687 };
> +enum kinds { nct6683, nct6686, nct6687 };
>  
>  static bool force;
>  module_param(force, bool, 0);
> @@ -41,11 +42,13 @@ MODULE_PARM_DESC(force, "Set to one to enable support for unknown vendors");
>  
>  static const char * const nct6683_device_names[] = {
>  	"nct6683",
> +	"nct6686",
>  	"nct6687",
>  };
>  
>  static const char * const nct6683_chip_names[] = {
>  	"NCT6683D",
> +	"NCT6686D",
>  	"NCT6687D",
>  };
>  
> @@ -66,6 +69,7 @@ static const char * const nct6683_chip_names[] = {
>  
>  #define SIO_NCT6681_ID		0xb270	/* for later */
>  #define SIO_NCT6683_ID		0xc730
> +#define SIO_NCT6686_ID		0xd440
>  #define SIO_NCT6687_ID		0xd590
>  #define SIO_ID_MASK		0xFFF0
>  
> @@ -1362,6 +1366,9 @@ static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data)
>  	case SIO_NCT6683_ID:
>  		sio_data->kind = nct6683;
>  		break;
> +	case SIO_NCT6686_ID:
> +		sio_data->kind = nct6686;
> +		break;
>  	case SIO_NCT6687_ID:
>  		sio_data->kind = nct6687;
>  		break;
> 


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

* 回复: [External]  Re: [PATCH] hwmon: (nct6883) Support NCT6686D
  2021-03-03  5:47 ` Guenter Roeck
@ 2021-03-03  6:58   ` Jiqi JQ9 Li
  0 siblings, 0 replies; 3+ messages in thread
From: Jiqi JQ9 Li @ 2021-03-03  6:58 UTC (permalink / raw)
  To: Guenter Roeck, jdelvare, linux-hwmon, linux-kernel; +Cc: Mark RH Pearson

[-- Attachment #1: Type: text/plain, Size: 2807 bytes --]

Ok, I will re-send patch with version. 
For driver/hwmon/nct6683 git log, please check attachment. 

Regards,
Jiqi.

-----邮件原件-----
发件人: Guenter Roeck <groeck7@gmail.com> 代表 Guenter Roeck
发送时间: 2021年3月3日 13:47
收件人: Jiqi JQ9 Li <lijq9@lenovo.com>; jdelvare@suse.com; linux-hwmon@vger.kernel.org; linux-kernel@vger.kernel.org
抄送: Mark RH Pearson <markpearson@lenovo.com>
主题: [External] Re: [PATCH] hwmon: (nct6883) Support NCT6686D

On 3/2/21 7:20 PM, Jiqi Li wrote:
> Add support for NCT6686D chip used in the Lenovo P620.
> 
> Signed-off-by: Jiqi Li <lijq9@lenovo.com>
> Reviewed-by: Mark Pearson <markpearson@lenovo.com

Please version your patches, and provide change logs.

Guenter

> ---
>  drivers/hwmon/nct6683.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index 
> a23047a3bfe2..256e8d62f858 100644
> --- a/drivers/hwmon/nct6683.c
> +++ b/drivers/hwmon/nct6683.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * nct6683 - Driver for the hardware monitoring functionality of
> - *	     Nuvoton NCT6683D/NCT6687D eSIO
> + *	     Nuvoton NCT6683D/NCT6686D/NCT6687D eSIO
>   *
>   * Copyright (C) 2013  Guenter Roeck <linux@roeck-us.net>
>   *
> @@ -12,6 +12,7 @@
>   *
>   * Chip        #vin    #fan    #pwm    #temp  chip ID
>   * nct6683d     21(1)   16      8       32(1) 0xc730
> + * nct6686d     21(1)   16      8       32(1) 0xd440
>   * nct6687d     21(1)   16      8       32(1) 0xd590
>   *
>   * Notes:
> @@ -33,7 +34,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  
> -enum kinds { nct6683, nct6687 };
> +enum kinds { nct6683, nct6686, nct6687 };
>  
>  static bool force;
>  module_param(force, bool, 0);
> @@ -41,11 +42,13 @@ MODULE_PARM_DESC(force, "Set to one to enable 
> support for unknown vendors");
>  
>  static const char * const nct6683_device_names[] = {
>  	"nct6683",
> +	"nct6686",
>  	"nct6687",
>  };
>  
>  static const char * const nct6683_chip_names[] = {
>  	"NCT6683D",
> +	"NCT6686D",
>  	"NCT6687D",
>  };
>  
> @@ -66,6 +69,7 @@ static const char * const nct6683_chip_names[] = {
>  
>  #define SIO_NCT6681_ID		0xb270	/* for later */
>  #define SIO_NCT6683_ID		0xc730
> +#define SIO_NCT6686_ID		0xd440
>  #define SIO_NCT6687_ID		0xd590
>  #define SIO_ID_MASK		0xFFF0
>  
> @@ -1362,6 +1366,9 @@ static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data)
>  	case SIO_NCT6683_ID:
>  		sio_data->kind = nct6683;
>  		break;
> +	case SIO_NCT6686_ID:
> +		sio_data->kind = nct6686;
> +		break;
>  	case SIO_NCT6687_ID:
>  		sio_data->kind = nct6687;
>  		break;
> 


[-- Attachment #2: git.log --]
[-- Type: application/octet-stream, Size: 18953 bytes --]

commit 8587a7149a23a9a4f7fbe8b4e3c75f74723f1084
Author: Jiqi Li <lijq9@lenovo.com>
Date:   Mon Mar 1 19:55:02 2021 +0800

    hwmon: (nct6883) Support NCT6686D
    
    Add support for NCT6686D chip used in the Lenovo P620.
    
    Signed-off-by: Jiqi Li <lijq9@lenovo.com>
    Reviewed-by: Mark Pearson <markpearson@lenovo.com>

commit bd433537fef88d76e7f427bafda18791ae60e721
Author: Blaž Hrastnik <blaz@mxxn.io>
Date:   Tue Jan 19 14:12:41 2021 +0900

    hwmon: (nct6683) Support ASRock boards
    
    Tested with ASRock X570 Phantom Gaming-ITX/TB3. It also appears
    on other ASRock boards.
    
    Signed-off-by: Blaž Hrastnik <blaz@mxxn.io>
    Link: https://lore.kernel.org/r/b08d641c-3fb5-4845-85f7-e1753149cd7d@www.fastmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit daf4fedde6177941b55ba3c3293a8585d5280b94
Author: David Bartley <andareed@gmail.com>
Date:   Tue Dec 1 18:50:57 2020 -0800

    hwmon: (nct6683) Support NCT6687D.
    
    This is found on many MSI motherboards.
    
    Signed-off-by: David Bartley <andareed@gmail.com>
    Link: https://lore.kernel.org/r/20201202025057.5492-1-andareed@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit 23fd63a44460cda2e09703b625fa2fbcf2a27000
Author: Wang Qing <wangqing@vivo.com>
Date:   Sat Jun 13 16:06:44 2020 +0800

    hwmon: (nct6683) Replace container_of() with  kobj_to_dev()
    
    Use kobj_to_dev() instead of container_of().
    
    Signed-off-by: Wang Qing <wangqing@vivo.com>
    Link: https://lore.kernel.org/r/1592035604-22336-1-git-send-email-wangqing@vivo.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit c942fddf8793b2013be8c901b47d0a8dc02bf99f
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Mon May 27 08:55:06 2019 +0200

    treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157
    
    Based on 3 normalized pattern(s):
    
      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
    
      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 [author] [kishon] [vijay] [abraham]
      [i] [kishon]@[ti] [com] 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
    
      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 [author] [graeme] [gregory]
      [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
      [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
      [hk] [hemahk]@[ti] [com] 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
    
    extracted by the scancode license scanner the SPDX license identifier
    
      GPL-2.0-or-later
    
    has been chosen to replace the boilerplate/reference in 1105 file(s).
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Allison Randal <allison@lohutok.net>
    Reviewed-by: Richard Fontana <rfontana@redhat.com>
    Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a86854d0c599b3202307abceb68feee4d7061578
Author: Kees Cook <keescook@chromium.org>
Date:   Tue Jun 12 14:07:58 2018 -0700

    treewide: devm_kzalloc() -> devm_kcalloc()
    
    The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:
    
            devm_kzalloc(handle, a * b, gfp)
    
    with:
            devm_kcalloc(handle, a * b, gfp)
    
    as well as handling cases of:
    
            devm_kzalloc(handle, a * b * c, gfp)
    
    with:
    
            devm_kzalloc(handle, array3_size(a, b, c), gfp)
    
    as it's slightly less ugly than:
    
            devm_kcalloc(handle, array_size(a, b), c, gfp)
    
    This does, however, attempt to ignore constant size factors like:
    
            devm_kzalloc(handle, 4 * 1024, gfp)
    
    though any constants defined via macros get caught up in the conversion.
    
    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.
    
    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
    
    The Coccinelle script used for this was:
    
    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@
    
    (
      devm_kzalloc(HANDLE,
    -       (sizeof(TYPE)) * E
    +       sizeof(TYPE) * E
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       (sizeof(THING)) * E
    +       sizeof(THING) * E
      , ...)
    )
    
    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@
    
    (
      devm_kzalloc(HANDLE,
    -       sizeof(u8) * (COUNT)
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(__u8) * (COUNT)
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(char) * (COUNT)
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(unsigned char) * (COUNT)
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(u8) * COUNT
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(__u8) * COUNT
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(char) * COUNT
    +       COUNT
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(unsigned char) * COUNT
    +       COUNT
      , ...)
    )
    
    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@
    
    (
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(TYPE) * (COUNT_ID)
    +       COUNT_ID, sizeof(TYPE)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(TYPE) * COUNT_ID
    +       COUNT_ID, sizeof(TYPE)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(TYPE) * (COUNT_CONST)
    +       COUNT_CONST, sizeof(TYPE)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(TYPE) * COUNT_CONST
    +       COUNT_CONST, sizeof(TYPE)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(THING) * (COUNT_ID)
    +       COUNT_ID, sizeof(THING)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(THING) * COUNT_ID
    +       COUNT_ID, sizeof(THING)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(THING) * (COUNT_CONST)
    +       COUNT_CONST, sizeof(THING)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(THING) * COUNT_CONST
    +       COUNT_CONST, sizeof(THING)
      , ...)
    )
    
    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@
    
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       SIZE * COUNT
    +       COUNT, SIZE
      , ...)
    
    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@
    
    (
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE) * (COUNT) * (STRIDE)
    +       array3_size(COUNT, STRIDE, sizeof(TYPE))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE) * (COUNT) * STRIDE
    +       array3_size(COUNT, STRIDE, sizeof(TYPE))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE) * COUNT * (STRIDE)
    +       array3_size(COUNT, STRIDE, sizeof(TYPE))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE) * COUNT * STRIDE
    +       array3_size(COUNT, STRIDE, sizeof(TYPE))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(THING) * (COUNT) * (STRIDE)
    +       array3_size(COUNT, STRIDE, sizeof(THING))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(THING) * (COUNT) * STRIDE
    +       array3_size(COUNT, STRIDE, sizeof(THING))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(THING) * COUNT * (STRIDE)
    +       array3_size(COUNT, STRIDE, sizeof(THING))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(THING) * COUNT * STRIDE
    +       array3_size(COUNT, STRIDE, sizeof(THING))
      , ...)
    )
    
    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@
    
    (
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    +       array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    +       array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(THING1) * sizeof(THING2) * COUNT
    +       array3_size(COUNT, sizeof(THING1), sizeof(THING2))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(THING1) * sizeof(THING2) * (COUNT)
    +       array3_size(COUNT, sizeof(THING1), sizeof(THING2))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE1) * sizeof(THING2) * COUNT
    +       array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    +       array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
      , ...)
    )
    
    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@
    
    (
      devm_kzalloc(HANDLE,
    -       (COUNT) * STRIDE * SIZE
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       COUNT * (STRIDE) * SIZE
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       COUNT * STRIDE * (SIZE)
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       (COUNT) * (STRIDE) * SIZE
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       COUNT * (STRIDE) * (SIZE)
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       (COUNT) * STRIDE * (SIZE)
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       (COUNT) * (STRIDE) * (SIZE)
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       COUNT * STRIDE * SIZE
    +       array3_size(COUNT, STRIDE, SIZE)
      , ...)
    )
    
    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@
    
    (
      devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
      devm_kzalloc(HANDLE,
    -       (E1) * E2 * E3
    +       array3_size(E1, E2, E3)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       (E1) * (E2) * E3
    +       array3_size(E1, E2, E3)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       (E1) * (E2) * (E3)
    +       array3_size(E1, E2, E3)
      , ...)
    |
      devm_kzalloc(HANDLE,
    -       E1 * E2 * E3
    +       array3_size(E1, E2, E3)
      , ...)
    )
    
    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@
    
    (
      devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
      devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
      devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
      devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(TYPE) * (E2)
    +       E2, sizeof(TYPE)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(TYPE) * E2
    +       E2, sizeof(TYPE)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(THING) * (E2)
    +       E2, sizeof(THING)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       sizeof(THING) * E2
    +       E2, sizeof(THING)
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       (E1) * E2
    +       E1, E2
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       (E1) * (E2)
    +       E1, E2
      , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
      (HANDLE,
    -       E1 * E2
    +       E1, E2
      , ...)
    )
    
    Signed-off-by: Kees Cook <keescook@chromium.org>

commit dbac00f0cf634120d77edee10d25e3f6899d7636
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sun Apr 22 18:16:54 2018 -0700

    hwmon: (nct6683) Enable EC access if disabled at boot
    
    On Asrock Z370M Pro4, it was observed that EC access was disabled after
    initially booting the system. As a result, the driver failed to load
    with
            nct6683: EC is disabled
    After a suspend/resume cycle, the driver loaded correctly.
            nct6683: Found NCT6683D or compatible chip at 0x2e:0xa20
            nct6683 nct6683.2592: NCT6683D EC firmware version 1.0 build 07/18/16
    
    Enable EC access after identifying the chip if disabled to fix the problem.
    Warn the user that the data it reports may be unusable, similar to other
    drivers for chips from Nuvoton.
    
    Fixes: 41082d66bfd6f ("hwmon: Driver for NCT6683D")
    Reported-by: Jonathan Sims <jonathan.625266@earthlink.net>
    Tested-by: Jonathan Sims <jonathan.625266@earthlink.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit 1f856175e44bc2b8c5c961854abe80fb6c106229
Author: Julia Lawall <Julia.Lawall@lip6.fr>
Date:   Thu Dec 22 13:05:01 2016 +0100

    hwmon: (nct6683) use permission-specific DEVICE_ATTR variants
    
    Use DEVICE_ATTR_RW for read/write attributes. This simplifies the source
    code, improves readbility, and reduces the chance of inconsistencies.
    
    The conversion was done automatically using coccinelle. It was validated
    by compiling both the old and the new source code and comparing its text,
    data, and bss size.
    
    Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
    [groeck: Updated description]
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit 91918d13eb17b8c11a9b6b76bfdd7cc0efab4f50
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Thu Feb 19 09:21:29 2015 -0800

    hwmon: (nct6683) Add basic support for NCT6683 on Mitac boards
    
    Mitac microcode differs from Intel microcode. One key difference
    is that pwm values can be written.
    
    Detect vendor from customer ID field and no longer use DMI data
    to identify which microcode is running on the chip.
    
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit c60fdf8587aef7d8907472242227735f1d5117b8
Author: Julia Lawall <Julia.Lawall@lip6.fr>
Date:   Sat Dec 12 17:36:39 2015 +0100

    hwmon: (nct6683,nct6775) constify sensor_template_group structures
    
    The sensor_template_group structures are never modified, so declare them as
    const.
    
    Done with the help of Coccinelle.
    
    Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit c7bd6dc320b85445b6b36a0aff41f929210027c7
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Thu May 28 09:12:23 2015 -0700

    hwmon: (nct6683) Add missing sysfs attribute initialization
    
    The following error message is seen when loading the nct6683 driver
    with DEBUG_LOCK_ALLOC enabled.
    
    BUG: key ffff88040b2f0030 not in .data!
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988
                                    lockdep_init_map+0x469/0x630()
    DEBUG_LOCKS_WARN_ON(1)
    
    Caused by a missing call to sysfs_attr_init() when initializing
    sysfs attributes.
    
    Reported-by: Alexey Orishko <alexey.orishko@gmail.com>
    Reviewed-by: Jean Delvare <jdelvare@suse.de>
    Cc: stable@vger.kernel.org # v3.18+
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit 2a1ed077189a38bccf39cb00d8dca96d20a49463
Author: Wolfram Sang <wsa@the-dreams.de>
Date:   Mon Oct 20 16:20:36 2014 +0200

    hwmon: drop owner assignment from platform_drivers
    
    A platform_driver does not need to set an owner, it will be populated by the
    driver core.
    
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

commit 30190c3c6181470203e6f635166496aa640ffe06
Author: Axel Lin <axel.lin@ingics.com>
Date:   Sat May 24 23:04:22 2014 +0800

    hwmon: (nct6683) Fix probe unwind paths to properly unregister platform devices
    
    Call platform_device_unregister() rather than platform_device_put() to
    unregister successfully registered platform devices.
    
    Signed-off-by: Axel Lin <axel.lin@ingics.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

commit 41082d66bfd6fafe001c0902bb4622d7aee6f128
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sun Apr 6 08:57:20 2014 -0700

    hwmon: Driver for NCT6683D
    
    Nuvoton NCT6683D is an eSIO with hardware monitoring capabilities.
    
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>

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

end of thread, other threads:[~2021-03-03 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  3:20 [PATCH] hwmon: (nct6883) Support NCT6686D Jiqi Li
2021-03-03  5:47 ` Guenter Roeck
2021-03-03  6:58   ` 回复: [External] " Jiqi JQ9 Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).