summaryrefslogtreecommitdiff
path: root/drivers/parisc
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-08-13 00:21:08 +0300
committerHelge Deller <deller@gmx.de>2023-08-20 21:23:46 +0300
commite71d47dc2a6c9a1ec83f015c7c3dd87b635ffcda (patch)
treecefc58243e22f455d8693bf7a2840e309fafeb30 /drivers/parisc
parent706a741595047797872e669b3101429ab8d378ef (diff)
downloadlinux-e71d47dc2a6c9a1ec83f015c7c3dd87b635ffcda.tar.xz
parisc: lasi: Register LASI power-off feature as sys_off_handler
Prefer the Linux kernel sys_off_handler functionality over a home-grown implementation. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'drivers/parisc')
-rw-r--r--drivers/parisc/lasi.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c
index 6ef621adb63a..d7331823255f 100644
--- a/drivers/parisc/lasi.c
+++ b/drivers/parisc/lasi.c
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/types.h>
+#include <linux/reboot.h>
#include <asm/io.h>
#include <asm/hardware.h>
@@ -145,23 +146,19 @@ static void __init lasi_led_init(unsigned long lasi_hpa)
* 1 to PWR_ON_L in the Power Control Register
*
*/
-
-static unsigned long lasi_power_off_hpa __read_mostly;
-
-static void lasi_power_off(void)
+static int lasi_power_off(struct sys_off_data *data)
{
- unsigned long datareg;
+ struct gsc_asic *lasi = data->cb_data;
- /* calculate addr of the Power Control Register */
- datareg = lasi_power_off_hpa + 0x0000C000;
+ /* Power down the machine via Power Control Register */
+ gsc_writel(0x02, lasi->hpa + 0x0000C000);
- /* Power down the machine */
- gsc_writel(0x02, datareg);
+ /* might not be reached: */
+ return NOTIFY_DONE;
}
static int __init lasi_init_chip(struct parisc_device *dev)
{
- extern void (*chassis_power_off)(void);
struct gsc_asic *lasi;
int ret;
@@ -212,13 +209,10 @@ static int __init lasi_init_chip(struct parisc_device *dev)
gsc_fixup_irqs(dev, lasi, lasi_choose_irq);
- /* initialize the power off function */
- /* FIXME: Record the LASI HPA for the power off function. This should
- * ensure that only the first LASI (the one controlling the power off)
- * should set the HPA here */
- lasi_power_off_hpa = lasi->hpa;
- chassis_power_off = lasi_power_off;
-
+ /* register the LASI power off function */
+ register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+ SYS_OFF_PRIO_DEFAULT, lasi_power_off, lasi);
+
return ret;
}