From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Luke D. Jones" <luke@ljones.dev>
Cc: Hans de Goede <hdegoede@redhat.com>,
corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/9] platform/x86: asus-wmi: reduce code duplication with macros
Date: Tue, 28 May 2024 12:03:34 +0300 (EEST) [thread overview]
Message-ID: <f07c4980-9adc-96a2-4b72-c5db850e44c2@linux.intel.com> (raw)
In-Reply-To: <20240528013626.14066-5-luke@ljones.dev>
On Tue, 28 May 2024, Luke D. Jones wrote:
> Over time many default patterns have emerged while adding functionality.
> This patch consolidates those patterns in to a few macros to remove a lot
> of copy/paste, and make it easier to add more of the same style of
> features in the future.
>
> Signed-off-by: Luke D. Jones <luke@ljones.dev>
> ---
> +#define WMI_SIMPLE_SHOW(_fname, _fmt, _wmi) \
> +static ssize_t _fname##_show(struct device *dev, \
> + struct device_attribute *attr, char *buf) \
> +{ \
> + struct asus_wmi *asus = dev_get_drvdata(dev); \
> + u32 result; \
> + asus_wmi_get_devstate(asus, _wmi, &result); \
> + if (result < 0) \
> + return result; \
> + return sysfs_emit(buf, _fmt, result & ~ASUS_WMI_DSTS_PRESENCE_BIT); \
> +}
One more thing. To improve readability further, add also normal newlines
into macros like this (obviously with the continuation backslashes far
right as already mentioned).
--
i.
next prev parent reply other threads:[~2024-05-28 9:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 1:36 [PATCH 0/9] platform-x86-asus-wmi: multiple fixes, improvements, features Luke D. Jones
2024-05-28 1:36 ` [PATCH 1/9] platform/x86: asus-wmi: add debug print in more key places Luke D. Jones
2024-05-28 1:36 ` [PATCH 2/9] platform/x86: asus-wmi: don't fail if platform_profile already registered Luke D. Jones
2024-05-28 1:36 ` [PATCH 3/9] platform/x86: asus-wmi: add macros and expose min/max sysfs for ppt tunables Luke D. Jones
2024-05-28 8:50 ` Ilpo Järvinen
2024-06-04 5:14 ` kernel test robot
2024-05-28 1:36 ` [PATCH 4/9] platform/x86: asus-wmi: reduce code duplication with macros Luke D. Jones
2024-05-28 8:55 ` Ilpo Järvinen
2024-05-28 9:03 ` Ilpo Järvinen [this message]
2024-05-28 1:36 ` [PATCH 5/9] platform/x86: asus-wmi: use WMI_SIMPLE_SHOW in more places Luke D. Jones
2024-05-28 9:06 ` Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 6/9] platform/x86: asus-wmi: add panel-fhd functionality Luke D. Jones
2024-05-28 9:18 ` Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 7/9] platform/x86: asus-wmi: add enable/disable CPU cores Luke D. Jones
2024-05-28 9:27 ` Ilpo Järvinen
2024-05-28 21:37 ` Luke Jones
2024-05-28 1:36 ` [PATCH 8/9] platform/x86: asus-wmi: add apu_mem setting Luke D. Jones
2024-05-28 2:19 ` Limonciello, Mario
2024-05-28 2:40 ` Luke Jones
2024-05-28 13:27 ` Mario Limonciello
2024-05-28 21:04 ` Luke Jones
2024-05-28 21:16 ` Mario Limonciello
2024-05-28 21:34 ` Luke Jones
2024-05-28 21:36 ` Mario Limonciello
2024-05-28 21:37 ` Mario Limonciello
2024-05-28 1:36 ` [PATCH 9/9] platform/x86: asus-wmi: add setting dGPU TGP Luke D. Jones
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=f07c4980-9adc-96a2-4b72-c5db850e44c2@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox