| .. | .. |
|---|
| 17 | 17 | * Dely Sy <dely.l.sy@intel.com>" |
|---|
| 18 | 18 | */ |
|---|
| 19 | 19 | |
|---|
| 20 | +#define pr_fmt(fmt) "pciehp: " fmt |
|---|
| 21 | +#define dev_fmt pr_fmt |
|---|
| 22 | + |
|---|
| 20 | 23 | #include <linux/moduleparam.h> |
|---|
| 21 | 24 | #include <linux/kernel.h> |
|---|
| 22 | 25 | #include <linux/slab.h> |
|---|
| 23 | 26 | #include <linux/types.h> |
|---|
| 24 | 27 | #include <linux/pci.h> |
|---|
| 25 | 28 | #include "pciehp.h" |
|---|
| 26 | | -#include <linux/interrupt.h> |
|---|
| 27 | | -#include <linux/time.h> |
|---|
| 28 | 29 | |
|---|
| 29 | 30 | #include "../pci.h" |
|---|
| 30 | 31 | |
|---|
| 31 | 32 | /* Global variables */ |
|---|
| 32 | | -bool pciehp_debug; |
|---|
| 33 | 33 | bool pciehp_poll_mode; |
|---|
| 34 | 34 | int pciehp_poll_time; |
|---|
| 35 | 35 | |
|---|
| .. | .. |
|---|
| 37 | 37 | * not really modular, but the easiest way to keep compat with existing |
|---|
| 38 | 38 | * bootargs behaviour is to continue using module_param here. |
|---|
| 39 | 39 | */ |
|---|
| 40 | | -module_param(pciehp_debug, bool, 0644); |
|---|
| 41 | 40 | module_param(pciehp_poll_mode, bool, 0644); |
|---|
| 42 | 41 | module_param(pciehp_poll_time, int, 0644); |
|---|
| 43 | | -MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); |
|---|
| 44 | 42 | MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); |
|---|
| 45 | 43 | MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); |
|---|
| 46 | 44 | |
|---|
| 47 | | -#define PCIE_MODULE_NAME "pciehp" |
|---|
| 48 | | - |
|---|
| 49 | 45 | static int set_attention_status(struct hotplug_slot *slot, u8 value); |
|---|
| 50 | | -static int enable_slot(struct hotplug_slot *slot); |
|---|
| 51 | | -static int disable_slot(struct hotplug_slot *slot); |
|---|
| 52 | 46 | static int get_power_status(struct hotplug_slot *slot, u8 *value); |
|---|
| 53 | | -static int get_attention_status(struct hotplug_slot *slot, u8 *value); |
|---|
| 54 | 47 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
|---|
| 55 | 48 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
|---|
| 56 | | -static int reset_slot(struct hotplug_slot *slot, int probe); |
|---|
| 57 | 49 | |
|---|
| 58 | 50 | static int init_slot(struct controller *ctrl) |
|---|
| 59 | 51 | { |
|---|
| 60 | | - struct slot *slot = ctrl->slot; |
|---|
| 61 | | - struct hotplug_slot *hotplug = NULL; |
|---|
| 62 | | - struct hotplug_slot_info *info = NULL; |
|---|
| 63 | | - struct hotplug_slot_ops *ops = NULL; |
|---|
| 52 | + struct hotplug_slot_ops *ops; |
|---|
| 64 | 53 | char name[SLOT_NAME_SIZE]; |
|---|
| 65 | | - int retval = -ENOMEM; |
|---|
| 66 | | - |
|---|
| 67 | | - hotplug = kzalloc(sizeof(*hotplug), GFP_KERNEL); |
|---|
| 68 | | - if (!hotplug) |
|---|
| 69 | | - goto out; |
|---|
| 70 | | - |
|---|
| 71 | | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
|---|
| 72 | | - if (!info) |
|---|
| 73 | | - goto out; |
|---|
| 54 | + int retval; |
|---|
| 74 | 55 | |
|---|
| 75 | 56 | /* Setup hotplug slot ops */ |
|---|
| 76 | 57 | ops = kzalloc(sizeof(*ops), GFP_KERNEL); |
|---|
| 77 | 58 | if (!ops) |
|---|
| 78 | | - goto out; |
|---|
| 59 | + return -ENOMEM; |
|---|
| 79 | 60 | |
|---|
| 80 | | - ops->enable_slot = enable_slot; |
|---|
| 81 | | - ops->disable_slot = disable_slot; |
|---|
| 61 | + ops->enable_slot = pciehp_sysfs_enable_slot; |
|---|
| 62 | + ops->disable_slot = pciehp_sysfs_disable_slot; |
|---|
| 82 | 63 | ops->get_power_status = get_power_status; |
|---|
| 83 | 64 | ops->get_adapter_status = get_adapter_status; |
|---|
| 84 | | - ops->reset_slot = reset_slot; |
|---|
| 65 | + ops->reset_slot = pciehp_reset_slot; |
|---|
| 85 | 66 | if (MRL_SENS(ctrl)) |
|---|
| 86 | 67 | ops->get_latch_status = get_latch_status; |
|---|
| 87 | 68 | if (ATTN_LED(ctrl)) { |
|---|
| 88 | | - ops->get_attention_status = get_attention_status; |
|---|
| 69 | + ops->get_attention_status = pciehp_get_attention_status; |
|---|
| 89 | 70 | ops->set_attention_status = set_attention_status; |
|---|
| 90 | 71 | } else if (ctrl->pcie->port->hotplug_user_indicators) { |
|---|
| 91 | 72 | ops->get_attention_status = pciehp_get_raw_indicator_status; |
|---|
| .. | .. |
|---|
| 93 | 74 | } |
|---|
| 94 | 75 | |
|---|
| 95 | 76 | /* register this slot with the hotplug pci core */ |
|---|
| 96 | | - hotplug->info = info; |
|---|
| 97 | | - hotplug->private = slot; |
|---|
| 98 | | - hotplug->ops = ops; |
|---|
| 99 | | - slot->hotplug_slot = hotplug; |
|---|
| 77 | + ctrl->hotplug_slot.ops = ops; |
|---|
| 100 | 78 | snprintf(name, SLOT_NAME_SIZE, "%u", PSN(ctrl)); |
|---|
| 101 | 79 | |
|---|
| 102 | | - retval = pci_hp_initialize(hotplug, |
|---|
| 80 | + retval = pci_hp_initialize(&ctrl->hotplug_slot, |
|---|
| 103 | 81 | ctrl->pcie->port->subordinate, 0, name); |
|---|
| 104 | | - if (retval) |
|---|
| 105 | | - ctrl_err(ctrl, "pci_hp_initialize failed: error %d\n", retval); |
|---|
| 106 | | -out: |
|---|
| 107 | 82 | if (retval) { |
|---|
| 83 | + ctrl_err(ctrl, "pci_hp_initialize failed: error %d\n", retval); |
|---|
| 108 | 84 | kfree(ops); |
|---|
| 109 | | - kfree(info); |
|---|
| 110 | | - kfree(hotplug); |
|---|
| 111 | 85 | } |
|---|
| 112 | 86 | return retval; |
|---|
| 113 | 87 | } |
|---|
| 114 | 88 | |
|---|
| 115 | 89 | static void cleanup_slot(struct controller *ctrl) |
|---|
| 116 | 90 | { |
|---|
| 117 | | - struct hotplug_slot *hotplug_slot = ctrl->slot->hotplug_slot; |
|---|
| 91 | + struct hotplug_slot *hotplug_slot = &ctrl->hotplug_slot; |
|---|
| 118 | 92 | |
|---|
| 119 | 93 | pci_hp_destroy(hotplug_slot); |
|---|
| 120 | 94 | kfree(hotplug_slot->ops); |
|---|
| 121 | | - kfree(hotplug_slot->info); |
|---|
| 122 | | - kfree(hotplug_slot); |
|---|
| 123 | 95 | } |
|---|
| 124 | 96 | |
|---|
| 125 | 97 | /* |
|---|
| 126 | | - * set_attention_status - Turns the Amber LED for a slot on, off or blink |
|---|
| 98 | + * set_attention_status - Turns the Attention Indicator on, off or blinking |
|---|
| 127 | 99 | */ |
|---|
| 128 | 100 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) |
|---|
| 129 | 101 | { |
|---|
| 130 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 131 | | - struct pci_dev *pdev = slot->ctrl->pcie->port; |
|---|
| 102 | + struct controller *ctrl = to_ctrl(hotplug_slot); |
|---|
| 103 | + struct pci_dev *pdev = ctrl->pcie->port; |
|---|
| 104 | + |
|---|
| 105 | + if (status) |
|---|
| 106 | + status <<= PCI_EXP_SLTCTL_ATTN_IND_SHIFT; |
|---|
| 107 | + else |
|---|
| 108 | + status = PCI_EXP_SLTCTL_ATTN_IND_OFF; |
|---|
| 132 | 109 | |
|---|
| 133 | 110 | pci_config_pm_runtime_get(pdev); |
|---|
| 134 | | - pciehp_set_attention_status(slot, status); |
|---|
| 111 | + pciehp_set_indicators(ctrl, INDICATOR_NOOP, status); |
|---|
| 135 | 112 | pci_config_pm_runtime_put(pdev); |
|---|
| 136 | 113 | return 0; |
|---|
| 137 | | -} |
|---|
| 138 | | - |
|---|
| 139 | | - |
|---|
| 140 | | -static int enable_slot(struct hotplug_slot *hotplug_slot) |
|---|
| 141 | | -{ |
|---|
| 142 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 143 | | - |
|---|
| 144 | | - return pciehp_sysfs_enable_slot(slot); |
|---|
| 145 | | -} |
|---|
| 146 | | - |
|---|
| 147 | | - |
|---|
| 148 | | -static int disable_slot(struct hotplug_slot *hotplug_slot) |
|---|
| 149 | | -{ |
|---|
| 150 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 151 | | - |
|---|
| 152 | | - return pciehp_sysfs_disable_slot(slot); |
|---|
| 153 | 114 | } |
|---|
| 154 | 115 | |
|---|
| 155 | 116 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
|---|
| 156 | 117 | { |
|---|
| 157 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 158 | | - struct pci_dev *pdev = slot->ctrl->pcie->port; |
|---|
| 118 | + struct controller *ctrl = to_ctrl(hotplug_slot); |
|---|
| 119 | + struct pci_dev *pdev = ctrl->pcie->port; |
|---|
| 159 | 120 | |
|---|
| 160 | 121 | pci_config_pm_runtime_get(pdev); |
|---|
| 161 | | - pciehp_get_power_status(slot, value); |
|---|
| 122 | + pciehp_get_power_status(ctrl, value); |
|---|
| 162 | 123 | pci_config_pm_runtime_put(pdev); |
|---|
| 163 | | - return 0; |
|---|
| 164 | | -} |
|---|
| 165 | | - |
|---|
| 166 | | -static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
|---|
| 167 | | -{ |
|---|
| 168 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 169 | | - |
|---|
| 170 | | - pciehp_get_attention_status(slot, value); |
|---|
| 171 | 124 | return 0; |
|---|
| 172 | 125 | } |
|---|
| 173 | 126 | |
|---|
| 174 | 127 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
|---|
| 175 | 128 | { |
|---|
| 176 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 177 | | - struct pci_dev *pdev = slot->ctrl->pcie->port; |
|---|
| 129 | + struct controller *ctrl = to_ctrl(hotplug_slot); |
|---|
| 130 | + struct pci_dev *pdev = ctrl->pcie->port; |
|---|
| 178 | 131 | |
|---|
| 179 | 132 | pci_config_pm_runtime_get(pdev); |
|---|
| 180 | | - pciehp_get_latch_status(slot, value); |
|---|
| 133 | + pciehp_get_latch_status(ctrl, value); |
|---|
| 181 | 134 | pci_config_pm_runtime_put(pdev); |
|---|
| 182 | 135 | return 0; |
|---|
| 183 | 136 | } |
|---|
| 184 | 137 | |
|---|
| 185 | 138 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
|---|
| 186 | 139 | { |
|---|
| 187 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 188 | | - struct pci_dev *pdev = slot->ctrl->pcie->port; |
|---|
| 140 | + struct controller *ctrl = to_ctrl(hotplug_slot); |
|---|
| 141 | + struct pci_dev *pdev = ctrl->pcie->port; |
|---|
| 142 | + int ret; |
|---|
| 189 | 143 | |
|---|
| 190 | 144 | pci_config_pm_runtime_get(pdev); |
|---|
| 191 | | - pciehp_get_adapter_status(slot, value); |
|---|
| 145 | + ret = pciehp_card_present_or_link_active(ctrl); |
|---|
| 192 | 146 | pci_config_pm_runtime_put(pdev); |
|---|
| 147 | + if (ret < 0) |
|---|
| 148 | + return ret; |
|---|
| 149 | + |
|---|
| 150 | + *value = ret; |
|---|
| 193 | 151 | return 0; |
|---|
| 194 | | -} |
|---|
| 195 | | - |
|---|
| 196 | | -static int reset_slot(struct hotplug_slot *hotplug_slot, int probe) |
|---|
| 197 | | -{ |
|---|
| 198 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 199 | | - |
|---|
| 200 | | - return pciehp_reset_slot(slot, probe); |
|---|
| 201 | 152 | } |
|---|
| 202 | 153 | |
|---|
| 203 | 154 | /** |
|---|
| 204 | 155 | * pciehp_check_presence() - synthesize event if presence has changed |
|---|
| 156 | + * @ctrl: controller to check |
|---|
| 205 | 157 | * |
|---|
| 206 | 158 | * On probe and resume, an explicit presence check is necessary to bring up an |
|---|
| 207 | 159 | * occupied slot or bring down an unoccupied slot. This can't be triggered by |
|---|
| .. | .. |
|---|
| 212 | 164 | */ |
|---|
| 213 | 165 | static void pciehp_check_presence(struct controller *ctrl) |
|---|
| 214 | 166 | { |
|---|
| 215 | | - struct slot *slot = ctrl->slot; |
|---|
| 216 | | - u8 occupied; |
|---|
| 167 | + int occupied; |
|---|
| 217 | 168 | |
|---|
| 218 | | - down_read(&ctrl->reset_lock); |
|---|
| 219 | | - mutex_lock(&slot->lock); |
|---|
| 169 | + down_read_nested(&ctrl->reset_lock, ctrl->depth); |
|---|
| 170 | + mutex_lock(&ctrl->state_lock); |
|---|
| 220 | 171 | |
|---|
| 221 | | - pciehp_get_adapter_status(slot, &occupied); |
|---|
| 222 | | - if ((occupied && (slot->state == OFF_STATE || |
|---|
| 223 | | - slot->state == BLINKINGON_STATE)) || |
|---|
| 224 | | - (!occupied && (slot->state == ON_STATE || |
|---|
| 225 | | - slot->state == BLINKINGOFF_STATE))) |
|---|
| 172 | + occupied = pciehp_card_present_or_link_active(ctrl); |
|---|
| 173 | + if ((occupied > 0 && (ctrl->state == OFF_STATE || |
|---|
| 174 | + ctrl->state == BLINKINGON_STATE)) || |
|---|
| 175 | + (!occupied && (ctrl->state == ON_STATE || |
|---|
| 176 | + ctrl->state == BLINKINGOFF_STATE))) |
|---|
| 226 | 177 | pciehp_request(ctrl, PCI_EXP_SLTSTA_PDC); |
|---|
| 227 | 178 | |
|---|
| 228 | | - mutex_unlock(&slot->lock); |
|---|
| 179 | + mutex_unlock(&ctrl->state_lock); |
|---|
| 229 | 180 | up_read(&ctrl->reset_lock); |
|---|
| 230 | 181 | } |
|---|
| 231 | 182 | |
|---|
| .. | .. |
|---|
| 233 | 184 | { |
|---|
| 234 | 185 | int rc; |
|---|
| 235 | 186 | struct controller *ctrl; |
|---|
| 236 | | - struct slot *slot; |
|---|
| 237 | 187 | |
|---|
| 238 | 188 | /* If this is not a "hotplug" service, we have no business here. */ |
|---|
| 239 | 189 | if (dev->service != PCIE_PORT_SERVICE_HP) |
|---|
| .. | .. |
|---|
| 241 | 191 | |
|---|
| 242 | 192 | if (!dev->port->subordinate) { |
|---|
| 243 | 193 | /* Can happen if we run out of bus numbers during probe */ |
|---|
| 244 | | - dev_err(&dev->device, |
|---|
| 194 | + pci_err(dev->port, |
|---|
| 245 | 195 | "Hotplug bridge without secondary bus, ignoring\n"); |
|---|
| 246 | 196 | return -ENODEV; |
|---|
| 247 | 197 | } |
|---|
| 248 | 198 | |
|---|
| 249 | 199 | ctrl = pcie_init(dev); |
|---|
| 250 | 200 | if (!ctrl) { |
|---|
| 251 | | - dev_err(&dev->device, "Controller initialization failed\n"); |
|---|
| 201 | + pci_err(dev->port, "Controller initialization failed\n"); |
|---|
| 252 | 202 | return -ENODEV; |
|---|
| 253 | 203 | } |
|---|
| 254 | 204 | set_service_data(dev, ctrl); |
|---|
| .. | .. |
|---|
| 271 | 221 | } |
|---|
| 272 | 222 | |
|---|
| 273 | 223 | /* Publish to user space */ |
|---|
| 274 | | - slot = ctrl->slot; |
|---|
| 275 | | - rc = pci_hp_add(slot->hotplug_slot); |
|---|
| 224 | + rc = pci_hp_add(&ctrl->hotplug_slot); |
|---|
| 276 | 225 | if (rc) { |
|---|
| 277 | 226 | ctrl_err(ctrl, "Publication to user space failed (%d)\n", rc); |
|---|
| 278 | 227 | goto err_out_shutdown_notification; |
|---|
| .. | .. |
|---|
| 295 | 244 | { |
|---|
| 296 | 245 | struct controller *ctrl = get_service_data(dev); |
|---|
| 297 | 246 | |
|---|
| 298 | | - pci_hp_del(ctrl->slot->hotplug_slot); |
|---|
| 247 | + pci_hp_del(&ctrl->hotplug_slot); |
|---|
| 299 | 248 | pcie_shutdown_notification(ctrl); |
|---|
| 300 | 249 | cleanup_slot(ctrl); |
|---|
| 301 | 250 | pciehp_release_ctrl(ctrl); |
|---|
| 302 | 251 | } |
|---|
| 303 | 252 | |
|---|
| 304 | 253 | #ifdef CONFIG_PM |
|---|
| 254 | +static bool pme_is_native(struct pcie_device *dev) |
|---|
| 255 | +{ |
|---|
| 256 | + const struct pci_host_bridge *host; |
|---|
| 257 | + |
|---|
| 258 | + host = pci_find_host_bridge(dev->port->bus); |
|---|
| 259 | + return pcie_ports_native || host->native_pme; |
|---|
| 260 | +} |
|---|
| 261 | + |
|---|
| 262 | +static void pciehp_disable_interrupt(struct pcie_device *dev) |
|---|
| 263 | +{ |
|---|
| 264 | + /* |
|---|
| 265 | + * Disable hotplug interrupt so that it does not trigger |
|---|
| 266 | + * immediately when the downstream link goes down. |
|---|
| 267 | + */ |
|---|
| 268 | + if (pme_is_native(dev)) |
|---|
| 269 | + pcie_disable_interrupt(get_service_data(dev)); |
|---|
| 270 | +} |
|---|
| 271 | + |
|---|
| 272 | +#ifdef CONFIG_PM_SLEEP |
|---|
| 305 | 273 | static int pciehp_suspend(struct pcie_device *dev) |
|---|
| 306 | 274 | { |
|---|
| 275 | + /* |
|---|
| 276 | + * If the port is already runtime suspended we can keep it that |
|---|
| 277 | + * way. |
|---|
| 278 | + */ |
|---|
| 279 | + if (dev_pm_skip_suspend(&dev->port->dev)) |
|---|
| 280 | + return 0; |
|---|
| 281 | + |
|---|
| 282 | + pciehp_disable_interrupt(dev); |
|---|
| 307 | 283 | return 0; |
|---|
| 308 | 284 | } |
|---|
| 309 | 285 | |
|---|
| 310 | 286 | static int pciehp_resume_noirq(struct pcie_device *dev) |
|---|
| 311 | 287 | { |
|---|
| 312 | 288 | struct controller *ctrl = get_service_data(dev); |
|---|
| 313 | | - struct slot *slot = ctrl->slot; |
|---|
| 314 | 289 | |
|---|
| 315 | 290 | /* pci_restore_state() just wrote to the Slot Control register */ |
|---|
| 316 | 291 | ctrl->cmd_started = jiffies; |
|---|
| 317 | 292 | ctrl->cmd_busy = true; |
|---|
| 318 | 293 | |
|---|
| 319 | 294 | /* clear spurious events from rediscovery of inserted card */ |
|---|
| 320 | | - if (slot->state == ON_STATE || slot->state == BLINKINGOFF_STATE) |
|---|
| 295 | + if (ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) |
|---|
| 321 | 296 | pcie_clear_hotplug_events(ctrl); |
|---|
| 322 | 297 | |
|---|
| 323 | 298 | return 0; |
|---|
| 324 | 299 | } |
|---|
| 300 | +#endif |
|---|
| 325 | 301 | |
|---|
| 326 | 302 | static int pciehp_resume(struct pcie_device *dev) |
|---|
| 327 | 303 | { |
|---|
| 328 | 304 | struct controller *ctrl = get_service_data(dev); |
|---|
| 329 | 305 | |
|---|
| 306 | + if (pme_is_native(dev)) |
|---|
| 307 | + pcie_enable_interrupt(ctrl); |
|---|
| 308 | + |
|---|
| 330 | 309 | pciehp_check_presence(ctrl); |
|---|
| 331 | 310 | |
|---|
| 332 | 311 | return 0; |
|---|
| 333 | 312 | } |
|---|
| 313 | + |
|---|
| 314 | +static int pciehp_runtime_suspend(struct pcie_device *dev) |
|---|
| 315 | +{ |
|---|
| 316 | + pciehp_disable_interrupt(dev); |
|---|
| 317 | + return 0; |
|---|
| 318 | +} |
|---|
| 319 | + |
|---|
| 320 | +static int pciehp_runtime_resume(struct pcie_device *dev) |
|---|
| 321 | +{ |
|---|
| 322 | + struct controller *ctrl = get_service_data(dev); |
|---|
| 323 | + |
|---|
| 324 | + /* pci_restore_state() just wrote to the Slot Control register */ |
|---|
| 325 | + ctrl->cmd_started = jiffies; |
|---|
| 326 | + ctrl->cmd_busy = true; |
|---|
| 327 | + |
|---|
| 328 | + /* clear spurious events from rediscovery of inserted card */ |
|---|
| 329 | + if ((ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) && |
|---|
| 330 | + pme_is_native(dev)) |
|---|
| 331 | + pcie_clear_hotplug_events(ctrl); |
|---|
| 332 | + |
|---|
| 333 | + return pciehp_resume(dev); |
|---|
| 334 | +} |
|---|
| 334 | 335 | #endif /* PM */ |
|---|
| 335 | 336 | |
|---|
| 336 | 337 | static struct pcie_port_service_driver hpdriver_portdrv = { |
|---|
| 337 | | - .name = PCIE_MODULE_NAME, |
|---|
| 338 | + .name = "pciehp", |
|---|
| 338 | 339 | .port_type = PCIE_ANY_PORT, |
|---|
| 339 | 340 | .service = PCIE_PORT_SERVICE_HP, |
|---|
| 340 | 341 | |
|---|
| .. | .. |
|---|
| 342 | 343 | .remove = pciehp_remove, |
|---|
| 343 | 344 | |
|---|
| 344 | 345 | #ifdef CONFIG_PM |
|---|
| 346 | +#ifdef CONFIG_PM_SLEEP |
|---|
| 345 | 347 | .suspend = pciehp_suspend, |
|---|
| 346 | 348 | .resume_noirq = pciehp_resume_noirq, |
|---|
| 347 | 349 | .resume = pciehp_resume, |
|---|
| 350 | +#endif |
|---|
| 351 | + .runtime_suspend = pciehp_runtime_suspend, |
|---|
| 352 | + .runtime_resume = pciehp_runtime_resume, |
|---|
| 348 | 353 | #endif /* PM */ |
|---|
| 349 | 354 | }; |
|---|
| 350 | 355 | |
|---|
| .. | .. |
|---|
| 353 | 358 | int retval = 0; |
|---|
| 354 | 359 | |
|---|
| 355 | 360 | retval = pcie_port_service_register(&hpdriver_portdrv); |
|---|
| 356 | | - dbg("pcie_port_service_register = %d\n", retval); |
|---|
| 361 | + pr_debug("pcie_port_service_register = %d\n", retval); |
|---|
| 357 | 362 | if (retval) |
|---|
| 358 | | - dbg("Failure to register service\n"); |
|---|
| 363 | + pr_debug("Failure to register service\n"); |
|---|
| 359 | 364 | |
|---|
| 360 | 365 | return retval; |
|---|
| 361 | 366 | } |
|---|