Skip to content

Commit 3f925cd

Browse files
bjorn-helgaaskwilczynski
authored andcommitted
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>
1 parent b88cbaa commit 3f925cd

File tree

5 files changed

+81
-79
lines changed

5 files changed

+81
-79
lines changed

drivers/pci/bus.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,10 @@ void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
322322
void __weak pcibios_bus_add_device(struct pci_dev *pdev) { }
323323

324324
/*
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
326326
* state.
327327
*/
328-
static void pci_pwrctl_create_devices(struct pci_dev *dev)
328+
static void pci_pwrctrl_create_devices(struct pci_dev *dev)
329329
{
330330
struct device_node *np = dev_of_node(&dev->dev);
331331
struct device *parent = &dev->dev;
@@ -337,23 +337,24 @@ static void pci_pwrctl_create_devices(struct pci_dev *dev)
337337
*/
338338
if (np && pci_is_bridge(dev)) {
339339
/*
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
342342
* power state of the devices.
343343
*/
344344
for_each_available_child_of_node_scoped(np, child) {
345345
/*
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.
350351
*/
351352
if (!of_pci_supply_present(child)) {
352353
pci_dbg(dev, "skipping OF node: %s\n", child->name);
353354
return;
354355
}
355356

356-
/* Now create the pwrctl device */
357+
/* Now create the pwrctrl device */
357358
pdev = of_platform_device_create(child, NULL, parent);
358359
if (!pdev)
359360
pci_err(dev, "failed to create OF node: %s\n", child->name);
@@ -385,12 +386,12 @@ void pci_bus_add_device(struct pci_dev *dev)
385386
pci_proc_attach_device(dev);
386387
pci_bridge_d3_update(dev);
387388

388-
pci_pwrctl_create_devices(dev);
389+
pci_pwrctrl_create_devices(dev);
389390

390391
/*
391-
* If the PCI device is associated with a pwrctl device with a
392+
* If the PCI device is associated with a pwrctrl device with a
392393
* power supply, create a device link between the PCI device and
393-
* pwrctl device. This ensures that pwrctl drivers are probed
394+
* pwrctrl device. This ensures that pwrctrl drivers are probed
394395
* before PCI client drivers.
395396
*/
396397
pdev = of_find_device_by_node(dn);

drivers/pci/pwrctrl/core.c

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
#include <linux/property.h>
1212
#include <linux/slab.h>
1313

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)
1616
{
17-
struct pci_pwrctl *pwrctl = container_of(nb, struct pci_pwrctl, nb);
17+
struct pci_pwrctrl *pwrctrl = container_of(nb, struct pci_pwrctrl, nb);
1818
struct device *dev = data;
1919

20-
if (dev_fwnode(dev) != dev_fwnode(pwrctl->dev))
20+
if (dev_fwnode(dev) != dev_fwnode(pwrctrl->dev))
2121
return NOTIFY_DONE;
2222

2323
switch (action) {
@@ -40,31 +40,32 @@ static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action,
4040

4141
static void rescan_work_func(struct work_struct *work)
4242
{
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);
4445

4546
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);
4748
pci_unlock_rescan_remove();
4849
}
4950

5051
/**
51-
* pci_pwrctl_init() - Initialize the PCI power control context struct
52+
* pci_pwrctrl_init() - Initialize the PCI power control context struct
5253
*
53-
* @pwrctl: PCI power control data
54+
* @pwrctrl: PCI power control data
5455
* @dev: Parent device
5556
*/
56-
void pci_pwrctl_init(struct pci_pwrctl *pwrctl, struct device *dev)
57+
void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev)
5758
{
58-
pwrctl->dev = dev;
59-
INIT_WORK(&pwrctl->work, rescan_work_func);
59+
pwrctrl->dev = dev;
60+
INIT_WORK(&pwrctrl->work, rescan_work_func);
6061
}
61-
EXPORT_SYMBOL_GPL(pci_pwrctl_init);
62+
EXPORT_SYMBOL_GPL(pci_pwrctrl_init);
6263

6364
/**
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
6566
* device is powered-up and ready to be detected.
6667
*
67-
* @pwrctl: PCI power control data.
68+
* @pwrctrl: PCI power control data.
6869
*
6970
* Returns:
7071
* 0 on success, negative error number on error.
@@ -74,73 +75,73 @@ EXPORT_SYMBOL_GPL(pci_pwrctl_init);
7475
* that the bus rescan was successfully started. The device will get bound to
7576
* its PCI driver asynchronously.
7677
*/
77-
int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl)
78+
int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrctrl)
7879
{
7980
int ret;
8081

81-
if (!pwrctl->dev)
82+
if (!pwrctrl->dev)
8283
return -ENODEV;
8384

84-
pwrctl->nb.notifier_call = pci_pwrctl_notify;
85-
ret = bus_register_notifier(&pci_bus_type, &pwrctl->nb);
85+
pwrctrl->nb.notifier_call = pci_pwrctrl_notify;
86+
ret = bus_register_notifier(&pci_bus_type, &pwrctrl->nb);
8687
if (ret)
8788
return ret;
8889

89-
schedule_work(&pwrctl->work);
90+
schedule_work(&pwrctrl->work);
9091

9192
return 0;
9293
}
93-
EXPORT_SYMBOL_GPL(pci_pwrctl_device_set_ready);
94+
EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready);
9495

9596
/**
96-
* pci_pwrctl_device_unset_ready() - Notify the pwrctl subsystem that the PCI
97+
* pci_pwrctrl_device_unset_ready() - Notify the pwrctrl subsystem that the PCI
9798
* device is about to be powered-down.
9899
*
99-
* @pwrctl: PCI power control data.
100+
* @pwrctrl: PCI power control data.
100101
*/
101-
void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl)
102+
void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl)
102103
{
103104
/*
104105
* We don't have to delete the link here. Typically, this function
105106
* is only called when the power control device is being detached. If
106107
* it is being detached then the child PCI device must have already
107108
* been unbound too or the device core wouldn't let us unbind.
108109
*/
109-
bus_unregister_notifier(&pci_bus_type, &pwrctl->nb);
110+
bus_unregister_notifier(&pci_bus_type, &pwrctrl->nb);
110111
}
111-
EXPORT_SYMBOL_GPL(pci_pwrctl_device_unset_ready);
112+
EXPORT_SYMBOL_GPL(pci_pwrctrl_device_unset_ready);
112113

113-
static void devm_pci_pwrctl_device_unset_ready(void *data)
114+
static void devm_pci_pwrctrl_device_unset_ready(void *data)
114115
{
115-
struct pci_pwrctl *pwrctl = data;
116+
struct pci_pwrctrl *pwrctrl = data;
116117

117-
pci_pwrctl_device_unset_ready(pwrctl);
118+
pci_pwrctrl_device_unset_ready(pwrctrl);
118119
}
119120

120121
/**
121-
* devm_pci_pwrctl_device_set_ready - Managed variant of
122-
* pci_pwrctl_device_set_ready().
122+
* devm_pci_pwrctrl_device_set_ready - Managed variant of
123+
* pci_pwrctrl_device_set_ready().
123124
*
124-
* @dev: Device managing this pwrctl provider.
125-
* @pwrctl: PCI power control data.
125+
* @dev: Device managing this pwrctrl provider.
126+
* @pwrctrl: PCI power control data.
126127
*
127128
* Returns:
128129
* 0 on success, negative error number on error.
129130
*/
130-
int devm_pci_pwrctl_device_set_ready(struct device *dev,
131-
struct pci_pwrctl *pwrctl)
131+
int devm_pci_pwrctrl_device_set_ready(struct device *dev,
132+
struct pci_pwrctrl *pwrctrl)
132133
{
133134
int ret;
134135

135-
ret = pci_pwrctl_device_set_ready(pwrctl);
136+
ret = pci_pwrctrl_device_set_ready(pwrctrl);
136137
if (ret)
137138
return ret;
138139

139140
return devm_add_action_or_reset(dev,
140-
devm_pci_pwrctl_device_unset_ready,
141-
pwrctl);
141+
devm_pci_pwrctrl_device_unset_ready,
142+
pwrctrl);
142143
}
143-
EXPORT_SYMBOL_GPL(devm_pci_pwrctl_device_set_ready);
144+
EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready);
144145

145146
MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>");
146147
MODULE_DESCRIPTION("PCI Device Power Control core driver");

drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
#include <linux/slab.h>
1414
#include <linux/types.h>
1515

16-
struct pci_pwrctl_pwrseq_data {
17-
struct pci_pwrctl ctx;
16+
struct pci_pwrctrl_pwrseq_data {
17+
struct pci_pwrctrl ctx;
1818
struct pwrseq_desc *pwrseq;
1919
};
2020

21-
static void devm_pci_pwrctl_pwrseq_power_off(void *data)
21+
static void devm_pci_pwrctrl_pwrseq_power_off(void *data)
2222
{
2323
struct pwrseq_desc *pwrseq = data;
2424

2525
pwrseq_power_off(pwrseq);
2626
}
2727

28-
static int pci_pwrctl_pwrseq_probe(struct platform_device *pdev)
28+
static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev)
2929
{
30-
struct pci_pwrctl_pwrseq_data *data;
30+
struct pci_pwrctrl_pwrseq_data *data;
3131
struct device *dev = &pdev->dev;
3232
int ret;
3333

@@ -45,22 +45,22 @@ static int pci_pwrctl_pwrseq_probe(struct platform_device *pdev)
4545
return dev_err_probe(dev, ret,
4646
"Failed to power-on the device\n");
4747

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,
4949
data->pwrseq);
5050
if (ret)
5151
return ret;
5252

53-
pci_pwrctl_init(&data->ctx, dev);
53+
pci_pwrctrl_init(&data->ctx, dev);
5454

55-
ret = devm_pci_pwrctl_device_set_ready(dev, &data->ctx);
55+
ret = devm_pci_pwrctrl_device_set_ready(dev, &data->ctx);
5656
if (ret)
5757
return dev_err_probe(dev, ret,
58-
"Failed to register the pwrctl wrapper\n");
58+
"Failed to register the pwrctrl wrapper\n");
5959

6060
return 0;
6161
}
6262

63-
static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = {
63+
static const struct of_device_id pci_pwrctrl_pwrseq_of_match[] = {
6464
{
6565
/* ATH11K in QCA6390 package. */
6666
.compatible = "pci17cb,1101",
@@ -78,16 +78,16 @@ static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = {
7878
},
7979
{ }
8080
};
81-
MODULE_DEVICE_TABLE(of, pci_pwrctl_pwrseq_of_match);
81+
MODULE_DEVICE_TABLE(of, pci_pwrctrl_pwrseq_of_match);
8282

83-
static struct platform_driver pci_pwrctl_pwrseq_driver = {
83+
static struct platform_driver pci_pwrctrl_pwrseq_driver = {
8484
.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,
8787
},
88-
.probe = pci_pwrctl_pwrseq_probe,
88+
.probe = pci_pwrctrl_pwrseq_probe,
8989
};
90-
module_platform_driver(pci_pwrctl_pwrseq_driver);
90+
module_platform_driver(pci_pwrctrl_pwrseq_driver);
9191

9292
MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>");
9393
MODULE_DESCRIPTION("Generic PCI Power Control module for power sequenced devices");

drivers/pci/remove.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static void pci_free_resources(struct pci_dev *dev)
1717
}
1818
}
1919

20-
static void pci_pwrctl_unregister(struct device *dev)
20+
static void pci_pwrctrl_unregister(struct device *dev)
2121
{
2222
struct platform_device *pdev;
2323

@@ -34,7 +34,7 @@ static void pci_stop_dev(struct pci_dev *dev)
3434
pci_pme_active(dev, false);
3535

3636
if (pci_dev_is_added(dev)) {
37-
pci_pwrctl_unregister(&dev->dev);
37+
pci_pwrctrl_unregister(&dev->dev);
3838
device_release_driver(&dev->dev);
3939
pci_proc_detach_device(dev);
4040
pci_remove_sysfs_dev_files(dev);

include/linux/pci-pwrctrl.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Copyright (C) 2024 Linaro Ltd.
44
*/
55

6-
#ifndef __PCI_PWRCTL_H__
7-
#define __PCI_PWRCTL_H__
6+
#ifndef __PCI_PWRCTRL_H__
7+
#define __PCI_PWRCTRL_H__
88

99
#include <linux/notifier.h>
1010
#include <linux/workqueue.h>
@@ -29,14 +29,14 @@ struct device_link;
2929
*/
3030

3131
/**
32-
* struct pci_pwrctl - PCI device power control context.
32+
* struct pci_pwrctrl - PCI device power control context.
3333
* @dev: Address of the power controlling device.
3434
*
3535
* 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
3737
* link with the device once it's up.
3838
*/
39-
struct pci_pwrctl {
39+
struct pci_pwrctrl {
4040
struct device *dev;
4141

4242
/* Private: don't use. */
@@ -45,10 +45,10 @@ struct pci_pwrctl {
4545
struct work_struct work;
4646
};
4747

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);
5353

54-
#endif /* __PCI_PWRCTL_H__ */
54+
#endif /* __PCI_PWRCTRL_H__ */

0 commit comments

Comments
 (0)