Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp173516rdf; Mon, 20 Nov 2023 21:58:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNhVcgaZScRMmJgZPnqBDWqMLJvIJykDc6Cu7htfFIDfM/xHE1sgzvJ7mSbKSvHCPc+EjT X-Received: by 2002:a05:6a20:4292:b0:181:15:576b with SMTP id o18-20020a056a20429200b001810015576bmr8745386pzj.48.1700546302780; Mon, 20 Nov 2023 21:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700546302; cv=none; d=google.com; s=arc-20160816; b=hR6pM/ztCNDQ0FNWxaamDOg3R9TTEuRlFnT4h1s9oqDdxqsuIHLK+1um/VICmvoH47 +Fs2c4fAIfMG+HjeVCUoewHRq4OZoicysQOuPEFuQ+Cd5vAn1hFly5GlZPNVkG9nZL/H Rl5SBtFazWtCdsGwz3EeR4HqFJaLWdDYdhcy0QWYV3714EFqN9ZfEplochuO5SqbQwc1 yMm6FSobSOdEwp/JkMnwS1DXP3egSBnEZjufxyKHWJHd0JCuiuK5i3uYZmmrkKJTvelE ueJsY9WS/+TyM60945DQwLQkpvhGLuNU/CjWZB4mVenm9gI5XRn1o+K75GyMGjRCPtM2 pDXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=R9tJBkui5n25v+k5XBKmvmcM21ODsT8spSbeLAlavWA=; fh=g/tQaVPiakMrEdOuH4cJ1ALyv7Nty2ywgB+2Bd18dho=; b=hi4UU+qhMm72sXX8idb3v2qQoQEF0xMtKBlAEUIgg+IAaBv2d1mQGviOiKoSGA6z5W hDH9/9rbUjg6xGFjxC1aXJINzXRet3aKeumZdWqyu7bgpwF+0KfWDYlAa9KJTuzBZrNX 23vjtxAcnH7acV+BGeStcfrQnOUYqfiUNHUFShXeLc2NGwyo2OhSWoJ3VrkjpoxPWziR FY7pbIIdhV4cFDqadZiv/9WBDITlX4Ck1W6uoHpicpGRZcnuELyUMqGTpunWd3+mFtfj wMuR7BouxA7qgKp1ne0kLCZkLIZI8Yt2JbpIIEXymmM2krgVEPIn4a+IqR8/7Tp0lkcU Oukw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k15-20020a170902c40f00b001c3a06b4fd7si10163332plk.561.2023.11.20.21.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 21:58:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1F4798093F46; Mon, 20 Nov 2023 21:58:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233434AbjKUF6H (ORCPT + 99 others); Tue, 21 Nov 2023 00:58:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbjKUF6D (ORCPT ); Tue, 21 Nov 2023 00:58:03 -0500 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B73E5CA; Mon, 20 Nov 2023 21:57:59 -0800 (PST) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-40b26d700a1so4025425e9.0; Mon, 20 Nov 2023 21:57:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700546278; x=1701151078; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R9tJBkui5n25v+k5XBKmvmcM21ODsT8spSbeLAlavWA=; b=kooNRrx9Br2yn32wDT99mnvBOx35xAIMH1XbHNN+9iSrAeGIDEIf4e5WeOuuvzK81Y G6heUXgGC2i5syZZlLmXWWrEZBE15BnocDTpH1SWGMG8MetR/xzMuvi3rQ77rQPkHlIX Y2xrzjQodBrtOYGtanOp0yEdyVWZKB6NFpfhWxCEA5MRXz6veu8sd1zalEz33PMPh/7m n1tf7dnXDiLTv2CSjqXWbFJYZgDlmo29Nj++Yy1pXTXkRNuUGeipq413EpTip2qNAPtT lYYYXZdXcxf8U7skI4THUZzCxXmOTTiR5q9wo0Rl6VA7EW/kET3cfVfJDjXEaeCnVjDk /GyA== X-Gm-Message-State: AOJu0Yx7BdkXwrXaFZHg4R1KxCrQ1XDapnB4Ve5iD0cJkhkYNcaK0aSa ALVeQm9hsfK+r+w4V1KSRLLn/xIM2m0sJA== X-Received: by 2002:a05:600c:3103:b0:40a:20f3:d126 with SMTP id g3-20020a05600c310300b0040a20f3d126mr6483267wmo.6.1700546277885; Mon, 20 Nov 2023 21:57:57 -0800 (PST) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:59? ([2a0b:e7c0:0:107::aaaa:59]) by smtp.gmail.com with ESMTPSA id n13-20020a05600c500d00b004083996dad8sm20285241wmr.18.2023.11.20.21.57.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Nov 2023 21:57:57 -0800 (PST) Message-ID: <90ba18b8-1a31-498d-a103-5c91b80cea5b@kernel.org> Date: Tue, 21 Nov 2023 06:57:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/1] serial: sc16is7xx: improve regmap debugfs by using one regmap per port Content-Language: en-US To: Hugo Villeneuve , gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, lech.perczak@camlingroup.com, Hugo Villeneuve References: <20231120163931.2872431-1-hugo@hugovil.com> <20231120163931.2872431-2-hugo@hugovil.com> From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL9stHyvTGw0Fjsualwb0Gwdx ReTZzMgheAyoy/umIOKrSEpWouVoBt5FFSZUyjuDdlPPYyPav+hpI6ggmCTld3u2hyiHji2H cDpcLM2LMhlHBipu80s9anNeZhCANDhbC5E+NZmuwgzHBcan8WC7xsPXPaiZSIm7TKaVoOcL 9tE5aN3jQmIlrT7ZUX52Ff/hSdx/JKDP3YMNtt4B0cH6ejIjtqTd+Ge8sSttsnNM0CQUkXps w98jwz+Lxw/bKMr3NSnnFpUZaxwji3BC9vYyxKMAwNelBCHEgS/OAa3EJoTfuYOK6wT6nadm YqYjwYbZE5V/SwzMbpWu7Jwlvuwyfo5mh7w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lYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <20231120163931.2872431-2-hugo@hugovil.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 21:58:20 -0800 (PST) On 20. 11. 23, 17:39, Hugo Villeneuve wrote: > From: Hugo Villeneuve > > With this current driver regmap implementation, it is hard to make sense > of the register addresses displayed using the regmap debugfs interface, > because they do not correspond to the actual register addresses documented > in the datasheet. For example, register 1 is displayed as registers 04 thru > 07: ... > --- a/drivers/tty/serial/sc16is7xx.c > +++ b/drivers/tty/serial/sc16is7xx.c ... > #ifdef CONFIG_SERIAL_SC16IS7XX_SPI > static int sc16is7xx_spi_probe(struct spi_device *spi) > { > const struct sc16is7xx_devtype *devtype; > - struct regmap *regmap; > + struct regmap *regmaps[2]; IMO, in all places, it would make sense to declare a VLA with devtype->nr_uart. > + unsigned int i; > int ret; > > /* Setup SPI bus */ > @@ -1732,11 +1736,20 @@ static int sc16is7xx_spi_probe(struct spi_device *spi) > devtype = (struct sc16is7xx_devtype *)id_entry->driver_data; > } > > - regcfg.max_register = (0xf << SC16IS7XX_REG_SHIFT) | > - (devtype->nr_uart - 1); > - regmap = devm_regmap_init_spi(spi, ®cfg); > + for (i = 0; i < devtype->nr_uart; i++) { > + regcfg.name = sc16is7xx_regmap_name(i); > + /* > + * If read_flag_mask is 0, the regmap code sets it to a default > + * of 0x80. Since we specify our own mask, we must add the READ > + * bit ourselves: > + */ > + regcfg.read_flag_mask = sc16is7xx_regmap_port_mask(i) | > + SC16IS7XX_SPI_READ_BIT; > + regcfg.write_flag_mask = sc16is7xx_regmap_port_mask(i); > + regmaps[i] = devm_regmap_init_spi(spi, ®cfg); As you trip over the array until devtype->nr_uart which is of course up to 2. For now. Or at least add an asserion: devtype->nr_uart <= 2 somewhere. thanks, -- js suse labs