Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp168198pxf; Thu, 11 Mar 2021 00:29:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxz36T+5mj5shw1MgByjN4LrK1mnesUTGdUKC6oKoNE6eTcqIsY1hvXCztqlg9pEgLIFAQG X-Received: by 2002:a05:6402:11c9:: with SMTP id j9mr7351823edw.348.1615451365704; Thu, 11 Mar 2021 00:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615451365; cv=none; d=google.com; s=arc-20160816; b=xTHpVO6WmE+uG2cYrxw0gk7+VQxWlMeW+ZEvZB7sVLNm3PNFEXr9BvZOI+2q+8puo9 vm7Zpbo73aGkdj81pSVzmue1MxjRHnZ3TibHVOfHvvYYfaA1J+54IfyXQhGg7UDE9Dxy 9U79E3wqlhCIz9pxtxT1gs+Mc7LRqPEqBlcS4GbL9m0NlyNWjUuI1sjve+JC/pb8ZUfE gfAo0bKyr4H0Vq1LG0Mmf2StFw0ArxHM2iSjhMklSUqx92OJHkdY3yA/f/RvF3UTH5OM TmbmHfhbczx6u/aAoDAu8PFO5IzD1TyIn8L4TWqGYZyqVCd894t/eWFtbWgKp83S5tkp elqA== 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=LLGtQhfsVfRq+Semkv5sJ2PS83SkOPyTdM6mvvW7nko=; b=on11zDAFSVdFOcedljzwlOczpqhGCPnssAcqf015dh/NvQNBjfis99jL8JCViyx/oB wx086I/8EVAnd68pEQdqUfqeSXPInnPnfQeJXaHhO6zQRx6l12GdWT5IwbkidcznADrt ADtvmMLSH2A9TerSbZfScwUyMsRTlJ/ewWGE7NImXsCicrNPBxatyz1dpXT0bQzBUeux lKTICTj+m4sQaCes9VbDz+gYxoSEk7JyS20iOaky+QMA8wXVDeeOhFdPGkAUzTJKS6qr Sqh0WhAAv86b11x2NT6fpOfjMuZKRkfsplMj9b+FgW8RvIPjYJIUj7OQ1V2WIQ3BZgIU 6Nxw== 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 b26si1348763ejb.374.2021.03.11.00.29.03; Thu, 11 Mar 2021 00:29:25 -0800 (PST) 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 S231335AbhCKI1x (ORCPT + 99 others); Thu, 11 Mar 2021 03:27:53 -0500 Received: from mga02.intel.com ([134.134.136.20]:50994 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231394AbhCKI1c (ORCPT ); Thu, 11 Mar 2021 03:27:32 -0500 IronPort-SDR: nsN+Jwgzo9vKGf/76IbnYy/VGzjLyTdQyVk0OXYFMI67YQUEVFEMVpDjYGCfhVAcFxQHZKf7CT IDUETTq4vEWQ== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="175744168" X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="175744168" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2021 00:27:31 -0800 IronPort-SDR: pJTjStgHCnmv5a1kWffP+57JbDpIvmrdwDCAF6kvP/wMpFTNU3qOkaI8NObhjmdaZAjYTGEE8y xnriS9luJGow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="509955082" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 11 Mar 2021 00:27:28 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 11 Mar 2021 10:27:27 +0200 Date: Thu, 11 Mar 2021 10:27:27 +0200 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Tso , stable@vger.kernel.org Subject: Re: [PATCH v1] usb: typec: tcpci: Refactor tcpc_presenting_cc1_rd macro Message-ID: References: <20210310223536.3471243-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210310223536.3471243-1-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 02:35:36PM -0800, Badhri Jagan Sridharan wrote: > Defining one macro instead of two for tcpc_presenting_*_rd. > This is a follow up of the comment left by Heikki Krogerus. > > https://patchwork.kernel.org/project/linux-usb/patch/ > 20210304070931.1947316-1-badhri@google.com/ > > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/tcpm/tcpci.c | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c > index 027afd7dfdce..25b480752266 100644 > --- a/drivers/usb/typec/tcpm/tcpci.c > +++ b/drivers/usb/typec/tcpm/tcpci.c > @@ -24,14 +24,10 @@ > #define AUTO_DISCHARGE_PD_HEADROOM_MV 850 > #define AUTO_DISCHARGE_PPS_HEADROOM_MV 1250 > > -#define tcpc_presenting_cc1_rd(reg) \ > +#define tcpc_presenting_rd(reg, cc) \ > (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ > - (((reg) & (TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT)) == \ > - (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC1_SHIFT))) > -#define tcpc_presenting_cc2_rd(reg) \ > - (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ > - (((reg) & (TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT)) == \ > - (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC2_SHIFT))) > + (((reg) & (TCPC_ROLE_CTRL_## cc ##_MASK << TCPC_ROLE_CTRL_## cc ##_SHIFT)) == \ > + (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_## cc ##_SHIFT))) > > struct tcpci { > struct device *dev; > @@ -201,11 +197,11 @@ static int tcpci_get_cc(struct tcpc_dev *tcpc, > *cc1 = tcpci_to_typec_cc((reg >> TCPC_CC_STATUS_CC1_SHIFT) & > TCPC_CC_STATUS_CC1_MASK, > reg & TCPC_CC_STATUS_TERM || > - tcpc_presenting_cc1_rd(role_control)); > + tcpc_presenting_rd(role_control, CC1)); > *cc2 = tcpci_to_typec_cc((reg >> TCPC_CC_STATUS_CC2_SHIFT) & > TCPC_CC_STATUS_CC2_MASK, > reg & TCPC_CC_STATUS_TERM || > - tcpc_presenting_cc2_rd(role_control)); > + tcpc_presenting_rd(role_control, CC2)); > > return 0; > } > -- > 2.31.0.rc1.246.gcd05c9c855-goog thanks, -- heikki