PCI/pwrctrl: Rename pwrctl to pwrctrl
Subsystems (2)
cover PCI/pwrctrl: Rename pwrctl to pwrctrl
From: Bjorn Helgaas <[email protected]>
I'm sorry to propose this, but it seems like ongoing confusion to have "pwrctl" and "bwctrl" (different ctl/ctrl suffixes).
pwrctl was merged for v6.11, so I would propose changing bwctrl to match it except that we already have several "ctrl" files in PCI hotplug drivers, and in the wider kernel, the "ctrl" filename suffix outnumbers "ctl" by about two to one.
Bjorn Helgaas (2):
PCI/pwrctrl: Rename pwrctl files to pwrctrl PCI/pwrctrl: Rename pwrctrl functions and structures
MAINTAINERS | 4 +-
drivers/pci/Kconfig | 2 +-
drivers/pci/Makefile | 2 +-
drivers/pci/pwrctl/Makefile | 6 --
drivers/pci/{pwrctl => pwrctrl}/Kconfig | 0
drivers/pci/pwrctrl/Makefile | 6 ++
drivers/pci/{pwrctl => pwrctrl}/core.c | 88 +++++++++----------
.../pci-pwrctrl-pwrseq.c} | 34 +++----
drivers/pci/remove.c | 4 +-
include/linux/{pci-pwrctl.h => pci-pwrctrl.h} | 22 ++---
10 files changed, 84 insertions(+), 84 deletions(-)
delete mode 100644 drivers/pci/pwrctl/Makefile
rename drivers/pci/{pwrctl => pwrctrl}/Kconfig (100%)
create mode 100644 drivers/pci/pwrctrl/Makefile
rename drivers/pci/{pwrctl => pwrctrl}/core.c (50%)
rename drivers/pci/{pwrctl/pci-pwrctl-pwrseq.c => pwrctrl/pci-pwrctrl-pwrseq.c} (64%)
rename include/linux/{pci-pwrctl.h => pci-pwrctrl.h} (69%)Signature · 1 line
2.34.1
PATCH 1/2 PCI/pwrctrl: Rename pwrctl files to pwrctrl
From: Bjorn Helgaas <[email protected]>
To slightly reduce confusion between "pwrctl" (the power controller and power sequencing framework) and "bwctrl" (the bandwidth controller), rename "pwrctl" to "pwrctrl" so they use the same "ctrl" suffix.
Rename drivers/pci/pwrctl/ to drivers/pci/pwrctrl/, including the related MAINTAINERS, include file (include/linux/pci-pwrctl.h), Makefile, and Kconfig changes.
This is the minimal rename of files only. A subsequent commit will rename functions and data structures.
---
MAINTAINERS | 4 ++--
drivers/pci/Kconfig | 2 +-
drivers/pci/Makefile | 2 +-
drivers/pci/pwrctl/Makefile | 6 ------
drivers/pci/{pwrctl => pwrctrl}/Kconfig | 0
drivers/pci/pwrctrl/Makefile | 6 ++++++
drivers/pci/{pwrctl => pwrctrl}/core.c | 2 +-
.../pci-pwrctl-pwrseq.c => pwrctrl/pci-pwrctrl-pwrseq.c} | 2 +-
include/linux/{pci-pwrctl.h => pci-pwrctrl.h} | 0
9 files changed, 12 insertions(+), 12 deletions(-)
delete mode 100644 drivers/pci/pwrctl/Makefile
rename drivers/pci/{pwrctl => pwrctrl}/Kconfig (100%)
create mode 100644 drivers/pci/pwrctrl/Makefile
rename drivers/pci/{pwrctl => pwrctrl}/core.c (99%)
rename drivers/pci/{pwrctl/pci-pwrctl-pwrseq.c => pwrctrl/pci-pwrctrl-pwrseq.c} (98%)
rename include/linux/{pci-pwrctl.h => pci-pwrctrl.h} (100%)MAINTAINERS +2 -2
@@ -17910,8 +17910,8 @@ M: Bartosz Golaszewski <[email protected]> L: [email protected] S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git -F: drivers/pci/pwrctl/* -F: include/linux/pci-pwrctl.h +F: drivers/pci/pwrctrl/* +F: include/linux/pci-pwrctrl.h PCI SUBSYSTEM M: Bjorn Helgaas <[email protected]>
drivers/pci/Kconfig +1 -1
@@ -305,6 +305,6 @@ source "drivers/pci/hotplug/Kconfig" source "drivers/pci/controller/Kconfig" source "drivers/pci/endpoint/Kconfig" source "drivers/pci/switch/Kconfig" -source "drivers/pci/pwrctl/Kconfig" +source "drivers/pci/pwrctrl/Kconfig" endif
drivers/pci/Makefile +1 -1
@@ -9,7 +9,7 @@ obj-$(CONFIG_PCI) += access.o bus.o probe.o host-bridge.o \ obj-$(CONFIG_PCI) += msi/ obj-$(CONFIG_PCI) += pcie/ -obj-$(CONFIG_PCI) += pwrctl/ +obj-$(CONFIG_PCI) += pwrctrl/ ifdef CONFIG_PCI obj-$(CONFIG_PROC_FS) += proc.o
drivers/pci/pwrctl/Makefile deleted +0 -6
@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -obj-$(CONFIG_PCI_PWRCTL) += pci-pwrctl-core.o -pci-pwrctl-core-y := core.o - -obj-$(CONFIG_PCI_PWRCTL_PWRSEQ) += pci-pwrctl-pwrseq.o
drivers/pci/pwrctrl/Kconfig renamed from drivers/pci/pwrctl/Kconfig +0 -0
drivers/pci/pwrctrl/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_PCI_PWRCTL) += pci-pwrctrl-core.o +pci-pwrctrl-core-y := core.o + +obj-$(CONFIG_PCI_PWRCTL_PWRSEQ) += pci-pwrctrl-pwrseq.o
drivers/pci/pwrctrl/core.c renamed from drivers/pci/pwrctl/core.c +1 -1
@@ -7,7 +7,7 @@#include <linux/export.h> #include <linux/kernel.h> #include <linux/pci.h> -#include <linux/pci-pwrctl.h> +#include <linux/pci-pwrctrl.h> #include <linux/property.h> #include <linux/slab.h>
drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c renamed from drivers/pci/pwrctl/pci-pwrctl-pwrseq.c +1 -1
@@ -7,7 +7,7 @@#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/pci-pwrctl.h> +#include <linux/pci-pwrctrl.h> #include <linux/platform_device.h> #include <linux/pwrseq/consumer.h> #include <linux/slab.h>
include/linux/pci-pwrctrl.h renamed from include/linux/pci-pwrctl.h +0 -0
Signature · 1 line
2.34.1
PATCH 2/2 PCI/pwrctrl: Rename pwrctrl functions and structures
In reply to Bjorn HelgaasFrom: Bjorn Helgaas <[email protected]>
Rename pwrctrl functions and structures from "pwrctl" to "pwrctrl" to match the similar file renames.
--- drivers/pci/pwrctrl/core.c | 86 ++++++++++++------------ drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 32 ++++----- drivers/pci/remove.c | 4 +- include/linux/pci-pwrctrl.h | 22 +++--- 4 files changed, 72 insertions(+), 72 deletions(-)
drivers/pci/pwrctrl/core.c +43 -43
@@ -11,13 +11,13 @@#include <linux/property.h> #include <linux/slab.h> -static int pci_pwrctl_notify (struct notifier_block *nb,unsigned long action, -void *data) +static int pci_pwrctrl_notify (struct notifier_block *nb,unsigned long action, +void *data) { - struct pci_pwrctl *pwrctl = container_of(nb, struct pci_pwrctl, nb); + struct pci_pwrctrl *pwrctrl = container_of(nb, struct pci_pwrctrl, nb);struct device *dev = data; -if (dev_fwnode (dev) !=dev_fwnode (pwrctl->dev)) +if (dev_fwnode (dev) !=dev_fwnode (pwrctrl->dev))return NOTIFY_DONE ;switch (action) {
@@ -34,14 +34,14 @@ static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action, dev->of_node_reused = true;break ;case BUS_NOTIFY_BOUND_DRIVER : - pwrctl->link =device_link_add (dev, pwrctl->dev, + pwrctrl->link =device_link_add (dev, pwrctrl->dev,DL_FLAG_AUTOREMOVE_CONSUMER ); -if (!pwrctl->link) -dev_err (pwrctl->dev,"Failed to add device link\n" ); +if (!pwrctrl->link) +dev_err (pwrctrl->dev,"Failed to add device link\n" );break ;case BUS_NOTIFY_UNBOUND_DRIVER : -if (pwrctl->link) -device_link_remove (dev, pwrctl->dev); +if (pwrctrl->link) +device_link_remove (dev, pwrctrl->dev);break ; }
@@ -50,31 +50,31 @@ static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action,static void rescan_work_func (struct work_struct *work) { - struct pci_pwrctl *pwrctl = container_of(work, struct pci_pwrctl, work); + struct pci_pwrctrl *pwrctrl = container_of(work, struct pci_pwrctrl, work);pci_lock_rescan_remove (); -pci_rescan_bus (to_pci_dev (pwrctl->dev->parent)->bus); +pci_rescan_bus (to_pci_dev (pwrctrl->dev->parent)->bus);pci_unlock_rescan_remove (); }/** -* pci_pwrctl_init() - Initialize the PCI power control context struct +* pci_pwrctrl_init() - Initialize the PCI power control context struct * -* @pwrctl: PCI power control data +* @pwrctrl: PCI power control data * @dev: Parent device */ -void pci_pwrctl_init (struct pci_pwrctl *pwrctl,struct device *dev) +void pci_pwrctrl_init (struct pci_pwrctrl *pwrctrl,struct device *dev) { - pwrctl->dev = dev; -INIT_WORK (&pwrctl->work, rescan_work_func); + pwrctrl->dev = dev; +INIT_WORK (&pwrctrl->work, rescan_work_func); } -EXPORT_SYMBOL_GPL (pci_pwrctl_init); +EXPORT_SYMBOL_GPL (pci_pwrctrl_init);/** -* pci_pwrctl_device_set_ready() - Notify the pwrctl subsystem that the PCI +* pci_pwrctrl_device_set_ready() - Notify the pwrctrl subsystem that the PCI * device is powered-up and ready to be detected. * -* @pwrctl: PCI power control data. +* @pwrctrl: PCI power control data. * * Returns: * 0 on success, negative error number on error.
@@ -84,31 +84,31 @@ EXPORT_SYMBOL_GPL(pci_pwrctl_init);* that the bus rescan was successfully started. The device will get bound to * its PCI driver asynchronously. */ -int pci_pwrctl_device_set_ready (struct pci_pwrctl *pwrctl) +int pci_pwrctrl_device_set_ready (struct pci_pwrctrl *pwrctrl) {int ret; -if (!pwrctl->dev) +if (!pwrctrl->dev)return -ENODEV ; - pwrctl->nb.notifier_call = pci_pwrctl_notify; - ret =bus_register_notifier (&pci_bus_type, &pwrctl->nb); + pwrctrl->nb.notifier_call = pci_pwrctrl_notify; + ret =bus_register_notifier (&pci_bus_type, &pwrctrl->nb);if (ret)return ret; -schedule_work (&pwrctl->work); +schedule_work (&pwrctrl->work);return 0 ; } -EXPORT_SYMBOL_GPL (pci_pwrctl_device_set_ready); +EXPORT_SYMBOL_GPL (pci_pwrctrl_device_set_ready);/** -* pci_pwrctl_device_unset_ready() - Notify the pwrctl subsystem that the PCI +* pci_pwrctrl_device_unset_ready() - Notify the pwrctrl subsystem that the PCI * device is about to be powered-down. * -* @pwrctl: PCI power control data. +* @pwrctrl: PCI power control data. */ -void pci_pwrctl_device_unset_ready (struct pci_pwrctl *pwrctl) +void pci_pwrctrl_device_unset_ready (struct pci_pwrctrl *pwrctrl) {/* * We don't have to delete the link here. Typically, this function
@@ -116,41 +116,41 @@ void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl)* it is being detached then the child PCI device must have already * been unbound too or the device core wouldn't let us unbind. */ -bus_unregister_notifier (&pci_bus_type, &pwrctl->nb); +bus_unregister_notifier (&pci_bus_type, &pwrctrl->nb); } -EXPORT_SYMBOL_GPL (pci_pwrctl_device_unset_ready); +EXPORT_SYMBOL_GPL (pci_pwrctrl_device_unset_ready); -static void devm_pci_pwrctl_device_unset_ready (void *data) +static void devm_pci_pwrctrl_device_unset_ready (void *data) { -struct pci_pwrctl *pwrctl = data; +struct pci_pwrctrl *pwrctrl = data; -pci_pwrctl_device_unset_ready (pwrctl); +pci_pwrctrl_device_unset_ready (pwrctrl); }/** -* devm_pci_pwrctl_device_set_ready - Managed variant of -* pci_pwrctl_device_set_ready(). +* devm_pci_pwrctrl_device_set_ready - Managed variant of +* pci_pwrctrl_device_set_ready(). * -* @dev: Device managing this pwrctl provider. -* @pwrctl: PCI power control data. +* @dev: Device managing this pwrctrl provider. +* @pwrctrl: PCI power control data. * * Returns: * 0 on success, negative error number on error. */ -int devm_pci_pwrctl_device_set_ready (struct device *dev, -struct pci_pwrctl *pwrctl) +int devm_pci_pwrctrl_device_set_ready (struct device *dev, +struct pci_pwrctrl *pwrctrl) {int ret; - ret =pci_pwrctl_device_set_ready (pwrctl); + ret =pci_pwrctrl_device_set_ready (pwrctrl);if (ret)return ret;return devm_add_action_or_reset (dev, - devm_pci_pwrctl_device_unset_ready, - pwrctl); + devm_pci_pwrctrl_device_unset_ready, + pwrctrl); } -EXPORT_SYMBOL_GPL (devm_pci_pwrctl_device_set_ready); +EXPORT_SYMBOL_GPL (devm_pci_pwrctrl_device_set_ready);MODULE_AUTHOR ("Bartosz Golaszewski <[email protected]>" );MODULE_DESCRIPTION ("PCI Device Power Control core driver" );
drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +16 -16
@@ -13,21 +13,21 @@#include <linux/slab.h> #include <linux/types.h> -struct pci_pwrctl_pwrseq_data { -struct pci_pwrctl ctx; +struct pci_pwrctrl_pwrseq_data { +struct pci_pwrctrl ctx;struct pwrseq_desc *pwrseq; }; -static void devm_pci_pwrctl_pwrseq_power_off (void *data) +static void devm_pci_pwrctrl_pwrseq_power_off (void *data) {struct pwrseq_desc *pwrseq = data;pwrseq_power_off (pwrseq); } -static int pci_pwrctl_pwrseq_probe (struct platform_device *pdev) +static int pci_pwrctrl_pwrseq_probe (struct platform_device *pdev) { -struct pci_pwrctl_pwrseq_data *data; +struct pci_pwrctrl_pwrseq_data *data;struct device *dev = &pdev->dev;int ret;
@@ -45,22 +45,22 @@ static int pci_pwrctl_pwrseq_probe(struct platform_device *pdev)return dev_err_probe (dev, ret,"Failed to power-on the device\n" ); - ret =devm_add_action_or_reset (dev, devm_pci_pwrctl_pwrseq_power_off, + ret =devm_add_action_or_reset (dev, devm_pci_pwrctrl_pwrseq_power_off, data->pwrseq);if (ret)return ret; -pci_pwrctl_init (&data->ctx, dev); +pci_pwrctrl_init (&data->ctx, dev); - ret =devm_pci_pwrctl_device_set_ready (dev, &data->ctx); + ret =devm_pci_pwrctrl_device_set_ready (dev, &data->ctx);if (ret)return dev_err_probe (dev, ret, -"Failed to register the pwrctl wrapper\n" ); +"Failed to register the pwrctrl wrapper\n" );return 0 ; } -static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = { +static const struct of_device_id pci_pwrctrl_pwrseq_of_match[] = { {/* ATH11K in QCA6390 package. */ .compatible ="pci17cb,1101" ,
@@ -78,16 +78,16 @@ static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = { }, { } }; -MODULE_DEVICE_TABLE (of, pci_pwrctl_pwrseq_of_match); +MODULE_DEVICE_TABLE (of, pci_pwrctrl_pwrseq_of_match); -static struct platform_driver pci_pwrctl_pwrseq_driver = { +static struct platform_driver pci_pwrctrl_pwrseq_driver = { .driver = { - .name ="pci-pwrctl-pwrseq" , - .of_match_table = pci_pwrctl_pwrseq_of_match, + .name ="pci-pwrctrl-pwrseq" , + .of_match_table = pci_pwrctrl_pwrseq_of_match, }, - .probe = pci_pwrctl_pwrseq_probe, + .probe = pci_pwrctrl_pwrseq_probe, }; -module_platform_driver (pci_pwrctl_pwrseq_driver); +module_platform_driver (pci_pwrctrl_pwrseq_driver);MODULE_AUTHOR ("Bartosz Golaszewski <[email protected]>" );MODULE_DESCRIPTION ("Generic PCI Power Control module for power sequenced devices" );
drivers/pci/remove.c +2 -2
@@ -17,7 +17,7 @@ static void pci_free_resources(struct pci_dev *dev) } } -static int pci_pwrctl_unregister (struct device *dev,void *data) +static int pci_pwrctrl_unregister (struct device *dev,void *data) {struct device_node *pci_node = data, *plat_node =dev_of_node (dev);
@@ -35,7 +35,7 @@ static void pci_stop_dev(struct pci_dev *dev)if (pci_dev_is_added (dev)) {device_for_each_child (dev->dev.parent,dev_of_node (&dev->dev), - pci_pwrctl_unregister); + pci_pwrctrl_unregister);device_release_driver (&dev->dev);pci_proc_detach_device (dev);pci_remove_sysfs_dev_files (dev);
include/linux/pci-pwrctrl.h +11 -11
@@ -3,8 +3,8 @@* Copyright (C) 2024 Linaro Ltd. */ -#ifndef __PCI_PWRCTL_H__ -#define __PCI_PWRCTL_H__ +#ifndef __PCI_PWRCTRL_H__ +#define __PCI_PWRCTRL_H__#include <linux/notifier.h> #include <linux/workqueue.h>
@@ -29,14 +29,14 @@ struct device_link;*/ /** -* struct pci_pwrctl - PCI device power control context. +* struct pci_pwrctrl - PCI device power control context. * @dev: Address of the power controlling device. * * An object of this type must be allocated by the PCI power control device and -* passed to the pwrctl subsystem to trigger a bus rescan and setup a device +* passed to the pwrctrl subsystem to trigger a bus rescan and setup a device * link with the device once it's up. */ -struct pci_pwrctl { +struct pci_pwrctrl {struct device *dev;/* Private: don't use. */
@@ -45,10 +45,10 @@ struct pci_pwrctl { struct work_struct work; }; -void pci_pwrctl_init (struct pci_pwrctl *pwrctl,struct device *dev); -int pci_pwrctl_device_set_ready (struct pci_pwrctl *pwrctl); -void pci_pwrctl_device_unset_ready (struct pci_pwrctl *pwrctl); -int devm_pci_pwrctl_device_set_ready (struct device *dev, -struct pci_pwrctl *pwrctl); +void pci_pwrctrl_init (struct pci_pwrctrl *pwrctrl,struct device *dev); +int pci_pwrctrl_device_set_ready (struct pci_pwrctrl *pwrctrl); +void pci_pwrctrl_device_unset_ready (struct pci_pwrctrl *pwrctrl); +int devm_pci_pwrctrl_device_set_ready (struct device *dev, +struct pci_pwrctrl *pwrctrl); -#endif /* __PCI_PWRCTL_H__ */ +#endif /* __PCI_PWRCTRL_H__ */
Signature · 1 line
2.34.1
Hello,
Quoted 7 lines
I'm sorry to propose this, but it seems like ongoing confusion to have "pwrctl" and "bwctrl" (different ctl/ctrl suffixes).
pwrctl was merged for v6.11, so I would propose changing bwctrl to match it except that we already have several "ctrl" files in PCI hotplug drivers, and in the wider kernel, the "ctrl" filename suffix outnumbers "ctl" by about two to one.
For the entire series:
Krzysztof