1. 17 9月, 2018 1 次提交
  2. 16 9月, 2018 1 次提交
  3. 15 9月, 2018 1 次提交
    • G
      hwmon: (nct6775) Fix virtual temperature sources for NCT6796D · 37196ba4
      Guenter Roeck 提交于
      The following kernel log message is reported for the nct6775 driver
      on ASUS WS X299 SAGE.
      
      nct6775: Found NCT6796D or compatible chip at 0x2e:0x290
      nct6775 nct6775.656: Invalid temperature source 11 at index 0,
      			source register 0x100, temp register 0x73
      nct6775 nct6775.656: Invalid temperature source 11 at index 2,
      			source register 0x300, temp register 0x77
      nct6775 nct6775.656: Invalid temperature source 11 at index 3,
      			source register 0x800, temp register 0x79
      nct6775 nct6775.656: Invalid temperature source 11 at index 4,
      			source register 0x900, temp register 0x7b
      
      A recent version of the datasheet lists temperature source 11 as reserved.
      However, an older version of the datasheet lists temperature sources 10
      and 11 as supported virtual temperature sources. Apparently the older
      version of the datasheet is correct, so list those temperature sources
      as supported.
      
      Virtual temperature sources are different than other temperature sources:
      Values are not read from a temperature sensor, but written either from
      BIOS or an embedded controller. As such, each virtual temperature has to
      be reported. Since there is now more than one temperature source, we have
      to keep virtual temperature sources in a chip-specific mask and can no
      longer rely on the assumption that there is only one virtual temperature
      source with a fixed index. This accounts for most of the complexity of this
      patch.
      Reported-by: NRobert Kern <ulteq@web.de>
      Cc: Robert Kern <ulteq@web.de>
      Fixes: 81820059 ("hwmon: (nct6775) Add support for NCT6796D")
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      37196ba4
  4. 08 9月, 2018 1 次提交
    • G
      hwmon: (nct6775) Fix access to fan pulse registers · c793279c
      Guenter Roeck 提交于
      Not all fans have a fan pulse register. This can result in reading
      beyond the end of REG_FAN_PULSES and FAN_PULSE_SHIFT arrays,
      and was reported by smatch as possible error.
      
      1672          for (i = 0; i < ARRAY_SIZE(data->rpm); i++) {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^
      			      This is a 7 element array.
      ...
      1685                  data->fan_pulses[i] =
      1686                    (nct6775_read_value(data, data->REG_FAN_PULSES[i])
      1687                          >> data->FAN_PULSE_SHIFT[i]) & 0x03;
                                       ^^^^^^^^^^^^^^^^^^^^^^^^
      				 FAN_PULSE_SHIFT is either 5 or 6
      				 elements.
      
      To fix the problem, we have to ensure that all REG_FAN_PULSES and
      FAN_PULSE_SHIFT have the appropriate length, and that REG_FAN_PULSES
      is only read if the register actually exists.
      
      Fixes: 6c009501 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      c793279c
  5. 06 9月, 2018 1 次提交
  6. 27 8月, 2018 1 次提交
  7. 09 7月, 2018 2 次提交
  8. 17 6月, 2018 1 次提交
  9. 13 6月, 2018 1 次提交
    • K
      treewide: devm_kzalloc() -> devm_kcalloc() · a86854d0
      Kees Cook 提交于
      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: NKees Cook <keescook@chromium.org>
      a86854d0
  10. 27 3月, 2018 1 次提交
    • G
      hwmon: (nct6775) Fix writing pwmX_mode · 415eb2a1
      Guenter Roeck 提交于
      pwmX_mode is defined in the ABI as 0=DC mode, 1=pwm mode. The chip
      register bit is set to 1 for DC mode. This got mixed up, and writing
      1 into pwmX_mode resulted in DC mode enabled. Fix it up by using
      the ABI definition throughout the driver for consistency.
      
      Fixes: 77eb5b37 ("hwmon: (nct6775) Add support for pwm, pwm_mode, ... ")
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      415eb2a1
  11. 11 3月, 2018 4 次提交
  12. 12 6月, 2017 4 次提交
  13. 03 1月, 2017 1 次提交
  14. 19 9月, 2016 1 次提交
    • G
      hwmon: (nct6775) Add support for multiple virtual temperature sources · 7ce4190c
      Guenter Roeck 提交于
      For virtual temperatures, the actual temperature values are written
      by software, presumably by the BIOS. This functionality is (as of
      right now) supported on NCT6791D, NCT6792D, and NCT6793D. On those chips,
      the temperatures are written into registers 0xea..0xef on page 0.
      This is known to be used on some Asus motherboards, where the actual
      temperature source can be configured in the BIOS.
      
      Report the 'virtual' temperatures for all monotoring sources to address
      this situation.
      
      Example for the resulting output (as seen with the 'sensors' command):
      
      nct6791-isa-0290
      Adapter: ISA adapter
      ...
      Virtual_TEMP:           +31.0°C
      PECI Agent 0:           +38.5°C
      Virtual_TEMP:           +32.0°C
      ...
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      7ce4190c
  15. 09 9月, 2016 1 次提交
    • G
      hwmon: (nct6775) Do not accept force_id unless chip is found · fc72af3a
      Guenter Roeck 提交于
      Since commit 698a7c24 ("hwmon: (nct6775) Support two SuperIO chips
      in the same system"), the driver supports two Super-IO chips. This has
      the undesirable side effect that force_id always detects a second chip
      at address 0xfff8, even if no chip exists at that address.
      
      nct6775: Found NCT6793D or compatible chip at 0x4e:0xfff8
      
      If no chip at all is found at a given SIO address, it does not make sense
      to instantiate it. Limit force_id to only work if some chip is found,
      that is if the chip ID returns a value other than 0xffff.
      Reviewed-by: NJean Delvare <jdelvare@suse.de>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      fc72af3a
  16. 19 12月, 2015 1 次提交
  17. 30 10月, 2015 2 次提交
  18. 13 9月, 2015 2 次提交
  19. 30 5月, 2015 1 次提交
  20. 15 3月, 2015 3 次提交
  21. 01 12月, 2014 2 次提交
  22. 20 10月, 2014 1 次提交
  23. 04 8月, 2014 2 次提交
  24. 24 5月, 2014 1 次提交
  25. 30 1月, 2014 1 次提交
  26. 15 1月, 2014 1 次提交
  27. 19 11月, 2013 1 次提交