Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp790897lqs; Tue, 5 Mar 2024 17:32:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUwEAuJQGkQo1Ufe8pOUqPhMRfjd7VeaCyUtun1Hh6++akscveKfL3nI9RziG/9GtArtOq+Dclds6C+oivKpxNmAiX/V4Mqwnu3Bhdiog== X-Google-Smtp-Source: AGHT+IG9VhKtDesXxthSky/E++e3/30giY+WaRnSyza2kJiCWvzJZP5A5nArSed950cWZ56Gtj4y X-Received: by 2002:a05:6358:3406:b0:17c:1d6c:c8ca with SMTP id h6-20020a056358340600b0017c1d6cc8camr4083313rwd.27.1709688754362; Tue, 05 Mar 2024 17:32:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709688754; cv=pass; d=google.com; s=arc-20160816; b=EsCG6MYd8ykNONhfwuxzqwX0WnrrsTPoWQM76UUJ9uPFuICl8Gu7IRT+ELF9mO5yu7 Q1cDkLywL8P6us43q4v47ts56QA4z/7mTpoqxkkOm3ISU2YoM6tkYVGs4M2f87Y2YvET NHM59qASisQLrWRhYktxoYtnzFkHF60yI+omsrmdc6usi5YC8jTa1xImnEO7508RlRpf nT7JVXwpMERsf61SRXYYfXnYUCDuH851K1l9WRb6GglffOqp5MQcCJ7UDT8JyHDM1lTt EAUBPDGB93iDumzkeZDtPB6twwwlqiZh6GmuCDubmSGGU3R8YdUAcxXtlMgfwM0h1Y2v tKVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Y0+8gF7WqZvyb/044nLtUIzxT0X5jj+CG9vI+Acoglc=; fh=I2h1g3ukzdpoaDHxO0ON7d1NQInFMcMyMuzYkxWoZ5c=; b=fuF8nscPb3H70DteYkcTKTz4a/wEmVArZ+1Uhioj94KrXS64SKvOb56J+cjPhql7h1 ugJKor0bMlU8OYjY7S5kcQA9Vx/jyPzEZeT0vYvt6XxnfYwc0mOtoMosljYiT/gGRY+M yam6ZCKkdDJMIrkF7/S5s4cNEGlNNgJgWEfBcJMr5XVNfryd55wpGCr87tkZKJVYF0tW 7NORl/VTDwdqbidYwl2ThDXxNSawQkqWDE97hS2OB8wXUnvVjCaLXrUo3pCK1NFE1zVV cFEnDxwhAdJYqzp/Oq1JzwXpPkJ6Yvg9zcLPI19Ma53vzQh9nRFzS2mBhsZTQhiZbKD0 Ipfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sbrdtODI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vu27-20020a05620a561b00b0078826f324e5si6120197qkn.564.2024.03.05.17.32.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 17:32:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sbrdtODI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1644A1C22304 for ; Wed, 6 Mar 2024 01:32:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7E6C7460; Wed, 6 Mar 2024 01:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sbrdtODI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD95BECF; Wed, 6 Mar 2024 01:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709688744; cv=none; b=mwbeTKMqtDj1kXIAqgslPu5ZkPr7AkkzaNy73qnUMx9OWkhER773yuU2UjtiZcchmoXDlAsQJWvEFPoTZRFIegt66z9AjiEmwmerOykw0Xxrevt5uLnWaP7tQzZUnsgzbuz53XmIHdGgwXXC8nhHZ+UtiP4YVKrLQas1/BV6J9U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709688744; c=relaxed/simple; bh=K7e/3Jvw+q4xoIZ8XEiXRizjLSRo5qPWF23ZIKnpUQ8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cGPlQAC2M3Pjno4KFWt00DnSi1flblBTzbMqZmPeiHioL1nCCuwWrU4OUSZuJG3mebk+SnOgWVUaKB1jvDaGe1VwFsrNjPbCUOs3ZlOArpg96hBp6knh91k4oEyB6JEqb5t3OPJCedv+wENTh83kgg1iUWotjXmBLIQW+5GU6fU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sbrdtODI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF86AC433F1; Wed, 6 Mar 2024 01:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709688744; bh=K7e/3Jvw+q4xoIZ8XEiXRizjLSRo5qPWF23ZIKnpUQ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sbrdtODIBW1NW8cU33R418vIc1i6JmLP38GALrxpMpUMKSIHl8x2IaXVShMRWL5YQ MVAD9BgZkGAIJ++9HPLja3RUB3lPoU2/BwTtMxvrvzp9qgb4ouF8veosAjC55JIQtr mhnchoy3+uq7QotmGM+stV1rOejtAb3jtX3RWyqPLodkPbEhQ48dyEYhqMZLKWe6L7 uGglMABeHllLDXAvPMctbpKl9knSNrLXi2rs36HEXl+4qpQ88/Bs79xUGPg8nUA0nS 5I5FpUmjhNTJBMo1kZw4+r5vNS6SCYCKYSwIYc+AkBKiMGt58pFCpeAXNqnpIzM+1K 23kNChbi3n61Q== Date: Wed, 6 Mar 2024 02:32:20 +0100 From: Andi Shyti To: "Hsin-Yu.Chen" Cc: wsa+renesas@sang-engineering.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: remove redundant condition Message-ID: References: <20240305165652.18842-1-harry021633@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240305165652.18842-1-harry021633@gmail.com> Hi Hsin-Yu, On Wed, Mar 06, 2024 at 12:56:52AM +0800, Hsin-Yu.Chen wrote: > I2C_M_RD is defined as 1 and `flag & I2C_M_RD` is one or zero > no need one more condition to get the value this can be written a bit better as: /no need one more/no need for an additional/ > Signed-off-by: Hsin-Yu.Chen anyway: Reviewed-by: Andi Shyti Thanks, Andi > --- > include/linux/i2c.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/i2c.h b/include/linux/i2c.h > index 652ecb7abeda..363dde9ef94f 100644 > --- a/include/linux/i2c.h > +++ b/include/linux/i2c.h > @@ -931,7 +931,7 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) > > static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg) > { > - return (msg->addr << 1) | (msg->flags & I2C_M_RD ? 1 : 0); > + return (msg->addr << 1) | (msg->flags & I2C_M_RD); > } > > u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold); > -- > 2.38.1 >