aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-12 21:27:47 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-12 21:27:47 -0400
commitb981d8b3f5e008ff10d993be633ad00564fc22cd (patch)
treee292dc07b22308912cf6a58354a608b9e5e8e1fd /drivers/macintosh
parentb11d2127c4893a7315d1e16273bc8560049fa3ca (diff)
parent2b9e0aae1d50e880c58d46788e5e3ebd89d75d62 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/macintosh/adbhid.c
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/Kconfig5
-rw-r--r--drivers/macintosh/adb-iop.c1
-rw-r--r--drivers/macintosh/adb.c4
-rw-r--r--drivers/macintosh/adbhid.c21
-rw-r--r--drivers/macintosh/ans-lcd.c3
-rw-r--r--drivers/macintosh/ans-lcd.h11
-rw-r--r--drivers/macintosh/mac_hid.c1
-rw-r--r--drivers/macintosh/macio_asic.c3
-rw-r--r--drivers/macintosh/rack-meter.c1
-rw-r--r--drivers/macintosh/smu.c3
-rw-r--r--drivers/macintosh/therm_adt746x.c5
-rw-r--r--drivers/macintosh/therm_pm72.c6
-rw-r--r--drivers/macintosh/therm_windtunnel.c3
-rw-r--r--drivers/macintosh/via-pmu.c36
-rw-r--r--drivers/macintosh/via-pmu68k.c240
-rw-r--r--drivers/macintosh/windfarm_core.c3
-rw-r--r--drivers/macintosh/windfarm_lm75_sensor.c3
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c2
18 files changed, 61 insertions, 290 deletions
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 20da011d40d0..77f50b63a970 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -3,6 +3,11 @@ menuconfig MACINTOSH_DRIVERS
3 bool "Macintosh device drivers" 3 bool "Macintosh device drivers"
4 depends on PPC || MAC || X86 4 depends on PPC || MAC || X86
5 default y if (PPC_PMAC || MAC) 5 default y if (PPC_PMAC || MAC)
6 ---help---
7 Say Y here to get to see options for devices used with Macintosh
8 computers. This option alone does not add any kernel code.
9
10 If you say N, all options in this submenu will be skipped and disabled.
6 11
7if MACINTOSH_DRIVERS 12if MACINTOSH_DRIVERS
8 13
diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c
index 17ef5d3c01b4..444696625171 100644
--- a/drivers/macintosh/adb-iop.c
+++ b/drivers/macintosh/adb-iop.c
@@ -19,7 +19,6 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
21 21
22#include <asm/bootinfo.h>
23#include <asm/macintosh.h> 22#include <asm/macintosh.h>
24#include <asm/macints.h> 23#include <asm/macints.h>
25#include <asm/mac_iop.h> 24#include <asm/mac_iop.h>
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index bc77c5e2ca9f..5c742a526082 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -89,7 +89,7 @@ static int sleepy_trackpad;
89static int autopoll_devs; 89static int autopoll_devs;
90int __adb_probe_sync; 90int __adb_probe_sync;
91 91
92#ifdef CONFIG_PM 92#ifdef CONFIG_PM_SLEEP
93static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when); 93static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
94static struct pmu_sleep_notifier adb_sleep_notifier = { 94static struct pmu_sleep_notifier adb_sleep_notifier = {
95 adb_notify_sleep, 95 adb_notify_sleep,
@@ -313,7 +313,7 @@ int __init adb_init(void)
313 printk(KERN_WARNING "Warning: no ADB interface detected\n"); 313 printk(KERN_WARNING "Warning: no ADB interface detected\n");
314 adb_controller = NULL; 314 adb_controller = NULL;
315 } else { 315 } else {
316#ifdef CONFIG_PM 316#ifdef CONFIG_PM_SLEEP
317 pmu_register_sleep_notifier(&adb_sleep_notifier); 317 pmu_register_sleep_notifier(&adb_sleep_notifier);
318#endif /* CONFIG_PM */ 318#endif /* CONFIG_PM */
319#ifdef CONFIG_PPC 319#ifdef CONFIG_PPC
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 9ff2189d2e2a..8cce016b3d09 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -75,7 +75,7 @@ static struct notifier_block adbhid_adb_notifier = {
75#define ADB_KEY_POWER_OLD 0x7e 75#define ADB_KEY_POWER_OLD 0x7e
76#define ADB_KEY_POWER 0x7f 76#define ADB_KEY_POWER 0x7f
77 77
78u8 adb_to_linux_keycodes[128] = { 78u16 adb_to_linux_keycodes[128] = {
79 /* 0x00 */ KEY_A, /* 30 */ 79 /* 0x00 */ KEY_A, /* 30 */
80 /* 0x01 */ KEY_S, /* 31 */ 80 /* 0x01 */ KEY_S, /* 31 */
81 /* 0x02 */ KEY_D, /* 32 */ 81 /* 0x02 */ KEY_D, /* 32 */
@@ -139,7 +139,7 @@ u8 adb_to_linux_keycodes[128] = {
139 /* 0x3c */ KEY_RIGHT, /* 106 */ 139 /* 0x3c */ KEY_RIGHT, /* 106 */
140 /* 0x3d */ KEY_DOWN, /* 108 */ 140 /* 0x3d */ KEY_DOWN, /* 108 */
141 /* 0x3e */ KEY_UP, /* 103 */ 141 /* 0x3e */ KEY_UP, /* 103 */
142 /* 0x3f */ 0, 142 /* 0x3f */ KEY_FN, /* 0x1d0 */
143 /* 0x40 */ 0, 143 /* 0x40 */ 0,
144 /* 0x41 */ KEY_KPDOT, /* 83 */ 144 /* 0x41 */ KEY_KPDOT, /* 83 */
145 /* 0x42 */ 0, 145 /* 0x42 */ 0,
@@ -213,7 +213,7 @@ struct adbhid {
213 int original_handler_id; 213 int original_handler_id;
214 int current_handler_id; 214 int current_handler_id;
215 int mouse_kind; 215 int mouse_kind;
216 unsigned char *keycode; 216 u16 *keycode;
217 char name[64]; 217 char name[64];
218 char phys[32]; 218 char phys[32];
219 int flags; 219 int flags;
@@ -334,7 +334,7 @@ adbhid_input_keycode(int id, int scancode, int repeat)
334 keycode = ADB_KEY_POWER; 334 keycode = ADB_KEY_POWER;
335 } 335 }
336 break; 336 break;
337 case ADB_KEY_POWER: 337 case ADB_KEY_POWER:
338 /* Fn + Command will produce a bogus "power" keycode */ 338 /* Fn + Command will produce a bogus "power" keycode */
339 if (ahid->flags & FLAG_FN_KEY_PRESSED) { 339 if (ahid->flags & FLAG_FN_KEY_PRESSED) {
340 keycode = ADB_KEY_CMD; 340 keycode = ADB_KEY_CMD;
@@ -359,8 +359,7 @@ adbhid_input_keycode(int id, int scancode, int repeat)
359 } 359 }
360 } else 360 } else
361 ahid->flags |= FLAG_FN_KEY_PRESSED; 361 ahid->flags |= FLAG_FN_KEY_PRESSED;
362 /* Swallow the key press */ 362 break;
363 return;
364 case ADB_KEY_DEL: 363 case ADB_KEY_DEL:
365 /* Emulate Fn+delete = forward delete */ 364 /* Emulate Fn+delete = forward delete */
366 if (ahid->flags & FLAG_FN_KEY_PRESSED) { 365 if (ahid->flags & FLAG_FN_KEY_PRESSED) {
@@ -374,9 +373,9 @@ adbhid_input_keycode(int id, int scancode, int repeat)
374#endif /* CONFIG_PPC_PMAC */ 373#endif /* CONFIG_PPC_PMAC */
375 } 374 }
376 375
377 if (adbhid[id]->keycode[keycode]) { 376 key = adbhid[id]->keycode[keycode];
378 input_report_key(adbhid[id]->input, 377 if (key) {
379 adbhid[id]->keycode[keycode], !up_flag); 378 input_report_key(adbhid[id]->input, key, !up_flag);
380 input_sync(adbhid[id]->input); 379 input_sync(adbhid[id]->input);
381 } else 380 } else
382 printk(KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n", keycode, 381 printk(KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n", keycode,
@@ -795,8 +794,8 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
795 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); 794 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
796 input_dev->ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML); 795 input_dev->ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML);
797 input_dev->event = adbhid_kbd_event; 796 input_dev->event = adbhid_kbd_event;
798 input_dev->keycodemax = 127; 797 input_dev->keycodemax = KEY_FN;
799 input_dev->keycodesize = 1; 798 input_dev->keycodesize = sizeof(hid->keycode[0]);
800 break; 799 break;
801 800
802 case ADB_MOUSE: 801 case ADB_MOUSE:
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
index e54c4d9f6365..73c50bc02095 100644
--- a/drivers/macintosh/ans-lcd.c
+++ b/drivers/macintosh/ans-lcd.c
@@ -14,9 +14,10 @@
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <asm/sections.h> 15#include <asm/sections.h>
16#include <asm/prom.h> 16#include <asm/prom.h>
17#include <asm/ans-lcd.h>
18#include <asm/io.h> 17#include <asm/io.h>
19 18
19#include "ans-lcd.h"
20
20#define ANSLCD_ADDR 0xf301c000 21#define ANSLCD_ADDR 0xf301c000
21#define ANSLCD_CTRL_IX 0x00 22#define ANSLCD_CTRL_IX 0x00
22#define ANSLCD_DATA_IX 0x10 23#define ANSLCD_DATA_IX 0x10
diff --git a/drivers/macintosh/ans-lcd.h b/drivers/macintosh/ans-lcd.h
new file mode 100644
index 000000000000..d795b9fd2db6
--- /dev/null
+++ b/drivers/macintosh/ans-lcd.h
@@ -0,0 +1,11 @@
1#ifndef _PPC_ANS_LCD_H
2#define _PPC_ANS_LCD_H
3
4#define ANSLCD_MINOR 156
5
6#define ANSLCD_CLEAR 0x01
7#define ANSLCD_SENDCTRL 0x02
8#define ANSLCD_SETSHORTDELAY 0x03
9#define ANSLCD_SETLONGDELAY 0x04
10
11#endif
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 76c1e8e4a487..33dee3a773ed 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -13,6 +13,7 @@
13#include <linux/sysctl.h> 13#include <linux/sysctl.h>
14#include <linux/input.h> 14#include <linux/input.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kbd_kern.h>
16 17
17 18
18static struct input_dev *emumousebtn; 19static struct input_dev *emumousebtn;
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index c96b7fe882a4..ec9e5f32f0ae 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -365,10 +365,9 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
365 if (np == NULL) 365 if (np == NULL)
366 return NULL; 366 return NULL;
367 367
368 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 368 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
369 if (!dev) 369 if (!dev)
370 return NULL; 370 return NULL;
371 memset(dev, 0, sizeof(*dev));
372 371
373 dev->bus = &chip->lbus; 372 dev->bus = &chip->lbus;
374 dev->media_bay = in_bay; 373 dev->media_bay = in_bay;
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index 4177ff004753..2c21d4f25cc8 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -30,7 +30,6 @@
30#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/pmac_feature.h> 31#include <asm/pmac_feature.h>
32#include <asm/dbdma.h> 32#include <asm/dbdma.h>
33#include <asm/dbdma.h>
34#include <asm/macio.h> 33#include <asm/macio.h>
35#include <asm/keylargo.h> 34#include <asm/keylargo.h>
36 35
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index f8e1a135bf9d..d409f6759482 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -1053,10 +1053,9 @@ static int smu_open(struct inode *inode, struct file *file)
1053 struct smu_private *pp; 1053 struct smu_private *pp;
1054 unsigned long flags; 1054 unsigned long flags;
1055 1055
1056 pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL); 1056 pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL);
1057 if (pp == 0) 1057 if (pp == 0)
1058 return -ENOMEM; 1058 return -ENOMEM;
1059 memset(pp, 0, sizeof(struct smu_private));
1060 spin_lock_init(&pp->lock); 1059 spin_lock_init(&pp->lock);
1061 pp->mode = smu_file_commands; 1060 pp->mode = smu_file_commands;
1062 init_waitqueue_head(&pp->wait); 1061 init_waitqueue_head(&pp->wait);
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index f25685b9b7cf..276945d51513 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -379,13 +379,10 @@ static int attach_one_thermostat(struct i2c_adapter *adapter, int addr,
379 if (thermostat) 379 if (thermostat)
380 return 0; 380 return 0;
381 381
382 th = (struct thermostat *) 382 th = kzalloc(sizeof(struct thermostat), GFP_KERNEL);
383 kmalloc(sizeof(struct thermostat), GFP_KERNEL);
384
385 if (!th) 383 if (!th)
386 return -ENOMEM; 384 return -ENOMEM;
387 385
388 memset(th, 0, sizeof(*th));
389 th->clt.addr = addr; 386 th->clt.addr = addr;
390 th->clt.adapter = adapter; 387 th->clt.adapter = adapter;
391 th->clt.driver = &thermostat_driver; 388 th->clt.driver = &thermostat_driver;
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index dbb22403979f..e43554e754a4 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -318,10 +318,9 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
318 if (adap == NULL) 318 if (adap == NULL)
319 return NULL; 319 return NULL;
320 320
321 clt = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 321 clt = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
322 if (clt == NULL) 322 if (clt == NULL)
323 return NULL; 323 return NULL;
324 memset(clt, 0, sizeof(struct i2c_client));
325 324
326 clt->addr = (id >> 1) & 0x7f; 325 clt->addr = (id >> 1) & 0x7f;
327 clt->adapter = adap; 326 clt->adapter = adap;
@@ -1770,7 +1769,8 @@ static int call_critical_overtemp(void)
1770 "PATH=/sbin:/usr/sbin:/bin:/usr/bin", 1769 "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
1771 NULL }; 1770 NULL };
1772 1771
1773 return call_usermodehelper(critical_overtemp_path, argv, envp, 0); 1772 return call_usermodehelper(critical_overtemp_path,
1773 argv, envp, UMH_WAIT_EXEC);
1774} 1774}
1775 1775
1776 1776
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 3d0354e96a97..5452da1bb1a5 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -431,9 +431,8 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind )
431 | I2C_FUNC_SMBUS_WRITE_BYTE) ) 431 | I2C_FUNC_SMBUS_WRITE_BYTE) )
432 return 0; 432 return 0;
433 433
434 if( !(cl=kmalloc(sizeof(*cl), GFP_KERNEL)) ) 434 if( !(cl=kzalloc(sizeof(*cl), GFP_KERNEL)) )
435 return -ENOMEM; 435 return -ENOMEM;
436 memset( cl, 0, sizeof(struct i2c_client) );
437 436
438 cl->addr = addr; 437 cl->addr = addr;
439 cl->adapter = adapter; 438 cl->adapter = adapter;
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 157080b3b468..f7c509b7a8ea 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -152,10 +152,10 @@ static spinlock_t pmu_lock;
152static u8 pmu_intr_mask; 152static u8 pmu_intr_mask;
153static int pmu_version; 153static int pmu_version;
154static int drop_interrupts; 154static int drop_interrupts;
155#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 155#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
156static int option_lid_wakeup = 1; 156static int option_lid_wakeup = 1;
157#endif /* CONFIG_PM && CONFIG_PPC32 */ 157#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
158#if (defined(CONFIG_PM)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY) 158#if (defined(CONFIG_PM_SLEEP)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY)
159static int sleep_in_progress; 159static int sleep_in_progress;
160#endif 160#endif
161static unsigned long async_req_locks; 161static unsigned long async_req_locks;
@@ -410,7 +410,7 @@ static int __init via_pmu_start(void)
410 410
411 irq = irq_of_parse_and_map(vias, 0); 411 irq = irq_of_parse_and_map(vias, 0);
412 if (irq == NO_IRQ) { 412 if (irq == NO_IRQ) {
413 printk(KERN_ERR "via-pmu: can't map interruptn"); 413 printk(KERN_ERR "via-pmu: can't map interrupt\n");
414 return -ENODEV; 414 return -ENODEV;
415 } 415 }
416 if (request_irq(irq, via_pmu_interrupt, 0, "VIA-PMU", (void *)0)) { 416 if (request_irq(irq, via_pmu_interrupt, 0, "VIA-PMU", (void *)0)) {
@@ -875,7 +875,7 @@ proc_read_options(char *page, char **start, off_t off,
875{ 875{
876 char *p = page; 876 char *p = page;
877 877
878#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 878#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
879 if (pmu_kind == PMU_KEYLARGO_BASED && 879 if (pmu_kind == PMU_KEYLARGO_BASED &&
880 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) 880 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
881 p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup); 881 p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
@@ -916,7 +916,7 @@ proc_write_options(struct file *file, const char __user *buffer,
916 *(val++) = 0; 916 *(val++) = 0;
917 while(*val == ' ') 917 while(*val == ' ')
918 val++; 918 val++;
919#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 919#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
920 if (pmu_kind == PMU_KEYLARGO_BASED && 920 if (pmu_kind == PMU_KEYLARGO_BASED &&
921 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) 921 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
922 if (!strcmp(label, "lid_wakeup")) 922 if (!strcmp(label, "lid_wakeup"))
@@ -1738,7 +1738,7 @@ pmu_present(void)
1738 return via != 0; 1738 return via != 0;
1739} 1739}
1740 1740
1741#ifdef CONFIG_PM 1741#ifdef CONFIG_PM_SLEEP
1742 1742
1743static LIST_HEAD(sleep_notifiers); 1743static LIST_HEAD(sleep_notifiers);
1744 1744
@@ -1769,9 +1769,9 @@ pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n)
1769 return 0; 1769 return 0;
1770} 1770}
1771EXPORT_SYMBOL(pmu_unregister_sleep_notifier); 1771EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
1772#endif /* CONFIG_PM */ 1772#endif /* CONFIG_PM_SLEEP */
1773 1773
1774#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 1774#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
1775 1775
1776/* Sleep is broadcast last-to-first */ 1776/* Sleep is broadcast last-to-first */
1777static void broadcast_sleep(int when) 1777static void broadcast_sleep(int when)
@@ -2390,7 +2390,7 @@ powerbook_sleep_3400(void)
2390 return 0; 2390 return 0;
2391} 2391}
2392 2392
2393#endif /* CONFIG_PM && CONFIG_PPC32 */ 2393#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
2394 2394
2395/* 2395/*
2396 * Support for /dev/pmu device 2396 * Support for /dev/pmu device
@@ -2573,7 +2573,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2573 int error = -EINVAL; 2573 int error = -EINVAL;
2574 2574
2575 switch (cmd) { 2575 switch (cmd) {
2576#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 2576#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
2577 case PMU_IOC_SLEEP: 2577 case PMU_IOC_SLEEP:
2578 if (!capable(CAP_SYS_ADMIN)) 2578 if (!capable(CAP_SYS_ADMIN))
2579 return -EACCES; 2579 return -EACCES;
@@ -2601,7 +2601,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2601 return put_user(0, argp); 2601 return put_user(0, argp);
2602 else 2602 else
2603 return put_user(1, argp); 2603 return put_user(1, argp);
2604#endif /* CONFIG_PM && CONFIG_PPC32 */ 2604#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
2605 2605
2606#ifdef CONFIG_PMAC_BACKLIGHT_LEGACY 2606#ifdef CONFIG_PMAC_BACKLIGHT_LEGACY
2607 /* Compatibility ioctl's for backlight */ 2607 /* Compatibility ioctl's for backlight */
@@ -2757,7 +2757,7 @@ pmu_polled_request(struct adb_request *req)
2757 * to do suspend-to-disk. 2757 * to do suspend-to-disk.
2758 */ 2758 */
2759 2759
2760#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 2760#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
2761 2761
2762int pmu_sys_suspended; 2762int pmu_sys_suspended;
2763 2763
@@ -2792,7 +2792,7 @@ static int pmu_sys_resume(struct sys_device *sysdev)
2792 return 0; 2792 return 0;
2793} 2793}
2794 2794
2795#endif /* CONFIG_PM && CONFIG_PPC32 */ 2795#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
2796 2796
2797static struct sysdev_class pmu_sysclass = { 2797static struct sysdev_class pmu_sysclass = {
2798 set_kset_name("pmu"), 2798 set_kset_name("pmu"),
@@ -2803,10 +2803,10 @@ static struct sys_device device_pmu = {
2803}; 2803};
2804 2804
2805static struct sysdev_driver driver_pmu = { 2805static struct sysdev_driver driver_pmu = {
2806#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 2806#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
2807 .suspend = &pmu_sys_suspend, 2807 .suspend = &pmu_sys_suspend,
2808 .resume = &pmu_sys_resume, 2808 .resume = &pmu_sys_resume,
2809#endif /* CONFIG_PM && CONFIG_PPC32 */ 2809#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
2810}; 2810};
2811 2811
2812static int __init init_pmu_sysfs(void) 2812static int __init init_pmu_sysfs(void)
@@ -2841,10 +2841,10 @@ EXPORT_SYMBOL(pmu_wait_complete);
2841EXPORT_SYMBOL(pmu_suspend); 2841EXPORT_SYMBOL(pmu_suspend);
2842EXPORT_SYMBOL(pmu_resume); 2842EXPORT_SYMBOL(pmu_resume);
2843EXPORT_SYMBOL(pmu_unlock); 2843EXPORT_SYMBOL(pmu_unlock);
2844#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 2844#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
2845EXPORT_SYMBOL(pmu_enable_irled); 2845EXPORT_SYMBOL(pmu_enable_irled);
2846EXPORT_SYMBOL(pmu_battery_count); 2846EXPORT_SYMBOL(pmu_battery_count);
2847EXPORT_SYMBOL(pmu_batteries); 2847EXPORT_SYMBOL(pmu_batteries);
2848EXPORT_SYMBOL(pmu_power_flags); 2848EXPORT_SYMBOL(pmu_power_flags);
2849#endif /* CONFIG_PM && CONFIG_PPC32 */ 2849#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
2850 2850
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index dfdf11c1eec4..e2f84da09e7c 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -818,243 +818,3 @@ pmu_present(void)
818{ 818{
819 return (pmu_kind != PMU_UNKNOWN); 819 return (pmu_kind != PMU_UNKNOWN);
820} 820}
821
822#if 0 /* needs some work for 68K */
823
824/*
825 * This struct is used to store config register values for
826 * PCI devices which may get powered off when we sleep.
827 */
828static struct pci_save {
829 u16 command;
830 u16 cache_lat;
831 u16 intr;
832} *pbook_pci_saves;
833static int n_pbook_pci_saves;
834
835static inline void
836pbook_pci_save(void)
837{
838 int npci;
839 struct pci_dev *pd = NULL;
840 struct pci_save *ps;
841
842 npci = 0;
843 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL)
844 ++npci;
845 n_pbook_pci_saves = npci;
846 if (npci == 0)
847 return;
848 ps = kmalloc(npci * sizeof(*ps), GFP_KERNEL);
849 pbook_pci_saves = ps;
850 if (ps == NULL)
851 return;
852
853 pd = NULL;
854 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
855 pci_read_config_word(pd, PCI_COMMAND, &ps->command);
856 pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
857 pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
858 ++ps;
859 --npci;
860 }
861}
862
863static inline void
864pbook_pci_restore(void)
865{
866 u16 cmd;
867 struct pci_save *ps = pbook_pci_saves;
868 struct pci_dev *pd = NULL;
869 int j;
870
871 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
872 if (ps->command == 0)
873 continue;
874 pci_read_config_word(pd, PCI_COMMAND, &cmd);
875 if ((ps->command & ~cmd) == 0)
876 continue;
877 switch (pd->hdr_type) {
878 case PCI_HEADER_TYPE_NORMAL:
879 for (j = 0; j < 6; ++j)
880 pci_write_config_dword(pd,
881 PCI_BASE_ADDRESS_0 + j*4,
882 pd->resource[j].start);
883 pci_write_config_dword(pd, PCI_ROM_ADDRESS,
884 pd->resource[PCI_ROM_RESOURCE].start);
885 pci_write_config_word(pd, PCI_CACHE_LINE_SIZE,
886 ps->cache_lat);
887 pci_write_config_word(pd, PCI_INTERRUPT_LINE,
888 ps->intr);
889 pci_write_config_word(pd, PCI_COMMAND, ps->command);
890 break;
891 /* other header types not restored at present */
892 }
893 }
894}
895
896/*
897 * Put the powerbook to sleep.
898 */
899#define IRQ_ENABLE ((unsigned int *)0xf3000024)
900#define MEM_CTRL ((unsigned int *)0xf8000070)
901
902int powerbook_sleep(void)
903{
904 int ret, i, x;
905 static int save_backlight;
906 static unsigned int save_irqen;
907 unsigned long msr;
908 unsigned int hid0;
909 unsigned long p, wait;
910 struct adb_request sleep_req;
911
912 /* Notify device drivers */
913 ret = blocking_notifier_call_chain(&sleep_notifier_list,
914 PBOOK_SLEEP, NULL);
915 if (ret & NOTIFY_STOP_MASK)
916 return -EBUSY;
917
918 /* Sync the disks. */
919 /* XXX It would be nice to have some way to ensure that
920 * nobody is dirtying any new buffers while we wait. */
921 sys_sync();
922
923 /* Turn off the display backlight */
924 save_backlight = backlight_enabled;
925 if (save_backlight)
926 pmu_enable_backlight(0);
927
928 /* Give the disks a little time to actually finish writing */
929 for (wait = jiffies + (HZ/4); time_before(jiffies, wait); )
930 mb();
931
932 /* Disable all interrupts except pmu */
933 save_irqen = in_le32(IRQ_ENABLE);
934 for (i = 0; i < 32; ++i)
935 if (i != vias->intrs[0].line && (save_irqen & (1 << i)))
936 disable_irq(i);
937 asm volatile("mtdec %0" : : "r" (0x7fffffff));
938
939 /* Save the state of PCI config space for some slots */
940 pbook_pci_save();
941
942 /* Set the memory controller to keep the memory refreshed
943 while we're asleep */
944 for (i = 0x403f; i >= 0x4000; --i) {
945 out_be32(MEM_CTRL, i);
946 do {
947 x = (in_be32(MEM_CTRL) >> 16) & 0x3ff;
948 } while (x == 0);
949 if (x >= 0x100)
950 break;
951 }
952
953 /* Ask the PMU to put us to sleep */
954 pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
955 while (!sleep_req.complete)
956 mb();
957 /* displacement-flush the L2 cache - necessary? */
958 for (p = KERNELBASE; p < KERNELBASE + 0x100000; p += 0x1000)
959 i = *(volatile int *)p;
960 asleep = 1;
961
962 /* Put the CPU into sleep mode */
963 asm volatile("mfspr %0,1008" : "=r" (hid0) :);
964 hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP;
965 asm volatile("mtspr 1008,%0" : : "r" (hid0));
966 local_save_flags(msr);
967 msr |= MSR_POW | MSR_EE;
968 local_irq_restore(msr);
969 udelay(10);
970
971 /* OK, we're awake again, start restoring things */
972 out_be32(MEM_CTRL, 0x3f);
973 pbook_pci_restore();
974
975 /* wait for the PMU interrupt sequence to complete */
976 while (asleep)
977 mb();
978
979 /* reenable interrupts */
980 for (i = 0; i < 32; ++i)
981 if (i != vias->intrs[0].line && (save_irqen & (1 << i)))
982 enable_irq(i);
983
984 /* Notify drivers */
985 blocking_notifier_call_chain(&sleep_notifier_list, PBOOK_WAKE, NULL);
986
987 /* reenable ADB autopoll */
988 pmu_adb_autopoll(adb_dev_map);
989
990 /* Turn on the screen backlight, if it was on before */
991 if (save_backlight)
992 pmu_enable_backlight(1);
993
994 /* Wait for the hard disk to spin up */
995
996 return 0;
997}
998
999/*
1000 * Support for /dev/pmu device
1001 */
1002static int pmu_open(struct inode *inode, struct file *file)
1003{
1004 return 0;
1005}
1006
1007static ssize_t pmu_read(struct file *file, char *buf,
1008 size_t count, loff_t *ppos)
1009{
1010 return 0;
1011}
1012
1013static ssize_t pmu_write(struct file *file, const char *buf,
1014 size_t count, loff_t *ppos)
1015{
1016 return 0;
1017}
1018
1019static int pmu_ioctl(struct inode * inode, struct file *filp,
1020 u_int cmd, u_long arg)
1021{
1022 int error;
1023 __u32 value;
1024
1025 switch (cmd) {
1026 case PMU_IOC_SLEEP:
1027 return -ENOSYS;
1028 case PMU_IOC_GET_BACKLIGHT:
1029 return put_user(backlight_level, (__u32 *)arg);
1030 case PMU_IOC_SET_BACKLIGHT:
1031 error = get_user(value, (__u32 *)arg);
1032 if (!error)
1033 pmu_set_brightness(value);
1034 return error;
1035 case PMU_IOC_GET_MODEL:
1036 return put_user(pmu_kind, (__u32 *)arg);
1037 }
1038 return -EINVAL;
1039}
1040
1041static const struct file_operations pmu_device_fops = {
1042 .read = pmu_read,
1043 .write = pmu_write,
1044 .ioctl = pmu_ioctl,
1045 .open = pmu_open,
1046};
1047
1048static struct miscdevice pmu_device = {
1049 PMU_MINOR, "pmu", &pmu_device_fops
1050};
1051
1052void pmu_device_init(void)
1053{
1054 if (!via)
1055 return;
1056 if (misc_register(&pmu_device) < 0)
1057 printk(KERN_ERR "via-pmu68k: cannot register misc device.\n");
1058}
1059#endif /* CONFIG_PMAC_PBOOK */
1060
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index e18d265d5d33..516d943227e2 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -80,7 +80,8 @@ int wf_critical_overtemp(void)
80 "PATH=/sbin:/usr/sbin:/bin:/usr/bin", 80 "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
81 NULL }; 81 NULL };
82 82
83 return call_usermodehelper(critical_overtemp_path, argv, envp, 0); 83 return call_usermodehelper(critical_overtemp_path,
84 argv, envp, UMH_WAIT_EXEC);
84} 85}
85EXPORT_SYMBOL_GPL(wf_critical_overtemp); 86EXPORT_SYMBOL_GPL(wf_critical_overtemp);
86 87
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index a0fabf3c2008..7e10c3ab4d50 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -117,10 +117,9 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
117 DBG("wf_lm75: creating %s device at address 0x%02x\n", 117 DBG("wf_lm75: creating %s device at address 0x%02x\n",
118 ds1775 ? "ds1775" : "lm75", addr); 118 ds1775 ? "ds1775" : "lm75", addr);
119 119
120 lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL); 120 lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
121 if (lm == NULL) 121 if (lm == NULL)
122 return NULL; 122 return NULL;
123 memset(lm, 0, sizeof(struct wf_lm75_sensor));
124 123
125 /* Usual rant about sensor names not beeing very consistent in 124 /* Usual rant about sensor names not beeing very consistent in
126 * the device-tree, oh well ... 125 * the device-tree, oh well ...
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 351982bcec1b..f449d775cdf4 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -380,10 +380,12 @@ static int __init sat_sensors_init(void)
380 return i2c_add_driver(&wf_sat_driver); 380 return i2c_add_driver(&wf_sat_driver);
381} 381}
382 382
383#if 0 /* uncomment when module_exit() below is uncommented */
383static void __exit sat_sensors_exit(void) 384static void __exit sat_sensors_exit(void)
384{ 385{
385 i2c_del_driver(&wf_sat_driver); 386 i2c_del_driver(&wf_sat_driver);
386} 387}
388#endif
387 389
388module_init(sat_sensors_init); 390module_init(sat_sensors_init);
389/*module_exit(sat_sensors_exit); Uncomment when cleanup is implemented */ 391/*module_exit(sat_sensors_exit); Uncomment when cleanup is implemented */