mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									b88cbaaa6f
								
							
						
					
					
						commit
						3f925cd628
					
				
					 5 changed files with 81 additions and 79 deletions
				
			
		| 
						 | 
					@ -322,10 +322,10 @@ void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
 | 
				
			||||||
void __weak pcibios_bus_add_device(struct pci_dev *pdev) { }
 | 
					void __weak pcibios_bus_add_device(struct pci_dev *pdev) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Create pwrctl devices (if required) for the PCI devices to handle the power
 | 
					 * Create pwrctrl devices (if required) for the PCI devices to handle the power
 | 
				
			||||||
 * state.
 | 
					 * state.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void pci_pwrctl_create_devices(struct pci_dev *dev)
 | 
					static void pci_pwrctrl_create_devices(struct pci_dev *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct device_node *np = dev_of_node(&dev->dev);
 | 
						struct device_node *np = dev_of_node(&dev->dev);
 | 
				
			||||||
	struct device *parent = &dev->dev;
 | 
						struct device *parent = &dev->dev;
 | 
				
			||||||
| 
						 | 
					@ -337,23 +337,24 @@ static void pci_pwrctl_create_devices(struct pci_dev *dev)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (np && pci_is_bridge(dev)) {
 | 
						if (np && pci_is_bridge(dev)) {
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * Now look for the child PCI device nodes and create pwrctl
 | 
							 * Now look for the child PCI device nodes and create pwrctrl
 | 
				
			||||||
		 * devices for them. The pwrctl device drivers will manage the
 | 
							 * devices for them. The pwrctrl device drivers will manage the
 | 
				
			||||||
		 * power state of the devices.
 | 
							 * power state of the devices.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		for_each_available_child_of_node_scoped(np, child) {
 | 
							for_each_available_child_of_node_scoped(np, child) {
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * First check whether the pwrctl device really needs to
 | 
								 * First check whether the pwrctrl device really
 | 
				
			||||||
			 * be created or not. This is decided based on at least
 | 
								 * needs to be created or not. This is decided
 | 
				
			||||||
			 * one of the power supplies being defined in the
 | 
								 * based on at least one of the power supplies
 | 
				
			||||||
			 * devicetree node of the device.
 | 
								 * being defined in the devicetree node of the
 | 
				
			||||||
 | 
								 * device.
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			if (!of_pci_supply_present(child)) {
 | 
								if (!of_pci_supply_present(child)) {
 | 
				
			||||||
				pci_dbg(dev, "skipping OF node: %s\n", child->name);
 | 
									pci_dbg(dev, "skipping OF node: %s\n", child->name);
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Now create the pwrctl device */
 | 
								/* Now create the pwrctrl device */
 | 
				
			||||||
			pdev = of_platform_device_create(child, NULL, parent);
 | 
								pdev = of_platform_device_create(child, NULL, parent);
 | 
				
			||||||
			if (!pdev)
 | 
								if (!pdev)
 | 
				
			||||||
				pci_err(dev, "failed to create OF node: %s\n", child->name);
 | 
									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)
 | 
				
			||||||
	pci_proc_attach_device(dev);
 | 
						pci_proc_attach_device(dev);
 | 
				
			||||||
	pci_bridge_d3_update(dev);
 | 
						pci_bridge_d3_update(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pci_pwrctl_create_devices(dev);
 | 
						pci_pwrctrl_create_devices(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * If the PCI device is associated with a pwrctl device with a
 | 
						 * If the PCI device is associated with a pwrctrl device with a
 | 
				
			||||||
	 * power supply, create a device link between the PCI device and
 | 
						 * power supply, create a device link between the PCI device and
 | 
				
			||||||
	 * pwrctl device.  This ensures that pwrctl drivers are probed
 | 
						 * pwrctrl device.  This ensures that pwrctrl drivers are probed
 | 
				
			||||||
	 * before PCI client drivers.
 | 
						 * before PCI client drivers.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	pdev = of_find_device_by_node(dn);
 | 
						pdev = of_find_device_by_node(dn);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,13 +11,13 @@
 | 
				
			||||||
#include <linux/property.h>
 | 
					#include <linux/property.h>
 | 
				
			||||||
#include <linux/slab.h>
 | 
					#include <linux/slab.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action,
 | 
					static int pci_pwrctrl_notify(struct notifier_block *nb, unsigned long action,
 | 
				
			||||||
			      void *data)
 | 
								      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;
 | 
						struct device *dev = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (dev_fwnode(dev) != dev_fwnode(pwrctl->dev))
 | 
						if (dev_fwnode(dev) != dev_fwnode(pwrctrl->dev))
 | 
				
			||||||
		return NOTIFY_DONE;
 | 
							return NOTIFY_DONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (action) {
 | 
						switch (action) {
 | 
				
			||||||
| 
						 | 
					@ -40,31 +40,32 @@ static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void rescan_work_func(struct work_struct *work)
 | 
					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_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_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
 | 
					 * @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;
 | 
						pwrctrl->dev = dev;
 | 
				
			||||||
	INIT_WORK(&pwrctl->work, rescan_work_func);
 | 
						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.
 | 
					 * device is powered-up and ready to be detected.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @pwrctl: PCI power control data.
 | 
					 * @pwrctrl: PCI power control data.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Returns:
 | 
					 * Returns:
 | 
				
			||||||
 * 0 on success, negative error number on error.
 | 
					 * 0 on success, negative error number on error.
 | 
				
			||||||
| 
						 | 
					@ -74,31 +75,31 @@ EXPORT_SYMBOL_GPL(pci_pwrctl_init);
 | 
				
			||||||
 * that the bus rescan was successfully started. The device will get bound to
 | 
					 * that the bus rescan was successfully started. The device will get bound to
 | 
				
			||||||
 * its PCI driver asynchronously.
 | 
					 * 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;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!pwrctl->dev)
 | 
						if (!pwrctrl->dev)
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pwrctl->nb.notifier_call = pci_pwrctl_notify;
 | 
						pwrctrl->nb.notifier_call = pci_pwrctrl_notify;
 | 
				
			||||||
	ret = bus_register_notifier(&pci_bus_type, &pwrctl->nb);
 | 
						ret = bus_register_notifier(&pci_bus_type, &pwrctrl->nb);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	schedule_work(&pwrctl->work);
 | 
						schedule_work(&pwrctrl->work);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						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.
 | 
					 * 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
 | 
						 * We don't have to delete the link here. Typically, this function
 | 
				
			||||||
| 
						 | 
					@ -106,41 +107,41 @@ void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl)
 | 
				
			||||||
	 * it is being detached then the child PCI device must have already
 | 
						 * it is being detached then the child PCI device must have already
 | 
				
			||||||
	 * been unbound too or the device core wouldn't let us unbind.
 | 
						 * 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
 | 
					 * devm_pci_pwrctrl_device_set_ready - Managed variant of
 | 
				
			||||||
 * pci_pwrctl_device_set_ready().
 | 
					 * pci_pwrctrl_device_set_ready().
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @dev: Device managing this pwrctl provider.
 | 
					 * @dev: Device managing this pwrctrl provider.
 | 
				
			||||||
 * @pwrctl: PCI power control data.
 | 
					 * @pwrctrl: PCI power control data.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Returns:
 | 
					 * Returns:
 | 
				
			||||||
 * 0 on success, negative error number on error.
 | 
					 * 0 on success, negative error number on error.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int devm_pci_pwrctl_device_set_ready(struct device *dev,
 | 
					int devm_pci_pwrctrl_device_set_ready(struct device *dev,
 | 
				
			||||||
				     struct pci_pwrctl *pwrctl)
 | 
									      struct pci_pwrctrl *pwrctrl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = pci_pwrctl_device_set_ready(pwrctl);
 | 
						ret = pci_pwrctrl_device_set_ready(pwrctrl);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return devm_add_action_or_reset(dev,
 | 
						return devm_add_action_or_reset(dev,
 | 
				
			||||||
					devm_pci_pwrctl_device_unset_ready,
 | 
										devm_pci_pwrctrl_device_unset_ready,
 | 
				
			||||||
					pwrctl);
 | 
										pwrctrl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(devm_pci_pwrctl_device_set_ready);
 | 
					EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>");
 | 
					MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>");
 | 
				
			||||||
MODULE_DESCRIPTION("PCI Device Power Control core driver");
 | 
					MODULE_DESCRIPTION("PCI Device Power Control core driver");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,21 +13,21 @@
 | 
				
			||||||
#include <linux/slab.h>
 | 
					#include <linux/slab.h>
 | 
				
			||||||
#include <linux/types.h>
 | 
					#include <linux/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pci_pwrctl_pwrseq_data {
 | 
					struct pci_pwrctrl_pwrseq_data {
 | 
				
			||||||
	struct pci_pwrctl ctx;
 | 
						struct pci_pwrctrl ctx;
 | 
				
			||||||
	struct pwrseq_desc *pwrseq;
 | 
						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;
 | 
						struct pwrseq_desc *pwrseq = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pwrseq_power_off(pwrseq);
 | 
						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;
 | 
						struct device *dev = &pdev->dev;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,22 +45,22 @@ static int pci_pwrctl_pwrseq_probe(struct platform_device *pdev)
 | 
				
			||||||
		return dev_err_probe(dev, ret,
 | 
							return dev_err_probe(dev, ret,
 | 
				
			||||||
				     "Failed to power-on the device\n");
 | 
									     "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);
 | 
									       data->pwrseq);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return 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)
 | 
						if (ret)
 | 
				
			||||||
		return dev_err_probe(dev, ret,
 | 
							return dev_err_probe(dev, ret,
 | 
				
			||||||
				     "Failed to register the pwrctl wrapper\n");
 | 
									     "Failed to register the pwrctrl wrapper\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						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. */
 | 
							/* ATH11K in QCA6390 package. */
 | 
				
			||||||
		.compatible = "pci17cb,1101",
 | 
							.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 = {
 | 
						.driver = {
 | 
				
			||||||
		.name = "pci-pwrctl-pwrseq",
 | 
							.name = "pci-pwrctrl-pwrseq",
 | 
				
			||||||
		.of_match_table = pci_pwrctl_pwrseq_of_match,
 | 
							.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 <bartosz.golaszewski@linaro.org>");
 | 
					MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>");
 | 
				
			||||||
MODULE_DESCRIPTION("Generic PCI Power Control module for power sequenced devices");
 | 
					MODULE_DESCRIPTION("Generic PCI Power Control module for power sequenced devices");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ static void pci_free_resources(struct pci_dev *dev)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void pci_pwrctl_unregister(struct device *dev)
 | 
					static void pci_pwrctrl_unregister(struct device *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct platform_device *pdev;
 | 
						struct platform_device *pdev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ static void pci_stop_dev(struct pci_dev *dev)
 | 
				
			||||||
	pci_pme_active(dev, false);
 | 
						pci_pme_active(dev, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (pci_dev_is_added(dev)) {
 | 
						if (pci_dev_is_added(dev)) {
 | 
				
			||||||
		pci_pwrctl_unregister(&dev->dev);
 | 
							pci_pwrctrl_unregister(&dev->dev);
 | 
				
			||||||
		device_release_driver(&dev->dev);
 | 
							device_release_driver(&dev->dev);
 | 
				
			||||||
		pci_proc_detach_device(dev);
 | 
							pci_proc_detach_device(dev);
 | 
				
			||||||
		pci_remove_sysfs_dev_files(dev);
 | 
							pci_remove_sysfs_dev_files(dev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,8 +3,8 @@
 | 
				
			||||||
 * Copyright (C) 2024 Linaro Ltd.
 | 
					 * Copyright (C) 2024 Linaro Ltd.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __PCI_PWRCTL_H__
 | 
					#ifndef __PCI_PWRCTRL_H__
 | 
				
			||||||
#define __PCI_PWRCTL_H__
 | 
					#define __PCI_PWRCTRL_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/notifier.h>
 | 
					#include <linux/notifier.h>
 | 
				
			||||||
#include <linux/workqueue.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.
 | 
					 * @dev: Address of the power controlling device.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * An object of this type must be allocated by the PCI power control device and
 | 
					 * 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.
 | 
					 * link with the device once it's up.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct pci_pwrctl {
 | 
					struct pci_pwrctrl {
 | 
				
			||||||
	struct device *dev;
 | 
						struct device *dev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Private: don't use. */
 | 
						/* Private: don't use. */
 | 
				
			||||||
| 
						 | 
					@ -45,10 +45,10 @@ struct pci_pwrctl {
 | 
				
			||||||
	struct work_struct work;
 | 
						struct work_struct work;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pci_pwrctl_init(struct pci_pwrctl *pwrctl, struct device *dev);
 | 
					void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev);
 | 
				
			||||||
int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl);
 | 
					int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrctrl);
 | 
				
			||||||
void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl);
 | 
					void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl);
 | 
				
			||||||
int devm_pci_pwrctl_device_set_ready(struct device *dev,
 | 
					int devm_pci_pwrctrl_device_set_ready(struct device *dev,
 | 
				
			||||||
				     struct pci_pwrctl *pwrctl);
 | 
									     struct pci_pwrctrl *pwrctrl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __PCI_PWRCTL_H__ */
 | 
					#endif /* __PCI_PWRCTRL_H__ */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue