1. 16 Apr, 2019 40 commits
    • Guenter Roeck's avatar
      hwmon: (adm1026) Use permission specific SENSOR[_DEVICE]_ATTR variants · 7ded2315
      Guenter Roeck authored
      Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
      to improve readbility, and to reduce the chance of inconsistencies.
      
      Also replace any remaining S_<PERMS> in the driver with octal values.
      
      The conversion was done automatically with coccinelle. The semantic patches
      and the scripts used to generate this commit log are available at
      https://github.com/groeck/coccinelle-patches/.
      
      This patch does not introduce functional changes. It was verified by
      compiling the old and new files and comparing text and data sizes.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      7ded2315
    • Guenter Roeck's avatar
      hwmon: (adm1025) Use permission specific SENSOR[_DEVICE]_ATTR variants · 66efcd2b
      Guenter Roeck authored
      Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
      to improve readbility, and to reduce the chance of inconsistencies.
      
      Also replace any remaining S_<PERMS> in the driver with octal values.
      
      The conversion was done automatically with coccinelle. The semantic patches
      and the scripts used to generate this commit log are available at
      https://github.com/groeck/coccinelle-patches/.
      
      This patch does not introduce functional changes. It was verified by
      compiling the old and new files and comparing text and data sizes.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      66efcd2b
    • Guenter Roeck's avatar
      hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses · 8c082675
      Guenter Roeck authored
      Super-IO accesses may fail on a system with no or unmapped LPC bus.
      
      Also, other drivers may attempt to access the LPC bus at the same time,
      resulting in undefined behavior.
      
      Use request_muxed_region() to ensure that IO access on the requested
      address space is supported, and to ensure that access by multiple drivers
      is synchronized.
      
      Fixes: 8d5d45fb ("I2C: Move hwmon drivers (2/3)")
      Reported-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reported-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: John Garry <john.garry@huawei.com>
      Acked-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      8c082675
    • Guenter Roeck's avatar
      hwmon: (pc87427) Use request_muxed_region for Super-IO accesses · 755a9b0f
      Guenter Roeck authored
      Super-IO accesses may fail on a system with no or unmapped LPC bus.
      
      Also, other drivers may attempt to access the LPC bus at the same time,
      resulting in undefined behavior.
      
      Use request_muxed_region() to ensure that IO access on the requested
      address space is supported, and to ensure that access by multiple drivers
      is synchronized.
      
      Fixes: ba224e2c ("hwmon: New PC87427 hardware monitoring driver")
      Reported-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reported-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: John Garry <john.garry@huawei.com>
      Acked-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      755a9b0f
    • Guenter Roeck's avatar
      hwmon: (f71805f) Use request_muxed_region for Super-IO accesses · 73e6ff71
      Guenter Roeck authored
      Super-IO accesses may fail on a system with no or unmapped LPC bus.
      
      Unable to handle kernel paging request at virtual address ffffffbffee0002e
      pgd = ffffffc1d68d4000
      [ffffffbffee0002e] *pgd=0000000000000000, *pud=0000000000000000
      Internal error: Oops: 94000046 [#1] PREEMPT SMP
      Modules linked in: f71805f(+) hwmon
      CPU: 3 PID: 1659 Comm: insmod Not tainted 4.5.0+ #88
      Hardware name: linux,dummy-virt (DT)
      task: ffffffc1f6665400 ti: ffffffc1d6418000 task.ti: ffffffc1d6418000
      PC is at f71805f_find+0x6c/0x358 [f71805f]
      
      Also, other drivers may attempt to access the LPC bus at the same time,
      resulting in undefined behavior.
      
      Use request_muxed_region() to ensure that IO access on the requested
      address space is supported, and to ensure that access by multiple
      drivers is synchronized.
      
      Fixes: e53004e2 ("hwmon: New f71805f driver")
      Reported-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reported-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: John Garry <john.garry@huawei.com>
      Acked-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      73e6ff71
    • Guenter Roeck's avatar
      hwmon: (ina2xx) Fix build warning · df6b8c70
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/ina2xx.c:510:34: warning:
      	‘ina2xx_of_match’ defined but not used
      
      Mark ina2xx_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      df6b8c70
    • Guenter Roeck's avatar
      hwmon: (lm63) Fix build warning · 8c71c7b9
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/lm63.c:1156:34: warning:
      	‘lm63_of_match’ defined but not used
      
      Mark lm63_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      8c71c7b9
    • Guenter Roeck's avatar
      hwmon: lm95245: Fix build warnings · 0e09e9f9
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/lm95245.c:626:34: warning:
      	‘lm95245_of_match’ defined but not used
      
      Mark lm95245_of_match as __maybe_unused to fix the problem.
      
      The following build warning is always seen.
      
      drivers/hwmon/lm95245.c:95:17: warning:
      	‘lm95245_reg_address’ defined but not used
      
      The array is no longer used since commit c0a4b9ec ("hwmon: (lm95245)
      Use new hwmon registration API"). Remove it.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      0e09e9f9
    • Guenter Roeck's avatar
      hwmon: (tmp421) Fix build warning · bd7d56a7
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/tmp421.c:73:34: warning:
      	‘tmp421_of_match’ defined but not used
      
      Mark tmp421_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      bd7d56a7
    • Guenter Roeck's avatar
      hwmon: (stts751) Fix build warning · 1cbee124
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/stts751.c:88:34: warning:
      	‘stts751_of_match’ defined but not used
      
      Mark stts751_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      1cbee124
    • Guenter Roeck's avatar
      hwmon: (max6621) Fix build warning · 969c45b9
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/max6621.c:573:34: warning:
      	‘max6621_of_match’ defined but not used
      
      Mark max6621_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      969c45b9
    • Guenter Roeck's avatar
      hwmon: (lm85) Fix build warning · 20b497ab
      Guenter Roeck authored
      The following build warning is seen if CONFIG_OF is disabled.
      
      drivers/hwmon/lm85.c:1645:34: warning:
      	‘lm85_of_match’ defined but not used
      
      Mark lm85_of_match as __maybe_unused to ix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      20b497ab
    • Guenter Roeck's avatar
      hwmon: (max6650) Fix build warning · 2720ce7e
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/max6650.c:137:34: warning:
      	‘max6650_dt_match’ defined but not used
      
      Mark max6650_dt_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      2720ce7e
    • Guenter Roeck's avatar
      hwmon: (max6697) Fix build warning · f198a869
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/max6697.c:653:34: warning:
      	‘max6697_of_match’ defined but not used
      
      Mark max6697_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      f198a869
    • Guenter Roeck's avatar
      hwmon: (ina209) Fix build warning · 32c2d402
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/ina209.c:590:34: warning:
      	‘ina209_of_match’ defined but not used
      
      Mark ina209_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      32c2d402
    • Guenter Roeck's avatar
      hwmon: (lm75) Fix build warning · ffa83e78
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/lm75.c:446:34: warning:
      	‘lm75_of_match’ defined but not used
      
      Mark lm75_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      ffa83e78
    • Guenter Roeck's avatar
      hwmon: (w83773g) Fix build warning · acb614a3
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/w83773g.c:47:34: warning:
      	‘w83773_of_match’ defined but not used
      
      Mark w83773_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      acb614a3
    • Guenter Roeck's avatar
      hwmon: (ads7828) Fix build warning · 0337dd9b
      Guenter Roeck authored
      If CONFIG_OF is not enabled, the following build warning is observed.
      
      drivers/hwmon/ads7828.c:203:34: warning:
      	‘ads7828_of_match’ defined but not used
      
      Mark ads7828_of_match as __maybe_unused to fix the problem.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      0337dd9b
    • 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