aboutsummaryrefslogtreecommitdiff
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/adb.c5
-rw-r--r--drivers/macintosh/adbhid.c2
-rw-r--r--drivers/macintosh/macio_sysfs.c12
-rw-r--r--drivers/macintosh/mediabay.c27
-rw-r--r--drivers/macintosh/smu.c38
-rw-r--r--drivers/macintosh/therm_adt746x.c2
-rw-r--r--drivers/macintosh/therm_pm72.c4
-rw-r--r--drivers/macintosh/therm_windtunnel.c18
-rw-r--r--drivers/macintosh/via-pmu68k.c5
9 files changed, 63 insertions, 50 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 40c70ba62bf..e5d446804d3 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -46,7 +46,6 @@
#endif
-EXPORT_SYMBOL(adb_controller);
EXPORT_SYMBOL(adb_client_list);
extern struct adb_driver via_macii_driver;
@@ -80,7 +79,7 @@ static struct adb_driver *adb_driver_list[] = {
static struct class *adb_dev_class;
-struct adb_driver *adb_controller;
+static struct adb_driver *adb_controller;
BLOCKING_NOTIFIER_HEAD(adb_client_list);
static int adb_got_sleep;
static int adb_inited;
@@ -290,7 +289,7 @@ static int adb_resume(struct platform_device *dev)
}
#endif /* CONFIG_PM */
-int __init adb_init(void)
+static int __init adb_init(void)
{
struct adb_driver *driver;
int i;
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index ef4c117ea35..59ea520a5d7 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -75,7 +75,7 @@ static struct notifier_block adbhid_adb_notifier = {
#define ADB_KEY_POWER_OLD 0x7e
#define ADB_KEY_POWER 0x7f
-u16 adb_to_linux_keycodes[128] = {
+static const u16 adb_to_linux_keycodes[128] = {
/* 0x00 */ KEY_A, /* 30 */
/* 0x01 */ KEY_S, /* 31 */
/* 0x02 */ KEY_D, /* 32 */
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index 112e5ef728f..9e9453b5842 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -44,7 +44,7 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
struct of_device *ofdev = to_of_device(dev);
int len;
- len = of_device_get_modalias(ofdev, buf, PAGE_SIZE);
+ len = of_device_get_modalias(ofdev, buf, PAGE_SIZE - 2);
buf[len] = '\n';
buf[len+1] = 0;
@@ -52,6 +52,15 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
return len+1;
}
+static ssize_t devspec_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct of_device *ofdev;
+
+ ofdev = to_of_device(dev);
+ return sprintf(buf, "%s\n", ofdev->node->full_name);
+}
+
macio_config_of_attr (name, "%s\n");
macio_config_of_attr (type, "%s\n");
@@ -60,5 +69,6 @@ struct device_attribute macio_dev_attrs[] = {
__ATTR_RO(type),
__ATTR_RO(compatible),
__ATTR_RO(modalias),
+ __ATTR_RO(devspec),
__ATTR_NULL
};
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 818aba36854..b1e5b470525 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -21,6 +21,7 @@
#include <linux/init.h>
#include <linux/ide.h>
#include <linux/kthread.h>
+#include <linux/mutex.h>
#include <asm/prom.h>
#include <asm/pgtable.h>
#include <asm/io.h>
@@ -77,7 +78,7 @@ struct media_bay_info {
int index;
int cached_gpio;
int sleeping;
- struct semaphore lock;
+ struct mutex lock;
#ifdef CONFIG_BLK_DEV_IDE_PMAC
ide_hwif_t *cd_port;
void __iomem *cd_base;
@@ -459,27 +460,27 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
int timeout = 5000, index = hwif->index;
- down(&bay->lock);
+ mutex_lock(&bay->lock);
bay->cd_port = hwif;
bay->cd_base = (void __iomem *) base;
bay->cd_irq = irq;
if ((MB_CD != bay->content_id) || bay->state != mb_up) {
- up(&bay->lock);
+ mutex_unlock(&bay->lock);
return 0;
}
printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i);
do {
if (MB_IDE_READY(i)) {
bay->cd_index = index;
- up(&bay->lock);
+ mutex_unlock(&bay->lock);
return 0;
}
mdelay(1);
} while(--timeout);
printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i);
- up(&bay->lock);
+ mutex_unlock(&bay->lock);
return -ENODEV;
}
}
@@ -617,10 +618,10 @@ static int media_bay_task(void *x)
while (!kthread_should_stop()) {
for (i = 0; i < media_bay_count; ++i) {
- down(&media_bays[i].lock);
+ mutex_lock(&media_bays[i].lock);
if (!media_bays[i].sleeping)
media_bay_step(i);
- up(&media_bays[i].lock);
+ mutex_unlock(&media_bays[i].lock);
}
msleep_interruptible(MB_POLL_DELAY);
@@ -660,7 +661,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de
bay->index = i;
bay->ops = match->data;
bay->sleeping = 0;
- init_MUTEX(&bay->lock);
+ mutex_init(&bay->lock);
/* Init HW probing */
if (bay->ops->init)
@@ -698,10 +699,10 @@ static int media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
if (state.event != mdev->ofdev.dev.power.power_state.event
&& (state.event & PM_EVENT_SLEEP)) {
- down(&bay->lock);
+ mutex_lock(&bay->lock);
bay->sleeping = 1;
set_mb_power(bay, 0);
- up(&bay->lock);
+ mutex_unlock(&bay->lock);
msleep(MB_POLL_DELAY);
mdev->ofdev.dev.power.power_state = state;
}
@@ -720,12 +721,12 @@ static int media_bay_resume(struct macio_dev *mdev)
they seem to help the 3400 get it right.
*/
/* Force MB power to 0 */
- down(&bay->lock);
+ mutex_lock(&bay->lock);
set_mb_power(bay, 0);
msleep(MB_POWER_DELAY);
if (bay->ops->content(bay) != bay->content_id) {
printk("mediabay%d: content changed during sleep...\n", bay->index);
- up(&bay->lock);
+ mutex_unlock(&bay->lock);
return 0;
}
set_mb_power(bay, 1);
@@ -741,7 +742,7 @@ static int media_bay_resume(struct macio_dev *mdev)
} while((bay->state != mb_empty) &&
(bay->state != mb_up));
bay->sleeping = 0;
- up(&bay->lock);
+ mutex_unlock(&bay->lock);
}
return 0;
}
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 32cb0298f88..96faa799b82 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -36,6 +36,8 @@
#include <linux/sysdev.h>
#include <linux/poll.h>
#include <linux/mutex.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
#include <asm/byteorder.h>
#include <asm/io.h>
@@ -46,8 +48,6 @@
#include <asm/sections.h>
#include <asm/abs_addr.h>
#include <asm/uaccess.h>
-#include <asm/of_device.h>
-#include <asm/of_platform.h>
#define VERSION "0.7"
#define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp."
@@ -475,6 +475,7 @@ int __init smu_init (void)
{
struct device_node *np;
const u32 *data;
+ int ret = 0;
np = of_find_node_by_type(NULL, "smu");
if (np == NULL)
@@ -484,16 +485,11 @@ int __init smu_init (void)
if (smu_cmdbuf_abs == 0) {
printk(KERN_ERR "SMU: Command buffer not allocated !\n");
- of_node_put(np);
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail_np;
}
smu = alloc_bootmem(sizeof(struct smu_device));
- if (smu == NULL) {
- of_node_put(np);
- return -ENOMEM;
- }
- memset(smu, 0, sizeof(*smu));
spin_lock_init(&smu->lock);
INIT_LIST_HEAD(&smu->cmd_list);
@@ -511,14 +507,14 @@ int __init smu_init (void)
smu->db_node = of_find_node_by_name(NULL, "smu-doorbell");
if (smu->db_node == NULL) {
printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
- goto fail;
+ ret = -ENXIO;
+ goto fail_bootmem;
}
data = of_get_property(smu->db_node, "reg", NULL);
if (data == NULL) {
- of_node_put(smu->db_node);
- smu->db_node = NULL;
printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n");
- goto fail;
+ ret = -ENXIO;
+ goto fail_db_node;
}
/* Current setup has one doorbell GPIO that does both doorbell
@@ -552,7 +548,8 @@ int __init smu_init (void)
smu->db_buf = ioremap(0x8000860c, 0x1000);
if (smu->db_buf == NULL) {
printk(KERN_ERR "SMU: Can't map doorbell buffer pointer !\n");
- goto fail;
+ ret = -ENXIO;
+ goto fail_msg_node;
}
/* U3 has an issue with NAP mode when issuing SMU commands */
@@ -563,10 +560,17 @@ int __init smu_init (void)
sys_ctrler = SYS_CTRLER_SMU;
return 0;
- fail:
+fail_msg_node:
+ if (smu->msg_node)
+ of_node_put(smu->msg_node);
+fail_db_node:
+ of_node_put(smu->db_node);
+fail_bootmem:
+ free_bootmem((unsigned long)smu, sizeof(struct smu_device));
smu = NULL;
- return -ENXIO;
-
+fail_np:
+ of_node_put(np);
+ return ret;
}
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 5366dc93fb3..22bf981d393 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -24,13 +24,13 @@
#include <linux/kthread.h>
#include <linux/moduleparam.h>
#include <linux/freezer.h>
+#include <linux/of_platform.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/sections.h>
-#include <asm/of_platform.h>
#undef DEBUG
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index ddfb426a9ab..817607e2af6 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -123,14 +123,14 @@
#include <linux/i2c.h>
#include <linux/kthread.h>
#include <linux/mutex.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/sections.h>
-#include <asm/of_device.h>
#include <asm/macio.h>
-#include <asm/of_platform.h>
#include "therm_pm72.h"
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index d11821af3b8..3da0a02efd7 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -37,13 +37,13 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/kthread.h>
+#include <linux/of_platform.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/sections.h>
-#include <asm/of_platform.h>
#include <asm/macio.h>
#define LOG_TEMP 0 /* continously log temperature */
@@ -62,7 +62,7 @@ static struct {
volatile int running;
struct task_struct *poll_task;
- struct semaphore lock;
+ struct mutex lock;
struct of_device *of_dev;
struct i2c_client *thermostat;
@@ -286,23 +286,23 @@ restore_regs( void )
static int control_loop(void *dummy)
{
- down(&x.lock);
+ mutex_lock(&x.lock);
setup_hardware();
- up(&x.lock);
+ mutex_unlock(&x.lock);
for (;;) {
msleep_interruptible(8000);
if (kthread_should_stop())
break;
- down(&x.lock);
+ mutex_lock(&x.lock);
poll_temp();
- up(&x.lock);
+ mutex_unlock(&x.lock);
}
- down(&x.lock);
+ mutex_lock(&x.lock);
restore_regs();
- up(&x.lock);
+ mutex_unlock(&x.lock);
return 0;
}
@@ -489,7 +489,7 @@ g4fan_init( void )
const struct apple_thermal_info *info;
struct device_node *np;
- init_MUTEX( &x.lock );
+ mutex_init(&x.lock);
if( !(np=of_find_node_by_name(NULL, "power-mgt")) )
return -ENODEV;
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index e2f84da09e7..b64741c95ac 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -101,7 +101,6 @@ static int pmu_kind = PMU_UNKNOWN;
static int pmu_fully_inited;
int asleep;
-BLOCKING_NOTIFIER_HEAD(sleep_notifier_list);
static int pmu_probe(void);
static int pmu_init(void);
@@ -741,8 +740,8 @@ pmu_handle_data(unsigned char *data, int len)
}
}
-int backlight_level = -1;
-int backlight_enabled = 0;
+static int backlight_level = -1;
+static int backlight_enabled = 0;
#define LEVEL_TO_BRIGHT(lev) ((lev) < 1? 0x7f: 0x4a - ((lev) << 1))