Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp716283ybb; Wed, 25 Mar 2020 08:16:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vueSCWUk7MnFMRAm9Qx0V1hD7esLWTu4CIO4yn+ZPtgQacjrZyUATml4tQLVOf2qc67FiAJ X-Received: by 2002:a4a:9b07:: with SMTP id a7mr1605886ook.78.1585149380304; Wed, 25 Mar 2020 08:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585149380; cv=none; d=google.com; s=arc-20160816; b=TuA/nqM8Cb8ZRNy1q5zq2aHVoIzbK3Y02ANEo5i4LCqz/+EUxEGj/GYWlFew4h1+RT WtQioYuQmOTtKBkYhJFwEAF1ZsPufpIPgaHzT95mc9a/UJ9GPhGnkgOjF5uBjXel9F7u ilWLX268aUx8U/Dh5gbCYrnpQsV/zMkaITJ18FAUS8lL+KhjegteqrEj7fDcp2WJt8Kt /xOmbrUlYLf52FmAEaQhgkE2BO53NRi3Fosad3ydyaHb74FlLW9rcGk71bU/DmcRJctD jFwICkW8XPdOOTXXxkkHFHKcV5VnjJyc1iekZ9HK4DmoPHM4rShU0Ny7q8mmVoag7MiM pBvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jZXSt/VrIZOV3oVnNKDvW8RIpCUfTNMiDOfSBRU0VB8=; b=Y5z181Wczhe6mggJYhZx5Fkd1rtr3U+2jxflGb1uUVdFWGGnmlrwhLxLPAx+aHxInx p7dsybcJ7LnTQ0F6+JMsP6w0Oy0sdMzmnqE5I24eAkYXUw2RiZ4vVbD6ZdgMJ2oPz4OQ g9Xh19LPj+kSlxoVF4IMduxomMztXSFWZ8Y02aoeiGntwHDi0C0Ri0NI7tYOZp9oFOrs lKpderLP1ksSRAaqzyloCPLD/jXaChdpvDbbehlqSNqWbaO9i9jAf6rStwGmQSo+CGvm Tn91cJFVU6ibIE8REjgQWB/FLN6SRA5yVJpdlJlhvsrimuaVNCIAWXNBEbyXlZ3NNFtj pRmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TUUuszWO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si11131160otq.214.2020.03.25.08.15.58; Wed, 25 Mar 2020 08:16:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TUUuszWO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727556AbgCYPPc (ORCPT + 99 others); Wed, 25 Mar 2020 11:15:32 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:38371 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbgCYPPb (ORCPT ); Wed, 25 Mar 2020 11:15:31 -0400 Received: by mail-qk1-f195.google.com with SMTP id h14so2901750qke.5; Wed, 25 Mar 2020 08:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jZXSt/VrIZOV3oVnNKDvW8RIpCUfTNMiDOfSBRU0VB8=; b=TUUuszWOWR6k65Zd0oivopeWcUF500AHJzVV/Sg/CpVv17RUNlIFHVn4+EWYExw7ty yMWJ+T2Eb13M8tbgnO1WKSWhSIbFWyVKJoSJFRcLTlRhf4gqMAnEqqmHSw0ugi6tGra2 t51Z+y/0Lik3mf/08yI055P9RJxkWa2/lthUuipGLrsoEHpLsH1DmMJfuHLmu8QrbkDg AEzWKxSKD+0RY4j3b7B/w6jBk1hRbiDInW2f/lIWUQ7xm0qS2lRKVB6MYgJ+WsbQvYLE AX4yEiAtHPdhAaVHeYCCyoPPq61xeqbQkk/H92vINT6vG88BUODo1cOFIMKAhA3HdVWM 7Vbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jZXSt/VrIZOV3oVnNKDvW8RIpCUfTNMiDOfSBRU0VB8=; b=BFBXmEnjmkbhi/1KTvwcFZFrZT9KUyiIwDVyEdiVjFOc/86H+CV4R6EdTEFB6pwNK5 Ql/XqUfk65IMyLXGR87uf8MMSlrzKqRDzjS4F7as/7bdm8MLtyVvQGplKYYhUZqdDxmv ZFpkCaLPP5n+mS+TE6+Po3H4rJ555AY+QnuBIIMHelsg0Ol5KFNM4CMzDiJ9PTyzMS1q c13VzV64XMLIwhoX4UyRv5yI52TxLZWhvRIP8umkBGKe0EeqX+nJJGA0U1sTr5vJCNL5 zyo8iX30+hujfGiGEThiaH3a9P4afMTCDTNH7CkiZqEL0qPf8fiu4Qo4n76e7z87TiNg 8+7Q== X-Gm-Message-State: ANhLgQ30Sv8cdSLhZVcL/Yq+AuJnLuw6MSOWwD1nYZzwNEjRMmd6hQPK xzQhLPkfZmv673dLjJAOi/EUWZ0WyKVEr8++tg8= X-Received: by 2002:a37:66c9:: with SMTP id a192mr3397481qkc.10.1585149328778; Wed, 25 Mar 2020 08:15:28 -0700 (PDT) MIME-Version: 1.0 References: <20190813204513.4790-1-skunberg.kelsey@gmail.com> <20190815153352.86143-2-skunberg.kelsey@gmail.com> <20200314112022.GA53794@kroah.com> <20200324062422.GA1977781@kroah.com> <20200325071702.GB2978943@kroah.com> In-Reply-To: <20200325071702.GB2978943@kroah.com> From: Kelsey Date: Wed, 25 Mar 2020 09:15:17 -0600 Message-ID: Subject: Re: [PATCH v3 1/4] PCI: sysfs: Define device attributes with DEVICE_ATTR* To: Greg Kroah-Hartman Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, Ruslan Bilovol , Linux Kernel Mailing List , Shuah Khan , linux-kernel-mentees@lists.linuxfoundation.org, Bodong Wang , Don Dutile , rbilovol@cisco.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2020 at 1:17 AM Greg Kroah-Hartman wrote: > > On Tue, Mar 24, 2020 at 05:53:59PM -0600, Kelsey wrote: > > On Tue, Mar 24, 2020 at 12:24 AM Greg Kroah-Hartman > > wrote: > > > > > > On Tue, Mar 24, 2020 at 12:10:33AM -0600, Kelsey wrote: > > > > On Sat, Mar 14, 2020 at 5:20 AM Greg Kroah-Hartman > > > > wrote: > > > > > > > > > > On Sat, Mar 14, 2020 at 12:51:47PM +0200, Ruslan Bilovol wrote: > > > > > > On Thu, Aug 15, 2019 at 7:01 PM Kelsey Skunberg > > > > > > wrote: > > > > > > > > > > > > > > Defining device attributes should be done through the helper > > > > > > > DEVICE_ATTR_RO(), DEVICE_ATTR_WO(), or similar. Change all instances using > > > > > > > __ATTR* to now use its equivalent DEVICE_ATTR*. > > > > > > > > > > > > > > Example of old: > > > > > > > > > > > > > > static struct device_attribute dev_name_##_attr=__ATTR_RO(_name); > > > > > > > > > > > > > > Example of new: > > > > > > > > > > > > > > static DEVICE_ATTR_RO(_name); > > > > > > > > > > > > > > Signed-off-by: Kelsey Skunberg > > > > > > > --- > > > > > > > drivers/pci/pci-sysfs.c | 59 +++++++++++++++++++---------------------- > > > > > > > 1 file changed, 27 insertions(+), 32 deletions(-) > > > > > > > > > > > > > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > > > > > > > index 965c72104150..8af7944fdccb 100644 > > > > > > > --- a/drivers/pci/pci-sysfs.c > > > > > > > +++ b/drivers/pci/pci-sysfs.c > > > > > > > @@ -464,9 +464,7 @@ static ssize_t dev_rescan_store(struct device *dev, > > > > > > > } > > > > > > > return count; > > > > > > > } > > > > > > > -static struct device_attribute dev_rescan_attr = __ATTR(rescan, > > > > > > > - (S_IWUSR|S_IWGRP), > > > > > > > - NULL, dev_rescan_store); > > > > > > > +static DEVICE_ATTR(rescan, (S_IWUSR | S_IWGRP), NULL, dev_rescan_store); > > > > > > > > > > > > > > static ssize_t remove_store(struct device *dev, struct device_attribute *attr, > > > > > > > const char *buf, size_t count) > > > > > > > @@ -480,9 +478,8 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr, > > > > > > > pci_stop_and_remove_bus_device_locked(to_pci_dev(dev)); > > > > > > > return count; > > > > > > > } > > > > > > > -static struct device_attribute dev_remove_attr = __ATTR_IGNORE_LOCKDEP(remove, > > > > > > > - (S_IWUSR|S_IWGRP), > > > > > > > - NULL, remove_store); > > > > > > > +static DEVICE_ATTR_IGNORE_LOCKDEP(remove, (S_IWUSR | S_IWGRP), NULL, > > > > > > > + remove_store); > > > > > > > > > > > > > > static ssize_t dev_bus_rescan_store(struct device *dev, > > > > > > > struct device_attribute *attr, > > > > > > > @@ -504,7 +501,7 @@ static ssize_t dev_bus_rescan_store(struct device *dev, > > > > > > > } > > > > > > > return count; > > > > > > > } > > > > > > > -static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store); > > > > > > > +static DEVICE_ATTR(bus_rescan, (S_IWUSR | S_IWGRP), NULL, dev_bus_rescan_store); > > > > > > > > > > > > This patch renamed 'rescan' to 'bus_rescan' and broke my userspace application. > > > > > > There is also mismatch now between real functionality and documentation > > > > > > Documentation/ABI/testing/sysfs-bus-pci which still contains old "rescan" > > > > > > descriptions. > > > > > > > > > > > > Another patch from this patch series also renamed 'rescan' to 'dev_rescan' > > > > > > > > > > > > Here is a comparison between two stable kernels (with and without this > > > > > > patch series): > > > > > > > > > > > > v5.4 > > > > > > # find /sys -name '*rescan' > > > > > > /sys/devices/pci0000:00/0000:00:01.2/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:01.0/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:04.0/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:00.0/dev_rescan > > > > > > /sys/devices/pci0000:00/pci_bus/0000:00/bus_rescan > > > > > > /sys/devices/pci0000:00/0000:00:01.3/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:03.0/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:01.1/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:02.0/dev_rescan > > > > > > /sys/devices/pci0000:00/0000:00:05.0/dev_rescan > > > > > > /sys/bus/pci/rescan > > > > > > > > > > > > v4.19 > > > > > > # find /sys -name '*rescan' > > > > > > /sys/devices/pci0000:00/0000:00:01.2/rescan > > > > > > /sys/devices/pci0000:00/0000:00:01.0/rescan > > > > > > /sys/devices/pci0000:00/0000:00:04.0/rescan > > > > > > /sys/devices/pci0000:00/0000:00:00.0/rescan > > > > > > /sys/devices/pci0000:00/pci_bus/0000:00/rescan > > > > > > /sys/devices/pci0000:00/0000:00:01.3/rescan > > > > > > /sys/devices/pci0000:00/0000:00:03.0/rescan > > > > > > /sys/devices/pci0000:00/0000:00:01.1/rescan > > > > > > /sys/devices/pci0000:00/0000:00:02.0/rescan > > > > > > /sys/devices/pci0000:00/0000:00:05.0/rescan > > > > > > /sys/bus/pci/rescan > > > > > > > > > > > > Do we maintain this kind of API as non-changeable? > > > > > > > > > > Yeah, that's a bug and should be fixed, sorry for missing that on > > > > > review. > > > > > > > > > > Kelsey, can you fix this up? > > > > > > > > > > thanks, > > > > > > > > > > greg k-h > > > > > > > > I'd be happy to help get this fixed up. > > > > > > > > Would it be proper to go back to using DEVICE_ATTR() for 'bus_rescan' > > > > and 'dev_rescan' in order to change their names back to 'rescan'? > > > > > > Yes. > > > > > > thanks, > > > > > > greg k-h > > > > > > Ack. Sent a patch out. Will stay posted in case any updates need to be made. > > > > commit 4cb9e42d3226 ("PCI: sysfs: Change bus_rescan and dev_rescan to rescan") > > That's your local commit, not the commit in Linus's tree :) > > greg k-h hah, whoops! Wanted to reference the patch name and didn't think that through. Maybe would have been better to reference a link to the patch anyways. :) https://lore.kernel.org/r/20200324234848.8299-1-skunberg.kelsey@gmail.com - Kelsey