From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linusw@kernel.org>,
mfd@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Lee Jones <lee@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] mfd: si476x-i2c: Get rid of duplicate NULL checks
Date: Wed, 15 Jul 2026 21:16:03 +0200 [thread overview]
Message-ID: <20260715191603.1325479-1-andriy.shevchenko@linux.intel.com> (raw)
GPIO descriptor APIs are NULL-aware and since the requested line is optional
we don't need to have an additional check each time we want to toggle GPIO.
Get rid of duplicate NULL checks.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mfd/si476x-i2c.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c
index 55700ce711f4..9bce720a0a08 100644
--- a/drivers/mfd/si476x-i2c.c
+++ b/drivers/mfd/si476x-i2c.c
@@ -130,8 +130,7 @@ int si476x_core_start(struct si476x_core *core, bool soft)
int err;
if (!soft) {
- if (core->reset)
- gpiod_set_value_cansleep(core->reset, 0);
+ gpiod_set_value_cansleep(core->reset, 0);
if (client->irq)
enable_irq(client->irq);
@@ -197,8 +196,7 @@ int si476x_core_start(struct si476x_core *core, bool soft)
else
cancel_delayed_work_sync(&core->status_monitor);
- if (core->reset)
- gpiod_set_value_cansleep(core->reset, 1);
+ gpiod_set_value_cansleep(core->reset, 1);
return err;
}
@@ -242,10 +240,9 @@ int si476x_core_stop(struct si476x_core *core, bool soft)
else
cancel_delayed_work_sync(&core->status_monitor);
- if (!soft) {
- if (core->reset)
- gpiod_set_value_cansleep(core->reset, 1);
- }
+ if (!soft)
+ gpiod_set_value_cansleep(core->reset, 1);
+
return err;
}
EXPORT_SYMBOL_GPL(si476x_core_stop);
--
2.50.1
reply other threads:[~2026-07-15 19:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260715191603.1325479-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfd@lists.linux.dev \
/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
Powered by JetHome