From: "Winiarska, Iwona" <iwona.winiarska@intel.com>
To: "linux@roeck-us.net" <linux@roeck-us.net>,
"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>
Cc: "jdelvare@suse.com" <jdelvare@suse.com>
Subject: Re: [PATCH 4/7] hwmon: (peci/cputemp) Use HWMON_CHANNEL_INFO macro
Date: Fri, 13 May 2022 20:24:25 +0000 [thread overview]
Message-ID: <228efaf3483a8abb316f4897b1a87748e74fb6df.camel@intel.com> (raw)
In-Reply-To: <20220512195556.137741-4-linux@roeck-us.net>
On Thu, 2022-05-12 at 12:55 -0700, Guenter Roeck wrote:
> 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.
>
> @s@
> identifier i,j,ty;
> @@
>
> -struct hwmon_channel_info j = {
> - .type = ty,
> - .config = i,
> -};
>
> @r@
> initializer list elements;
> identifier s.i;
> @@
>
> -u32 i[] = {
> - elements,
> - 0
> -};
>
> @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 coccinelle script.
>
> Cc: Iwona Winiarska <iwona.winiarska@intel.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
Thanks
-Iwona
> ---
> drivers/hwmon/peci/cputemp.c | 38 +++++++++++++++---------------------
> 1 file changed, 16 insertions(+), 22 deletions(-)
>
next prev parent reply other threads:[~2022-05-13 20:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 19:55 [PATCH 1/7] hwmon: (as370-hwmon) Use HWMON_CHANNEL_INFO macro Guenter Roeck
2022-05-12 19:55 ` [PATCH 2/7] hwmon: (ltc2992) " Guenter Roeck
2022-05-12 19:55 ` [PATCH 3/7] hwmon: (mr75203) " Guenter Roeck
2022-05-12 19:55 ` [PATCH 4/7] hwmon: (peci/cputemp) " Guenter Roeck
2022-05-13 20:24 ` Winiarska, Iwona [this message]
2022-05-12 19:55 ` [PATCH 5/7] hwmon: (peci/dimmtemp) " Guenter Roeck
2022-05-13 20:24 ` Winiarska, Iwona
2022-05-12 19:55 ` [PATCH 6/7] hwmon: (pwm-fan) " Guenter Roeck
2022-05-12 19:55 ` [PATCH 7/7] hwmon: (sl28cpld-hwmon) " Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=228efaf3483a8abb316f4897b1a87748e74fb6df.camel@intel.com \
--to=iwona.winiarska@intel.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.