Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp974661ybh; Wed, 15 Jul 2020 22:42:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ11ULslu2dvrfWnFBPqAXMlPWenlTYS+srCdqgwyVhaBgu1qHCoSKBVhiv6gj3Ahms0Gr X-Received: by 2002:a17:906:35ce:: with SMTP id p14mr2176075ejb.514.1594878124737; Wed, 15 Jul 2020 22:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594878124; cv=none; d=google.com; s=arc-20160816; b=SmWR2lVDXXIk8fhbP2qbcGC6q4qTtvWssPdc6KVU1zD4+Yo6iwZRE01QZOsbtGi5de qo/4D4ilOkEFUiJ0pfbmsqdbr1UIsK6MrpfQMl9+zM0KOmgv//qKGoNsaY/UMdxulObF 9Y8E3hGmGMS/5tq8xAb6ftrq+b4A8gWrXbvBoniNkRB5LFCQYzVzEgfFfX0MUtP1IsHW fRMISxMm7EOb5PhrvFTcOzi/RV1krqBJvvcdEOKgm4ncZnLSFl8fLvMAD9jX69SDjfN5 s2qfldfCT8/83+K0qRefDsETOdBiVg1RLqqbIj5z2JB+YPeivbubGsi1x/dVSAWbQKbH gWiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mkDB3tdwP3ZrecyeuZ2HihfaUMSWIkxJsdLLCDHoVsk=; b=ZYbcHszb+9kF/N527lIGEBzfh7U/A4k+V4n1k6a9drBG7BFGgCgM4SQ530oGJSf7l5 /2XPu1WFEQ6cMCBbjJD71HwKeChQScZSsu15rojZIJ2eWtWP9Lu6vDOyitIFHEtSWJau vGUKUt4i9oahZ0NE0MpyyUEjJA/4d4lcwcX9iHvNGSGtMygWp3IKs4QThoS9WBx6/5dj yHKZ/fCxrpHcSocpbIouzoJHLGxl+VF+YRaLBrOZYCWIjRtycbXGVZju3V3ixi1wIBRV s9FepSqiVDbqBi5TSCCz1Vq9+6MQ74uiRYCNT7+/jPcC4cixQmZ74kPmEPU6z4Z+K2C4 KMTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MzrX8p2+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si2545969eje.434.2020.07.15.22.41.41; Wed, 15 Jul 2020 22:42:04 -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=@gmail.com header.s=20161025 header.b=MzrX8p2+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726069AbgGPFjQ (ORCPT + 99 others); Thu, 16 Jul 2020 01:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbgGPFjQ (ORCPT ); Thu, 16 Jul 2020 01:39:16 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E600C061755; Wed, 15 Jul 2020 22:39:16 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id l63so4266615pge.12; Wed, 15 Jul 2020 22:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mkDB3tdwP3ZrecyeuZ2HihfaUMSWIkxJsdLLCDHoVsk=; b=MzrX8p2+gdJ26geWwsRzsyc0TF1UDznhbV5hI3aNqJhCu+rv8D1lKeKroazYErM4Sd cbOOoWcsUBFoB3Lm8E36OV/EgQSKd4A46hXps+vvRDZpwmSYb+SEWgtMnGv5aDuUf0sV WQRvkBJOm0V1jt04PRm2tFazIHX3Vv6vjn6KHQDyrLVx1/2siRWXPafm8dRVTByOVMwZ +if5MKet5U72+VLkpezzfCIabqc6L3fdUV7OsKNG8fFLxJz9viafaRhnVhiuLnvGnEaf ZyV008Sw985wDIC9S+W6p6VAWmT3X4kypQC2HLrekV6PJnNslW6szh/7I25dOycUWUCH nAhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mkDB3tdwP3ZrecyeuZ2HihfaUMSWIkxJsdLLCDHoVsk=; b=EqrbyXOs5V+2xvO1848aRsMBItZe4brO5Tt9cjddR8WKBJUEU3gIK5HQdPnhgcAQtw +tH34PHhe+WLzpDib7r9lYxjN8qgbF4yEkkmggn7S1TXs2nt26c3CTP45fSZy4UPbe5f 4abfKdN8pgVh+038QA/5kFErdzx7ds6MWb4ljkPFryl3XhzqM1GdoSK03oRBt1nPH8/0 T2Vw8wIPqeWoyBPIxGXbYpFH19kBErNPkM78dlnQGPFEbfDPwM4i7nNF1uVE2mM/yjJ4 u52p50uCXxPwHUEplVz4CyNrpOOR0ToY4d514N3vlZfoIOJrr4YHqTZTEN8Jph8QXbYf V7dg== X-Gm-Message-State: AOAM532BBonFQvcJH0Ftf3t/MMiGdAejziMHzsjOfXo+xAohMpoaeFkj Lxf0mUoxsLa2Tn55KWLQ6JY= X-Received: by 2002:aa7:9241:: with SMTP id 1mr2442967pfp.188.1594877955324; Wed, 15 Jul 2020 22:39:15 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:a6ae:11ff:fe11:fcc3]) by smtp.gmail.com with ESMTPSA id b82sm3576371pfb.215.2020.07.15.22.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 22:39:14 -0700 (PDT) Date: Wed, 15 Jul 2020 22:39:12 -0700 From: Dmitry Torokhov To: Jingle Wu Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, phoenix@emc.com.tw, josh.chen@emc.com.tw, kai.heng.feng@canonical.com Subject: Re: [PATCH 2/2] Input: elan_i2c - Modify the IAP related function for page sizes 128, 512 bytes. Message-ID: <20200716053912.GB1665100@dtor-ws> References: <20200714105641.15151-1-jingle.wu@emc.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200714105641.15151-1-jingle.wu@emc.com.tw> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jingle, On Tue, Jul 14, 2020 at 06:56:41AM -0400, Jingle Wu wrote: > + if (!iap) > + cmd = ETP_I2C_FW_VERSION_CMD; > + else if (pattern_ver == 0) > + cmd = ETP_I2C_IAP_VERSION_CMD_OLD; Just to confirm, the older devices (I assume that pattern 0 means older) have version command that is numerically higher than the one for the newer (pattern >= 1) devices? > + else > + cmd = ETP_I2C_IAP_VERSION_CMD; > > - error = elan_i2c_read_cmd(client, > - iap ? ETP_I2C_IAP_VERSION_CMD : > - ETP_I2C_FW_VERSION_CMD, > - val); > + error = elan_i2c_read_cmd(client, cmd, val); > if (error) { > dev_err(&client->dev, "failed to get %s version: %d\n", > iap ? "IAP" : "FW", error); > return error; > } > > - if (pattern_ver == 0x01) > + if (pattern_ver >= 0x01) > *version = iap ? val[1] : val[0]; > else > *version = val[0]; > @@ -298,7 +316,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, > return error; > } > > - if (pattern_ver == 0x01) { > + if (pattern_ver >= 0x01) { > error = elan_i2c_read_cmd(client, ETP_I2C_IC_TYPE_CMD, val); > if (error) { > dev_err(&client->dev, "failed to get ic type: %d\n", > @@ -324,7 +342,14 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, > return error; > } > *version = val[0]; > - *ic_type = val[1]; > + > + error = elan_i2c_read_cmd(client, ETP_I2C_IAP_VERSION_CMD, val); > + if (error) { > + dev_err(&client->dev, "failed to get ic type: %d\n", > + error); > + return error; > + } Could you please tell me why this chunk is needed? Thanks. -- Dmitry