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

Configure Feed

Select the types of activity you want to include in your feed.

PCI/pwrctrl: pwrseq: Rename private struct and pointers for consistency

Previously the pwrseq, tc9563, and slot pwrctrl drivers used different
naming conventions for their private data structs and pointers to them,
which makes patches hard to read.

Rename structs, variables, and functions to reduce boiler-plate and start
with "pwrseq":

struct pci_pwrctrl_pwrseq_data -> struct pwrseq_pwrctrl
struct pci_pwrctrl ctx -> struct pci_pwrctrl pwrctrl
struct pci_pwrctrl_pwrseq_data *data -> struct pwrseq_pwrctrl *pwrseq
struct pci_pwrctrl_pwrseq_pdata -> struct pwrseq_pwrctrl_pdata
pci_pwrctrl_pwrseq_qcom_wcn_pdata -> pwrseq_pwrctrl_qcom_wcn_pdata
pci_pwrctrl_pwrseq_probe() -> pwrseq_pwrctrl_probe()
devm_pci_pwrctrl_pwrseq_power_off() -> devm_pwrseq_pwrctrl_power_off()
pci_pwrctrl_pwrseq_qcm_wcn_validate_device() -> pwrseq_pwrctrl_qcm_wcn_validate_device()

No functional change intended.

[bhelgaas: move "pwrseq" to beginning, also rename functions]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260115-pci-pwrctrl-rework-v5-1-9d26da3ce903@oss.qualcomm.com

+29 -29
+29 -29
drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
··· 13 13 #include <linux/slab.h> 14 14 #include <linux/types.h> 15 15 16 - struct pci_pwrctrl_pwrseq_data { 17 - struct pci_pwrctrl ctx; 16 + struct pwrseq_pwrctrl { 17 + struct pci_pwrctrl pwrctrl; 18 18 struct pwrseq_desc *pwrseq; 19 19 }; 20 20 21 - struct pci_pwrctrl_pwrseq_pdata { 21 + struct pwrseq_pwrctrl_pdata { 22 22 const char *target; 23 23 /* 24 24 * Called before doing anything else to perform device-specific ··· 27 27 int (*validate_device)(struct device *dev); 28 28 }; 29 29 30 - static int pci_pwrctrl_pwrseq_qcm_wcn_validate_device(struct device *dev) 30 + static int pwrseq_pwrctrl_qcm_wcn_validate_device(struct device *dev) 31 31 { 32 32 /* 33 33 * Old device trees for some platforms already define wifi nodes for ··· 47 47 return 0; 48 48 } 49 49 50 - static const struct pci_pwrctrl_pwrseq_pdata pci_pwrctrl_pwrseq_qcom_wcn_pdata = { 50 + static const struct pwrseq_pwrctrl_pdata pwrseq_pwrctrl_qcom_wcn_pdata = { 51 51 .target = "wlan", 52 - .validate_device = pci_pwrctrl_pwrseq_qcm_wcn_validate_device, 52 + .validate_device = pwrseq_pwrctrl_qcm_wcn_validate_device, 53 53 }; 54 54 55 - static void devm_pci_pwrctrl_pwrseq_power_off(void *data) 55 + static void devm_pwrseq_pwrctrl_power_off(void *data) 56 56 { 57 57 struct pwrseq_desc *pwrseq = data; 58 58 59 59 pwrseq_power_off(pwrseq); 60 60 } 61 61 62 - static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev) 62 + static int pwrseq_pwrctrl_probe(struct platform_device *pdev) 63 63 { 64 - const struct pci_pwrctrl_pwrseq_pdata *pdata; 65 - struct pci_pwrctrl_pwrseq_data *data; 64 + const struct pwrseq_pwrctrl_pdata *pdata; 65 + struct pwrseq_pwrctrl *pwrseq; 66 66 struct device *dev = &pdev->dev; 67 67 int ret; 68 68 ··· 76 76 return ret; 77 77 } 78 78 79 - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 80 - if (!data) 79 + pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); 80 + if (!pwrseq) 81 81 return -ENOMEM; 82 82 83 - data->pwrseq = devm_pwrseq_get(dev, pdata->target); 84 - if (IS_ERR(data->pwrseq)) 85 - return dev_err_probe(dev, PTR_ERR(data->pwrseq), 83 + pwrseq->pwrseq = devm_pwrseq_get(dev, pdata->target); 84 + if (IS_ERR(pwrseq->pwrseq)) 85 + return dev_err_probe(dev, PTR_ERR(pwrseq->pwrseq), 86 86 "Failed to get the power sequencer\n"); 87 87 88 - ret = pwrseq_power_on(data->pwrseq); 88 + ret = pwrseq_power_on(pwrseq->pwrseq); 89 89 if (ret) 90 90 return dev_err_probe(dev, ret, 91 91 "Failed to power-on the device\n"); 92 92 93 - ret = devm_add_action_or_reset(dev, devm_pci_pwrctrl_pwrseq_power_off, 94 - data->pwrseq); 93 + ret = devm_add_action_or_reset(dev, devm_pwrseq_pwrctrl_power_off, 94 + pwrseq->pwrseq); 95 95 if (ret) 96 96 return ret; 97 97 98 - pci_pwrctrl_init(&data->ctx, dev); 98 + pci_pwrctrl_init(&pwrseq->pwrctrl, dev); 99 99 100 - ret = devm_pci_pwrctrl_device_set_ready(dev, &data->ctx); 100 + ret = devm_pci_pwrctrl_device_set_ready(dev, &pwrseq->pwrctrl); 101 101 if (ret) 102 102 return dev_err_probe(dev, ret, 103 103 "Failed to register the pwrctrl wrapper\n"); ··· 105 105 return 0; 106 106 } 107 107 108 - static const struct of_device_id pci_pwrctrl_pwrseq_of_match[] = { 108 + static const struct of_device_id pwrseq_pwrctrl_of_match[] = { 109 109 { 110 110 /* ATH11K in QCA6390 package. */ 111 111 .compatible = "pci17cb,1101", 112 - .data = &pci_pwrctrl_pwrseq_qcom_wcn_pdata, 112 + .data = &pwrseq_pwrctrl_qcom_wcn_pdata, 113 113 }, 114 114 { 115 115 /* ATH11K in WCN6855 package. */ 116 116 .compatible = "pci17cb,1103", 117 - .data = &pci_pwrctrl_pwrseq_qcom_wcn_pdata, 117 + .data = &pwrseq_pwrctrl_qcom_wcn_pdata, 118 118 }, 119 119 { 120 120 /* ATH12K in WCN7850 package. */ 121 121 .compatible = "pci17cb,1107", 122 - .data = &pci_pwrctrl_pwrseq_qcom_wcn_pdata, 122 + .data = &pwrseq_pwrctrl_qcom_wcn_pdata, 123 123 }, 124 124 { } 125 125 }; 126 - MODULE_DEVICE_TABLE(of, pci_pwrctrl_pwrseq_of_match); 126 + MODULE_DEVICE_TABLE(of, pwrseq_pwrctrl_of_match); 127 127 128 - static struct platform_driver pci_pwrctrl_pwrseq_driver = { 128 + static struct platform_driver pwrseq_pwrctrl_driver = { 129 129 .driver = { 130 130 .name = "pci-pwrctrl-pwrseq", 131 - .of_match_table = pci_pwrctrl_pwrseq_of_match, 131 + .of_match_table = pwrseq_pwrctrl_of_match, 132 132 }, 133 - .probe = pci_pwrctrl_pwrseq_probe, 133 + .probe = pwrseq_pwrctrl_probe, 134 134 }; 135 - module_platform_driver(pci_pwrctrl_pwrseq_driver); 135 + module_platform_driver(pwrseq_pwrctrl_driver); 136 136 137 137 MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>"); 138 138 MODULE_DESCRIPTION("Generic PCI Power Control module for power sequenced devices");