From: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
To: nattan <nattanferreira58@gmail.com>, jic23@kernel.org
Cc: lucasantonio.santos@usp.br, linux-iio@vger.kernel.org
Subject: Re: [PATCH v3] iio: light: apds9306: Refactor threshold get/set functions to use helper
Date: Thu, 24 Apr 2025 22:34:26 +0930 [thread overview]
Message-ID: <222efff5-38d6-483f-8e5b-b0f07cb98130@tweaklogic.com> (raw)
In-Reply-To: <20250422191114.32832-1-nattanferreira58@gmail.com>
Hi Nattan, Lucas,
> Refactor the apds9306_event_thresh_get and apds9306_event_thresh_set
> functions to use a helper function (apds9306_get_thresh_reg) for obtaining the
> correct register based on the direction of the event. This improves code
> readability,minimize the number of lines and maintains consistency
It actually adds four more lines to the driver file. Rephrase maybe.
> drivers/iio/light/apds9306.c | 36 ++++++++++++++++++++----------------
> 1 file changed, 20 insertions(+), 16 deletions(-)
20 additions and 16 deletions.
> @@ -769,22 +776,19 @@ static int apds9306_event_thresh_get(struct apds9306_data *data, int dir,
> static int apds9306_event_thresh_set(struct apds9306_data *data, int dir,
> int val)
> {
> - int var;
> + int reg;
I like the name changed from 'var' to reg', makes much more sense.
> u8 buff[3];
>
There is always a balance/trade-off between modularity and execution speed.
I agree with Marcelo's reply in the first patch and I also think that separate function for this does not add much value.
Overall the patch looks good to me.
With the above:
Acked-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
Regards,
Subhajit Ghosh
next prev parent reply other threads:[~2025-04-24 13:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 19:11 [PATCH v3] iio: light: apds9306: Refactor threshold get/set functions to use helper nattan
2025-04-24 13:04 ` Subhajit Ghosh [this message]
2025-05-26 23:33 ` Nattan Ferreira
-- strict thread matches above, loose matches on Subject: below --
2025-05-26 23:59 nattan
2025-05-31 17:23 ` Jonathan Cameron
2025-06-05 18:55 ` Nattan Ferreira
2025-06-04 1:33 ` Marcelo Schmitt
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=222efff5-38d6-483f-8e5b-b0f07cb98130@tweaklogic.com \
--to=subhajit.ghosh@tweaklogic.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=lucasantonio.santos@usp.br \
--cc=nattanferreira58@gmail.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