lkml.org 
[lkml]   [2020]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 2/2] usb: typec: tps6598x: Export some power supply properties
On Fri, Nov 27, 2020 at 2:57 PM Guido Günther <agx@sigxcpu.org> wrote:
>
> This allows downstream supplies and userspace to detect
> whether external power is supplied.

> + if (!(pwr_status & TPS_POWER_STATUS_CONNECTION) ||
> + !(pwr_status & TPS_POWER_STATUS_SOURCESINK)) {
> + val->intval = 0;
> + } else {
> + val->intval = 1;
> + }

Can we please use positive conditionals (which usually are easier to read)?

if ((pwr_status & TPS_POWER_STATUS_CONNECTION) &&
(pwr_status & TPS_POWER_STATUS_SOURCESINK)) {
val->intval = 1;
} else {
val->intval = 0;
}

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-11-30 19:36    [W:0.103 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site