Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1590666pxb; Thu, 4 Feb 2021 17:51:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7SDjEBqtSo6Tsv5ZRUCP+ByANzxXrXYeRwO6SnunDC2n7vaANVi+X6ojzkNBrkA57KUrw X-Received: by 2002:a17:906:ecb6:: with SMTP id qh22mr1875242ejb.252.1612489898625; Thu, 04 Feb 2021 17:51:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612489898; cv=none; d=google.com; s=arc-20160816; b=ng0idMO/rKL9RifWjCmmqweHc9UlzYypSJLWGIDFjZyybIif0kdlaiuIp6jegCJ91W 37Dj9eq2yoHuZZxUf9Yxs3hAQ88ofI7W9fuc1RLbokaK9H6B6ZBHMkjj2r336H2RgEpn xLujVupQYtZIRNp7pVYKoEps8lg0qdVpRpjdP7+osBCO0wZjF97IerPMInVxt1j9gm31 c+0r+Q1FRT0aWU9Te/DMFkcIvjO6t+js82Tvjg06+hw2grv2Z1CY0cuzS5CnLChB3xWq rAt6Gk8LsXIgoDYib3eXNgEO7eycmnlybj72nOhv8HnATcfr1iNLzo183yeMYV6rteaO eNFQ== 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=uFCATT5VoC/kjwdxuxKFx8QYQX7TWhV2vAdVBTBTWv0=; b=gKTrEol9S5dfTKBAnDRsEp8ZDSOWDTG0M9uX7i6KgEUpF0kHbxYy3HBZlRAkQ5VFhG yzX5eDUjl5yfnGg4Lk8rRX7qbXMOV0g+yGwhe/jJshF6WdqFJhmK5nsuq/CBUWR5GE5L p/El2JyDlVr6EoUVznYSUqRUKcWKdQJcPjWuINwMXU398smuI9KoXH9o8EbAoqwUITHS 0Yn6IX2l8AmubCMdEZG6Uq7F7NmmIx1icMVFS/9H4iU8uGPjJrw4pvMie4CrejuToCGz M0wdtBYOMlmiUj9a5ReiAgHKIbOaWoobS+4NZ0ie2loHoyHl5t5i2Ra9YVfaY36Zcogv mKww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WequWrpt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi22si4312993ejb.299.2021.02.04.17.51.14; Thu, 04 Feb 2021 17:51:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WequWrpt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbhBDVvP (ORCPT + 99 others); Thu, 4 Feb 2021 16:51:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:50876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbhBDVvC (ORCPT ); Thu, 4 Feb 2021 16:51:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE39E64E7B; Thu, 4 Feb 2021 21:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612475421; bh=PmEJQCCq9oY53CiWzcFwaIPerZi1rEcWvCOS/uKzoFQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=WequWrptF4WjW06B0BSUo7SbQyS+KfQGTGsiwm9iU60B1NVylYXeQTl1fDMqGEAta JReU0y9ygCPvABAqgwOcutNNywGESDTlzpSVpa71m4FE3QbAvRkhhat3S6RiIlTcUp JTlugHTATg5QaP5m/I3pbdjVLEpFTHshnXMOKWLoRlKOwLXYCMra/+GuRzRq+eo1R5 NXgth8yVgN34gF7h+9aDUld5QrUiafvq/6NBCwTxrkKWRXbUTpNg+dEM/GObX4l1j2 XB9A4pGG+h3SKSszPKJM5hdYb33urnHHvJOVqsyf9D4QgjMSmA4NenhdmbdpN2zBhS pu0QMV7je4d5Q== Date: Thu, 4 Feb 2021 15:50:19 -0600 From: Bjorn Helgaas To: Daniel Vetter Cc: LKML , Stephen Rothwell , linux-samsung-soc@vger.kernel.org, Jan Kara , Kees Cook , Greg Kroah-Hartman , linux-pci@vger.kernel.org, DRI Development , linux-mm@kvack.org, Jason Gunthorpe , =?iso-8859-1?B?Suly9G1l?= Glisse , John Hubbard , Bjorn Helgaas , Daniel Vetter , Dan Williams , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, Oliver O'Halloran , Pali =?iso-8859-1?Q?Roh=E1r?= , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= Subject: Re: [PATCH 1/2] PCI: also set up legacy files only after sysfs init Message-ID: <20210204215019.GA104698@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210204165831.2703772-2-daniel.vetter@ffwll.ch> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc Oliver, Pali, Krzysztof] s/also/Also/ in subject On Thu, Feb 04, 2021 at 05:58:30PM +0100, Daniel Vetter wrote: > We are already doing this for all the regular sysfs files on PCI > devices, but not yet on the legacy io files on the PCI buses. Thus far > now problem, but in the next patch I want to wire up iomem revoke > support. That needs the vfs up an running already to make so that > iomem_get_mapping() works. s/now problem/no problem/ s/an running/and running/ s/so that/sure that/ ? iomem_get_mapping() doesn't exist; I don't know what that should be. > Wire it up exactly like the existing code. Note that > pci_remove_legacy_files() doesn't need a check since the one for > pci_bus->legacy_io is sufficient. I'm not sure exactly what you mean by "the existing code." I could probably figure it out, but it would save time to mention the existing function here. This looks like another instance where we should really apply Oliver's idea of converting these to attribute_groups [1]. The cover letter mentions options discussed with Greg in [2], but I don't think the "sysfs_initialized" hack vs attribute_groups was part of that discussion. It's not absolutely a show-stopper, but it *is* a shame to extend the sysfs_initialized hack if attribute_groups could do this more cleanly and help solve more than one issue. Bjorn [1] https://lore.kernel.org/r/CAOSf1CHss03DBSDO4PmTtMp0tCEu5kScn704ZEwLKGXQzBfqaA@mail.gmail.com [2] https://lore.kernel.org/dri-devel/CAKMK7uGrdDrbtj0OyzqQc0CGrQwc2F3tFJU9vLfm2jjufAZ5YQ@mail.gmail.com/ > Signed-off-by: Daniel Vetter > Cc: Stephen Rothwell > Cc: Jason Gunthorpe > Cc: Kees Cook > Cc: Dan Williams > Cc: Andrew Morton > Cc: John Hubbard > Cc: J?r?me Glisse > Cc: Jan Kara > Cc: Dan Williams > Cc: Greg Kroah-Hartman > Cc: linux-mm@kvack.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-samsung-soc@vger.kernel.org > Cc: linux-media@vger.kernel.org > Cc: Bjorn Helgaas > Cc: linux-pci@vger.kernel.org > --- > drivers/pci/pci-sysfs.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index fb072f4b3176..0c45b4f7b214 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -927,6 +927,9 @@ void pci_create_legacy_files(struct pci_bus *b) > { > int error; > > + if (!sysfs_initialized) > + return; > + > b->legacy_io = kcalloc(2, sizeof(struct bin_attribute), > GFP_ATOMIC); > if (!b->legacy_io) > @@ -1448,6 +1451,7 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) > static int __init pci_sysfs_init(void) > { > struct pci_dev *pdev = NULL; > + struct pci_bus *pbus = NULL; > int retval; > > sysfs_initialized = 1; > @@ -1459,6 +1463,9 @@ static int __init pci_sysfs_init(void) > } > } > > + while ((pbus = pci_find_next_bus(pbus))) > + pci_create_legacy_files(pbus); > + > return 0; > } > late_initcall(pci_sysfs_init); > -- > 2.30.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel