Lines Matching full:ctrl

50 static int init_slot(struct controller *ctrl)  in init_slot()  argument
66 if (MRL_SENS(ctrl)) in init_slot()
68 if (ATTN_LED(ctrl)) { in init_slot()
71 } else if (ctrl->pcie->port->hotplug_user_indicators) { in init_slot()
77 ctrl->hotplug_slot.ops = ops; in init_slot()
78 snprintf(name, SLOT_NAME_SIZE, "%u", PSN(ctrl)); in init_slot()
80 retval = pci_hp_initialize(&ctrl->hotplug_slot, in init_slot()
81 ctrl->pcie->port->subordinate, 0, name); in init_slot()
83 ctrl_err(ctrl, "pci_hp_initialize failed: error %d\n", retval); in init_slot()
89 static void cleanup_slot(struct controller *ctrl) in cleanup_slot() argument
91 struct hotplug_slot *hotplug_slot = &ctrl->hotplug_slot; in cleanup_slot()
102 struct controller *ctrl = to_ctrl(hotplug_slot); in set_attention_status() local
103 struct pci_dev *pdev = ctrl->pcie->port; in set_attention_status()
111 pciehp_set_indicators(ctrl, INDICATOR_NOOP, status); in set_attention_status()
118 struct controller *ctrl = to_ctrl(hotplug_slot); in get_power_status() local
119 struct pci_dev *pdev = ctrl->pcie->port; in get_power_status()
122 pciehp_get_power_status(ctrl, value); in get_power_status()
129 struct controller *ctrl = to_ctrl(hotplug_slot); in get_latch_status() local
130 struct pci_dev *pdev = ctrl->pcie->port; in get_latch_status()
133 pciehp_get_latch_status(ctrl, value); in get_latch_status()
140 struct controller *ctrl = to_ctrl(hotplug_slot); in get_adapter_status() local
141 struct pci_dev *pdev = ctrl->pcie->port; in get_adapter_status()
145 ret = pciehp_card_present_or_link_active(ctrl); in get_adapter_status()
156 * @ctrl: controller to check
165 static void pciehp_check_presence(struct controller *ctrl) in pciehp_check_presence() argument
169 down_read_nested(&ctrl->reset_lock, ctrl->depth); in pciehp_check_presence()
170 mutex_lock(&ctrl->state_lock); in pciehp_check_presence()
172 occupied = pciehp_card_present_or_link_active(ctrl); in pciehp_check_presence()
173 if ((occupied > 0 && (ctrl->state == OFF_STATE || in pciehp_check_presence()
174 ctrl->state == BLINKINGON_STATE)) || in pciehp_check_presence()
175 (!occupied && (ctrl->state == ON_STATE || in pciehp_check_presence()
176 ctrl->state == BLINKINGOFF_STATE))) in pciehp_check_presence()
177 pciehp_request(ctrl, PCI_EXP_SLTSTA_PDC); in pciehp_check_presence()
179 mutex_unlock(&ctrl->state_lock); in pciehp_check_presence()
180 up_read(&ctrl->reset_lock); in pciehp_check_presence()
186 struct controller *ctrl; in pciehp_probe() local
199 ctrl = pcie_init(dev); in pciehp_probe()
200 if (!ctrl) { in pciehp_probe()
204 set_service_data(dev, ctrl); in pciehp_probe()
207 rc = init_slot(ctrl); in pciehp_probe()
210 ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n"); in pciehp_probe()
212 ctrl_err(ctrl, "Slot initialization failed (%d)\n", rc); in pciehp_probe()
217 rc = pcie_init_notification(ctrl); in pciehp_probe()
219 ctrl_err(ctrl, "Notification initialization failed (%d)\n", rc); in pciehp_probe()
224 rc = pci_hp_add(&ctrl->hotplug_slot); in pciehp_probe()
226 ctrl_err(ctrl, "Publication to user space failed (%d)\n", rc); in pciehp_probe()
230 pciehp_check_presence(ctrl); in pciehp_probe()
235 pcie_shutdown_notification(ctrl); in pciehp_probe()
237 cleanup_slot(ctrl); in pciehp_probe()
239 pciehp_release_ctrl(ctrl); in pciehp_probe()
245 struct controller *ctrl = get_service_data(dev); in pciehp_remove() local
247 pci_hp_del(&ctrl->hotplug_slot); in pciehp_remove()
248 pcie_shutdown_notification(ctrl); in pciehp_remove()
249 cleanup_slot(ctrl); in pciehp_remove()
250 pciehp_release_ctrl(ctrl); in pciehp_remove()
288 struct controller *ctrl = get_service_data(dev); in pciehp_resume_noirq() local
291 ctrl->cmd_started = jiffies; in pciehp_resume_noirq()
292 ctrl->cmd_busy = true; in pciehp_resume_noirq()
295 if (ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) in pciehp_resume_noirq()
296 pcie_clear_hotplug_events(ctrl); in pciehp_resume_noirq()
304 struct controller *ctrl = get_service_data(dev); in pciehp_resume() local
307 pcie_enable_interrupt(ctrl); in pciehp_resume()
309 pciehp_check_presence(ctrl); in pciehp_resume()
322 struct controller *ctrl = get_service_data(dev); in pciehp_runtime_resume() local
325 ctrl->cmd_started = jiffies; in pciehp_runtime_resume()
326 ctrl->cmd_busy = true; in pciehp_runtime_resume()
329 if ((ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) && in pciehp_runtime_resume()
331 pcie_clear_hotplug_events(ctrl); in pciehp_runtime_resume()