Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp519446rdb; Thu, 30 Nov 2023 10:38:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtU+XFfl59C0eDiQo0Ww234ZmLb1nh6tGVu83xXNqZaa0RympRNgZcciQwtC2tRG+8ZPBN X-Received: by 2002:a62:84d5:0:b0:6cd:f423:23fb with SMTP id k204-20020a6284d5000000b006cdf42323fbmr1324383pfd.5.1701369519002; Thu, 30 Nov 2023 10:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701369518; cv=none; d=google.com; s=arc-20160816; b=ZW3p6+3NioHfHas8SD+jA2OgaTr7bwBtKkPXK/G1Tc3j9/vQr4aW8W6CY+TAFb5KFM RMXDQMbWFoERqV65Y0S1PkT4RbKrh/eIxcy9oBr2Tu3cHP9Y674vZIkAMssX69ESGCVw bru4DjPFWdcAHI1SZ6qXgGIEa5sI98d1c8mNp2YLKp/gJ+thPSY4LWkGbbKINUjmhw7p EnQTlwfr58kBX2fkOdcH4g96AaGSvhHke9MX6HnD/XVrHNk9orHtzDD6+3ibHiPgrIcy 2kGdUPg6EeaytC26G2wey4WM8jdHVx5BX8zg01wTw/gG80AL8NVytvtluFJm18rjjquO MomA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=ZEiJuwYQEamIoJmBpEj6v9/GLExL3QGaywCLAlAYAXY=; fh=GkrebVqmcTHNcWzkQHND2rNG9VwpBZBmuzt7Vdvo3Ag=; b=T95EiRZghghPsFOnlMciLExmmb7ND30OB29+VEM5C2FfORTXlC/K+51AfooP7Qtcto 8GqK8qcK21s9cTlhX+JQrm78v5nSsTxCqC7KXnct5qMv7wUcSkrhIuOxg+1bCmtna2nq fckwWLFltHbxihHDxcuwSl0fMbRAFkwVsW7iNjyXaDIPb/yZiFHuyX85RW1AHeX7BlE9 rgwQosdcRRGpcULFdzOoSb8uyjQ6AKa9X0kR2mseGKwrakUwaeYdklpOaYhJgnyufq8C U+ZwKnQnQdh/x+b65F8YwTp7jK2aYnuuhF2FvHTQNw9AS1fUFPv4BG2PoMptAS1qDVsM 8VJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eQGSObfE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id fj8-20020a056a003a0800b0068e3efffe2csi1758529pfb.243.2023.11.30.10.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 10:38:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eQGSObfE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 4B58D82CC47E; Thu, 30 Nov 2023 10:38:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346480AbjK3Shy (ORCPT + 99 others); Thu, 30 Nov 2023 13:37:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbjK3Shv (ORCPT ); Thu, 30 Nov 2023 13:37:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FBDC10F4 for ; Thu, 30 Nov 2023 10:37:57 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F11F4C433C7; Thu, 30 Nov 2023 18:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701369477; bh=KTVhbWtyOj5CHYptB/YZKupH8RBoVdAwyN+Tqnv2IoU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=eQGSObfEQXMLIIKR6qHyTIIAkvri7MN76Pfg66IW6uLH1LHSD5zbVupZEwxvYUxXE wDl4+SKwotJbMzkQH3H8p1iDblk8ocNDsu2RGzoYuoTVU2AP36Kr2+1YJZ+OXxr5mE UJi6QFIr70DZVNBcg46d6209zrswsp/0gl7QdKdOog9MwYDuPTU4VIzF/Nk3QxslF4 iH5iO+rT67b8SU74Yzo6wUrRaE0uMjSKoRKCLGnHqrbLyy+kpPhnR0Y9caBCDxQXNU YmpOF4uSi3tplWADKJ3XC1AdZ3iy4lCiCxmts2fi7IP6Qq1PPTC5JX+Nx5BAvQVfBD MIXmEeOarJ+9A== Date: Thu, 30 Nov 2023 12:37:55 -0600 From: Bjorn Helgaas To: Ilpo =?utf-8?B?SsOkcnZpbmVu?= Cc: Shuai Xue , ilkka@os.amperecomputing.com, kaishen@linux.alibaba.com, yangyicong@huawei.com, will@kernel.org, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com, chengyou@linux.alibaba.com, LKML , linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, zhuo.song@linux.alibaba.com, renyu.zj@linux.alibaba.com Subject: Re: [PATCH v11 3/5] PCI: Move pci_clear_and_set_dword() helper to PCI header Message-ID: <20231130183755.GA487634@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 30 Nov 2023 10:38:36 -0800 (PST) On Thu, Nov 30, 2023 at 12:52:20PM +0200, Ilpo Järvinen wrote: > On Wed, 29 Nov 2023, Bjorn Helgaas wrote: > > On Mon, Nov 27, 2023 at 09:34:05AM +0800, Shuai Xue wrote: > > > On 2023/11/22 21:14, Ilpo Järvinen wrote: > > > > On Tue, 21 Nov 2023, Shuai Xue wrote: > > > > > > > >> The clear and set pattern is commonly used for accessing PCI config, > > > >> move the helper pci_clear_and_set_dword() from aspm.c into PCI header. > > > >> In addition, rename to pci_clear_and_set_config_dword() to retain the > > > >> "config" information and match the other accessors. > > > >> > > > >> No functional change intended. > > > > >> + > > > >> +void pci_clear_and_set_config_dword(const struct pci_dev *dev, int pos, > > > >> + u32 clear, u32 set) > > > > > > > > Just noting that annoyingly the ordering within the name is inconsistent > > > > between: > > > > pci_clear_and_set_config_dword() > > > > and > > > > pcie_capability_clear_and_set_dword() > > > > > > > > And if changed, it would be again annoyingly inconsistent with > > > > pci_read/write_config_*(), oh well... And renaming pci_read/write_config_* > > > > into the hierarchical pci_config_read/write_*() form for would touch only > > > > ~6k lines... ;-D > > > > > > I think it is a good question, but I don't have a clear answer. I don't > > > know much about the name history. As you mentioned, the above two > > > accessors are the foundation operation, may it comes to @Bjorn decision. > > > > > > The pci_clear_and_set_config_dword() is a variant of below pci accessors: > > > > > > pci_read_config_dword() > > > pci_write_config_dword() > > > > > > At last, they are consistent :) > > > > "pcie_capability_clear_and_set_dword" is specific to the PCIe > > Capability, doesn't work for arbitrary config space, and doesn't > > include the word "config". > > > > "pci_clear_and_set_config_dword" seems consistent with the arbitrary > > config space accessor pattern. > > > > At least "clear_and_set" is consistent across both. > > > > I'm not too bothered by the difference between "clear_and_set_dword" > > (for the PCIe capability) and "clear_and_set_config_dword" (for > > arbitrary things). > > > > Yes, "pcie_capability_clear_and_set_config_dword" would be a little > > more consistent, but seems excessively wordy (no pun intended). > > > > But maybe I'm missing your point, Ilpo. If so, what would you > > propose? > > What I was hoping for a way to (eventually) have consistency in naming > like this (that is, the place where "config" or "capabilitity" appears > in the name): > > pci_config_read_dword() > pci_config_clear_and_set_dword() > pcie_capability_read_dword() > pcie_capability_clear_and_set_dword() Ah, I see, thanks. > But thanks to pci_read_config_dword() & friends being there since dawn of > time and with 6k+ instances, I guess I'm just dreaming of impossible > things. Yeah, I think so. Bjorn