linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: helgaas at kernel.org (Bjorn Helgaas)
Subject: [Linux-kernel-mentees] [PATCH] PCI/IOV: Move sysfs SR-IOV functions to iov.c
Date: Sat, 10 Aug 2019 12:15:25 -0500	[thread overview]
Message-ID: <20190810171525.GG221706@google.com> (raw)
In-Reply-To: <20190810071719.GA16356@kroah.com>

On Sat, Aug 10, 2019 at 09:17:19AM +0200, Greg KH wrote:
> On Fri, Aug 09, 2019 at 01:57:21PM -0600, Kelsey Skunberg wrote:
> > +static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
> 
> DEVICE_ATTR_RO() please.  This is a device attribute, not a "raw"
> kobject attribute.

This patch is just a move; here's the source of the line above:

> > -static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);

I certainly support using DEVICE_ATTR_RO() instead of __ATTR_RO(), but
that should be down with a separate patch so it's not buried in what
is otherwise a simple move.

> > +static struct device_attribute sriov_numvfs_attr =
> > +		__ATTR(sriov_numvfs, (S_IRUGO | S_IWUSR | S_IWGRP),
> > +		       sriov_numvfs_show, sriov_numvfs_store);
> > +static struct device_attribute sriov_offset_attr = __ATTR_RO(sriov_offset);
> > +static struct device_attribute sriov_stride_attr = __ATTR_RO(sriov_stride);
> > +static struct device_attribute sriov_vf_device_attr =
> > +		__ATTR_RO(sriov_vf_device);
> > +static struct device_attribute sriov_drivers_autoprobe_attr =
> > +		__ATTR(sriov_drivers_autoprobe, (S_IRUGO | S_IWUSR | S_IWGRP),
> > +		       sriov_drivers_autoprobe_show,
> > +		       sriov_drivers_autoprobe_store);
> 
> Same for all of these, they should use DEVICE_ATTR* macros.
> 
> And why the odd permissions on 2 of these files?  Are you sure about
> that?

Same for these.  It'd be nice to fix them (and similar cases in
pci-sysfs.c, rpadlpar_sysfs.c, sgi_hotplug.c, slot.c) but in a
separate patch.

I think Kelsey did the right thing here by not mixing unrelated fixes
in with the code move.  A couple additional patches to change the
__ATTR() uses and the permissions (git grep "\<S_" finds several
possibilities) would be icing on the cake, but getting the SR-IOV
code all together is an improvement by itself.

Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: helgaas@kernel.org (Bjorn Helgaas)
Subject: [Linux-kernel-mentees] [PATCH] PCI/IOV: Move sysfs SR-IOV functions to iov.c
Date: Sat, 10 Aug 2019 12:15:25 -0500	[thread overview]
Message-ID: <20190810171525.GG221706@google.com> (raw)
Message-ID: <20190810171525.hOuQwbjD-6t-JUzJcrAUKvSHC9XOFABPCSUsZPSAk9A@z> (raw)
In-Reply-To: <20190810071719.GA16356@kroah.com>

On Sat, Aug 10, 2019 at 09:17:19AM +0200, Greg KH wrote:
> On Fri, Aug 09, 2019 at 01:57:21PM -0600, Kelsey Skunberg wrote:
> > +static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
> 
> DEVICE_ATTR_RO() please.  This is a device attribute, not a "raw"
> kobject attribute.

This patch is just a move; here's the source of the line above:

> > -static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);

I certainly support using DEVICE_ATTR_RO() instead of __ATTR_RO(), but
that should be down with a separate patch so it's not buried in what
is otherwise a simple move.

> > +static struct device_attribute sriov_numvfs_attr =
> > +		__ATTR(sriov_numvfs, (S_IRUGO | S_IWUSR | S_IWGRP),
> > +		       sriov_numvfs_show, sriov_numvfs_store);
> > +static struct device_attribute sriov_offset_attr = __ATTR_RO(sriov_offset);
> > +static struct device_attribute sriov_stride_attr = __ATTR_RO(sriov_stride);
> > +static struct device_attribute sriov_vf_device_attr =
> > +		__ATTR_RO(sriov_vf_device);
> > +static struct device_attribute sriov_drivers_autoprobe_attr =
> > +		__ATTR(sriov_drivers_autoprobe, (S_IRUGO | S_IWUSR | S_IWGRP),
> > +		       sriov_drivers_autoprobe_show,
> > +		       sriov_drivers_autoprobe_store);
> 
> Same for all of these, they should use DEVICE_ATTR* macros.
> 
> And why the odd permissions on 2 of these files?  Are you sure about
> that?

Same for these.  It'd be nice to fix them (and similar cases in
pci-sysfs.c, rpadlpar_sysfs.c, sgi_hotplug.c, slot.c) but in a
separate patch.

I think Kelsey did the right thing here by not mixing unrelated fixes
in with the code move.  A couple additional patches to change the
__ATTR() uses and the permissions (git grep "\<S_" finds several
possibilities) would be icing on the cake, but getting the SR-IOV
code all together is an improvement by itself.

Bjorn

  parent reply	other threads:[~2019-08-10 17:15 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 19:57 [Linux-kernel-mentees] [PATCH] PCI/IOV: Move sysfs SR-IOV functions to iov.c skunberg.kelsey
2019-08-09 19:57 ` Kelsey Skunberg
2019-08-10  7:17 ` greg
2019-08-10  7:17   ` Greg KH
2019-08-10 17:15   ` helgaas [this message]
2019-08-10 17:15     ` Bjorn Helgaas
2019-08-10 17:24     ` greg
2019-08-10 17:24       ` Greg KH
2019-08-10 21:32       ` skunberg.kelsey
2019-08-10 21:32         ` Kelsey Skunberg
2019-08-13 20:45 ` [Linux-kernel-mentees] [PATCH v2 0/3] PCI: pci-sysfs.c cleanup skunberg.kelsey
2019-08-13 20:45   ` Kelsey Skunberg
2019-08-13 20:45   ` [Linux-kernel-mentees] [PATCH v2 1/3] PCI: sysfs: Define device attributes with DEVICE_ATTR*() skunberg.kelsey
2019-08-13 20:45     ` Kelsey Skunberg
2019-08-14  7:52     ` gregkh
2019-08-14  7:52       ` Greg KH
2019-08-14 23:14       ` skunberg.kelsey
2019-08-14 23:14         ` Kelsey Skunberg
2019-08-15 15:54       ` skunberg.kelsey
2019-08-15 15:54         ` Kelsey Skunberg
2019-08-13 20:45   ` [Linux-kernel-mentees] [PATCH v2 2/3] PCI: sysfs: Change permissions from symbolic to octal skunberg.kelsey
2019-08-13 20:45     ` Kelsey Skunberg
2019-08-14  5:38     ` helgaas
2019-08-14  5:38       ` Bjorn Helgaas
2019-08-14  7:53       ` gregkh
2019-08-14  7:53         ` Greg Kroah-Hartman
2019-08-15 14:37       ` ddutile
2019-08-15 14:37         ` Don Dutile
2019-09-04  6:22         ` skunberg.kelsey
2019-09-04  6:22           ` Kelsey Skunberg
2019-09-04 15:32           ` ddutile
2019-09-04 15:32             ` Don Dutile
2019-09-04 18:33           ` ddutile
2019-09-04 18:33             ` Don Dutile
2019-09-05  4:04             ` skunberg.kelsey
2019-09-05  4:04               ` Kelsey Skunberg
2019-08-13 20:45   ` [Linux-kernel-mentees] [PATCH v2 3/3] PCI/IOV: Move sysfs SR-IOV functions to iov.c skunberg.kelsey
2019-08-13 20:45     ` Kelsey Skunberg
2019-08-14  5:40   ` [Linux-kernel-mentees] [PATCH v2 0/3] PCI: pci-sysfs.c cleanup helgaas
2019-08-14  5:40     ` Bjorn Helgaas
2019-08-15 15:33   ` [Linux-kernel-mentees] [PATCH v3 0/4] PCI: Clean up pci-sysfs.c skunberg.kelsey
2019-08-15 15:33     ` Kelsey Skunberg
2019-08-15 16:08     ` gregkh
2019-08-15 16:08       ` Greg KH
2019-08-16  4:22     ` ddutile
2019-08-16  4:22       ` Don Dutile
2019-08-19 22:42     ` helgaas
2019-08-19 22:42       ` Bjorn Helgaas
2019-08-15 15:33   ` [Linux-kernel-mentees] [PATCH v3 1/4] PCI: sysfs: Define device attributes with DEVICE_ATTR* skunberg.kelsey
2019-08-15 15:33     ` Kelsey Skunberg
2020-03-14 10:51     ` Ruslan Bilovol
2020-03-14 11:20       ` Greg Kroah-Hartman
2020-03-24  6:10         ` Kelsey
2020-03-24  6:24           ` Greg Kroah-Hartman
2020-03-24 23:53             ` Kelsey
2020-03-25  7:17               ` Greg Kroah-Hartman
2020-03-25 15:15                 ` Kelsey
2019-08-15 15:33   ` [Linux-kernel-mentees] [PATCH v3 2/4] PCI: sysfs: Change permissions from symbolic to octal skunberg.kelsey
2019-08-15 15:33     ` Kelsey Skunberg
2019-08-15 15:33   ` [Linux-kernel-mentees] [PATCH v3 3/4] PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO() skunberg.kelsey
2019-08-15 15:33     ` Kelsey Skunberg
2019-08-15 15:33   ` [Linux-kernel-mentees] [PATCH v3 4/4] PCI/IOV: Move sysfs SR-IOV functions to iov.c skunberg.kelsey
2019-08-15 15:33     ` Kelsey Skunberg
2019-08-15 17:34     ` 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=20190810171525.GG221706@google.com \
    --to=linux-kernel-mentees@lists.linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).