Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp341257lqj; Sun, 2 Jun 2024 00:29:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWaFCd3gx1nY+cBYgmO8XMm62tqjdk1aVrbxhoH3/0dSgLgiT+acevYV8qEdMqknPOU8PEUnccL2yUZlQYbPCRiVIgSgk39TB4NUIp28Q== X-Google-Smtp-Source: AGHT+IHsyJdJSn6Wwi7+9O6fsDhQkVXgpGcKrVCnPk7Bw5px9R6PuSMoZ6pNwTv8t3idTIqHDj1m X-Received: by 2002:a17:906:36cf:b0:a68:5fb6:1a7f with SMTP id a640c23a62f3a-a685fb61d23mr472446566b.21.1717313366657; Sun, 02 Jun 2024 00:29:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717313366; cv=pass; d=google.com; s=arc-20160816; b=crk8c8Tj4TtjWGUpSpX/0rudC5T1t9/QZKJZeQyGF5WMsoS15o5UQIoLXEgH5yyRy+ 0o2oBJQiAqh2Wls/2ssuRgAq3bvp0EdryPdG7t7MsDK/MZo5Fp9eEDEVX+6WlZMtSvV9 YPHN/1hO0EeyqfvFRUqWmutSwEZxROvwwOFi3Sz9uMdLQqM5pIwv5WJIgbqWeYLx7VJx yGL7SO0mvDJetq040AUM49yF7n3rGmF0IPP/LObkhAqMMmxcJlAklbbiTiXMDKsV8/Lg 5vxU9X4RlvLeV1Gr1cZYmQXsCNBs0DhGBtsJ8AZTHNCA5qj0s3pJ3pwfOEUjOHJGdUCS LB1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from; bh=eA4lGBZkvYjxGVoLThzcz0ZWA0ttuGrJ9z+ZeJ2tieY=; fh=xiDZZPT3CAvmoYb3gyZWpK54jBuiC+BeMJx04U1Ea44=; b=UfvW8l5OmPrRcknrwDxSFcGctlgBoU4LYdQIJcZb4SEF4p22mzgpjPBfREasvCleqq y7+cIQQ3c9fIwOI46inWnDgJt7vMX+Azo6wFP3KZ9TwrdkxxaUzwEy25iyRzc2/h0L5j NLSuKoJrFGqBzBVky97YwongtxjrlGdeauFA175o4WimhfrC5PUtYFj/Re5kU+3McRRU v3BztUKc02TywjdaJ/C2ORfbg3hnnBm3spn9pgd1wrg0rAeOHh9j8zwI7FErJ7Ema3Tl JuTNkR/MN8FMLIsNVkS+C1+UxremiNCyRTf5J4ueZJ3eGeF/owoVhqe9XMSJx8GMQTcj QMFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-198151-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198151-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a67eb72347bsi276479766b.973.2024.06.02.00.29.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 00:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198151-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-198151-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198151-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 59BCD1F216D3 for ; Sun, 2 Jun 2024 07:29:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48D7B18622; Sun, 2 Jun 2024 07:29:19 +0000 (UTC) Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23E151CD06 for ; Sun, 2 Jun 2024 07:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717313358; cv=none; b=izLhdoRxcw1FBX9YjodGl3NU5TXSCZHluhiXW3nq3VuHwXO6Yv2OvRepeTxYaYDDWR9ohfKUlS21gn3831kIUBV24t7kAYoJH3tKIWOsEF2xgBF5IEVoVoNuDTqpjRAKHG75Ncfs2F/MMzG7yHtFWAVUldfscj281ItwqV/bWE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717313358; c=relaxed/simple; bh=zUZbFrgSobpP0gYNeUzRDdvN9yhMxp65fNvg1NuOxz4=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pn51pGjBkBSFMe+msASNi6QvvFfDYtfbCjt5wr099lNpxjEqYqtURGUZOn51m4OwydVaF50LU4ypdxRpgWjTMjnQYIxugrkccQltlGs0qrxbhr1uK9JiEiYbZ7gbhlMoPurGGQW86MXrhF5n/XJQ8eAlWXLohEfe4Z9rV2670QA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id cc087c22-20b1-11ef-8e3d-005056bdf889; Sun, 02 Jun 2024 10:29:09 +0300 (EEST) From: Andy Shevchenko Date: Sun, 2 Jun 2024 10:29:07 +0300 To: Jim Wylder Cc: Mark Brown , Greg Kroah-Hartman , "Rafael J. Wysocki" , kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] regmap-i2c: Subtract reg size from max_write Message-ID: References: <20240523211437.2839942-1-jwylder@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240523211437.2839942-1-jwylder@google.com> Thu, May 23, 2024 at 04:14:36PM -0500, Jim Wylder kirjoitti: > Currently, when an adapter defines a max_write_len quirk, > the data will be chunked into data sizes equal to the > max_write_len quirk value. But the payload will be increased by > the size of the register address before transmission. The > resulting value always ends up larger than the limit set > by the quirk. > > Avoid this error by setting regmap's max_write to the quirk's > max_write_len minus the number of bytes for the register and > padding. This allows the chunking to work correctly for this > limited case without impacting other use-cases. ... > (bus->max_raw_write == 0 || bus->max_raw_write > quirks->max_write_len)) > - max_write = quirks->max_write_len; > + max_write = quirks->max_write_len - > + (config->reg_bits + config->pad_bits) / BITS_PER_BYTE; Interesting. regmap-spi does this slightly differently, i.e. reg/8 + pad/8. I'm wondering which one is more correct (potential off-by-one I suppose). -- With Best Regards, Andy Shevchenko