From: Vasileios Amoiridis <vassilisamir@gmail.com>
To: jic23@kernel.org, lars@metafoo.de
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Vasileios Amoiridis <vassilisamir@gmail.com>
Subject: [PATCH v1 1/1] iio: acpi-als: Use elvis operator to simplify if statement
Date: Sun, 22 Sep 2024 18:03:04 +0200 [thread overview]
Message-ID: <20240922160304.520613-2-vassilisamir@gmail.com> (raw)
In-Reply-To: <20240922160304.520613-1-vassilisamir@gmail.com>
By using the elvis operator here, we can get rid of the if statement
and simplify the code.
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
drivers/iio/light/acpi-als.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
index 2d91caf24dd0..cea3499c3af3 100644
--- a/drivers/iio/light/acpi-als.c
+++ b/drivers/iio/light/acpi-als.c
@@ -171,10 +171,8 @@ static irqreturn_t acpi_als_trigger_handler(int irq, void *p)
*
* If the timestamp was actually 0, the timestamp is set one more time.
*/
- if (!pf->timestamp)
- pf->timestamp = iio_get_time_ns(indio_dev);
-
- iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp);
+ iio_push_to_buffers_with_timestamp(indio_dev, buffer,
+ pf->timestamp ?: iio_get_time_ns(indio_dev));
out:
mutex_unlock(&als->lock);
iio_trigger_notify_done(indio_dev->trig);
--
2.25.1
next prev parent reply other threads:[~2024-09-22 16:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-22 16:03 [PATCH v1 0/1] iio: Remove assignment to pf->timestamp by using elvis Vasileios Amoiridis
2024-09-22 16:03 ` Vasileios Amoiridis [this message]
2024-09-28 14:58 ` [PATCH v1 1/1] iio: acpi-als: Use elvis operator to simplify if statement Jonathan Cameron
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=20240922160304.520613-2-vassilisamir@gmail.com \
--to=vassilisamir@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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