public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@us.ibm.com>
To: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Cc: "Grover, Andrew" <andrew.grover@intel.com>,
	"'colpatch@us.ibm.com'" <colpatch@us.ibm.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"Martin J. Bligh" <Martin.Bligh@us.ibm.com>,
	linux-kernel@vger.kernel.org,
	Michael Hohnbaum <hohnbaum@us.ibm.com>,
	jgarzik@mandrakesoft.com, "Diefenbaugh,
	Paul S" <paul.s.diefenbaugh@intel.com>
Subject: Re: [patch] PCI Cleanup
Date: Thu, 15 Aug 2002 09:36:45 -0700	[thread overview]
Message-ID: <20020815163645.GC35918@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0208151014210.849-100000@chaos.physics.uiowa.edu>

On Thu, Aug 15, 2002 at 10:58:17AM -0500, Kai Germaschewski wrote:
> On Wed, 14 Aug 2002, Grover, Andrew wrote:
> 
> > ACPI needs access to PCI config space, and it doesn't have a struct pci_dev
> > to pass to access functions. It doesn't look like your patch exposes an
> > interface that 1) doesn't require a pci_dev and 2) abstracts the PCI config
> > access method, does it?
> 
> I think drivers/hotplug/pci_hotplug_util.c implements something like you 
> need, pci_read_config_byte_nodev().
> 
> Of course that's currently only available for PCI hotplug, and for all I 
> can see the concept is somewhat messed up, but maybe that's an opportunity 
> to clean things up?

I would love to clean those functions up.

> Currently, pci_read_config_byte_nodev() will construct a fake struct 
> pci_dev, and then use the normal pci_read_config_byte(). I think it 
> makes more sense to actually do things the other way around.
> 
> For reading/writing config space, we need to know (dev, fn), and need the 
> access method (struct pci_ops), which is a property of the bridge plus 
> possibly some private data (the arch's sysdata). So the member
> 
> 	struct pci_ops *ops;
> 
> of struct pci_dev is actually not necessary, it will always be
> pdev->ops == pdev->bus->ops AFAICS.
> 
> So we could instead have
> 
> 	pci_bus_read_config_byte(struct pci_bus *bus, u8 dev, u8 fn, ...)
> 
> and for common use
> 
> 	static inline pci_read_config_byte(struct pci_dev, *pdev, ...)
> 	{
> 		return pci_bus_read_config_byte(pdev->bus,
> 						PCI_SLOT(pdev->devfn),
> 						PCI_FUNC(pdev->devfn));
> 	}
> 
> The PCI hotplug controllers / ACPI could then use the pci_bus_* variants, 
> when they don't have a struct pci_dev available. They would need at least 
> the root bridge's struct pci_bus, though.

Thats a good idea.  The hotplug controllers do have acess to the pci_bus
structure.  Andy, does ACPI have access to this when you are needing to
do these kinds of calls?

If there are no complaints, I think I'll go implement this, and move the
functions into the main pci code so that other parts of the kernel (like
ACPI) can use them.

Thanks for the idea!

greg k-h

  reply	other threads:[~2002-08-15 16:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-15  2:24 [patch] PCI Cleanup Grover, Andrew
2002-08-15  7:38 ` [PATCH] Fixup pci_alloc_consistent with 64bit DMA masks on i386 Steffen Persvold
2002-08-15  7:49 ` [patch] PCI Cleanup Martin Mares
2002-08-15 15:58 ` Kai Germaschewski
2002-08-15 16:36   ` Greg KH [this message]
2002-08-16 22:34     ` Greg KH
2002-08-19 23:41       ` Matthew Dobson
2002-08-15 18:28 ` Patrick Mochel
  -- strict thread matches above, loose matches on Subject: below --
2002-08-15 20:23 Grover, Andrew
2002-08-15 20:54 ` Patrick Mochel
2002-08-13  0:08 Matthew Dobson
2002-08-13 11:45 ` Alan Cox
2002-08-13 14:17   ` Martin J. Bligh
2002-08-13 14:57     ` Alan Cox
2002-08-13 15:15       ` Martin J. Bligh
2002-08-13 17:00       ` Matthew Dobson
2002-08-13 17:23         ` Linus Torvalds
2002-08-13 19:57           ` Martin J. Bligh
2002-08-13 20:13             ` Alan Cox
2002-08-13 20:26               ` Linus Torvalds
2002-08-13 22:29                 ` Matthew Dobson
2002-08-13 22:46                   ` Linus Torvalds
2002-08-14  0:57                     ` Matthew Dobson
2002-08-15  0:23                     ` Matthew Dobson
2002-08-14  7:08               ` Martin Mares
2002-08-13 14:55   ` Martin J. Bligh
2002-08-13 15:07     ` Alan Cox

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=20020815163645.GC35918@us.ibm.com \
    --to=gregkh@us.ibm.com \
    --cc=Martin.Bligh@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andrew.grover@intel.com \
    --cc=colpatch@us.ibm.com \
    --cc=hohnbaum@us.ibm.com \
    --cc=jgarzik@mandrakesoft.com \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.s.diefenbaugh@intel.com \
    --cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox