devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Dennis Lambe Jr <dennis@sparkcharge.io>
Cc: "Alessandro Zummo" <a.zummo@towertech.it>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Atsushi Nemoto" <atsushi.nemoto@sord.co.jp>,
	"Mylène Josserand" <mylene.josserand@free-electrons.com>,
	"Gary Bisson" <gary.bisson@boundarydevices.com>,
	"Javier Martinez Canillas" <javier@osg.samsung.com>,
	"Troy Kisky" <troy.kisky@boundarydevices.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rtc@vger.kernel.org
Subject: Re: [PATCH v3 1/3] rtc: m41t80: probe: use IS_ENABLED for CONFIG_OF
Date: Thu, 19 Jan 2023 23:20:59 +0100	[thread overview]
Message-ID: <Y8nCS8Z0QKzbeY2G@mail.local> (raw)
In-Reply-To: <20230119213903.899756-2-dennis@sparkcharge.io>

On 19/01/2023 21:39:01+0000, Dennis Lambe Jr wrote:
> The style guide recommends IS_ENABLED rather than ifdef for wrapping
> conditional code wherever possible.
> 
> Functions that are only called on DeviceTree platforms would otherwise
> need to be cluttered up with __maybe_unused, which is especially
> undesirable if there's nothing inherently DT-specific about those
> functions.
> 
> Signed-off-by: Dennis Lambe Jr <dennis@sparkcharge.io>
> ---
> 
> Notes:
>     v1 -> v2: spelling fix in changelog
> 
>  drivers/rtc/rtc-m41t80.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
> index 494052dbd39f..f963b76e5fc0 100644
> --- a/drivers/rtc/rtc-m41t80.c
> +++ b/drivers/rtc/rtc-m41t80.c
> @@ -909,10 +909,11 @@ static int m41t80_probe(struct i2c_client *client)
>  	if (IS_ERR(m41t80_data->rtc))
>  		return PTR_ERR(m41t80_data->rtc);
>  
> -#ifdef CONFIG_OF
> -	wakeup_source = of_property_read_bool(client->dev.of_node,
> -					      "wakeup-source");
> -#endif
> +	if (IS_ENABLED(CONFIG_OF)) {
> +		wakeup_source = of_property_read_bool(client->dev.of_node,
> +						      "wakeup-source");
> +	}
> +

A way better patch would switch to fwnode_property_read_bool

>  	if (client->irq > 0) {
>  		rc = devm_request_threaded_irq(&client->dev, client->irq,
>  					       NULL, m41t80_handle_irq,
> -- 
> 2.25.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2023-01-19 22:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 21:39 [PATCH v3 0/3] rtc: Set M41T82 & M41T83 xtal load capacitance from DT Dennis Lambe Jr
2023-01-19 21:39 ` [PATCH v3 1/3] rtc: m41t80: probe: use IS_ENABLED for CONFIG_OF Dennis Lambe Jr
2023-01-19 22:20   ` Alexandre Belloni [this message]
2023-01-19 23:17     ` Dennis Lambe
2023-01-19 21:39 ` [PATCH v3 2/3] dt-bindings: m41t80: add xtal load capacitance Dennis Lambe Jr
2023-01-19 21:39 ` [PATCH v3 3/3] rtc: m41t80: set xtal load capacitance from DT Dennis Lambe Jr
2023-01-19 22:17 ` [PATCH v3 0/3] rtc: Set M41T82 & M41T83 " Alexandre Belloni
2023-01-19 23:27   ` Dennis Lambe
2023-01-19 23:52     ` Alexandre Belloni
2023-01-20 19:12       ` Dennis Lambe
2023-01-20  2:36 ` Atsushi Nemoto

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=Y8nCS8Z0QKzbeY2G@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=atsushi.nemoto@sord.co.jp \
    --cc=dennis@sparkcharge.io \
    --cc=devicetree@vger.kernel.org \
    --cc=gary.bisson@boundarydevices.com \
    --cc=javier@osg.samsung.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mylene.josserand@free-electrons.com \
    --cc=robh+dt@kernel.org \
    --cc=troy.kisky@boundarydevices.com \
    /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;
as well as URLs for NNTP newsgroup(s).