Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp687728imp; Wed, 20 Feb 2019 07:20:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IZwm2rSzdNf6BuM4t/HWY0hhUvJjsGyS0UUPQGNmsnvgeR0ZBQyjKR4qJo3odctVvnGw99z X-Received: by 2002:a63:2b03:: with SMTP id r3mr28647988pgr.1.1550676028775; Wed, 20 Feb 2019 07:20:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550676028; cv=none; d=google.com; s=arc-20160816; b=hyOwGR45Lj24rLsHcusmHlqmEdacMckLw50AmxjCingM+e9nsLS9vHO8dEtuwwPv0U VfXl1koshIOl18K/j/ucpSj3GOj2SbifEjqscDIaiTeiN5iZXXkffKJJwsonkOqPkg3D HhfeSlZJWHKnpMsWnZQEva6ny0IX+p7u64zfR+sjVnP9jnXNNFdNKTcXw2c7IIuKnsoR YPjUzrr7dnrJGHDBHKoC6eOy0Er5gxDAOR9hO3IOOs1qqYxGFXLQR5yGZG+rGs+YcTxk 2KMvIHZBMXvQxeM7vptRiLEJP4ZjJ+Qp58uebvhsUkxaR51juocLcfmSIooP8mO/QlhL auig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=Pa3mI/I8HU1I7lyoOjbvq4OQnSdD4ExpDlapkDW+E28=; b=XLgVn1F276BEI+dZuvMXzVKBPL4GAhBlX2Y3JWnK5dq1Ickh5IeC69xH8tn3kRvfsd +Ss1yW0W3JyicE2GHKbHg40NkuCAo147//fvaS93avC34MutOJiU4hV/jwYwLQygeWy8 T57MGD/wnraEMvZpl+Sp9xodlVc2mtRcGHb+FKTkxk4rTXFcJy5O5ZYTedvSt5HrnEt9 7PPfVpIPTa9YxswOyE2cVgwcO+wHcQhOgxk2UfzL7cv4ErZIF12ZTP0NEXUAJb9jc7+q nUdavXRAM3gEfXbtDhgHVygERn9Dwhe2MUeXdpa2lFh0xTGViW9tvmztbnLtjYHSMHVf 6mnA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p65si9658878pfi.76.2019.02.20.07.20.12; Wed, 20 Feb 2019 07:20:28 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726437AbfBTPSL (ORCPT + 99 others); Wed, 20 Feb 2019 10:18:11 -0500 Received: from mail.steuer-voss.de ([85.183.69.95]:34232 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbfBTPSL (ORCPT ); Wed, 20 Feb 2019 10:18:11 -0500 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de Received: by mail.steuer-voss.de (Postfix, from userid 1000) id E4FCE4D065; Wed, 20 Feb 2019 16:18:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.steuer-voss.de (Postfix) with ESMTP id E0A4C4D05B; Wed, 20 Feb 2019 16:18:04 +0100 (CET) Date: Wed, 20 Feb 2019 16:18:04 +0100 (CET) From: Nikolaus Voss X-X-Sender: nv@fox.voss.local To: Guenter Roeck cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2] usb: typec: tps6598x: handle block writes separately with plain-I2C adapters In-Reply-To: Message-ID: References: <20180425142209.30745-1-heikki.krogerus@linux.intel.com> <20190220110017.BFA344CE86@mail.steuer-voss.de> <20190220125731.02E274CFE0@mail.steuer-voss.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Feb 2019, Guenter Roeck wrote: > On 2/20/19 4:57 AM, Nikolaus Voss wrote: >> Commit 1a2f474d328f handles block _reads_ separately with plain-I2C >> adapters, but the problem described with regmap-i2c not handling >> SMBus block transfers (i.e. read and writes) correctly also exists >> with writes. >> >> As workaround, this patch adds a block write function the same way >> 1a2f474d328f adds a block read function. >> >> Fixes: 1a2f474d328f ("usb: typec: tps6598x: handle block reads separately >> with plain-I2C adapters") >> Fixes: 0a4c005bd171 ("usb: typec: driver for TI TPS6598x USB Power Delivery >> controllers") >> Signed-off-by: Nikolaus Voss >> --- >> v2: fix tps6598x_exec_cmd also >> --- >> drivers/usb/typec/tps6598x.c | 26 ++++++++++++++++++++------ >> 1 file changed, 20 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c >> index c84c8c189e90..c54b73fb2a2f 100644 >> --- a/drivers/usb/typec/tps6598x.c >> +++ b/drivers/usb/typec/tps6598x.c >> @@ -110,6 +110,20 @@ tps6598x_block_read(struct tps6598x *tps, u8 reg, void >> *val, size_t len) >> return 0; >> } >> +static int tps6598x_block_write(struct tps6598x *tps, u8 reg, >> + void *val, size_t len) >> +{ >> + u8 data[len + 1]; >> + > > You should use TPS_MAX_LEN + 1 here to avoid the variable length array. > See upstream commit 0bb95f80a38f8 ("Makefile: Globally enable VLA warning") > and 8d361fa2c29dc ("usb: typec: tps6598x: Remove VLA usage"). Not sure if > the WARN_ON introduced by 8d361fa2c29dc is really needed; I dislike > unnecessary runtime checks. Thanks for the pointer, I fixed this... Nikolaus