Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp849082rwb; Tue, 4 Oct 2022 11:29:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Vl0MRNIqClpea2dpcj3AwG63h/88pjShhr/zJmax2rreYS2LuhpOA1zaazvhrtS5bCL1g X-Received: by 2002:a62:31c7:0:b0:561:86fb:27e9 with SMTP id x190-20020a6231c7000000b0056186fb27e9mr9202139pfx.63.1664908176838; Tue, 04 Oct 2022 11:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664908176; cv=none; d=google.com; s=arc-20160816; b=zdB+pWnsx2ueyML1E1p9weAnxa9grFUOtgea5ANAYt162nUe3BNSTJXO+PTxLY26lU UGq5JbcklspLZ3AylWN03lUKppz9fK4gHrW/NZp6tBmZUPVBacZ8391z8VysfaHKWgsh 1e3wt6kw95u+u3roy3AoSejZKvg37Nwk0sxNGoVTBwBJbFUlLz8iTVMA53j8Shj9GK47 IzcqyM0Hg4MmFGFeh085yDQDzl5i5ZvGpQBGDwJCnHC1vZJnMUsQZeIusJBCsJlqlXOH wJMfe90er48dau0p/kU8mFTy0KOLYvDvnK7MgM2oDwcZVTZ6NAY6LFK7UBzN/oYL8jCe E+sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=fe2/HGyQiHdu8PByN9tscZrzkduboPXiQC0fTpoOX+8=; b=mhCI4tK7JCkjjQ17NadrZugcHRSezJW++0G0ttXqsnh7GeVxWsrSLGHvKwPwbPk99E Rb2DRQVWPgKyxuElD7IVZE7kAjA/Meg+P8ad/8nsjtQ3f5J2vYmpm+TE2NlckM7JoUfM /TaZsPluQtV9DzH0lZBosAn4J94PjNaTxV/0OqQ2Giu3FS8YT5xvxNG4R1w5t4BpLbkw jUHAbTpe265RjG0EqZUDe2RkaTMaXRgZVXeV8FMojljrSjfsk1BesiL+sMZylCcvwSws OxWp5gSTcXXcipO4rX7RE07zm5JOj1+kQZUHFN79cGotocIM1EM4laLOTA89ewtsC+fH Xw1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a63f745000000b0043c0753be2bsi13831902pgk.776.2022.10.04.11.29.24; Tue, 04 Oct 2022 11:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229911AbiJDSLq convert rfc822-to-8bit (ORCPT + 99 others); Tue, 4 Oct 2022 14:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbiJDSLn (ORCPT ); Tue, 4 Oct 2022 14:11:43 -0400 Received: from mail.inka.de (mail.inka.de [IPv6:2a04:c9c7:0:1073:217:a4ff:fe3b:e77c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DAA3ED7F; Tue, 4 Oct 2022 11:11:41 -0700 (PDT) Received: from mail3.berkhan-weisser.de ([2a03:4000:54:b9a::4]) by mail.inka.de with esmtpsa id 1ofmOJ-001GcI-9T; Tue, 04 Oct 2022 20:11:39 +0200 Received: from 127.0.0.1 (helo=localhost.localdomain) by mail3.berkhan-weisser.de with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1ofmOI-00AtIc-TP; Tue, 04 Oct 2022 20:11:38 +0200 Message-ID: <28932c5e2250c68e07ef5fafe3bee42653fd62f5.camel@inka.de> Subject: Re: [PATCH v2 4/7] HID: ft260: support i2c reads greater than HID report size From: Enrik Berkhan To: Michael Zaidman , jikos@kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Guillaume Champagne Date: Tue, 04 Oct 2022 20:11:37 +0200 In-Reply-To: <20220928144854.5580-5-michael.zaidman@gmail.com> References: <20220928144854.5580-1-michael.zaidman@gmail.com> <20220928144854.5580-5-michael.zaidman@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.1-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, On Wed, 2022-09-28 at 17:48 +0300, Michael Zaidman wrote: > diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c > index bfda5b191a3a..cb8f1782d1f0 100644 > --- a/drivers/hid/hid-ft260.c > +++ b/drivers/hid/hid-ft260.c > @@ -460,49 +460,68 @@ static int ft260_smbus_write(struct ft260_device *dev, u8 addr, u8 cmd, > static int ft260_i2c_read(struct ft260_device *dev, u8 addr, u8 *data, > u16 len, u8 flag) > { > + u16 rd_len; > + int timeout, ret; > struct ft260_i2c_read_request_report rep; > struct hid_device *hdev = dev->hdev; > - int timeout; > - int ret; > + bool first = true; > > - if (len > FT260_RD_DATA_MAX) { > - hid_err(hdev, "%s: unsupported rd len: %d\n", __func__, len); > - return -EINVAL; > - } > + do { > + if (first) { > + if (flag & FT260_FLAG_START_REPEATED) I think the test should be if ((flag & FT260_FLAG_START_REPEATED) == FT260_FLAG_START_REPEATED) Otherwise, flag will never be FT260_FLAG_START ( = 2), as FT260_FLAG_START_REPEATED (= 3) has tow bits set. It looks as if bit 0 actually means "repeated", bit 1 is "start" and bit 2 is "stop". Cheers, Enrik