Skip to content

hwmon: Use HWMON_CHANNEL_INFO macro

Guenter Roeck linux-hwmon 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest17 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17hwmon: (adt7411) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/adt7411.c+15 -330 replies
2/17hwmon: (ina3221) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/ina3221.c+15 -330 replies
3/17hwmon: (jc42) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/jc42.c+5 -130 replies
4/17hwmon: (lm75) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/lm75.c+4 -280 replies
5/17hwmon: (lm90) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/lm90.c+2 -110 replies
6/17hwmon: (lm95241) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/lm95241.c+8 -260 replies
7/17hwmon: (lm95245) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/lm95245.c+9 -250 replies
8/17hwmon: (ltc4245) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/ltc4245.c+23 -500 replies
9/17hwmon: (ltq-cputemp) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/ltq-cputemp.c+4 -220 replies
10/17hwmon: (max31790) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/max31790.c+20 -380 replies
11/17hwmon: (max6621) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/max6621.c+12 -300 replies
12/17hwmon: (mlxreg-fan) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/mlxreg-fan.c+15 -330 replies
13/17hwmon: (npcm750-pwm-fan) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/npcm750-pwm-fan.c+26 -440 replies
14/17hwmon: (raspberrypi-hwmon) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/raspberrypi-hwmon.c+2 -110 replies
15/17hwmon: (tmp102) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/tmp102.c+4 -220 replies
16/17hwmon: (tmp108) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/tmp108.c+6 -230 replies
17/17hwmon: (w83773g) Use HWMON_CHANNEL_INFO macrodrivers/hwmon/w83773g.c+6 -240 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/17] hwmon: Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood of errors, and makes the code easier to read. This series converts all hwmon drivers to use the macro if possible.

The conversion is 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)

The conversion does not introduce functional changes.

Many thanks to Julia Lawall for providing the semantic patch.