Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI/pwrctrl: Rename pwrctrl functions and structures

Rename pwrctrl functions and structures from "pwrctl" to "pwrctrl" to match
the similar file renames.

Link: https://lore.kernel.org/r/20241115214428.2061153-3-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Acked-by: Krzysztof Wilczyński <kw@linux.com>

authored by

Bjorn Helgaas and committed by
Krzysztof Wilczyński
3f925cd6 b88cbaaa

+81 -79
+13 -12
drivers/pci/bus.c
··· 322 322 void __weak pcibios_bus_add_device(struct pci_dev *pdev) { } 323 323 324 324 /* 325 - * Create pwrctl devices (if required) for the PCI devices to handle the power 325 + * Create pwrctrl devices (if required) for the PCI devices to handle the power 326 326 * state. 327 327 */ 328 - static void pci_pwrctl_create_devices(struct pci_dev *dev) 328 + static void pci_pwrctrl_create_devices(struct pci_dev *dev) 329 329 { 330 330 struct device_node *np = dev_of_node(&dev->dev); 331 331 struct device *parent = &dev->dev; ··· 337 337 */ 338 338 if (np && pci_is_bridge(dev)) { 339 339 /* 340 - * Now look for the child PCI device nodes and create pwrctl 341 - * devices for them. The pwrctl device drivers will manage the 340 + * Now look for the child PCI device nodes and create pwrctrl 341 + * devices for them. The pwrctrl device drivers will manage the 342 342 * power state of the devices. 343 343 */ 344 344 for_each_available_child_of_node_scoped(np, child) { 345 345 /* 346 - * First check whether the pwrctl device really needs to 347 - * be created or not. This is decided based on at least 348 - * one of the power supplies being defined in the 349 - * devicetree node of the device. 346 + * First check whether the pwrctrl device really 347 + * needs to be created or not. This is decided 348 + * based on at least one of the power supplies 349 + * being defined in the devicetree node of the 350 + * device. 350 351 */ 351 352 if (!of_pci_supply_present(child)) { 352 353 pci_dbg(dev, "skipping OF node: %s\n", child->name); 353 354 return; 354 355 } 355 356 356 - /* Now create the pwrctl device */ 357 + /* Now create the pwrctrl device */ 357 358 pdev = of_platform_device_create(child, NULL, parent); 358 359 if (!pdev) 359 360 pci_err(dev, "failed to create OF node: %s\n", child->name); ··· 386 385 pci_proc_attach_device(dev); 387 386 pci_bridge_d3_update(dev); 388 387 389 - pci_pwrctl_create_devices(dev); 388 + pci_pwrctrl_create_devices(dev); 390 389 391 390 /* 392 - * If the PCI device is associated with a pwrctl device with a 391 + * If the PCI device is associated with a pwrctrl device with a 393 392 * power supply, create a device link between the PCI device and 394 - * pwrctl device. This ensures that pwrctl drivers are probed 393 + * pwrctrl device. This ensures that pwrctrl drivers are probed 395 394 * before PCI client drivers. 396 395 */ 397 396 pdev = of_find_device_by_node(dn);
+39 -38
drivers/pci/pwrctrl/core.c
··· 11 11 #include <linux/property.h> 12 12 #include <linux/slab.h> 13 13 14 - static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action, 15 - void *data) 14 + static int pci_pwrctrl_notify(struct notifier_block *nb, unsigned long action, 15 + void *data) 16 16 { 17 - struct pci_pwrctl *pwrctl = container_of(nb, struct pci_pwrctl, nb); 17 + struct pci_pwrctrl *pwrctrl = container_of(nb, struct pci_pwrctrl, nb); 18 18 struct device *dev = data; 19 19 20 - if (dev_fwnode(dev) != dev_fwnode(pwrctl->dev)) 20 + if (dev_fwnode(dev) != dev_fwnode(pwrctrl->dev)) 21 21 return NOTIFY_DONE; 22 22 23 23 switch (action) { ··· 40 40 41 41 static void rescan_work_func(struct work_struct *work) 42 42 { 43 - struct pci_pwrctl *pwrctl = container_of(work, struct pci_pwrctl, work); 43 + struct pci_pwrctrl *pwrctrl = container_of(work, 44 + struct pci_pwrctrl, work); 44 45 45 46 pci_lock_rescan_remove(); 46 - pci_rescan_bus(to_pci_dev(pwrctl->dev->parent)->bus); 47 + pci_rescan_bus(to_pci_dev(pwrctrl->dev->parent)->bus); 47 48 pci_unlock_rescan_remove(); 48 49 } 49 50 50 51 /** 51 - * pci_pwrctl_init() - Initialize the PCI power control context struct 52 + * pci_pwrctrl_init() - Initialize the PCI power control context struct 52 53 * 53 - * @pwrctl: PCI power control data 54 + * @pwrctrl: PCI power control data 54 55 * @dev: Parent device 55 56 */ 56 - void pci_pwrctl_init(struct pci_pwrctl *pwrctl, struct device *dev) 57 + void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev) 57 58 { 58 - pwrctl->dev = dev; 59 - INIT_WORK(&pwrctl->work, rescan_work_func); 59 + pwrctrl->dev = dev; 60 + INIT_WORK(&pwrctrl->work, rescan_work_func); 60 61 } 61 - EXPORT_SYMBOL_GPL(pci_pwrctl_init); 62 + EXPORT_SYMBOL_GPL(pci_pwrctrl_init); 62 63 63 64 /** 64 - * pci_pwrctl_device_set_ready() - Notify the pwrctl subsystem that the PCI 65 + * pci_pwrctrl_device_set_ready() - Notify the pwrctrl subsystem that the PCI 65 66 * device is powered-up and ready to be detected. 66 67 * 67 - * @pwrctl: PCI power control data. 68 + * @pwrctrl: PCI power control data. 68 69 * 69 70 * Returns: 70 71 * 0 on success, negative error number on error. ··· 75 74 * that the bus rescan was successfully started. The device will get bound to 76 75 * its PCI driver asynchronously. 77 76 */ 78 - int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl) 77 + int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrctrl) 79 78 { 80 79 int ret; 81 80 82 - if (!pwrctl->dev) 81 + if (!pwrctrl->dev) 83 82 return -ENODEV; 84 83 85 - pwrctl->nb.notifier_call = pci_pwrctl_notify; 86 - ret = bus_register_notifier(&pci_bus_type, &pwrctl->nb); 84 + pwrctrl->nb.notifier_call = pci_pwrctrl_notify; 85 + ret = bus_register_notifier(&pci_bus_type, &pwrctrl->nb); 87 86 if (ret) 88 87 return ret; 89 88 90 - schedule_work(&pwrctl->work); 89 + schedule_work(&pwrctrl->work); 91 90 92 91 return 0; 93 92 } 94 - EXPORT_SYMBOL_GPL(pci_pwrctl_device_set_ready); 93 + EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready); 95 94 96 95 /** 97 - * pci_pwrctl_device_unset_ready() - Notify the pwrctl subsystem that the PCI 96 + * pci_pwrctrl_device_unset_ready() - Notify the pwrctrl subsystem that the PCI 98 97 * device is about to be powered-down. 99 98 * 100 - * @pwrctl: PCI power control data. 99 + * @pwrctrl: PCI power control data. 101 100 */ 102 - void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl) 101 + void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl) 103 102 { 104 103 /* 105 104 * We don't have to delete the link here. Typically, this function ··· 107 106 * it is being detached then the child PCI device must have already 108 107 * been unbound too or the device core wouldn't let us unbind. 109 108 */ 110 - bus_unregister_notifier(&pci_bus_type, &pwrctl->nb); 109 + bus_unregister_notifier(&pci_bus_type, &pwrctrl->nb); 111 110 } 112 - EXPORT_SYMBOL_GPL(pci_pwrctl_device_unset_ready); 111 + EXPORT_SYMBOL_GPL(pci_pwrctrl_device_unset_ready); 113 112 114 - static void devm_pci_pwrctl_device_unset_ready(void *data) 113 + static void devm_pci_pwrctrl_device_unset_ready(void *data) 115 114 { 116 - struct pci_pwrctl *pwrctl = data; 115 + struct pci_pwrctrl *pwrctrl = data; 117 116 118 - pci_pwrctl_device_unset_ready(pwrctl); 117 + pci_pwrctrl_device_unset_ready(pwrctrl); 119 118 } 120 119 121 120 /** 122 - * devm_pci_pwrctl_device_set_ready - Managed variant of 123 - * pci_pwrctl_device_set_ready(). 121 + * devm_pci_pwrctrl_device_set_ready - Managed variant of 122 + * pci_pwrctrl_device_set_ready(). 124 123 * 125 - * @dev: Device managing this pwrctl provider. 126 - * @pwrctl: PCI power control data. 124 + * @dev: Device managing this pwrctrl provider. 125 + * @pwrctrl: PCI power control data. 127 126 * 128 127 * Returns: 129 128 * 0 on success, negative error number on error. 130 129 */ 131 - int devm_pci_pwrctl_device_set_ready(struct device *dev, 132 - struct pci_pwrctl *pwrctl) 130 + int devm_pci_pwrctrl_device_set_ready(struct device *dev, 131 + struct pci_pwrctrl *pwrctrl) 133 132 { 134 133 int ret; 135 134 136 - ret = pci_pwrctl_device_set_ready(pwrctl); 135 + ret = pci_pwrctrl_device_set_ready(pwrctrl); 137 136 if (ret) 138 137 return ret; 139 138 140 139 return devm_add_action_or_reset(dev, 141 - devm_pci_pwrctl_device_unset_ready, 142 - pwrctl); 140 + devm_pci_pwrctrl_device_unset_ready, 141 + pwrctrl); 143 142 } 144 - EXPORT_SYMBOL_GPL(devm_pci_pwrctl_device_set_ready); 143 + EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready); 145 144 146 145 MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>"); 147 146 MODULE_DESCRIPTION("PCI Device Power Control core driver");
+16 -16
drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
··· 13 13 #include <linux/slab.h> 14 14 #include <linux/types.h> 15 15 16 - struct pci_pwrctl_pwrseq_data { 17 - struct pci_pwrctl ctx; 16 + struct pci_pwrctrl_pwrseq_data { 17 + struct pci_pwrctrl ctx; 18 18 struct pwrseq_desc *pwrseq; 19 19 }; 20 20 21 - static void devm_pci_pwrctl_pwrseq_power_off(void *data) 21 + static void devm_pci_pwrctrl_pwrseq_power_off(void *data) 22 22 { 23 23 struct pwrseq_desc *pwrseq = data; 24 24 25 25 pwrseq_power_off(pwrseq); 26 26 } 27 27 28 - static int pci_pwrctl_pwrseq_probe(struct platform_device *pdev) 28 + static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev) 29 29 { 30 - struct pci_pwrctl_pwrseq_data *data; 30 + struct pci_pwrctrl_pwrseq_data *data; 31 31 struct device *dev = &pdev->dev; 32 32 int ret; 33 33 ··· 45 45 return dev_err_probe(dev, ret, 46 46 "Failed to power-on the device\n"); 47 47 48 - ret = devm_add_action_or_reset(dev, devm_pci_pwrctl_pwrseq_power_off, 48 + ret = devm_add_action_or_reset(dev, devm_pci_pwrctrl_pwrseq_power_off, 49 49 data->pwrseq); 50 50 if (ret) 51 51 return ret; 52 52 53 - pci_pwrctl_init(&data->ctx, dev); 53 + pci_pwrctrl_init(&data->ctx, dev); 54 54 55 - ret = devm_pci_pwrctl_device_set_ready(dev, &data->ctx); 55 + ret = devm_pci_pwrctrl_device_set_ready(dev, &data->ctx); 56 56 if (ret) 57 57 return dev_err_probe(dev, ret, 58 - "Failed to register the pwrctl wrapper\n"); 58 + "Failed to register the pwrctrl wrapper\n"); 59 59 60 60 return 0; 61 61 } 62 62 63 - static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = { 63 + static const struct of_device_id pci_pwrctrl_pwrseq_of_match[] = { 64 64 { 65 65 /* ATH11K in QCA6390 package. */ 66 66 .compatible = "pci17cb,1101", ··· 78 78 }, 79 79 { } 80 80 }; 81 - MODULE_DEVICE_TABLE(of, pci_pwrctl_pwrseq_of_match); 81 + MODULE_DEVICE_TABLE(of, pci_pwrctrl_pwrseq_of_match); 82 82 83 - static struct platform_driver pci_pwrctl_pwrseq_driver = { 83 + static struct platform_driver pci_pwrctrl_pwrseq_driver = { 84 84 .driver = { 85 - .name = "pci-pwrctl-pwrseq", 86 - .of_match_table = pci_pwrctl_pwrseq_of_match, 85 + .name = "pci-pwrctrl-pwrseq", 86 + .of_match_table = pci_pwrctrl_pwrseq_of_match, 87 87 }, 88 - .probe = pci_pwrctl_pwrseq_probe, 88 + .probe = pci_pwrctrl_pwrseq_probe, 89 89 }; 90 - module_platform_driver(pci_pwrctl_pwrseq_driver); 90 + module_platform_driver(pci_pwrctrl_pwrseq_driver); 91 91 92 92 MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>"); 93 93 MODULE_DESCRIPTION("Generic PCI Power Control module for power sequenced devices");
+2 -2
drivers/pci/remove.c
··· 17 17 } 18 18 } 19 19 20 - static void pci_pwrctl_unregister(struct device *dev) 20 + static void pci_pwrctrl_unregister(struct device *dev) 21 21 { 22 22 struct platform_device *pdev; 23 23 ··· 34 34 pci_pme_active(dev, false); 35 35 36 36 if (pci_dev_is_added(dev)) { 37 - pci_pwrctl_unregister(&dev->dev); 37 + pci_pwrctrl_unregister(&dev->dev); 38 38 device_release_driver(&dev->dev); 39 39 pci_proc_detach_device(dev); 40 40 pci_remove_sysfs_dev_files(dev);
+11 -11
include/linux/pci-pwrctrl.h
··· 3 3 * Copyright (C) 2024 Linaro Ltd. 4 4 */ 5 5 6 - #ifndef __PCI_PWRCTL_H__ 7 - #define __PCI_PWRCTL_H__ 6 + #ifndef __PCI_PWRCTRL_H__ 7 + #define __PCI_PWRCTRL_H__ 8 8 9 9 #include <linux/notifier.h> 10 10 #include <linux/workqueue.h> ··· 29 29 */ 30 30 31 31 /** 32 - * struct pci_pwrctl - PCI device power control context. 32 + * struct pci_pwrctrl - PCI device power control context. 33 33 * @dev: Address of the power controlling device. 34 34 * 35 35 * An object of this type must be allocated by the PCI power control device and 36 - * passed to the pwrctl subsystem to trigger a bus rescan and setup a device 36 + * passed to the pwrctrl subsystem to trigger a bus rescan and setup a device 37 37 * link with the device once it's up. 38 38 */ 39 - struct pci_pwrctl { 39 + struct pci_pwrctrl { 40 40 struct device *dev; 41 41 42 42 /* Private: don't use. */ ··· 45 45 struct work_struct work; 46 46 }; 47 47 48 - void pci_pwrctl_init(struct pci_pwrctl *pwrctl, struct device *dev); 49 - int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl); 50 - void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl); 51 - int devm_pci_pwrctl_device_set_ready(struct device *dev, 52 - struct pci_pwrctl *pwrctl); 48 + void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev); 49 + int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrctrl); 50 + void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl); 51 + int devm_pci_pwrctrl_device_set_ready(struct device *dev, 52 + struct pci_pwrctrl *pwrctrl); 53 53 54 - #endif /* __PCI_PWRCTL_H__ */ 54 + #endif /* __PCI_PWRCTRL_H__ */