* [PATCH] Power: Supply: sbs-charger: simplfied bool function
@ 2017-02-14 13:43 Daniel Perez
2017-02-14 13:58 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Perez @ 2017-02-14 13:43 UTC (permalink / raw)
To: sre; +Cc: linux-pm, linux-kernel, nicolassaenzj, Daniel Perez
Simplified the syntax of a simple bool return value function.
Signed-off-by: Daniel Perez <danielperezdeandres@gmail.com>
---
drivers/power/supply/sbs-charger.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/power/supply/sbs-charger.c b/drivers/power/supply/sbs-charger.c
index 353765a..3e40553 100644
--- a/drivers/power/supply/sbs-charger.c
+++ b/drivers/power/supply/sbs-charger.c
@@ -137,10 +137,7 @@ static enum power_supply_property sbs_properties[] = {
static bool sbs_readable_reg(struct device *dev, unsigned int reg)
{
- if (reg < SBS_CHARGER_REG_SPEC_INFO)
- return false;
- else
- return true;
+ return reg < SBS_CHARGER_REG_SPEC_INFO ? false : true;
}
static bool sbs_volatile_reg(struct device *dev, unsigned int reg)
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Power: Supply: sbs-charger: simplfied bool function
2017-02-14 13:43 [PATCH] Power: Supply: sbs-charger: simplfied bool function Daniel Perez
@ 2017-02-14 13:58 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-02-14 13:58 UTC (permalink / raw)
To: Daniel Perez, sre; +Cc: linux-pm, linux-kernel, nicolassaenzj
On Tue, 2017-02-14 at 14:43 +0100, Daniel Perez wrote:
> Simplified the syntax of a simple bool return value function.
>
> Signed-off-by: Daniel Perez <danielperezdeandres@gmail.com>
> ---
> drivers/power/supply/sbs-charger.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/power/supply/sbs-charger.c b/drivers/power/supply/sbs-charger.c
> index 353765a..3e40553 100644
> --- a/drivers/power/supply/sbs-charger.c
> +++ b/drivers/power/supply/sbs-charger.c
> @@ -137,10 +137,7 @@ static enum power_supply_property sbs_properties[] = {
>
> static bool sbs_readable_reg(struct device *dev, unsigned int reg)
> {
> - if (reg < SBS_CHARGER_REG_SPEC_INFO)
> - return false;
> - else
> - return true;
> + return reg < SBS_CHARGER_REG_SPEC_INFO ? false : true;
Any ternary with true false could be simplified.
Why not just
return reg >= SBS_CHARGER_REG_SPEC_INFO;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-14 13:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 13:43 [PATCH] Power: Supply: sbs-charger: simplfied bool function Daniel Perez
2017-02-14 13:58 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®