From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 042EFC71156 for ; Tue, 1 Dec 2020 13:01:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7D6F2084C for ; Tue, 1 Dec 2020 13:01:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730920AbgLANAy (ORCPT ); Tue, 1 Dec 2020 08:00:54 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:44966 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730781AbgLANAy (ORCPT ); Tue, 1 Dec 2020 08:00:54 -0500 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 1AAAAFB06; Tue, 1 Dec 2020 14:00:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jBBmTbO464kn; Tue, 1 Dec 2020 14:00:12 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 220794068E; Tue, 1 Dec 2020 14:00:12 +0100 (CET) Date: Tue, 1 Dec 2020 14:00:12 +0100 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Andy Shevchenko Cc: Heikki Krogerus , Greg Kroah-Hartman , USB , Linux Kernel Mailing List Subject: Re: [PATCH v3 2/2] usb: typec: tps6598x: Export some power supply properties Message-ID: <20201201130012.GA303449@bogon.m.sigxcpu.org> References: <91c27b323786445f6b33c6a7e89e93755d05e3a2.1606481420.git.agx@sigxcpu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Hi, On Mon, Nov 30, 2020 at 08:35:26PM +0200, Andy Shevchenko wrote: > On Fri, Nov 27, 2020 at 2:57 PM Guido Günther 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)? Make sense. Fixed in v4. -- Guido > > 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 >