lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZqouDgCTPrQX4B+9@kuha.fi.intel.com>
Date: Wed, 31 Jul 2024 15:29:02 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: André Draszik <andre.draszik@...aro.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Peter Griffin <peter.griffin@...aro.org>,
	Tudor Ambarus <tudor.ambarus@...aro.org>,
	Will McVicker <willmcvicker@...gle.com>,
	Badhri Jagan Sridharan <badhri@...gle.com>, kernel-team@...roid.com,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/15] usb: typec: tcpm/tcpci_maxim: drop STATUS_CHECK()

On Wed, Jul 10, 2024 at 11:36:17AM +0100, André Draszik wrote:
> Only one user of STATUS_CHECK() remains, and the code can actually be
> made more legible by simply avoiding the use of that wrapper macro,
> allowing to also drop the macro altogether.
> 
> Do so.
> 
> Signed-off-by: André Draszik <andre.draszik@...aro.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
>  drivers/usb/typec/tcpm/maxim_contaminant.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/maxim_contaminant.c b/drivers/usb/typec/tcpm/maxim_contaminant.c
> index e7687aeb69c0..8ac8eeade277 100644
> --- a/drivers/usb/typec/tcpm/maxim_contaminant.c
> +++ b/drivers/usb/typec/tcpm/maxim_contaminant.c
> @@ -46,8 +46,6 @@ enum fladc_select {
>  #define READ1_SLEEP_MS			10
>  #define READ2_SLEEP_MS			5
>  
> -#define STATUS_CHECK(reg, mask, val)	(((reg) & (mask)) == (val))
> -
>  #define IS_CC_OPEN(cc_status) \
>  	(FIELD_GET(TCPC_CC_STATUS_CC1, cc_status) == TCPC_CC_STATE_SRC_OPEN \
>  	 && FIELD_GET(TCPC_CC_STATUS_CC2, cc_status) == TCPC_CC_STATE_SRC_OPEN)
> @@ -368,7 +366,7 @@ bool max_contaminant_is_contaminant(struct max_tcpci_chip *chip, bool disconnect
>  		}
>  		return false;
>  	} else if (chip->contaminant_state == DETECTED) {
> -		if (STATUS_CHECK(cc_status, TCPC_CC_STATUS_TOGGLING, 0)) {
> +		if (!(cc_status & TCPC_CC_STATUS_TOGGLING)) {
>  			chip->contaminant_state = max_contaminant_detect_contaminant(chip);
>  			if (chip->contaminant_state == DETECTED) {
>  				max_contaminant_enable_dry_detection(chip);
> 
> -- 
> 2.45.2.803.g4e1b14247a-goog

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ