Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1377830ybh; Thu, 16 Jul 2020 10:23:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2WXAXathrFHx7EPDTv8PNBQ1uL7hnlAF+pfedFurbvelp6gS0+IEYx6wu8jzhbwLx3Ax+ X-Received: by 2002:aa7:db53:: with SMTP id n19mr5494677edt.338.1594920190606; Thu, 16 Jul 2020 10:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594920190; cv=none; d=google.com; s=arc-20160816; b=fA9L6lkkG7mZG0MO3xwbbeF16mP4roXKIcwmT4qIlCuCvsh9UzpqNZ2li/CfZt4e/u tCCwJP9lf6KciEIS2ZVKdVxDEoDbQ0sdyG6PDoq/065ZmRnOtwM5OCdWeSAMkvnZ9SVS Ttkv2f/lKolUjcRPtbiHudpSqE2x9WFVdpLX88gBBDVGw28LBZNFaDoxkiARyqQ3VfF8 QDEz051YospofPcZ68ZecrOjeVpN8XF+3+SPcQYDz06zOG7utbp5FdjC2QEHzeStfO0K Q3nK3P2JVg1BF3bct4VDlz2D+Iyrjflzr4w5O9GkIFK1R3eSHN0FkA6an6Gc6gRawv0l vrGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bPbXwwYWyet5Kf6gV4HyZCVuYdSTHiTLHNtCwYMlFTo=; b=UjXslGUpnILoDswPWpzperO/BzSmyODtkXHpMpY69r8Ayf7Z/nAKZFK+2lZ1MG8i+c KuthutW6Z/RCUrF5Z0N8aYdaeRtusDR7WrvU+TrfjQyA6CNZwybseKqqMSJ8twneC/8s mwUQlrm0pEJEgPpJpHT/dtXdAYVnSAz8OG2HRkqlrgiGLPUb5aR3hyq5oc9heqUOJeO3 hTU4XtwsA0mXGz8uqQcodl/6vW1N79qfKNqG8+iCpUD2cpLXKWS8gbXq9TazRVsKzT1I EAPOEgKVliLdxyNcooHgMyra9eMNzx9F/VWsoAvAQ2hZ4jje+Iaj1VEGyKRtlui9GLDK j7+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dsZ2q5RS; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si3503169edy.558.2020.07.16.10.22.47; Thu, 16 Jul 2020 10:23:10 -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; dkim=pass header.i=@broadcom.com header.s=google header.b=dsZ2q5RS; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729594AbgGPRTe (ORCPT + 99 others); Thu, 16 Jul 2020 13:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729562AbgGPRT2 (ORCPT ); Thu, 16 Jul 2020 13:19:28 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8DCEC08C5C0 for ; Thu, 16 Jul 2020 10:19:27 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id h22so8772935lji.9 for ; Thu, 16 Jul 2020 10:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bPbXwwYWyet5Kf6gV4HyZCVuYdSTHiTLHNtCwYMlFTo=; b=dsZ2q5RSVCFI3KsQRstQ0D3jAOV7yGWHXz52xAjtYsg+LkGGeyOdT+AVmFM4u574a5 TXxs1z65QBUjbcFhnBCXuGjoF5xKxgTbY5Gp1PwcMDfg42XYzh2E4emUWXXhP8iodhb1 29nzU8YaCQ1J2UdYaBJn+M5xNgLpSYFIVwec0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bPbXwwYWyet5Kf6gV4HyZCVuYdSTHiTLHNtCwYMlFTo=; b=FpCSdZlVdZY3DYustxfzAA+P1YO0AifRLi0i8PFokzjZ7iS+v+9DoORkqh5fZwtanQ kxrsNt5IY/yvnFWz5PXuti0Dts1k1Ycl9eHLLFIYJHR5PCZ5B3GAQxzzti9I51aQ5P2o IYCVfXmE1eyLJSs2FwdHS9YSCbSIRj9l/QN/KluJ3G+EejcyP9hJzj1S3RHR5KNQ3iE+ HCj2uIWf/MCIiRmBqbHJfBpmw082Pe/9v80bJfr5uW4sYc3ueokmN5AcvF1Rf65cqKbv xtDhVAapfzZg448uiS3IF89ZHS/SonMggV2iIJ1H9QmCgWgvoZJ5thtvH51I9yxWiL1i 5l7A== X-Gm-Message-State: AOAM533ToQh8kmU68VtFvBet2Cf8GraDdONJojK3T9K77MikjDiHhJkF oGnv9JfFqSOwnsd/ebiQ/xlAfm21jwPbJ+LTF2OOwGLoZ28= X-Received: by 2002:a2e:9f13:: with SMTP id u19mr2393590ljk.427.1594919965973; Thu, 16 Jul 2020 10:19:25 -0700 (PDT) MIME-Version: 1.0 References: <20200716080836.2279-1-rayagonda.kokatanur@broadcom.com> <20200716080836.2279-3-rayagonda.kokatanur@broadcom.com> In-Reply-To: From: Rayagonda Kokatanur Date: Thu, 16 Jul 2020 22:49:14 +0530 Message-ID: Subject: Re: [PATCH V1 2/2] i2c: iproc: add slave pec support To: Andy Shevchenko Cc: Wolfram Sang , linux-i2c , Linux Kernel Mailing List , Ray Jui , Scott Branden , bcm-kernel-feedback-list , Lori Hikichi , Robert Richter , Nishka Dasgupta , Andy Shevchenko , linux-arm Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Thu, Jul 16, 2020 at 3:44 PM Andy Shevchenko wrote: > > On Thu, Jul 16, 2020 at 11:14 AM Rayagonda Kokatanur > wrote: > > > > Iproc supports PEC computation and checking in both Master > > and Slave mode. > > > > This patch adds support for PEC in slave mode. > > ... > > > -#define S_RX_PEC_ERR_SHIFT 29 > > +#define S_RX_PEC_ERR_SHIFT 28 > > +#define S_RX_PEC_ERR_MASK 0x3 > > +#define S_RX_PEC_ERR 0x1 > > This needs to be explained in the commit message, in particular why > this change makes no regression. I didn't get what do you mean by "no regression", please elaborate. > > ... > > > +static int bcm_iproc_smbus_check_slave_pec(struct bcm_iproc_i2c_dev *iproc_i2c, > > + u32 val) > > +{ > > + u8 err_status; > > > + int ret = 0; > > Completely redundant variable. > > > + if (!iproc_i2c->en_s_pec) > > + return ret; > > return 0; > > > + err_status = (u8)((val >> S_RX_PEC_ERR_SHIFT) & S_RX_PEC_ERR_MASK); > > Why casting? > > > + if (err_status == S_RX_PEC_ERR) { > > + dev_err(iproc_i2c->device, "Slave PEC error\n"); > > > + ret = -EBADMSG; > > return ... > > > + } > > + > > + return ret; > > return 0; > > > +} > > ... > > > + if (rx_status == I2C_SLAVE_RX_END) { > > + int ret; > > + > > + ret = bcm_iproc_smbus_check_slave_pec(iproc_i2c, > > + val); > > One line looks better. Yes, but to have 80 char per line, I have to do this. > > > + if (!ret) > > Why not positive conditional? Thank you for your review. Will fix all above. Best regards, Rayagonda > > > + i2c_slave_event(iproc_i2c->slave, > > + I2C_SLAVE_STOP, &value); > > + else > > + i2c_slave_event(iproc_i2c->slave, > > + I2C_SLAVE_PEC_ERR, > > + &value); > > + } > > -- > With Best Regards, > Andy Shevchenko