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
4141static 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
145146MODULE_AUTHOR ("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>" );
146147MODULE_DESCRIPTION ("PCI Device Power Control core driver" );
0 commit comments