Lines Matching refs: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()
144 *value = pciehp_card_present_or_link_active(ctrl); in get_adapter_status()
159 static void pciehp_check_presence(struct controller *ctrl) in pciehp_check_presence() argument
163 down_read(&ctrl->reset_lock); in pciehp_check_presence()
164 mutex_lock(&ctrl->state_lock); in pciehp_check_presence()
166 occupied = pciehp_card_present_or_link_active(ctrl); in pciehp_check_presence()
167 if ((occupied && (ctrl->state == OFF_STATE || in pciehp_check_presence()
168 ctrl->state == BLINKINGON_STATE)) || in pciehp_check_presence()
169 (!occupied && (ctrl->state == ON_STATE || in pciehp_check_presence()
170 ctrl->state == BLINKINGOFF_STATE))) in pciehp_check_presence()
171 pciehp_request(ctrl, PCI_EXP_SLTSTA_PDC); in pciehp_check_presence()
173 mutex_unlock(&ctrl->state_lock); in pciehp_check_presence()
174 up_read(&ctrl->reset_lock); in pciehp_check_presence()
180 struct controller *ctrl; in pciehp_probe() local
193 ctrl = pcie_init(dev); in pciehp_probe()
194 if (!ctrl) { in pciehp_probe()
198 set_service_data(dev, ctrl); in pciehp_probe()
201 rc = init_slot(ctrl); in pciehp_probe()
204 ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n"); in pciehp_probe()
206 ctrl_err(ctrl, "Slot initialization failed (%d)\n", rc); in pciehp_probe()
211 rc = pcie_init_notification(ctrl); in pciehp_probe()
213 ctrl_err(ctrl, "Notification initialization failed (%d)\n", rc); in pciehp_probe()
218 rc = pci_hp_add(&ctrl->hotplug_slot); in pciehp_probe()
220 ctrl_err(ctrl, "Publication to user space failed (%d)\n", rc); in pciehp_probe()
224 pciehp_check_presence(ctrl); in pciehp_probe()
229 pcie_shutdown_notification(ctrl); in pciehp_probe()
231 cleanup_slot(ctrl); in pciehp_probe()
233 pciehp_release_ctrl(ctrl); in pciehp_probe()
239 struct controller *ctrl = get_service_data(dev); in pciehp_remove() local
241 pci_hp_del(&ctrl->hotplug_slot); in pciehp_remove()
242 pcie_shutdown_notification(ctrl); in pciehp_remove()
243 cleanup_slot(ctrl); in pciehp_remove()
244 pciehp_release_ctrl(ctrl); in pciehp_remove()
270 struct controller *ctrl = get_service_data(dev); in pciehp_resume_noirq() local
273 ctrl->cmd_started = jiffies; in pciehp_resume_noirq()
274 ctrl->cmd_busy = true; in pciehp_resume_noirq()
277 if (ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) in pciehp_resume_noirq()
278 pcie_clear_hotplug_events(ctrl); in pciehp_resume_noirq()
285 struct controller *ctrl = get_service_data(dev); in pciehp_resume() local
288 pcie_enable_interrupt(ctrl); in pciehp_resume()
290 pciehp_check_presence(ctrl); in pciehp_resume()
297 struct controller *ctrl = get_service_data(dev); in pciehp_runtime_resume() local
300 ctrl->cmd_started = jiffies; in pciehp_runtime_resume()
301 ctrl->cmd_busy = true; in pciehp_runtime_resume()
304 if ((ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) && in pciehp_runtime_resume()
306 pcie_clear_hotplug_events(ctrl); in pciehp_runtime_resume()