Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp225960pxf; Thu, 8 Apr 2021 01:23:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHoycDdvK9sKwb8u43I6Gj+flZo8jFmN6m/rZyou1XlFAVH97dmNmCc+KrgZkg1QcWV9m+ X-Received: by 2002:a17:90b:3846:: with SMTP id nl6mr7190713pjb.48.1617870212187; Thu, 08 Apr 2021 01:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617870212; cv=none; d=google.com; s=arc-20160816; b=DRZzHxiwDllYkoa1I/WnGixByQkb826h374F+QMXt0xxbvgj3u9g58FDKD5MmtlnPm 2hYV2tJ2Hxm/PUcEf8UP0Ag6WoNHRO0frymJLogGzZz3VSOUZsDnNhNPSLEsLYoRD8Lx oedl3gqRTvr16Yy0KDJwthVErRm/Zmmdkbpv5+w8YcxdMwRjsgZodVx7YYcyeo+dNQT+ akIgG5AxfXymZFjVwM4T8Dwgj1kytxJ4fJrrrhKTld1jmHWEDbea0OpbODi6qJsShnLp 0lTQtDosFNxxE5Siq/ONSwoHG8yn/6WXJJhTTZmK9XkaSKdFY3y0uwpMjynEJS54I4y3 QoHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=ZOWUhCKl9bddH8XBLd6LC0yDlq9RyFpdTCNsoSzDv9Q=; b=GdvebfnvokftrQsLTSQJMlNtNU0EMLH7s0klNV9hHjAKo70TImFiAmakse1hm8tagv q2/lHsEZoh4A8mqmWwycbkOg5A9T3J+CYaEuAnU2FQLRtBGdM/BhBnERXUPPmIZAy28y pp1Wl/+0grFb57HmmrLiUqHMAtOfIIi8ErH9xNHOw0QU4dWVzVl4dS2qoHhIzRiddzZw YMVKzsS8c9BQjod4TxDfCofoaMaDQMSgzZaa4gPDt5xmbseJFyOhW6jf8xLNEgywXKOQ 0f48g7XShBwLPfs7Y0ZeERmgkLxpXFVBvO8Rd1qEuWQPA8OX3DvoXVbPAtoiGNB58utj bugw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si24249224pfc.57.2021.04.08.01.23.19; Thu, 08 Apr 2021 01:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbhDHIW6 (ORCPT + 99 others); Thu, 8 Apr 2021 04:22:58 -0400 Received: from mga18.intel.com ([134.134.136.126]:61098 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbhDHIW6 (ORCPT ); Thu, 8 Apr 2021 04:22:58 -0400 IronPort-SDR: t682/d3xdaMAImFzw2DgTKBdYw0vSXTJiYRdoxVg1smzs1/JLClNx8IWHOOeCGomNlPxGaMUog k+zoKpN4tfvA== X-IronPort-AV: E=McAfee;i="6000,8403,9947"; a="181028767" X-IronPort-AV: E=Sophos;i="5.82,205,1613462400"; d="scan'208";a="181028767" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 01:22:46 -0700 IronPort-SDR: z1/1PwhVcmfxJEbrVgjWsE8eSNzW+CTsJBrNvarhwgRIKhK/XLZleD8F9MXZcW6mYVxq88hJ66 XJlCTD45AGbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,205,1613462400"; d="scan'208";a="519764987" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 08 Apr 2021 01:22:40 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 08 Apr 2021 11:22:40 +0300 Date: Thu, 8 Apr 2021 11:22:40 +0300 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , Rob Herring , Adam Thomson , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Kyle Tso Subject: Re: [PATCH v2 5/6] usb: typec: tcpm: Allow slow charging loops to comply to pSnkStby Message-ID: References: <20210407200723.1914388-1-badhri@google.com> <20210407200723.1914388-5-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > @@ -4047,9 +4053,12 @@ static void run_state_machine(struct tcpm_port *port) > > break; > > case SNK_DISCOVERY: > > if (port->vbus_present) { > > - tcpm_set_current_limit(port, > > - tcpm_get_current_limit(port), > > - 5000); > > + u32 current_lim = (!port->slow_charger_loop || > > + (tcpm_get_current_limit(port) <= > > + PD_P_SNK_STDBY_MW / 5)) ? > > + tcpm_get_current_limit(port) : > > + PD_P_SNK_STDBY_MW / 5; > > Here the use of the ternary operator is not appropriate. Please try to > clean that up somehow. Maybe something like this would be better? > > u32 current_lim = tcpm_get_current_limit(port); > > if (port->slow_charger_loop || (current_lim < PD_P_SNK_STDBY_MW / 5)) > current_lim = PD_P_SNK_STDBY_MW / 5; Sorry, I mean: if (port->slow_charger_loop || (current_lim > PD_P_SNK_STDBY_MW / 5)) current_lim = PD_P_SNK_STDBY_MW / 5; thanks, -- heikki