Skip to content

Commit

Permalink
PCI / PM: constify pci_platform_pm_ops structure
Browse files Browse the repository at this point in the history
The pci_platform_pm_ops structure is never modified, so declare it as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Julia Lawall authored and Rafael J. Wysocki committed Dec 9, 2015
1 parent 527e931 commit 299f2ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static bool acpi_pci_need_resume(struct pci_dev *dev)
return !!adev->power.flags.dsw_present;
}

static struct pci_platform_pm_ops acpi_pci_platform_pm = {
static const struct pci_platform_pm_ops acpi_pci_platform_pm = {
.is_manageable = acpi_pci_power_manageable,
.set_state = acpi_pci_set_power_state,
.choose_state = acpi_pci_choose_state,
Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ static void pci_restore_bars(struct pci_dev *dev)
pci_update_resource(dev, i);
}

static struct pci_platform_pm_ops *pci_platform_pm;
static const struct pci_platform_pm_ops *pci_platform_pm;

int pci_set_platform_pm(struct pci_platform_pm_ops *ops)
int pci_set_platform_pm(const struct pci_platform_pm_ops *ops)
{
if (!ops->is_manageable || !ops->set_state || !ops->choose_state
|| !ops->sleep_wake)
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct pci_platform_pm_ops {
bool (*need_resume)(struct pci_dev *dev);
};

int pci_set_platform_pm(struct pci_platform_pm_ops *ops);
int pci_set_platform_pm(const struct pci_platform_pm_ops *ops);
void pci_update_current_state(struct pci_dev *dev, pci_power_t state);
void pci_power_up(struct pci_dev *dev);
void pci_disable_enabled_device(struct pci_dev *dev);
Expand Down

0 comments on commit 299f2ff

Please sign in to comment.