2 * Sonics Silicon Backplane
3 * PCI Hostdevice wrapper
5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 * Copyright (c) 2005 Stefano Brivio <st3@riseup.net>
7 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
8 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
9 * Copyright (c) 2005-2007 Michael Buesch <mbuesch@freenet.de>
11 * Licensed under the GNU/GPL. See COPYING for details.
14 #include <linux/pci.h>
15 #include <linux/ssb/ssb.h>
19 static int ssb_pcihost_suspend(struct pci_dev
*dev
, pm_message_t state
)
22 pci_disable_device(dev
);
23 pci_set_power_state(dev
, pci_choose_state(dev
, state
));
28 static int ssb_pcihost_resume(struct pci_dev
*dev
)
32 pci_set_power_state(dev
, 0);
33 err
= pci_enable_device(dev
);
36 pci_restore_state(dev
);
41 # define ssb_pcihost_suspend NULL
42 # define ssb_pcihost_resume NULL
43 #endif /* CONFIG_PM */
45 static int ssb_pcihost_probe(struct pci_dev
*dev
,
46 const struct pci_device_id
*id
)
52 ssb
= kzalloc(sizeof(*ssb
), GFP_KERNEL
);
55 err
= pci_enable_device(dev
);
58 name
= dev
->dev
.bus_id
;
59 if (dev
->driver
&& dev
->driver
->name
)
60 name
= dev
->driver
->name
;
61 err
= pci_request_regions(dev
, name
);
66 err
= ssb_bus_pcibus_register(ssb
, dev
);
68 goto err_pci_release_regions
;
70 pci_set_drvdata(dev
, ssb
);
75 err_pci_release_regions
:
76 pci_release_regions(dev
);
78 pci_disable_device(dev
);
84 static void ssb_pcihost_remove(struct pci_dev
*dev
)
86 struct ssb_bus
*ssb
= pci_get_drvdata(dev
);
88 ssb_bus_unregister(ssb
);
89 pci_release_regions(dev
);
90 pci_disable_device(dev
);
92 pci_set_drvdata(dev
, NULL
);
95 int ssb_pcihost_register(struct pci_driver
*driver
)
97 driver
->probe
= ssb_pcihost_probe
;
98 driver
->remove
= ssb_pcihost_remove
;
99 driver
->suspend
= ssb_pcihost_suspend
;
100 driver
->resume
= ssb_pcihost_resume
;
102 return pci_register_driver(driver
);
104 EXPORT_SYMBOL(ssb_pcihost_register
);
This page took 0.043675 seconds and 5 git commands to generate.