kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Faking PCI devices?
@ 2011-05-04  9:39 Manohar Vanga
  2011-05-04 14:55 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Manohar Vanga @ 2011-05-04  9:39 UTC (permalink / raw)
  To: kernelnewbies

Hi,

I have written a simulated driver for a PCI board and am looking for a clean
way to use the driver. Currently, I am setting the PCI ids to PCI_ANY_ID and
only allowing a single probe call to go through using a global variable
(concurrency issues but I don't care for the simulation).

static int n
...
static int fake_board_probe(struct pci_dev *pdev, const struct pci_device_id
*ent)
{
    if (n == 1)
        return -1;
    n = 1;
    ...
}
static int fake_board_init(void)
{
    n = 0;
    ....
}

I want to do a cleaner job of this and wanted to write a PCI bridge driver
that actually registers the devices with the correct IDs that I need. This
also gives me the advantage of being able to register multiple devices which
is a useful for the simulation I am working on.
Can anyone point me in the right direction for this? Most of the code (eg.
struct pci_controller) seem to be architecture specific.

The code is available for anyone interested at:
https://github.com/mvanga/wbonesim

Thanks and best regards.
-- 
/manohar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110504/5597d168/attachment.html 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-04 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04  9:39 Faking PCI devices? Manohar Vanga
2011-05-04 14:55 ` Greg KH

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).