@@ -20,6 +20,7 @@
#include <linux/pci.h>
#include <linux/device.h>
#include <linux/debugfs.h>
+#include <linux/pm.h>
#include <linux/seq_file.h>
#include <linux/io.h>
@@ -92,7 +93,7 @@ static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val)
writel(val, pmc->regmap + reg_offset);
}
-static void pmc_power_off(void)
+static void pmc_power_off(struct power_off_handler_block *this)
{
u16 pm1_cnt_port;
u32 pm1_cnt_value;
@@ -109,6 +110,11 @@ static void pmc_power_off(void)
outl(pm1_cnt_value, pm1_cnt_port);
}
+static struct power_off_handler_block pmc_power_off_hb = {
+ .handler = pmc_power_off,
+ .priority = POWER_OFF_PRIORITY_LOW,
+};
+
static void pmc_hw_reg_setup(struct pmc_dev *pmc)
{
/*
@@ -252,8 +258,12 @@ static int pmc_setup_dev(struct pci_dev *pdev)
acpi_base_addr &= ACPI_BASE_ADDR_MASK;
/* Install power off function */
- if (acpi_base_addr != 0 && pm_power_off == NULL)
- pm_power_off = pmc_power_off;
+ if (acpi_base_addr != 0) {
+ ret = register_power_off_handler(&pmc_power_off_hb);
+ if (ret)
+ dev_warn(&pdev->dev,
+ "Failed to install power-off handler\n");
+ }
pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr);
pmc->base_addr &= PMC_BASE_ADDR_MASK;