All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: linux-pci@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [Resend] pcibios_add_platform_entries usage
Date: Mon, 14 Apr 2014 11:35:41 -0600	[thread overview]
Message-ID: <20140414173541.GA4417@google.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1404141101500.1529@denkbrett>

[+cc Greg]

On Mon, Apr 14, 2014 at 11:03:42AM +0200, Sebastian Ott wrote:
> Hello Bjorn,
> 
> for pci on s390 we currently use pcibios_add_platform_entries to add
> some arch specific attributes to pdevs. This has 2 downsides - it will
> race with userspace which is triggered by udev events and expecting
> these attributes (but that's a theoretical issue). More important to
> me is that one cannot use attribute_groups with this. Both issues could
> be addressed by using pdev->dev.groups and let the driver core handle
> attribute creation.
> 
> So would it be ok if we set pdev->dev.groups in pcibios_add_device?
> (It should be since it's not used by pci common code which uses bus_type,
> dev_type, and class groups).

Hi Sebastian,

Sorry, I meant to respond to this earlier, but forgot.  This sounds
reasonable to me, but Greg can give you a much better answer than I can.

Documentation/driver-model/device.txt says the dev->groups pointer
should be set before calling device_register().  PCI calls
device_initialize() and device_add() instead of using device_register(),
and pcibios_add_device() looks like it happens at the right time:

    pci_scan_root_bus
      pci_scan_child_bus
        pci_scan_slot
          pci_scan_single_device
            pci_device_add
              device_initialize
              pcibios_add_device                # <---
              device_add
      pci_bus_add_devices
        pci_bus_add_device
          pci_create_sysfs_dev_files
            pcibios_add_platform_entries        # 8d4cd0833107 (benh)
          device_attach

I'm not sure why pci_create_sysfs_dev_files() is done later.  It seems
like that should be done before device_add() as well.  Maybe it's
because BARs might not be valid yet (that doesn't seem like a very good
excuse, but it's all I can think of).

I assume that if you change s390, you'll also change microblaze and
powerpc?  They look structurally similar to s390.

Bjorn

  reply	other threads:[~2014-04-14 17:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 18:41 pcibios_add_platform_entries usage Sebastian Ott
2014-04-14  9:03 ` [Resend] " Sebastian Ott
2014-04-14 17:35   ` Bjorn Helgaas [this message]
2014-04-14 18:07     ` Sebastian Ott
2014-04-17 17:46       ` Sebastian Ott
2014-04-17 21:02         ` Benjamin Herrenschmidt
2014-04-18 10:10           ` Sebastian Ott
2014-04-18 21:31             ` Benjamin Herrenschmidt
2014-04-22  8:26               ` Sebastian Ott
2014-04-23  6:48                 ` Michal Simek
2014-04-23  9:00                   ` Sebastian Ott
2014-04-29 23:30         ` Bjorn Helgaas
2014-04-30 14:40           ` Sebastian Ott

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=20140414173541.GA4417@google.com \
    --to=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sebott@linux.vnet.ibm.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.