Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp918931imm; Fri, 27 Jul 2018 08:16:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcSjuRe7De7aXPTgkrMdq3xDyovSi6Ag0DuodetWVL9KYNdTicT8Hkdw3ZPa9qLX63NNAHB X-Received: by 2002:a17:902:aa4b:: with SMTP id c11-v6mr6397430plr.344.1532704601758; Fri, 27 Jul 2018 08:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532704601; cv=none; d=google.com; s=arc-20160816; b=Zzsmh/El+9AZWyF5cSWKXJSubzM392orFk+oyePKjgWjIig9bz6JcScFc1YcEXT5yi 05fTErOIhzs1HaiAF++ZfbLk5rExsg9rjwaFd+WzUj1xKh5umwRnO4tKZWj1MhDF+gJq dtAAmTp1xg5IjV6uGSAGXC09xy3lLEVgcv3LlpMRKS/+OoB0m7pQjY5h0X/8HdDMNfc0 h9yJrjJHtb3cd1UElx4SzV/m8nx10DEZILYOn/aHE5ipMf3MHMmFLcW/42hVCRMclqNk +M5KdN4l8E9OrzW6EVZFTZirGRPwolFTEmkVyDkY6+P9i0bel7L4TpUOFbP+G7LvkOtt rMYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=psMRdnSJdZnoGeBYQV15J4BEE5682+F4UxPwme40lWc=; b=CALU7vZWbaKE/zigP24XWeotZTrJB3MKd32gKuD+Pg8v+JEuYbyYEob4HpkP6gQPZA dnC+AgVBbGAR+rmQLDM/R3A15Q89S9/i6n4JQIOGLlomsk9LNI6N9SP9ZhquGTPKvtys d/tXESoCHF41VbQld7O/faIihEoFaiVNuZJv7J3kyXVPzfSTx/SxZgCw5vL4U8ZZTszc hl9UmfnoO2Al/vgBOq0sJALwz4g3pVRlr/vNtIuxKE6EvK8MVORCyoVptdsWm5Sb1hJS 2tuwsn5+yfxhe/cLpDZ9DzjH4EYEzLYfxsFFUxIm5zCVM+ZzegPHWYdLN/a+uZRe1qJs GN6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si3652969plb.100.2018.07.27.08.16.26; Fri, 27 Jul 2018 08:16:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388633AbeG0Qhx (ORCPT + 99 others); Fri, 27 Jul 2018 12:37:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40366 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbeG0Qhx (ORCPT ); Fri, 27 Jul 2018 12:37:53 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 84720DBE; Fri, 27 Jul 2018 15:15:30 +0000 (UTC) Date: Fri, 27 Jul 2018 17:15:27 +0200 From: Greg Kroah-Hartman To: Georgios Tsotsos Cc: devel@driverdev.osuosl.org, Aaro Koskinen , James Hogan , linux-kernel@vger.kernel.org, Joe Perches Subject: Re: [PATCH v2 2/3] Staging: octeon-usb: Change coding style of CVMX_WAIT_FOR_FIELD32 marco. Message-ID: <20180727151527.GA2209@kroah.com> References: <37553f45bfb34de4b0af476286b1b782ea834963.1532610629.git.tsotsos@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37553f45bfb34de4b0af476286b1b782ea834963.1532610629.git.tsotsos@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 26, 2018 at 06:41:52PM +0300, Georgios Tsotsos wrote: > Fixing coding style for CVMX_WAIT_FOR_FIELD32 was confusing. Also > encapsulates into parentheses timeout_usec. > > Signed-off-by: Georgios Tsotsos > --- > drivers/staging/octeon-usb/octeon-hcd.c | 44 +++++++++++++++++---------------- > 1 file changed, 23 insertions(+), 21 deletions(-) > > diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c > index cff5e790b196..c8e0ebf1434f 100644 > --- a/drivers/staging/octeon-usb/octeon-hcd.c > +++ b/drivers/staging/octeon-usb/octeon-hcd.c > @@ -378,27 +378,29 @@ struct octeon_hcd { > }; > > /* This macro spins on a register waiting for it to reach a condition. */ > -#define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec) \ > - ({int result; \ > - do { \ > - u64 done = cvmx_get_cycle() + (u64)timeout_usec * \ > - octeon_get_clock_rate() / 1000000; \ > - union _union c; \ > - \ > - while (1) { \ > - c.u32 = cvmx_usb_read_csr32(usb, address); \ > - \ > - if (cond) { \ > - result = 0; \ > - break; \ > - } else if (cvmx_get_cycle() > done) { \ > - result = -1; \ > - break; \ > - } else \ > - __delay(100); \ > - } \ > - } while (0); \ > - result; }) > +#define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec) \ > +({ \ > + int result; \ > + do { \ > + u64 done = cvmx_get_cycle() + (u64)(timeout_usec) * \ > + octeon_get_clock_rate() / 1000000; \ > + union _union c; \ > + \ > + while (1) { \ > + c.u32 = cvmx_usb_read_csr32(usb, address); \ > + \ > + if (cond) { \ > + result = 0; \ > + break; \ > + } else if (cvmx_get_cycle() > done) { \ > + result = -1; \ > + break; \ > + } else \ > + __delay(100); \ > + } \ > + } while (0); \ > + result; \ > +}) It's still a mess, why not just make this a function call instead? thanks, greg k-h