Received: by 10.213.65.68 with SMTP id h4csp606610imn; Fri, 23 Mar 2018 11:27:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELvZyPjRLGpckr6ObnGePoTlG/R/c6zOrBDlqMbdit1jzLy5fpssO2GdAI+5PThJ/aIstFFw X-Received: by 2002:a17:902:a5c5:: with SMTP id t5-v6mr30851280plq.244.1521829638622; Fri, 23 Mar 2018 11:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521829638; cv=none; d=google.com; s=arc-20160816; b=d4hDOx20A5NsxRgVyiPK1PjnSH2wCENpZA+D88wS3+rhw8P/RUtZmC1IGCK+6FOcFy DvVO4TfXNsZv76Psw3ZYdGU3C6KRJWJaGOdqSQNxhTGym8SPDBSgHxNY4kSAPMDB5GKW np3sVw1Gz2vh2I+CQGRVhZQ+yZikdNt9PlYHKYm9gZ+91uYUV1CxKtXhdGHYKzVSZFvG /GaG59maM3+AZNuXwnyOmhhUaIa7WXxhZz9QHs/vqokTlLxZE8VY20PksXZFQA9c0NEb 1fFCSTklMe10MUmxXFYcEdPrnx7LtOHtNGEnQQa4Cc5CFw4qbLN7Ac7S7Mk4HbQkGj65 JWsg== 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:dkim-signature:arc-authentication-results; bh=IrzHovquKlqyN7j1lmNTkGo+oD5WgpIGMshbr15a/5k=; b=WbiRVALBI98XvhByEzPOrea0AJ4lqbs02sjUy4vmemvhs/enmnZU6Dn7hkWcsSPY/y cgiA3SzlNb/PerGp8E3wfBkpspxOhjEJHADEFdCsOOYUGb41D/RdmJm/nMM+Hra6rjNj UFgl/lDP5ayRKC5QuNOrwub2LrEcjb5hkvitpkP5joDPxZHgt0paLwxqTFQyMHUODdh4 2B2+r6Z6UjRuBmwtUhkT4/59L9lJUOkPkTrDRErOdWG5/EOTAWQNI/PAKY6B56mQiN0N tD3YqGBcJifx5rjy/TkjE3bYYX/dNlAHdo8OyCSFwHCvzgTVcjT8gB+De/flRrQoMuRO Kxzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=egUnD0Gj; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4-v6si9546710pll.339.2018.03.23.11.27.04; Fri, 23 Mar 2018 11:27:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=egUnD0Gj; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752364AbeCWS0E (ORCPT + 99 others); Fri, 23 Mar 2018 14:26:04 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:42293 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751843AbeCWS0D (ORCPT ); Fri, 23 Mar 2018 14:26:03 -0400 Received: by mail-pg0-f67.google.com with SMTP id f10so4722122pgs.9; Fri, 23 Mar 2018 11:26:02 -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:user-agent; bh=IrzHovquKlqyN7j1lmNTkGo+oD5WgpIGMshbr15a/5k=; b=egUnD0GjGmPyLe0ibFgV1E/ksbmK/AdDYWHpwobyERamp5l1baENT3X4KW7CsRiTUA nqTNeKyZwrqITCaca6Iiqi84L8kuEM1Q8AON33tUE7cCMsUaFopWdxiwUjwMzrEDem0e BT3FTZGhd9X505ifVH9Jx8q0kjNAUA0zA/x+U30WL1Mmc/PBiZRLdc+GQTZHJlevO6b7 ywffMYFctsaE6WFzmsTE61crKx+hgqhzHU8XStfGrkNWQWvwu4L6RDDsH13HlqCNalXj nfZaujBbhNCc9eV0V1GvRN9o04iD8LWSIP/bx7YCihABxBZVHck1iRb7j/U2DLvP4BcS v7WA== 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:user-agent; bh=IrzHovquKlqyN7j1lmNTkGo+oD5WgpIGMshbr15a/5k=; b=F7MKd14FKd0vbdpHzA+/EwF8WkPYsYjsmEoMKNqYLtDlUDihsOPq+i98W4ndEVWKlu MBCGHseA/vCmQsFMmnpYPJburJPxiA9kVwGp7q/gQq46209VyLb0vbte8CnFlZ2C8JaF hhT6OSpuzUY7fSebhUCY2EDFw7F//CmM1E8ZKguLOaOxyXiyqVQLd0V3tAJIeqQe2bdB 4KjT3AA3UMOggjQSOoINIih4rdRoynIkG2Or+H/MEDceyVgU2o7wczoAMFbmbEmEYKFN pl57ZaLkpCSddJcjoMMn6JVNbGo4pQVWmAlz+ZHXZYjY9r9kncTtxHlvT+X8I6Bukf9Z W+Mg== X-Gm-Message-State: AElRT7EiFBnzJW4vRr5PpzTsy4AXPF426Hv/j3TrO6s/JLvp42Fbm6Ss 2QUXtmg4oothzRTlRk2reNs= X-Received: by 10.99.133.193 with SMTP id u184mr22023751pgd.141.1521829561829; Fri, 23 Mar 2018 11:26:01 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id z67sm16390438pgb.69.2018.03.23.11.26.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Mar 2018 11:26:01 -0700 (PDT) Date: Fri, 23 Mar 2018 11:25:59 -0700 From: Dmitry Torokhov To: Sebastian Reichel Cc: Sebastian Reichel , Nick Dyer , linux-input@vger.kernel.org, Henrik Rydberg , linux-kernel@vger.kernel.org, kernel@collabora.com, Nandor Han Subject: Re: [PATCHv1] Input: atmel_mxt_ts - fix the firmware update Message-ID: <20180323182559.GB255819@dtor-ws> References: <20180322164330.24809-1-sebastian.reichel@collabora.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180322164330.24809-1-sebastian.reichel@collabora.co.uk> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sebastian, Nandor, On Thu, Mar 22, 2018 at 05:43:30PM +0100, Sebastian Reichel wrote: > From: Nandor Han > > The automatic update mechanism will trigger an update if the > info block CRCs are different between maxtouch configuration > file (maxtouch.cfg) and chip. > > The driver compared the CRCs without retrieving the chip CRC, > resulting always in a failure and firmware flashing action > triggered. The patch will fix this issue by retrieving the > chip info block CRC before the check. > > Suggested-by: Todd Weyenberg > Signed-off-by: Nandor Han > Signed-off-by: Sebastian Reichel > --- > drivers/input/touchscreen/atmel_mxt_ts.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c > index 7659bc48f1db..ab936e6b0286 100644 > --- a/drivers/input/touchscreen/atmel_mxt_ts.c > +++ b/drivers/input/touchscreen/atmel_mxt_ts.c > @@ -1728,6 +1728,25 @@ static int mxt_get_object_table(struct mxt_data *data) > return error; > } > > +static int mxt_get_info_block_crc(struct mxt_data *data) > +{ > + size_t table_size; > + int error; > + u8 info_block_crc[MXT_INFO_CHECKSUM_SIZE]; > + > + table_size = data->info.object_num * sizeof(struct mxt_object); > + > + /* Read the info block CRC */ > + error = __mxt_read_reg(data->client, MXT_OBJECT_START + table_size, > + sizeof(info_block_crc), info_block_crc); > + if (!error) { > + data->info_crc = info_block_crc[0] | (info_block_crc[1] << 8) | > + (info_block_crc[2] << 16); > + } > + > + return error; > +} > + > static int mxt_read_t9_resolution(struct mxt_data *data) > { > struct i2c_client *client = data->client; > @@ -2077,6 +2096,14 @@ static int mxt_initialize(struct mxt_data *data) > return error; > } > > + /* Get info block CRC */ > + error = mxt_get_info_block_crc(data); > + if (error) { > + dev_err(&client->dev, "Error %d reading info block CRC\n", > + error); > + return error; You are leaking object table memory here. By the way, why do we do this here, and not when we actually have config file and is about to apply it? Thanks. -- Dmitry