1. 16 Apr, 2019 40 commits
    • Guenter Roeck's avatar
      hwmon: (hih6130) Fix build warning · a62fe340
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/hih6130.c:255:34: warning:
      	‘hih6130_of_match’ defined but not used
      
      Mark hih6130_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      a62fe340
    • Guenter Roeck's avatar
      hwmon: (adt7475) Fix build warning · fe339dbf
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/adt7475.c:171:34: warning:
      	‘adt7475_of_match’ defined but not used
      
      Mark adt7475_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      fe339dbf
    • Guenter Roeck's avatar
      hwmon: (ads1015) Fix build warning · eb3cb6d5
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/ads1015.c:310:34: warning:
      	‘ads1015_of_match’ defined but not used
      
      Marking ads1015_of_match as __maybe_unused fixes the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      eb3cb6d5
    • Guenter Roeck's avatar
      hwmon: (tmp103) Fix build warning · 20894216
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/tmp103.c:173:34: warning:
      	‘tmp103_of_match’ defined but not used
      
      Marking tmp103_of_match as __maybe_unused fixes the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      20894216
    • Guenter Roeck's avatar
      hwmon: (tmp102) Fix build warning · 07af9a4a
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/tmp102.c:324:34: warning:
      	‘tmp102_of_match’ defined but not used
      
      Mark it as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      07af9a4a
    • Guenter Roeck's avatar
      hwmon: (ad7414) Fix build warning · 07182986
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/ad7414.c:218:34: warning:
      	‘ad7414_of_match’ defined but not used
      
      Marking ad7414_of_match as __mayybe_unused fixes the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      07182986
    • Guenter Roeck's avatar
      hwmon: (adc128d818) Fix build warning · 462d7e7e
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/adc128d818.c:524:34: warning:
      	‘adc128_of_match’ defined but not used
      
      Mark adc128_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      462d7e7e
    • Guenter Roeck's avatar
      hwmon: (lm90) Fix build warning · 787afaa3
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/lm90.c:239:34: warning:
      	‘lm90_of_match’ defined but not used
      
      Mark lm90_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      787afaa3
    • Guenter Roeck's avatar
      hwmon: (ltc4151) Fix build warning · a90cdd13
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/ltc4151.c:211:34: warning:
      	‘ltc4151_match’ defined but not used
      
      Mark ltc4151_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      a90cdd13
    • Guenter Roeck's avatar
      hwmon: (pmbus/ucd900) Fix build warning · 64e51162
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/pmbus/ucd9000.c:154:34: warning:
      	‘ucd9000_of_match’ defined but not used
      
      Mark ucd9000_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      64e51162
    • Guenter Roeck's avatar
      hwmon: (pmbus/tps53679) Fix build warning · e91cb17b
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/pmbus/tps53679.c:100:34: warning:
      	‘tps53679_of_match’ defined but not used
      
      Marking tps53679_of_match as __maybe_unused fixes the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      e91cb17b
    • Guenter Roeck's avatar
      hwmon: (pmbus/ucd9200): Mark ucd9200_of_match as maybe_unused · 9c6b0f75
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is
      observed.
      
      drivers/hwmon/pmbus/ucd9200.c:50:34: warning:
      	‘ucd9200_of_match’ defined but not used
      
      Mark it as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      9c6b0f75
    • Andrey Smirnov's avatar
      hwmon: (iio_hwmon) Simplify attr.name generation in iio_hwmon_probe() · cb202bb8
      Andrey Smirnov authored
      Since every call to devm_kasprintf() in the switch statement is mostly
      the same, we can move all of the shared code outside and capture
      differencies with two helper variables. No functional change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      cb202bb8
    • Guenter Roeck's avatar
      hwmon: (jz4740) Use devm_platform_ioremap_resource · 5aaa5873
      Guenter Roeck authored
      The new helper devm_platform_ioremap_resource() wraps
      platform_get_resource() and devm_ioremap_resource() together.
      Use it to simplify the code.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      5aaa5873
    • Guenter Roeck's avatar
      hwmon: (w83773g) Use HWMON_CHANNEL_INFO macro · 2f2defda
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      2f2defda
    • Guenter Roeck's avatar
      hwmon: (tmp108) Use HWMON_CHANNEL_INFO macro · 6cbd4926
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      6cbd4926
    • Guenter Roeck's avatar
      hwmon: (tmp102) Use HWMON_CHANNEL_INFO macro · 88078254
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      88078254
    • Guenter Roeck's avatar
      hwmon: (raspberrypi-hwmon) Use HWMON_CHANNEL_INFO macro · 0c42186e
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      0c42186e
    • Guenter Roeck's avatar
      hwmon: (npcm750-pwm-fan) Use HWMON_CHANNEL_INFO macro · dfeace08
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      
      Cc: Avi Fishman <avifishman70@gmail.com>
      Cc: Tomer Maimon <tmaimon77@gmail.com>
      Cc: Patrick Venture <venture@google.com>
      Cc: Nancy Yuen <yuenn@google.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      dfeace08
    • Guenter Roeck's avatar
      hwmon: (mlxreg-fan) Use HWMON_CHANNEL_INFO macro · 725dcf08
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      725dcf08
    • Guenter Roeck's avatar
      hwmon: (max6621) Use HWMON_CHANNEL_INFO macro · dcb00ee8
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      dcb00ee8
    • Guenter Roeck's avatar
      hwmon: (max31790) Use HWMON_CHANNEL_INFO macro · b605e671
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      b605e671
    • Guenter Roeck's avatar
      hwmon: (ltq-cputemp) Use HWMON_CHANNEL_INFO macro · f4a407f4
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      f4a407f4
    • Guenter Roeck's avatar
      hwmon: (ltc4245) Use HWMON_CHANNEL_INFO macro · 0ee508f0
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      0ee508f0
    • Guenter Roeck's avatar
      hwmon: (lm95245) Use HWMON_CHANNEL_INFO macro · 7aea0064
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      7aea0064
    • Guenter Roeck's avatar
      hwmon: (lm95241) Use HWMON_CHANNEL_INFO macro · f5011f9f
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      f5011f9f
    • Guenter Roeck's avatar
      hwmon: (lm90) Use HWMON_CHANNEL_INFO macro · a4d41e67
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      a4d41e67
    • Guenter Roeck's avatar
      hwmon: (lm75) Use HWMON_CHANNEL_INFO macro · e4f6fed1
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      e4f6fed1
    • Guenter Roeck's avatar
      hwmon: (jc42) Use HWMON_CHANNEL_INFO macro · 1eade10f
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      1eade10f
    • Guenter Roeck's avatar
      hwmon: (ina3221) Use HWMON_CHANNEL_INFO macro · 6f307b7c
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      
      The patch was post-edited to retain comments.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      6f307b7c
    • Guenter Roeck's avatar
      hwmon: (adt7411) Use HWMON_CHANNEL_INFO macro · ff56121e
      Guenter Roeck authored
      The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
      of errors, and makes the code easier to read.
      
      The conversion was done automatically with coccinelle. The semantic patch
      used to make this change is as follows.
      
      @r@
      initializer list elements;
      identifier i;
      @@
      
      -u32 i[] = {
      -  elements,
      -  0
      -};
      
      @s@
      identifier r.i,j,ty;
      @@
      
      -struct hwmon_channel_info j = {
      -       .type = ty,
      -       .config = i,
      -};
      
      @script:ocaml t@
      ty << s.ty;
      elements << r.elements;
      shorter;
      elems;
      @@
      
      shorter :=
         make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
      elems :=
         make_ident
          (String.concat ","
           (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
             (Str.split (Str.regexp " , ") elements)))
      
      @@
      identifier s.j,t.shorter;
      identifier t.elems;
      @@
      
      - &j
      + HWMON_CHANNEL_INFO(shorter,elems)
      
      This patch does not introduce functional changes. Many thanks to
      Julia Lawall for providing the semantic patch.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      ff56121e
    • Guenter Roeck's avatar
      hwmon: Documentation: Add usage example for HWMON_CHANNEL_INFO · 6bf2db46
      Guenter Roeck authored
      The new HWMON_CHANNEL_INFO macro simplifies the code, reduces the
      likelihood of errors, and makes the code easier to read. Add a usage
      example to help driver writers to actually use it.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      6bf2db46
    • Guenter Roeck's avatar
      hwmon: (nct7904) Use new HWMON_CHANNEL_INFO() macro · 4ec1d234
      Guenter Roeck authored
      The new macro simplifies the code, reduces the likelihood of errors,
      and makes the code easier to read.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      4ec1d234
    • Lucas Tanure's avatar
      hwmon: lochnagar: Add Lochnagar 2 hardware monitoring driver · 4cdb5621
      Lucas Tanure authored
      Lochnagar is an evaluation and development board for Cirrus
      Logic Smart CODEC and Amp devices. It allows the connection of
      most Cirrus Logic devices on mini-cards, as well as allowing
      connection of various application processor systems to provide a
      full evaluation platform.
      
      This driver adds support for the hardware monitoring features of
      the Lochnagar 2 to the hwmon API. Monitoring is provided for
      the board voltages, currents and temperature supported by the
      board controller chip.
      Signed-off-by: default avatarLucas Tanure <tanureal@opensource.cirrus.com>
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      4cdb5621
    • Charles Keepax's avatar
      hwmon: lochnagar: Add device tree binding document · 5ad4d7ca
      Charles Keepax authored
      Lochnagar is an evaluation and development board for Cirrus
      Logic Smart CODEC and Amp devices. It allows the connection of
      most Cirrus Logic devices on mini-cards, as well as allowing
      connection of various application processor systems to provide a
      full evaluation platform. This driver supports the board
      controller chip on the Lochnagar board.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      5ad4d7ca
    • Guenter Roeck's avatar
      hwmon: (ntc_thermistor) Use new HWMON_CHANNEL_INFO() macro · 0ddca577
      Guenter Roeck authored
      The new macro is indeed quite useful. Let's use it.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      0ddca577
    • Charles Keepax's avatar
      hwmon: Add convience macro to define simple static sensors · c43a113c
      Charles Keepax authored
      It takes a fair amount of boiler plate code to add new sensors, add a
      macro that can be used to specify simple static sensors.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      c43a113c
    • Vadim Pasternak's avatar
      hwmon: (mlxreg-fan) Add support for fan capability registers · b429ebc8
      Vadim Pasternak authored
      Add support for fan capability registers in order to distinct between
      the systems which have minor fan configuration differences. This
      reduces the amount of code used to describe such systems.
      The capability registers provides system specific information about the
      number of physically connected tachometers and system specific fan
      speed scale parameter.
      For example one system can be equipped with twelve fan tachometers,
      while the other with for example, eight or six. Or one system should
      use default fan speed divider value, while the other has a scale
      parameter defined in hardware, which should be used for divider
      setting.
      Reading this information from the capability registers allows to use the
      same fan structure for the systems with the such differences.
      Signed-off-by: default avatarVadim Pasternak <vadimp@mellanox.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      b429ebc8
    • Lei YU's avatar
      hwmon: (occ) Fix extended status bits · b88c5049
      Lei YU authored
      The occ's extended status is checked and shown as sysfs attributes. But
      the code was incorrectly checking the "status" bits.
      Fix it by checking the "ext_status" bits.
      
      Cc: stable@vger.kernel.org
      Fixes: df04ced6 ("hwmon (occ): Add sysfs attributes for additional OCC data")
      Signed-off-by: default avatarLei YU <mine260309@gmail.com>
      Reviewed-by: default avatarEddie James <eajames@linux.ibm.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      b88c5049
    • Stefan Wahren's avatar
      hwmon: (pwm-fan) Disable PWM if fetching cooling data fails · 53f1647d
      Stefan Wahren authored
      In case pwm_fan_of_get_cooling_data() fails we should disable the PWM
      just like in the other error cases.
      
      Fixes: 2e5219c7 ("hwmon: (pwm-fan) Read PWM FAN configuration from device tree")
      Cc: <stable@vger.kernel.org> # 4.14+
      Reported-by: default avatarGuenter Rock <linux@roeck-us.net>
      Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      53f1647d