All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Kelsey <skunberg.kelsey@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Bodong Wang <bodong@mellanox.com>,
	Don Dutile <ddutile@redhat.com>,
	rbilovol@cisco.com
Subject: Re: [PATCH v3 1/4] PCI: sysfs: Define device attributes with DEVICE_ATTR*
Date: Tue, 24 Mar 2020 07:24:22 +0100	[thread overview]
Message-ID: <20200324062422.GA1977781@kroah.com> (raw)
In-Reply-To: <CAFVqi1T1Fipajca8exrzs6uQAorSZeke80LYy43aCBpT45nFdA@mail.gmail.com>

On Tue, Mar 24, 2020 at 12:10:33AM -0600, Kelsey wrote:
> On Sat, Mar 14, 2020 at 5:20 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> 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
> > > <skunberg.kelsey@gmail.com> 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 <skunberg.kelsey@gmail.com>
> > > > ---
> > > >  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

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Kelsey <skunberg.kelsey@gmail.com>
Cc: linux-pci@vger.kernel.org, rbilovol@cisco.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Don Dutile <ddutile@redhat.com>,
	Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Bodong Wang <bodong@mellanox.com>
Subject: Re: [Linux-kernel-mentees] [PATCH v3 1/4] PCI: sysfs: Define device attributes with DEVICE_ATTR*
Date: Tue, 24 Mar 2020 07:24:22 +0100	[thread overview]
Message-ID: <20200324062422.GA1977781@kroah.com> (raw)
In-Reply-To: <CAFVqi1T1Fipajca8exrzs6uQAorSZeke80LYy43aCBpT45nFdA@mail.gmail.com>

On Tue, Mar 24, 2020 at 12:10:33AM -0600, Kelsey wrote:
> On Sat, Mar 14, 2020 at 5:20 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> 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
> > > <skunberg.kelsey@gmail.com> 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 <skunberg.kelsey@gmail.com>
> > > > ---
> > > >  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
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-03-24  6:24 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 19:57 [PATCH] PCI/IOV: Move sysfs SR-IOV functions to iov.c Kelsey Skunberg
2019-08-09 19:57 ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-09 19:57 ` skunberg.kelsey
2019-08-10  7:17 ` Greg KH
2019-08-10  7:17   ` Greg KH
2019-08-10  7:17   ` greg
2019-08-10 17:15   ` Bjorn Helgaas
2019-08-10 17:15     ` Bjorn Helgaas
2019-08-10 17:15     ` helgaas
2019-08-10 17:24     ` Greg KH
2019-08-10 17:24       ` Greg KH
2019-08-10 17:24       ` greg
2019-08-10 21:32       ` Kelsey Skunberg
2019-08-10 21:32         ` Kelsey Skunberg
2019-08-10 21:32         ` skunberg.kelsey
2019-08-13 20:45 ` [PATCH v2 0/3] PCI: pci-sysfs.c cleanup Kelsey Skunberg
2019-08-13 20:45   ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-13 20:45   ` skunberg.kelsey
2019-08-13 20:45   ` [PATCH v2 1/3] PCI: sysfs: Define device attributes with DEVICE_ATTR*() Kelsey Skunberg
2019-08-13 20:45     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-13 20:45     ` skunberg.kelsey
2019-08-14  7:52     ` Greg KH
2019-08-14  7:52       ` Greg KH
2019-08-14  7:52       ` gregkh
2019-08-14 23:14       ` Kelsey Skunberg
2019-08-14 23:14         ` Kelsey Skunberg
2019-08-14 23:14         ` skunberg.kelsey
2019-08-15 15:54       ` Kelsey Skunberg
2019-08-15 15:54         ` Kelsey Skunberg
2019-08-15 15:54         ` skunberg.kelsey
2019-08-13 20:45   ` [PATCH v2 2/3] PCI: sysfs: Change permissions from symbolic to octal Kelsey Skunberg
2019-08-13 20:45     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-13 20:45     ` skunberg.kelsey
2019-08-14  5:38     ` Bjorn Helgaas
2019-08-14  5:38       ` Bjorn Helgaas
2019-08-14  5:38       ` helgaas
2019-08-14  7:53       ` Greg Kroah-Hartman
2019-08-14  7:53         ` Greg Kroah-Hartman
2019-08-14  7:53         ` gregkh
2019-08-15 14:37       ` Don Dutile
2019-08-15 14:37         ` Don Dutile
2019-08-15 14:37         ` ddutile
2019-09-04  6:22         ` Kelsey Skunberg
2019-09-04  6:22           ` Kelsey Skunberg
2019-09-04  6:22           ` skunberg.kelsey
2019-09-04 15:32           ` Don Dutile
2019-09-04 15:32             ` Don Dutile
2019-09-04 15:32             ` ddutile
2019-09-04 18:33           ` Don Dutile
2019-09-04 18:33             ` Don Dutile
2019-09-04 18:33             ` ddutile
2019-09-05  4:04             ` Kelsey Skunberg
2019-09-05  4:04               ` Kelsey Skunberg
2019-09-05  4:04               ` skunberg.kelsey
2019-08-13 20:45   ` [PATCH v2 3/3] PCI/IOV: Move sysfs SR-IOV functions to iov.c Kelsey Skunberg
2019-08-13 20:45     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-13 20:45     ` skunberg.kelsey
2019-08-14  5:40   ` [Linux-kernel-mentees] [PATCH v2 0/3] PCI: pci-sysfs.c cleanup Bjorn Helgaas
2019-08-14  5:40     ` Bjorn Helgaas
2019-08-14  5:40     ` helgaas
2019-08-15 15:33   ` [PATCH v3 0/4] PCI: Clean up pci-sysfs.c Kelsey Skunberg
2019-08-15 15:33     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-15 15:33     ` skunberg.kelsey
2019-08-15 16:08     ` Greg KH
2019-08-15 16:08       ` [Linux-kernel-mentees] " Greg KH
2019-08-15 16:08       ` gregkh
2019-08-16  4:22     ` Don Dutile
2019-08-16  4:22       ` [Linux-kernel-mentees] " Don Dutile
2019-08-16  4:22       ` ddutile
2019-08-19 22:42     ` Bjorn Helgaas
2019-08-19 22:42       ` Bjorn Helgaas
2019-08-19 22:42       ` helgaas
2019-08-15 15:33   ` [PATCH v3 1/4] PCI: sysfs: Define device attributes with DEVICE_ATTR* Kelsey Skunberg
2019-08-15 15:33     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-15 15:33     ` skunberg.kelsey
2020-03-14 10:51     ` Ruslan Bilovol
2020-03-14 10:51       ` [Linux-kernel-mentees] " Ruslan Bilovol
2020-03-14 11:20       ` Greg Kroah-Hartman
2020-03-14 11:20         ` [Linux-kernel-mentees] " Greg Kroah-Hartman
2020-03-24  6:10         ` Kelsey
2020-03-24  6:10           ` [Linux-kernel-mentees] " Kelsey
2020-03-24  6:24           ` Greg Kroah-Hartman [this message]
2020-03-24  6:24             ` Greg Kroah-Hartman
2020-03-24 23:53             ` Kelsey
2020-03-24 23:53               ` [Linux-kernel-mentees] " Kelsey
2020-03-25  7:17               ` Greg Kroah-Hartman
2020-03-25  7:17                 ` [Linux-kernel-mentees] " Greg Kroah-Hartman
2020-03-25 15:15                 ` Kelsey
2020-03-25 15:15                   ` [Linux-kernel-mentees] " Kelsey
2019-08-15 15:33   ` [PATCH v3 2/4] PCI: sysfs: Change permissions from symbolic to octal Kelsey Skunberg
2019-08-15 15:33     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-15 15:33     ` skunberg.kelsey
2019-08-15 15:33   ` [PATCH v3 3/4] PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO() Kelsey Skunberg
2019-08-15 15:33     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-15 15:33     ` skunberg.kelsey
2019-08-15 15:33   ` [PATCH v3 4/4] PCI/IOV: Move sysfs SR-IOV functions to iov.c Kelsey Skunberg
2019-08-15 15:33     ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-08-15 15:33     ` skunberg.kelsey
2019-08-15 17:34     ` sathyanarayanan kuppuswamy
2019-08-15 17:34       ` [Linux-kernel-mentees] " sathyanarayanan kuppuswamy
2019-08-15 17:34       ` sathyanarayanan.kuppuswamy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200324062422.GA1977781@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bhelgaas@google.com \
    --cc=bodong@mellanox.com \
    --cc=ddutile@redhat.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rbilovol@cisco.com \
    --cc=ruslan.bilovol@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --cc=skunberg.kelsey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.