[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250913062041.GB1992308@rocinante>
Date: Sat, 13 Sep 2025 15:20:41 +0900
From: Krzysztof Wilczyński <kw@...ux.com>
To: Matthew Wood <thepacketgeek@...il.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Mario Limonciello <superm1@...nel.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [RESEND PATCH v7 1/1] PCI/sysfs: Expose PCIe device serial number
Hello,
> @@ -1749,10 +1767,13 @@ static umode_t pcie_dev_attrs_are_visible(struct kobject *kobj,
> struct device *dev = kobj_to_dev(kobj);
> struct pci_dev *pdev = to_pci_dev(dev);
>
> - if (pci_is_pcie(pdev))
> - return a->mode;
> + if (!pci_is_pcie(pdev))
> + return 0;
>
> - return 0;
> + if (a == &dev_attr_serial_number.attr && !pci_get_dsn(pdev))
> + return 0;
> +
> + return a->mode;
It would be fine to have this sysfs attribute present all the time, and
simply return error when the serial number is not available. Not sure if
hiding it adds a lot of value. This is how some of the existing attributes
currently behave.
But it does add extra code to pcie_dev_attrs_are_visible() where it is now
a special case, somewhat.
Thank you,
Krzysztof
Powered by blists - more mailing lists