.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /****************************************************************************** |
---|
2 | 3 | * platform-pci.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
8 | 9 | * Copyright (c) 2005, Intel Corporation. |
---|
9 | 10 | * Copyright (c) 2007, XenSource Inc. |
---|
10 | 11 | * Copyright (c) 2010, Citrix |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or modify it |
---|
13 | | - * under the terms and conditions of the GNU General Public License, |
---|
14 | | - * version 2, as published by the Free Software Foundation. |
---|
15 | | - * |
---|
16 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
17 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
18 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
19 | | - * more details. |
---|
20 | | - * |
---|
21 | | - * You should have received a copy of the GNU General Public License along with |
---|
22 | | - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
23 | | - * Place - Suite 330, Boston, MA 02111-1307 USA. |
---|
24 | | - * |
---|
25 | 12 | */ |
---|
26 | 13 | |
---|
27 | 14 | |
---|
.. | .. |
---|
87 | 74 | "xen-platform-pci", pdev); |
---|
88 | 75 | } |
---|
89 | 76 | |
---|
90 | | -static int platform_pci_resume(struct pci_dev *pdev) |
---|
| 77 | +static int platform_pci_resume(struct device *dev) |
---|
91 | 78 | { |
---|
92 | 79 | int err; |
---|
93 | 80 | |
---|
.. | .. |
---|
96 | 83 | |
---|
97 | 84 | err = xen_set_callback_via(callback_via); |
---|
98 | 85 | if (err) { |
---|
99 | | - dev_err(&pdev->dev, "platform_pci_resume failure!\n"); |
---|
| 86 | + dev_err(dev, "platform_pci_resume failure!\n"); |
---|
100 | 87 | return err; |
---|
101 | 88 | } |
---|
102 | 89 | return 0; |
---|
.. | .. |
---|
150 | 137 | if (ret) { |
---|
151 | 138 | dev_warn(&pdev->dev, "Unable to set the evtchn callback " |
---|
152 | 139 | "err=%d\n", ret); |
---|
153 | | - goto out; |
---|
| 140 | + goto irq_out; |
---|
154 | 141 | } |
---|
155 | 142 | } |
---|
156 | 143 | |
---|
.. | .. |
---|
158 | 145 | grant_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes); |
---|
159 | 146 | ret = gnttab_setup_auto_xlat_frames(grant_frames); |
---|
160 | 147 | if (ret) |
---|
161 | | - goto out; |
---|
| 148 | + goto irq_out; |
---|
162 | 149 | ret = gnttab_init(); |
---|
163 | 150 | if (ret) |
---|
164 | 151 | goto grant_out; |
---|
165 | 152 | return 0; |
---|
166 | 153 | grant_out: |
---|
167 | 154 | gnttab_free_auto_xlat_frames(); |
---|
| 155 | +irq_out: |
---|
| 156 | + if (!xen_have_vector_callback) |
---|
| 157 | + free_irq(pdev->irq, pdev); |
---|
168 | 158 | out: |
---|
169 | 159 | pci_release_region(pdev, 0); |
---|
170 | 160 | mem_out: |
---|
.. | .. |
---|
180 | 170 | {0,} |
---|
181 | 171 | }; |
---|
182 | 172 | |
---|
| 173 | +static const struct dev_pm_ops platform_pm_ops = { |
---|
| 174 | + .resume_noirq = platform_pci_resume, |
---|
| 175 | +}; |
---|
| 176 | + |
---|
183 | 177 | static struct pci_driver platform_driver = { |
---|
184 | 178 | .name = DRV_NAME, |
---|
185 | 179 | .probe = platform_pci_probe, |
---|
186 | 180 | .id_table = platform_pci_tbl, |
---|
187 | | -#ifdef CONFIG_PM |
---|
188 | | - .resume_early = platform_pci_resume, |
---|
189 | | -#endif |
---|
| 181 | + .driver = { |
---|
| 182 | + .pm = &platform_pm_ops, |
---|
| 183 | + }, |
---|
190 | 184 | }; |
---|
191 | 185 | |
---|
192 | 186 | builtin_pci_driver(platform_driver); |
---|