From 890c8ce6ae2054404991641b7a66d675a4832604 Mon Sep 17 00:00:00 2001 From: Michael Young Date: Jan 24 2011 21:47:01 +0000 Subject: Merge branch 'rawhide/user/kyle/kernel-git' into rawhide/user/myoung/xendom0 Conflicts: config-x86-generic config-x86_64-generic kernel.spec --- diff --git a/0001-use-__devexit-not-__exit-in-n2_unregister_algs-fixes.patch b/0001-use-__devexit-not-__exit-in-n2_unregister_algs-fixes.patch deleted file mode 100644 index a5c4c12..0000000 --- a/0001-use-__devexit-not-__exit-in-n2_unregister_algs-fixes.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 56a2432f60ea0a0c85a93b0951ae8507e5b85270 Mon Sep 17 00:00:00 2001 -From: dennis -Date: Wed, 5 Jan 2011 19:43:25 +0000 -Subject: [PATCH] use __devexit not __exit in n2_unregister_algs fixes build failure on fedora - -thanks to kylem for helping with debugging ---- - drivers/crypto/n2_core.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c -index 88ee015..3372491 100644 ---- a/drivers/crypto/n2_core.c -+++ b/drivers/crypto/n2_core.c -@@ -1542,7 +1542,7 @@ out: - return err; - } - --static void __exit n2_unregister_algs(void) -+static void __devexit n2_unregister_algs(void) - { - mutex_lock(&spu_lock); - if (!--algs_registered) --- -1.6.6.1 - diff --git a/Makefile b/Makefile index ca62cce..705670f 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,8 @@ debug: @perl -pi -e 's/# CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER is not set/CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y/' config-nodebug @perl -pi -e 's/# CONFIG_TEST_LIST_SORT is not set/CONFIG_TEST_LIST_SORT=y/' config-nodebug + @perl -pi -e 's/# CONFIG_DEBUG_SET_MODULE_RONX is not set/CONFIG_DEBUG_SET_MODULE_RONX=y/' config-nodebug + @# just in case we're going from extremedebug -> debug @perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug @@ -171,6 +173,8 @@ release: @perl -pi -e 's/CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y/# CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER is not set/' config-nodebug @perl -pi -e 's/CONFIG_TEST_LIST_SORT=y/# CONFIG_TEST_LIST_SORT is not set/' config-nodebug + @perl -pi -e 's/CONFIG_DEBUG_SET_MODULE_RONX=y/# CONFIG_DEBUG_SET_MODULE_RONX is not set/' config-nodebug + @perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-debug @perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug diff --git a/acpi-update-battery-information-on-notification-0x81.patch b/acpi-update-battery-information-on-notification-0x81.patch deleted file mode 100644 index 7f2c645..0000000 --- a/acpi-update-battery-information-on-notification-0x81.patch +++ /dev/null @@ -1,94 +0,0 @@ -From kyle@infradead.org Wed Sep 22 18:35:38 2010 -From: Matthew Garrett -To: linux-acpi@vger.kernel.org -Cc: linux-kernel@vger.kernel.org, Matthew Garrett -Subject: [PATCH] acpi: Update battery information on notification 0x81 -Date: Mon, 16 Aug 2010 16:32:19 -0400 - -A notification event 0x81 from an ACPI battery device requires us to -re-read the battery information structure. Do so, and if the battery's -reporting units have changed (as is the case on some Thinkpads) destroy -and recreate the battery in order to populate the fields correctly. - -Signed-off-by: Matthew Garrett ---- - - drivers/acpi/battery.c | 21 ++++++++++++++++----- - 1 files changed, 16 insertions(+), 5 deletions(-) - -diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c -index 95649d3..161e43a 100644 ---- a/drivers/acpi/battery.c -+++ b/drivers/acpi/battery.c -@@ -152,6 +152,7 @@ static int acpi_battery_technology(struct acpi_battery *battery) - return POWER_SUPPLY_TECHNOLOGY_UNKNOWN; - } - -+static int acpi_battery_update(struct acpi_battery *battery, bool get_info); - static int acpi_battery_get_state(struct acpi_battery *battery); - - static int acpi_battery_is_charged(struct acpi_battery *battery) -@@ -605,9 +606,11 @@ static void acpi_battery_quirks2(struct acpi_battery *battery) - } - } - --static int acpi_battery_update(struct acpi_battery *battery) -+static int acpi_battery_update(struct acpi_battery *battery, bool get_info) - { - int result, old_present = acpi_battery_present(battery); -+ int old_power_unit = battery->power_unit; -+ - result = acpi_battery_get_status(battery); - if (result) - return result; -@@ -626,6 +629,14 @@ static int acpi_battery_update(struct acpi_battery *battery) - } - if (!battery->bat.dev) - sysfs_add_battery(battery); -+ if (get_info) { -+ acpi_battery_get_info(battery); -+ if (old_power_unit != battery->power_unit) { -+ /* The battery has changed its reporting units */ -+ sysfs_remove_battery(battery); -+ sysfs_add_battery(battery); -+ } -+ } - result = acpi_battery_get_state(battery); - acpi_battery_quirks2(battery); - return result; -@@ -803,7 +814,7 @@ static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = { - static int acpi_battery_read(int fid, struct seq_file *seq) - { - struct acpi_battery *battery = seq->private; -- int result = acpi_battery_update(battery); -+ int result = acpi_battery_update(battery, false); - return acpi_print_funcs[fid](seq, result); - } - -@@ -914,7 +925,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) - if (!battery) - return; - old = battery->bat.dev; -- acpi_battery_update(battery); -+ acpi_battery_update(battery, (event == ACPI_BATTERY_NOTIFY_INFO)); - acpi_bus_generate_proc_event(device, event, - acpi_battery_present(battery)); - acpi_bus_generate_netlink_event(device->pnp.device_class, -@@ -943,7 +954,7 @@ static int acpi_battery_add(struct acpi_device *device) - if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, - "_BIX", &handle))) - set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); -- acpi_battery_update(battery); -+ acpi_battery_update(battery, false); - #ifdef CONFIG_ACPI_PROCFS_POWER - result = acpi_battery_add_fs(device); - #endif -@@ -984,7 +995,7 @@ static int acpi_battery_resume(struct acpi_device *device) - return -EINVAL; - battery = acpi_driver_data(device); - battery->update_time = 0; -- acpi_battery_update(battery); -+ acpi_battery_update(battery, true); - return 0; - } - diff --git a/applesmc_update.patch b/applesmc_update.patch deleted file mode 100644 index d421468..0000000 --- a/applesmc_update.patch +++ /dev/null @@ -1,2293 +0,0 @@ -Update the applesmc driver. Should work on all hardware. Upstream in .38? - -diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c -index b6598aa..0d7e9ae 100644 ---- a/drivers/hwmon/applesmc.c -+++ b/drivers/hwmon/applesmc.c -@@ -4,6 +4,7 @@ - * computers. - * - * Copyright (C) 2007 Nicolas Boichat -+ * Copyright (C) 2010 Henrik Rydberg - * - * Based on hdaps.c driver: - * Copyright (C) 2005 Robert Love -@@ -26,10 +27,12 @@ - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ - #include --#include - #include - #include -+#include - #include - #include - #include -@@ -39,16 +42,23 @@ - #include - #include - #include -+#include -+#include -+#include -+#include - - /* data port used by Apple SMC */ --#define APPLESMC_DATA_PORT 0x300 -+#define APPLESMC_DATA_PORT 0x0 - /* command/status port used by Apple SMC */ --#define APPLESMC_CMD_PORT 0x304 -+#define APPLESMC_CMD_PORT 0x4 -+/* interrupt status port */ -+#define APPLESMC_ISR_PORT 0x1f - - #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */ - - #define APPLESMC_MAX_DATA_LENGTH 32 - -+/* wait up to 32 ms for a status change. */ - #define APPLESMC_MIN_WAIT 0x0040 - #define APPLESMC_MAX_WAIT 0x8000 - -@@ -71,106 +81,19 @@ - #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */ - #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */ - -+#define NOTIFICATION_KEY "NTOK" -+ - #define FANS_COUNT "FNum" /* r-o ui8 */ - #define FANS_MANUAL "FS! " /* r-w ui16 */ --#define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */ --#define FAN_MIN_SPEED "F0Mn" /* r-o fpe2 (2 bytes) */ --#define FAN_MAX_SPEED "F0Mx" /* r-o fpe2 (2 bytes) */ --#define FAN_SAFE_SPEED "F0Sf" /* r-o fpe2 (2 bytes) */ --#define FAN_TARGET_SPEED "F0Tg" /* r-w fpe2 (2 bytes) */ --#define FAN_POSITION "F0ID" /* r-o char[16] */ -- --/* -- * Temperature sensors keys (sp78 - 2 bytes). -- */ --static const char *temperature_sensors_sets[][41] = { --/* Set 0: Macbook Pro */ -- { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", -- "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, --/* Set 1: Macbook2 set */ -- { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "TTF0", "Th0H", -- "Th0S", "Th1H", NULL }, --/* Set 2: Macbook set */ -- { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", -- "Th1H", "Ts0P", NULL }, --/* Set 3: Macmini set */ -- { "TC0D", "TC0P", NULL }, --/* Set 4: Mac Pro (2 x Quad-Core) */ -- { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", -- "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", -- "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", -- "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", -- "TM9S", "TN0H", "TS0C", NULL }, --/* Set 5: iMac */ -- { "TC0D", "TA0P", "TG0P", "TG0D", "TG0H", "TH0P", "Tm0P", "TO0P", -- "Tp0C", NULL }, --/* Set 6: Macbook3 set */ -- { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TTF0", "TW0P", "Th0H", -- "Th0S", "Th1H", NULL }, --/* Set 7: Macbook Air */ -- { "TB0T", "TB1S", "TB1T", "TB2S", "TB2T", "TC0D", "TC0P", "TCFP", -- "TTF0", "TW0P", "Th0H", "Tp0P", "TpFP", "Ts0P", "Ts0S", NULL }, --/* Set 8: Macbook Pro 4,1 (Penryn) */ -- { "TB0T", "TC0D", "TC0P", "TG0D", "TG0H", "TTF0", "TW0P", "Th0H", -- "Th1H", "Th2H", "Tm0P", "Ts0P", NULL }, --/* Set 9: Macbook Pro 3,1 (Santa Rosa) */ -- { "TALP", "TB0T", "TC0D", "TC0P", "TG0D", "TG0H", "TTF0", "TW0P", -- "Th0H", "Th1H", "Th2H", "Tm0P", "Ts0P", NULL }, --/* Set 10: iMac 5,1 */ -- { "TA0P", "TC0D", "TC0P", "TG0D", "TH0P", "TO0P", "Tm0P", NULL }, --/* Set 11: Macbook 5,1 */ -- { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0P", "TN0D", "TN0P", -- "TTF0", "Th0H", "Th1H", "ThFH", "Ts0P", "Ts0S", NULL }, --/* Set 12: Macbook Pro 5,1 */ -- { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TG0D", -- "TG0F", "TG0H", "TG0P", "TG0T", "TG1H", "TN0D", "TN0P", "TTF0", -- "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL }, --/* Set 13: iMac 8,1 */ -- { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TG0P", "TH0P", -- "TL0P", "TO0P", "TW0P", "Tm0P", "Tp0P", NULL }, --/* Set 14: iMac 6,1 */ -- { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TG0P", "TH0P", -- "TO0P", "Tp0P", NULL }, --/* Set 15: MacBook Air 2,1 */ -- { "TB0T", "TB1S", "TB1T", "TB2S", "TB2T", "TC0D", "TN0D", "TTF0", -- "TV0P", "TVFP", "TW0P", "Th0P", "Tp0P", "Tp1P", "TpFP", "Ts0P", -- "Ts0S", NULL }, --/* Set 16: Mac Pro 3,1 (2 x Quad-Core) */ -- { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", -- "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "TH0P", "TH1P", -- "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", "TM1P", -- "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", "TM9S", -- "TN0C", "TN0D", "TN0H", "TS0C", "Tp0C", "Tp1C", "Tv0S", "Tv1S", -- NULL }, --/* Set 17: iMac 9,1 */ -- { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TH0P", "TL0P", -- "TN0D", "TN0H", "TN0P", "TO0P", "Tm0P", "Tp0P", NULL }, --/* Set 18: MacBook Pro 2,2 */ -- { "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "TM0P", "TTF0", -- "Th0H", "Th1H", "Tm0P", "Ts0P", NULL }, --/* Set 19: Macbook Pro 5,3 */ -- { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TG0D", -- "TG0F", "TG0H", "TG0P", "TG0T", "TN0D", "TN0P", "TTF0", "Th2H", -- "Tm0P", "Ts0P", "Ts0S", NULL }, --/* Set 20: MacBook Pro 5,4 */ -- { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TN0D", -- "TN0P", "TTF0", "Th2H", "Ts0P", "Ts0S", NULL }, --/* Set 21: MacBook Pro 6,2 */ -- { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", "TC0P", "TC1C", "TG0D", -- "TG0P", "TG0T", "TMCD", "TP0P", "TPCD", "Th1H", "Th2H", "Tm0P", -- "Ts0P", "Ts0S", NULL }, --/* Set 22: MacBook Pro 7,1 */ -- { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", -- "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, --}; -+#define FAN_ID_FMT "F%dID" /* r-o char[16] */ - - /* List of keys used to read/write fan speeds */ --static const char* fan_speed_keys[] = { -- FAN_ACTUAL_SPEED, -- FAN_MIN_SPEED, -- FAN_MAX_SPEED, -- FAN_SAFE_SPEED, -- FAN_TARGET_SPEED -+static const char *const fan_speed_fmt[] = { -+ "F%dAc", /* actual speed */ -+ "F%dMn", /* minimum speed (rw) */ -+ "F%dMx", /* maximum speed */ -+ "F%dSf", /* safe speed - not all models */ -+ "F%dTg", /* target speed (manual: rw) */ - }; - - #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */ -@@ -184,18 +107,58 @@ static const char* fan_speed_keys[] = { - #define SENSOR_Y 1 - #define SENSOR_Z 2 - --/* Structure to be passed to DMI_MATCH function */ --struct dmi_match_data { --/* Indicates whether this computer has an accelerometer. */ -- int accelerometer; --/* Indicates whether this computer has light sensors and keyboard backlight. */ -- int light; --/* Indicates which temperature sensors set to use. */ -- int temperature_set; -+#define to_index(attr) (to_sensor_dev_attr(attr)->index & 0xffff) -+#define to_option(attr) (to_sensor_dev_attr(attr)->index >> 16) -+ -+struct applesmc_pnp_device { -+ int iobase; -+ int iolen; -+ int irq; -+}; -+ -+struct pnp_dev *pdev; -+struct applesmc_pnp_device *pnp_device; -+ -+/* Dynamic device node attributes */ -+struct applesmc_dev_attr { -+ struct sensor_device_attribute sda; /* hwmon attributes */ -+ char name[32]; /* room for node file name */ -+}; -+ -+/* Dynamic device node group */ -+struct applesmc_node_group { -+ char *format; /* format string */ -+ void *show; /* show function */ -+ void *store; /* store function */ -+ int option; /* function argument */ -+ struct applesmc_dev_attr *nodes; /* dynamic node array */ - }; - -+/* AppleSMC entry - cached register information */ -+struct applesmc_entry { -+ char key[5]; /* four-letter key code */ -+ u8 valid; /* set when entry is successfully read once */ -+ u8 len; /* bounded by APPLESMC_MAX_DATA_LENGTH */ -+ char type[5]; /* four-letter type code */ -+ u8 flags; /* 0x10: func; 0x40: write; 0x80: read */ -+}; -+ -+/* Register lookup and registers common to all SMCs */ -+static struct applesmc_registers { -+ struct mutex mutex; /* register read/write mutex */ -+ unsigned int key_count; /* number of SMC registers */ -+ unsigned int fan_count; /* number of fans */ -+ unsigned int temp_count; /* number of temperature registers */ -+ unsigned int temp_begin; /* temperature lower index bound */ -+ unsigned int temp_end; /* temperature upper index bound */ -+ int num_light_sensors; /* number of light sensors */ -+ bool has_accelerometer; /* has motion sensor */ -+ bool has_key_backlight; /* has keyboard backlight */ -+ bool init_complete; /* true when fully initialized */ -+ struct applesmc_entry *cache; /* cached key entries */ -+} smcreg; -+ - static const int debug; --static struct platform_device *pdev; - static s16 rest_x; - static s16 rest_y; - static u8 backlight_state[2]; -@@ -203,20 +166,6 @@ static u8 backlight_state[2]; - static struct device *hwmon_dev; - static struct input_polled_dev *applesmc_idev; - --/* Indicates whether this computer has an accelerometer. */ --static unsigned int applesmc_accelerometer; -- --/* Indicates whether this computer has light sensors and keyboard backlight. */ --static unsigned int applesmc_light; -- --/* The number of fans handled by the driver */ --static unsigned int fans_handled; -- --/* Indicates which temperature sensors set to use. */ --static unsigned int applesmc_temperature_set; -- --static DEFINE_MUTEX(applesmc_lock); -- - /* - * Last index written to key_at_index sysfs file, and value to use for all other - * key_at_index_* sysfs files. -@@ -225,6 +174,16 @@ static unsigned int key_at_index; - - static struct workqueue_struct *applesmc_led_wq; - -+static u8 applesmc_read_reg(u8 reg) -+{ -+ return inb(pnp_device->iobase + reg); -+} -+ -+static void applesmc_write_reg(u8 val, u8 reg) -+{ -+ outb(val, pnp_device->iobase + reg); -+} -+ - /* - * __wait_status - Wait up to 32ms for the status port to get a certain value - * (masked with 0x0f), returning zero if the value is obtained. Callers must -@@ -238,18 +197,12 @@ static int __wait_status(u8 val) - - for (us = APPLESMC_MIN_WAIT; us < APPLESMC_MAX_WAIT; us <<= 1) { - udelay(us); -- if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) { -- if (debug) -- printk(KERN_DEBUG -- "Waited %d us for status %x\n", -- 2 * us - APPLESMC_MIN_WAIT, val); -+ if ((applesmc_read_reg(APPLESMC_CMD_PORT) -+ & APPLESMC_STATUS_MASK) == val) { - return 0; - } - } - -- printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n", -- val, inb(APPLESMC_CMD_PORT)); -- - return -EIO; - } - -@@ -262,162 +215,246 @@ static int send_command(u8 cmd) - { - int us; - for (us = APPLESMC_MIN_WAIT; us < APPLESMC_MAX_WAIT; us <<= 1) { -- outb(cmd, APPLESMC_CMD_PORT); -+ applesmc_write_reg(cmd, APPLESMC_CMD_PORT); - udelay(us); -- if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == 0x0c) -+ if ((applesmc_read_reg(APPLESMC_CMD_PORT) -+ & APPLESMC_STATUS_MASK) == 0x0c) - return 0; - } -- printk(KERN_WARNING "applesmc: command failed: %x -> %x\n", -- cmd, inb(APPLESMC_CMD_PORT)); - return -EIO; - } - --/* -- * applesmc_read_key - reads len bytes from a given key, and put them in buffer. -- * Returns zero on success or a negative error on failure. Callers must -- * hold applesmc_lock. -- */ --static int applesmc_read_key(const char* key, u8* buffer, u8 len) -+static int send_argument(const char *key) - { - int i; - -- if (len > APPLESMC_MAX_DATA_LENGTH) { -- printk(KERN_ERR "applesmc_read_key: cannot read more than " -- "%d bytes\n", APPLESMC_MAX_DATA_LENGTH); -- return -EINVAL; -- } -- -- if (send_command(APPLESMC_READ_CMD)) -- return -EIO; -- - for (i = 0; i < 4; i++) { -- outb(key[i], APPLESMC_DATA_PORT); -+ applesmc_write_reg(key[i], APPLESMC_DATA_PORT); - if (__wait_status(0x04)) - return -EIO; - } -- if (debug) -- printk(KERN_DEBUG "<%s", key); -+ return 0; -+} - -- outb(len, APPLESMC_DATA_PORT); -- if (debug) -- printk(KERN_DEBUG ">%x", len); -+static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) -+{ -+ int i; -+ -+ if (send_command(cmd) || send_argument(key)) { -+ pr_warn("%s: read arg fail\n", key); -+ return -EIO; -+ } -+ -+ applesmc_write_reg(len, APPLESMC_DATA_PORT); - - for (i = 0; i < len; i++) { -- if (__wait_status(0x05)) -+ if (__wait_status(0x05)) { -+ pr_warn("%s: read data fail\n", key); - return -EIO; -- buffer[i] = inb(APPLESMC_DATA_PORT); -- if (debug) -- printk(KERN_DEBUG "<%x", buffer[i]); -+ } -+ buffer[i] = applesmc_read_reg(APPLESMC_DATA_PORT); - } -- if (debug) -- printk(KERN_DEBUG "\n"); - - return 0; - } - --/* -- * applesmc_write_key - writes len bytes from buffer to a given key. -- * Returns zero on success or a negative error on failure. Callers must -- * hold applesmc_lock. -- */ --static int applesmc_write_key(const char* key, u8* buffer, u8 len) -+static int write_smc(u8 cmd, const char *key, const u8 *buffer, u8 len) - { - int i; - -- if (len > APPLESMC_MAX_DATA_LENGTH) { -- printk(KERN_ERR "applesmc_write_key: cannot write more than " -- "%d bytes\n", APPLESMC_MAX_DATA_LENGTH); -- return -EINVAL; -- } -- -- if (send_command(APPLESMC_WRITE_CMD)) -+ if (send_command(cmd) || send_argument(key)) { -+ pr_warn("%s: write arg fail\n", key); - return -EIO; -- -- for (i = 0; i < 4; i++) { -- outb(key[i], APPLESMC_DATA_PORT); -- if (__wait_status(0x04)) -- return -EIO; - } - -- outb(len, APPLESMC_DATA_PORT); -+ applesmc_write_reg(len, APPLESMC_DATA_PORT); - - for (i = 0; i < len; i++) { -- if (__wait_status(0x04)) -+ if (__wait_status(0x04)) { -+ pr_warn("%s: write data fail\n", key); - return -EIO; -- outb(buffer[i], APPLESMC_DATA_PORT); -+ } -+ applesmc_write_reg(buffer[i], APPLESMC_DATA_PORT); - } - - return 0; - } - -+static int read_register_count(unsigned int *count) -+{ -+ __be32 be; -+ int ret; -+ -+ ret = read_smc(APPLESMC_READ_CMD, KEY_COUNT_KEY, (u8 *)&be, 4); -+ if (ret) -+ return ret; -+ -+ *count = be32_to_cpu(be); -+ return 0; -+} -+ - /* -- * applesmc_get_key_at_index - get key at index, and put the result in key -- * (char[6]). Returns zero on success or a negative error on failure. Callers -- * must hold applesmc_lock. -+ * Serialized I/O -+ * -+ * Returns zero on success or a negative error on failure. -+ * All functions below are concurrency safe - callers should NOT hold lock. - */ --static int applesmc_get_key_at_index(int index, char* key) -+ -+static int applesmc_read_entry(const struct applesmc_entry *entry, -+ u8 *buf, u8 len) - { -- int i; -- u8 readkey[4]; -- readkey[0] = index >> 24; -- readkey[1] = index >> 16; -- readkey[2] = index >> 8; -- readkey[3] = index; -+ int ret; - -- if (send_command(APPLESMC_GET_KEY_BY_INDEX_CMD)) -- return -EIO; -+ if (entry->len != len) -+ return -EINVAL; -+ mutex_lock(&smcreg.mutex); -+ ret = read_smc(APPLESMC_READ_CMD, entry->key, buf, len); -+ mutex_unlock(&smcreg.mutex); - -- for (i = 0; i < 4; i++) { -- outb(readkey[i], APPLESMC_DATA_PORT); -- if (__wait_status(0x04)) -- return -EIO; -+ return ret; -+} -+ -+static int applesmc_write_entry(const struct applesmc_entry *entry, -+ const u8 *buf, u8 len) -+{ -+ int ret; -+ -+ if (entry->len != len) -+ return -EINVAL; -+ mutex_lock(&smcreg.mutex); -+ ret = write_smc(APPLESMC_WRITE_CMD, entry->key, buf, len); -+ mutex_unlock(&smcreg.mutex); -+ return ret; -+} -+ -+static const struct applesmc_entry *applesmc_get_entry_by_index(int index) -+{ -+ struct applesmc_entry *cache = &smcreg.cache[index]; -+ u8 key[4], info[6]; -+ __be32 be; -+ int ret = 0; -+ -+ if (cache->valid) -+ return cache; -+ -+ mutex_lock(&smcreg.mutex); -+ -+ if (cache->valid) -+ goto out; -+ be = cpu_to_be32(index); -+ ret = read_smc(APPLESMC_GET_KEY_BY_INDEX_CMD, (u8 *)&be, key, 4); -+ if (ret) -+ goto out; -+ ret = read_smc(APPLESMC_GET_KEY_TYPE_CMD, key, info, 6); -+ if (ret) -+ goto out; -+ -+ memcpy(cache->key, key, 4); -+ cache->len = info[0]; -+ memcpy(cache->type, &info[1], 4); -+ cache->flags = info[5]; -+ cache->valid = 1; -+ -+out: -+ mutex_unlock(&smcreg.mutex); -+ if (ret) -+ return ERR_PTR(ret); -+ return cache; -+} -+ -+static int applesmc_get_lower_bound(unsigned int *lo, const char *key) -+{ -+ int begin = 0, end = smcreg.key_count; -+ const struct applesmc_entry *entry; -+ -+ while (begin != end) { -+ int middle = begin + (end - begin) / 2; -+ entry = applesmc_get_entry_by_index(middle); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ if (strcmp(entry->key, key) < 0) -+ begin = middle + 1; -+ else -+ end = middle; - } - -- outb(4, APPLESMC_DATA_PORT); -+ *lo = begin; -+ return 0; -+} - -- for (i = 0; i < 4; i++) { -- if (__wait_status(0x05)) -- return -EIO; -- key[i] = inb(APPLESMC_DATA_PORT); -+static int applesmc_get_upper_bound(unsigned int *hi, const char *key) -+{ -+ int begin = 0, end = smcreg.key_count; -+ const struct applesmc_entry *entry; -+ -+ while (begin != end) { -+ int middle = begin + (end - begin) / 2; -+ entry = applesmc_get_entry_by_index(middle); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ if (strcmp(key, entry->key) < 0) -+ end = middle; -+ else -+ begin = middle + 1; - } -- key[4] = 0; - -+ *hi = begin; - return 0; - } - --/* -- * applesmc_get_key_type - get key type, and put the result in type (char[6]). -- * Returns zero on success or a negative error on failure. Callers must -- * hold applesmc_lock. -- */ --static int applesmc_get_key_type(char* key, char* type) -+static const struct applesmc_entry *applesmc_get_entry_by_key(const char *key) - { -- int i; -+ int begin, end; -+ int ret; - -- if (send_command(APPLESMC_GET_KEY_TYPE_CMD)) -- return -EIO; -+ ret = applesmc_get_lower_bound(&begin, key); -+ if (ret) -+ return ERR_PTR(ret); -+ ret = applesmc_get_upper_bound(&end, key); -+ if (ret) -+ return ERR_PTR(ret); -+ if (end - begin != 1) -+ return ERR_PTR(-EINVAL); - -- for (i = 0; i < 4; i++) { -- outb(key[i], APPLESMC_DATA_PORT); -- if (__wait_status(0x04)) -- return -EIO; -- } -+ return applesmc_get_entry_by_index(begin); -+} - -- outb(6, APPLESMC_DATA_PORT); -+static int applesmc_read_key(const char *key, u8 *buffer, u8 len) -+{ -+ const struct applesmc_entry *entry; - -- for (i = 0; i < 6; i++) { -- if (__wait_status(0x05)) -- return -EIO; -- type[i] = inb(APPLESMC_DATA_PORT); -- } -- type[5] = 0; -+ entry = applesmc_get_entry_by_key(key); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ -+ return applesmc_read_entry(entry, buffer, len); -+} -+ -+static int applesmc_write_key(const char *key, const u8 *buffer, u8 len) -+{ -+ const struct applesmc_entry *entry; -+ -+ entry = applesmc_get_entry_by_key(key); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ -+ return applesmc_write_entry(entry, buffer, len); -+} -+ -+static int applesmc_has_key(const char *key, bool *value) -+{ -+ const struct applesmc_entry *entry; - -+ entry = applesmc_get_entry_by_key(key); -+ if (IS_ERR(entry) && PTR_ERR(entry) != -EINVAL) -+ return PTR_ERR(entry); -+ -+ *value = !IS_ERR(entry); - return 0; - } - - /* -- * applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). Callers must -- * hold applesmc_lock. -+ * applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). - */ - static int applesmc_read_motion_sensor(int index, s16* value) - { -@@ -444,100 +481,130 @@ static int applesmc_read_motion_sensor(int index, s16* value) - } - - /* -- * applesmc_device_init - initialize the accelerometer. Returns zero on success -- * and negative error code on failure. Can sleep. -+ * applesmc_device_init - initialize the accelerometer. Can sleep. - */ --static int applesmc_device_init(void) -+static void applesmc_device_init(void) - { -- int total, ret = -ENXIO; -+ int total; - u8 buffer[2]; - -- if (!applesmc_accelerometer) -- return 0; -- -- mutex_lock(&applesmc_lock); -+ if (!smcreg.has_accelerometer) -+ return; - - for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { -- if (debug) -- printk(KERN_DEBUG "applesmc try %d\n", total); - if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && -- (buffer[0] != 0x00 || buffer[1] != 0x00)) { -- if (total == INIT_TIMEOUT_MSECS) { -- printk(KERN_DEBUG "applesmc: device has" -- " already been initialized" -- " (0x%02x, 0x%02x).\n", -- buffer[0], buffer[1]); -- } else { -- printk(KERN_DEBUG "applesmc: device" -- " successfully initialized" -- " (0x%02x, 0x%02x).\n", -- buffer[0], buffer[1]); -- } -- ret = 0; -- goto out; -- } -+ (buffer[0] != 0x00 || buffer[1] != 0x00)) -+ return; - buffer[0] = 0xe0; - buffer[1] = 0x00; - applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); - msleep(INIT_WAIT_MSECS); - } - -- printk(KERN_WARNING "applesmc: failed to init the device\n"); -- --out: -- mutex_unlock(&applesmc_lock); -- return ret; -+ pr_warn("failed to init the device\n"); - } - - /* -- * applesmc_get_fan_count - get the number of fans. Callers must NOT hold -- * applesmc_lock. -+ * applesmc_init_smcreg_try - Try to initialize register cache. Idempotent. - */ --static int applesmc_get_fan_count(void) -+static int applesmc_init_smcreg_try(void) - { -+ struct applesmc_registers *s = &smcreg; -+ bool left_light_sensor, right_light_sensor; -+ u8 tmp[1]; - int ret; -- u8 buffer[1]; - -- mutex_lock(&applesmc_lock); -+ if (s->init_complete) -+ return 0; - -- ret = applesmc_read_key(FANS_COUNT, buffer, 1); -+ mutex_init(&s->mutex); - -- mutex_unlock(&applesmc_lock); -+ ret = read_register_count(&s->key_count); - if (ret) - return ret; -- else -- return buffer[0]; --} - --/* Device model stuff */ --static int applesmc_probe(struct platform_device *dev) --{ -- int ret; -+ if (!s->cache) -+ s->cache = kcalloc(s->key_count, sizeof(*s->cache), GFP_KERNEL); -+ if (!s->cache) -+ return -ENOMEM; - -- ret = applesmc_device_init(); -+ ret = applesmc_read_key(FANS_COUNT, tmp, 1); - if (ret) - return ret; -+ s->fan_count = tmp[0]; -+ -+ ret = applesmc_get_lower_bound(&s->temp_begin, "T"); -+ if (ret) -+ return ret; -+ ret = applesmc_get_lower_bound(&s->temp_end, "U"); -+ if (ret) -+ return ret; -+ s->temp_count = s->temp_end - s->temp_begin; -+ -+ ret = applesmc_has_key(LIGHT_SENSOR_LEFT_KEY, &left_light_sensor); -+ if (ret) -+ return ret; -+ ret = applesmc_has_key(LIGHT_SENSOR_RIGHT_KEY, &right_light_sensor); -+ if (ret) -+ return ret; -+ ret = applesmc_has_key(MOTION_SENSOR_KEY, &s->has_accelerometer); -+ if (ret) -+ return ret; -+ ret = applesmc_has_key(BACKLIGHT_KEY, &s->has_key_backlight); -+ if (ret) -+ return ret; -+ -+ s->num_light_sensors = left_light_sensor + right_light_sensor; -+ s->init_complete = true; -+ -+ pr_info("key=%d fan=%d temp=%d acc=%d lux=%d kbd=%d\n", -+ s->key_count, s->fan_count, s->temp_count, -+ s->has_accelerometer, -+ s->num_light_sensors, -+ s->has_key_backlight); - -- printk(KERN_INFO "applesmc: device successfully initialized.\n"); - return 0; - } - -+/* -+ * applesmc_init_smcreg - Initialize register cache. -+ * -+ * Retries until initialization is successful, or the operation times out. -+ * -+ */ -+static int applesmc_init_smcreg(void) -+{ -+ int ms, ret; -+ -+ for (ms = 0; ms < INIT_TIMEOUT_MSECS; ms += INIT_WAIT_MSECS) { -+ ret = applesmc_init_smcreg_try(); -+ if (!ret) -+ return 0; -+ pr_warn("slow init, retrying\n"); -+ msleep(INIT_WAIT_MSECS); -+ } -+ -+ return ret; -+} -+ -+static void applesmc_destroy_smcreg(void) -+{ -+ kfree(smcreg.cache); -+ memset(&smcreg, 0, sizeof(smcreg)); -+} -+ - /* Synchronize device with memorized backlight state */ - static int applesmc_pm_resume(struct device *dev) - { -- mutex_lock(&applesmc_lock); -- if (applesmc_light) -+ if (smcreg.has_key_backlight) - applesmc_write_key(BACKLIGHT_KEY, backlight_state, 2); -- mutex_unlock(&applesmc_lock); - return 0; - } - - /* Reinitialize device on resume from hibernation */ - static int applesmc_pm_restore(struct device *dev) - { -- int ret = applesmc_device_init(); -- if (ret) -- return ret; -+ applesmc_device_init(); - return applesmc_pm_resume(dev); - } - -@@ -546,15 +613,6 @@ static const struct dev_pm_ops applesmc_pm_ops = { - .restore = applesmc_pm_restore, - }; - --static struct platform_driver applesmc_driver = { -- .probe = applesmc_probe, -- .driver = { -- .name = "applesmc", -- .owner = THIS_MODULE, -- .pm = &applesmc_pm_ops, -- }, --}; -- - /* - * applesmc_calibrate - Set our "resting" values. Callers must - * hold applesmc_lock. -@@ -571,20 +629,15 @@ static void applesmc_idev_poll(struct input_polled_dev *dev) - struct input_dev *idev = dev->input; - s16 x, y; - -- mutex_lock(&applesmc_lock); -- - if (applesmc_read_motion_sensor(SENSOR_X, &x)) -- goto out; -+ return; - if (applesmc_read_motion_sensor(SENSOR_Y, &y)) -- goto out; -+ return; - - x = -x; - input_report_abs(idev, ABS_X, x - rest_x); - input_report_abs(idev, ABS_Y, y - rest_y); - input_sync(idev); -- --out: -- mutex_unlock(&applesmc_lock); - } - - /* Sysfs Files */ -@@ -601,8 +654,6 @@ static ssize_t applesmc_position_show(struct device *dev, - int ret; - s16 x, y, z; - -- mutex_lock(&applesmc_lock); -- - ret = applesmc_read_motion_sensor(SENSOR_X, &x); - if (ret) - goto out; -@@ -614,7 +665,6 @@ static ssize_t applesmc_position_show(struct device *dev, - goto out; - - out: -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -624,20 +674,20 @@ out: - static ssize_t applesmc_light_show(struct device *dev, - struct device_attribute *attr, char *sysfsbuf) - { -+ const struct applesmc_entry *entry; - static int data_length; - int ret; - u8 left = 0, right = 0; -- u8 buffer[10], query[6]; -- -- mutex_lock(&applesmc_lock); -+ u8 buffer[10]; - - if (!data_length) { -- ret = applesmc_get_key_type(LIGHT_SENSOR_LEFT_KEY, query); -- if (ret) -- goto out; -- data_length = clamp_val(query[0], 0, 10); -- printk(KERN_INFO "applesmc: light sensor data length set to " -- "%d\n", data_length); -+ entry = applesmc_get_entry_by_key(LIGHT_SENSOR_LEFT_KEY); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ if (entry->len > 10) -+ return -ENXIO; -+ data_length = entry->len; -+ pr_info("light sensor data length set to %d\n", data_length); - } - - ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); -@@ -653,7 +703,6 @@ static ssize_t applesmc_light_show(struct device *dev, - right = buffer[2]; - - out: -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -664,36 +713,48 @@ out: - static ssize_t applesmc_show_sensor_label(struct device *dev, - struct device_attribute *devattr, char *sysfsbuf) - { -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- const char *key = -- temperature_sensors_sets[applesmc_temperature_set][attr->index]; -+ int index = smcreg.temp_begin + to_index(devattr); -+ const struct applesmc_entry *entry; -+ -+ entry = applesmc_get_entry_by_index(index); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); - -- return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", key); -+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", entry->key); - } - - /* Displays degree Celsius * 1000 */ - static ssize_t applesmc_show_temperature(struct device *dev, - struct device_attribute *devattr, char *sysfsbuf) - { -+ int index = smcreg.temp_begin + to_index(devattr); -+ const struct applesmc_entry *entry; - int ret; - u8 buffer[2]; - unsigned int temp; -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- const char* key = -- temperature_sensors_sets[applesmc_temperature_set][attr->index]; - -- mutex_lock(&applesmc_lock); -- -- ret = applesmc_read_key(key, buffer, 2); -- temp = buffer[0]*1000; -- temp += (buffer[1] >> 6) * 250; -- -- mutex_unlock(&applesmc_lock); -+ entry = applesmc_get_entry_by_index(index); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ if (entry->len > 2) -+ return -EINVAL; - -+ ret = applesmc_read_entry(entry, buffer, entry->len); - if (ret) - return ret; -- else -- return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", temp); -+ -+ if (entry->len == 2) { -+ if (buffer[0] >= 0x80) { -+ /* The two byte format is signed - ignore negative */ -+ return -EINVAL; -+ } -+ temp = buffer[0] * 1000; -+ temp += (buffer[1] >> 6) * 250; -+ } else { -+ temp = buffer[0] * 4000; -+ } -+ -+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", temp); - } - - static ssize_t applesmc_show_fan_speed(struct device *dev, -@@ -703,21 +764,12 @@ static ssize_t applesmc_show_fan_speed(struct device *dev, - unsigned int speed = 0; - char newkey[5]; - u8 buffer[2]; -- struct sensor_device_attribute_2 *sensor_attr = -- to_sensor_dev_attr_2(attr); - -- newkey[0] = fan_speed_keys[sensor_attr->nr][0]; -- newkey[1] = '0' + sensor_attr->index; -- newkey[2] = fan_speed_keys[sensor_attr->nr][2]; -- newkey[3] = fan_speed_keys[sensor_attr->nr][3]; -- newkey[4] = 0; -- -- mutex_lock(&applesmc_lock); -+ sprintf(newkey, fan_speed_fmt[to_option(attr)], to_index(attr)); - - ret = applesmc_read_key(newkey, buffer, 2); - speed = ((buffer[0] << 8 | buffer[1]) >> 2); - -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -732,27 +784,18 @@ static ssize_t applesmc_store_fan_speed(struct device *dev, - u32 speed; - char newkey[5]; - u8 buffer[2]; -- struct sensor_device_attribute_2 *sensor_attr = -- to_sensor_dev_attr_2(attr); - - speed = simple_strtoul(sysfsbuf, NULL, 10); - - if (speed > 0x4000) /* Bigger than a 14-bit value */ - return -EINVAL; - -- newkey[0] = fan_speed_keys[sensor_attr->nr][0]; -- newkey[1] = '0' + sensor_attr->index; -- newkey[2] = fan_speed_keys[sensor_attr->nr][2]; -- newkey[3] = fan_speed_keys[sensor_attr->nr][3]; -- newkey[4] = 0; -- -- mutex_lock(&applesmc_lock); -+ sprintf(newkey, fan_speed_fmt[to_option(attr)], to_index(attr)); - - buffer[0] = (speed >> 6) & 0xff; - buffer[1] = (speed << 2) & 0xff; - ret = applesmc_write_key(newkey, buffer, 2); - -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -760,19 +803,15 @@ static ssize_t applesmc_store_fan_speed(struct device *dev, - } - - static ssize_t applesmc_show_fan_manual(struct device *dev, -- struct device_attribute *devattr, char *sysfsbuf) -+ struct device_attribute *attr, char *sysfsbuf) - { - int ret; - u16 manual = 0; - u8 buffer[2]; -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -- -- mutex_lock(&applesmc_lock); - - ret = applesmc_read_key(FANS_MANUAL, buffer, 2); -- manual = ((buffer[0] << 8 | buffer[1]) >> attr->index) & 0x01; -+ manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01; - -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -780,28 +819,25 @@ static ssize_t applesmc_show_fan_manual(struct device *dev, - } - - static ssize_t applesmc_store_fan_manual(struct device *dev, -- struct device_attribute *devattr, -+ struct device_attribute *attr, - const char *sysfsbuf, size_t count) - { - int ret; - u8 buffer[2]; - u32 input; - u16 val; -- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - - input = simple_strtoul(sysfsbuf, NULL, 10); - -- mutex_lock(&applesmc_lock); -- - ret = applesmc_read_key(FANS_MANUAL, buffer, 2); - val = (buffer[0] << 8 | buffer[1]); - if (ret) - goto out; - - if (input) -- val = val | (0x01 << attr->index); -+ val = val | (0x01 << to_index(attr)); - else -- val = val & ~(0x01 << attr->index); -+ val = val & ~(0x01 << to_index(attr)); - - buffer[0] = (val >> 8) & 0xFF; - buffer[1] = val & 0xFF; -@@ -809,7 +845,6 @@ static ssize_t applesmc_store_fan_manual(struct device *dev, - ret = applesmc_write_key(FANS_MANUAL, buffer, 2); - - out: -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -822,21 +857,12 @@ static ssize_t applesmc_show_fan_position(struct device *dev, - int ret; - char newkey[5]; - u8 buffer[17]; -- struct sensor_device_attribute_2 *sensor_attr = -- to_sensor_dev_attr_2(attr); - -- newkey[0] = FAN_POSITION[0]; -- newkey[1] = '0' + sensor_attr->index; -- newkey[2] = FAN_POSITION[2]; -- newkey[3] = FAN_POSITION[3]; -- newkey[4] = 0; -- -- mutex_lock(&applesmc_lock); -+ sprintf(newkey, FAN_ID_FMT, to_index(attr)); - - ret = applesmc_read_key(newkey, buffer, 16); - buffer[16] = 0; - -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -852,18 +878,14 @@ static ssize_t applesmc_calibrate_show(struct device *dev, - static ssize_t applesmc_calibrate_store(struct device *dev, - struct device_attribute *attr, const char *sysfsbuf, size_t count) - { -- mutex_lock(&applesmc_lock); - applesmc_calibrate(); -- mutex_unlock(&applesmc_lock); - - return count; - } - - static void applesmc_backlight_set(struct work_struct *work) - { -- mutex_lock(&applesmc_lock); - applesmc_write_key(BACKLIGHT_KEY, backlight_state, 2); -- mutex_unlock(&applesmc_lock); - } - static DECLARE_WORK(backlight_work, &applesmc_backlight_set); - -@@ -886,13 +908,10 @@ static ssize_t applesmc_key_count_show(struct device *dev, - u8 buffer[4]; - u32 count; - -- mutex_lock(&applesmc_lock); -- - ret = applesmc_read_key(KEY_COUNT_KEY, buffer, 4); - count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) + - ((u32)buffer[2]<<8) + buffer[3]; - -- mutex_unlock(&applesmc_lock); - if (ret) - return ret; - else -@@ -902,113 +921,53 @@ static ssize_t applesmc_key_count_show(struct device *dev, - static ssize_t applesmc_key_at_index_read_show(struct device *dev, - struct device_attribute *attr, char *sysfsbuf) - { -- char key[5]; -- char info[6]; -+ const struct applesmc_entry *entry; - int ret; - -- mutex_lock(&applesmc_lock); -- -- ret = applesmc_get_key_at_index(key_at_index, key); -- -- if (ret || !key[0]) { -- mutex_unlock(&applesmc_lock); -- -- return -EINVAL; -- } -- -- ret = applesmc_get_key_type(key, info); -- -- if (ret) { -- mutex_unlock(&applesmc_lock); -- -+ entry = applesmc_get_entry_by_index(key_at_index); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); -+ ret = applesmc_read_entry(entry, sysfsbuf, entry->len); -+ if (ret) - return ret; -- } -- -- /* -- * info[0] maximum value (APPLESMC_MAX_DATA_LENGTH) is much lower than -- * PAGE_SIZE, so we don't need any checks before writing to sysfsbuf. -- */ -- ret = applesmc_read_key(key, sysfsbuf, info[0]); -- -- mutex_unlock(&applesmc_lock); - -- if (!ret) { -- return info[0]; -- } else { -- return ret; -- } -+ return entry->len; - } - - static ssize_t applesmc_key_at_index_data_length_show(struct device *dev, - struct device_attribute *attr, char *sysfsbuf) - { -- char key[5]; -- char info[6]; -- int ret; -- -- mutex_lock(&applesmc_lock); -+ const struct applesmc_entry *entry; - -- ret = applesmc_get_key_at_index(key_at_index, key); -+ entry = applesmc_get_entry_by_index(key_at_index); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); - -- if (ret || !key[0]) { -- mutex_unlock(&applesmc_lock); -- -- return -EINVAL; -- } -- -- ret = applesmc_get_key_type(key, info); -- -- mutex_unlock(&applesmc_lock); -- -- if (!ret) -- return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", info[0]); -- else -- return ret; -+ return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", entry->len); - } - - static ssize_t applesmc_key_at_index_type_show(struct device *dev, - struct device_attribute *attr, char *sysfsbuf) - { -- char key[5]; -- char info[6]; -- int ret; -+ const struct applesmc_entry *entry; - -- mutex_lock(&applesmc_lock); -+ entry = applesmc_get_entry_by_index(key_at_index); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); - -- ret = applesmc_get_key_at_index(key_at_index, key); -- -- if (ret || !key[0]) { -- mutex_unlock(&applesmc_lock); -- -- return -EINVAL; -- } -- -- ret = applesmc_get_key_type(key, info); -- -- mutex_unlock(&applesmc_lock); -- -- if (!ret) -- return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", info+1); -- else -- return ret; -+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", entry->type); - } - - static ssize_t applesmc_key_at_index_name_show(struct device *dev, - struct device_attribute *attr, char *sysfsbuf) - { -- char key[5]; -- int ret; -- -- mutex_lock(&applesmc_lock); -- -- ret = applesmc_get_key_at_index(key_at_index, key); -+ const struct applesmc_entry *entry; - -- mutex_unlock(&applesmc_lock); -+ entry = applesmc_get_entry_by_index(key_at_index); -+ if (IS_ERR(entry)) -+ return PTR_ERR(entry); - -- if (!ret && key[0]) -- return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", key); -- else -- return -EINVAL; -+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", entry->key); - } - - static ssize_t applesmc_key_at_index_show(struct device *dev, -@@ -1020,12 +979,8 @@ static ssize_t applesmc_key_at_index_show(struct device *dev, - static ssize_t applesmc_key_at_index_store(struct device *dev, - struct device_attribute *attr, const char *sysfsbuf, size_t count) - { -- mutex_lock(&applesmc_lock); -- - key_at_index = simple_strtoul(sysfsbuf, NULL, 10); - -- mutex_unlock(&applesmc_lock); -- - return count; - } - -@@ -1035,387 +990,101 @@ static struct led_classdev applesmc_backlight = { - .brightness_set = applesmc_brightness_set, - }; - --static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL); -- --static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL); --static DEVICE_ATTR(calibrate, 0644, -- applesmc_calibrate_show, applesmc_calibrate_store); -- --static struct attribute *accelerometer_attributes[] = { -- &dev_attr_position.attr, -- &dev_attr_calibrate.attr, -- NULL --}; -- --static const struct attribute_group accelerometer_attributes_group = -- { .attrs = accelerometer_attributes }; -- --static DEVICE_ATTR(light, 0444, applesmc_light_show, NULL); -- --static DEVICE_ATTR(key_count, 0444, applesmc_key_count_show, NULL); --static DEVICE_ATTR(key_at_index, 0644, -- applesmc_key_at_index_show, applesmc_key_at_index_store); --static DEVICE_ATTR(key_at_index_name, 0444, -- applesmc_key_at_index_name_show, NULL); --static DEVICE_ATTR(key_at_index_type, 0444, -- applesmc_key_at_index_type_show, NULL); --static DEVICE_ATTR(key_at_index_data_length, 0444, -- applesmc_key_at_index_data_length_show, NULL); --static DEVICE_ATTR(key_at_index_data, 0444, -- applesmc_key_at_index_read_show, NULL); -- --static struct attribute *key_enumeration_attributes[] = { -- &dev_attr_key_count.attr, -- &dev_attr_key_at_index.attr, -- &dev_attr_key_at_index_name.attr, -- &dev_attr_key_at_index_type.attr, -- &dev_attr_key_at_index_data_length.attr, -- &dev_attr_key_at_index_data.attr, -- NULL --}; -- --static const struct attribute_group key_enumeration_group = -- { .attrs = key_enumeration_attributes }; -- --/* -- * Macro defining SENSOR_DEVICE_ATTR for a fan sysfs entries. -- * - show actual speed -- * - show/store minimum speed -- * - show maximum speed -- * - show safe speed -- * - show/store target speed -- * - show/store manual mode -- */ --#define sysfs_fan_speeds_offset(offset) \ --static SENSOR_DEVICE_ATTR_2(fan##offset##_input, S_IRUGO, \ -- applesmc_show_fan_speed, NULL, 0, offset-1); \ --\ --static SENSOR_DEVICE_ATTR_2(fan##offset##_min, S_IRUGO | S_IWUSR, \ -- applesmc_show_fan_speed, applesmc_store_fan_speed, 1, offset-1); \ --\ --static SENSOR_DEVICE_ATTR_2(fan##offset##_max, S_IRUGO, \ -- applesmc_show_fan_speed, NULL, 2, offset-1); \ --\ --static SENSOR_DEVICE_ATTR_2(fan##offset##_safe, S_IRUGO, \ -- applesmc_show_fan_speed, NULL, 3, offset-1); \ --\ --static SENSOR_DEVICE_ATTR_2(fan##offset##_output, S_IRUGO | S_IWUSR, \ -- applesmc_show_fan_speed, applesmc_store_fan_speed, 4, offset-1); \ --\ --static SENSOR_DEVICE_ATTR(fan##offset##_manual, S_IRUGO | S_IWUSR, \ -- applesmc_show_fan_manual, applesmc_store_fan_manual, offset-1); \ --\ --static SENSOR_DEVICE_ATTR(fan##offset##_label, S_IRUGO, \ -- applesmc_show_fan_position, NULL, offset-1); \ --\ --static struct attribute *fan##offset##_attributes[] = { \ -- &sensor_dev_attr_fan##offset##_input.dev_attr.attr, \ -- &sensor_dev_attr_fan##offset##_min.dev_attr.attr, \ -- &sensor_dev_attr_fan##offset##_max.dev_attr.attr, \ -- &sensor_dev_attr_fan##offset##_safe.dev_attr.attr, \ -- &sensor_dev_attr_fan##offset##_output.dev_attr.attr, \ -- &sensor_dev_attr_fan##offset##_manual.dev_attr.attr, \ -- &sensor_dev_attr_fan##offset##_label.dev_attr.attr, \ -- NULL \ -+static struct applesmc_node_group info_group[] = { -+ { "name", applesmc_name_show }, -+ { "key_count", applesmc_key_count_show }, -+ { "key_at_index", applesmc_key_at_index_show, applesmc_key_at_index_store }, -+ { "key_at_index_name", applesmc_key_at_index_name_show }, -+ { "key_at_index_type", applesmc_key_at_index_type_show }, -+ { "key_at_index_data_length", applesmc_key_at_index_data_length_show }, -+ { "key_at_index_data", applesmc_key_at_index_read_show }, -+ { } - }; - --/* -- * Create the needed functions for each fan using the macro defined above -- * (4 fans are supported) -- */ --sysfs_fan_speeds_offset(1); --sysfs_fan_speeds_offset(2); --sysfs_fan_speeds_offset(3); --sysfs_fan_speeds_offset(4); -- --static const struct attribute_group fan_attribute_groups[] = { -- { .attrs = fan1_attributes }, -- { .attrs = fan2_attributes }, -- { .attrs = fan3_attributes }, -- { .attrs = fan4_attributes }, -+static struct applesmc_node_group accelerometer_group[] = { -+ { "position", applesmc_position_show }, -+ { "calibrate", applesmc_calibrate_show, applesmc_calibrate_store }, -+ { } - }; - --/* -- * Temperature sensors sysfs entries. -- */ --static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 0); --static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 1); --static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 2); --static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 3); --static SENSOR_DEVICE_ATTR(temp5_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 4); --static SENSOR_DEVICE_ATTR(temp6_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 5); --static SENSOR_DEVICE_ATTR(temp7_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 6); --static SENSOR_DEVICE_ATTR(temp8_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 7); --static SENSOR_DEVICE_ATTR(temp9_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 8); --static SENSOR_DEVICE_ATTR(temp10_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 9); --static SENSOR_DEVICE_ATTR(temp11_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 10); --static SENSOR_DEVICE_ATTR(temp12_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 11); --static SENSOR_DEVICE_ATTR(temp13_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 12); --static SENSOR_DEVICE_ATTR(temp14_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 13); --static SENSOR_DEVICE_ATTR(temp15_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 14); --static SENSOR_DEVICE_ATTR(temp16_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 15); --static SENSOR_DEVICE_ATTR(temp17_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 16); --static SENSOR_DEVICE_ATTR(temp18_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 17); --static SENSOR_DEVICE_ATTR(temp19_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 18); --static SENSOR_DEVICE_ATTR(temp20_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 19); --static SENSOR_DEVICE_ATTR(temp21_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 20); --static SENSOR_DEVICE_ATTR(temp22_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 21); --static SENSOR_DEVICE_ATTR(temp23_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 22); --static SENSOR_DEVICE_ATTR(temp24_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 23); --static SENSOR_DEVICE_ATTR(temp25_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 24); --static SENSOR_DEVICE_ATTR(temp26_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 25); --static SENSOR_DEVICE_ATTR(temp27_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 26); --static SENSOR_DEVICE_ATTR(temp28_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 27); --static SENSOR_DEVICE_ATTR(temp29_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 28); --static SENSOR_DEVICE_ATTR(temp30_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 29); --static SENSOR_DEVICE_ATTR(temp31_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 30); --static SENSOR_DEVICE_ATTR(temp32_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 31); --static SENSOR_DEVICE_ATTR(temp33_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 32); --static SENSOR_DEVICE_ATTR(temp34_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 33); --static SENSOR_DEVICE_ATTR(temp35_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 34); --static SENSOR_DEVICE_ATTR(temp36_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 35); --static SENSOR_DEVICE_ATTR(temp37_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 36); --static SENSOR_DEVICE_ATTR(temp38_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 37); --static SENSOR_DEVICE_ATTR(temp39_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 38); --static SENSOR_DEVICE_ATTR(temp40_label, S_IRUGO, -- applesmc_show_sensor_label, NULL, 39); --static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, -- applesmc_show_temperature, NULL, 0); --static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, -- applesmc_show_temperature, NULL, 1); --static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, -- applesmc_show_temperature, NULL, 2); --static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, -- applesmc_show_temperature, NULL, 3); --static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, -- applesmc_show_temperature, NULL, 4); --static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, -- applesmc_show_temperature, NULL, 5); --static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, -- applesmc_show_temperature, NULL, 6); --static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, -- applesmc_show_temperature, NULL, 7); --static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, -- applesmc_show_temperature, NULL, 8); --static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, -- applesmc_show_temperature, NULL, 9); --static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO, -- applesmc_show_temperature, NULL, 10); --static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, -- applesmc_show_temperature, NULL, 11); --static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO, -- applesmc_show_temperature, NULL, 12); --static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO, -- applesmc_show_temperature, NULL, 13); --static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO, -- applesmc_show_temperature, NULL, 14); --static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO, -- applesmc_show_temperature, NULL, 15); --static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO, -- applesmc_show_temperature, NULL, 16); --static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO, -- applesmc_show_temperature, NULL, 17); --static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO, -- applesmc_show_temperature, NULL, 18); --static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO, -- applesmc_show_temperature, NULL, 19); --static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO, -- applesmc_show_temperature, NULL, 20); --static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO, -- applesmc_show_temperature, NULL, 21); --static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO, -- applesmc_show_temperature, NULL, 22); --static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO, -- applesmc_show_temperature, NULL, 23); --static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO, -- applesmc_show_temperature, NULL, 24); --static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO, -- applesmc_show_temperature, NULL, 25); --static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO, -- applesmc_show_temperature, NULL, 26); --static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO, -- applesmc_show_temperature, NULL, 27); --static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO, -- applesmc_show_temperature, NULL, 28); --static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO, -- applesmc_show_temperature, NULL, 29); --static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO, -- applesmc_show_temperature, NULL, 30); --static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO, -- applesmc_show_temperature, NULL, 31); --static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO, -- applesmc_show_temperature, NULL, 32); --static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO, -- applesmc_show_temperature, NULL, 33); --static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO, -- applesmc_show_temperature, NULL, 34); --static SENSOR_DEVICE_ATTR(temp36_input, S_IRUGO, -- applesmc_show_temperature, NULL, 35); --static SENSOR_DEVICE_ATTR(temp37_input, S_IRUGO, -- applesmc_show_temperature, NULL, 36); --static SENSOR_DEVICE_ATTR(temp38_input, S_IRUGO, -- applesmc_show_temperature, NULL, 37); --static SENSOR_DEVICE_ATTR(temp39_input, S_IRUGO, -- applesmc_show_temperature, NULL, 38); --static SENSOR_DEVICE_ATTR(temp40_input, S_IRUGO, -- applesmc_show_temperature, NULL, 39); -- --static struct attribute *label_attributes[] = { -- &sensor_dev_attr_temp1_label.dev_attr.attr, -- &sensor_dev_attr_temp2_label.dev_attr.attr, -- &sensor_dev_attr_temp3_label.dev_attr.attr, -- &sensor_dev_attr_temp4_label.dev_attr.attr, -- &sensor_dev_attr_temp5_label.dev_attr.attr, -- &sensor_dev_attr_temp6_label.dev_attr.attr, -- &sensor_dev_attr_temp7_label.dev_attr.attr, -- &sensor_dev_attr_temp8_label.dev_attr.attr, -- &sensor_dev_attr_temp9_label.dev_attr.attr, -- &sensor_dev_attr_temp10_label.dev_attr.attr, -- &sensor_dev_attr_temp11_label.dev_attr.attr, -- &sensor_dev_attr_temp12_label.dev_attr.attr, -- &sensor_dev_attr_temp13_label.dev_attr.attr, -- &sensor_dev_attr_temp14_label.dev_attr.attr, -- &sensor_dev_attr_temp15_label.dev_attr.attr, -- &sensor_dev_attr_temp16_label.dev_attr.attr, -- &sensor_dev_attr_temp17_label.dev_attr.attr, -- &sensor_dev_attr_temp18_label.dev_attr.attr, -- &sensor_dev_attr_temp19_label.dev_attr.attr, -- &sensor_dev_attr_temp20_label.dev_attr.attr, -- &sensor_dev_attr_temp21_label.dev_attr.attr, -- &sensor_dev_attr_temp22_label.dev_attr.attr, -- &sensor_dev_attr_temp23_label.dev_attr.attr, -- &sensor_dev_attr_temp24_label.dev_attr.attr, -- &sensor_dev_attr_temp25_label.dev_attr.attr, -- &sensor_dev_attr_temp26_label.dev_attr.attr, -- &sensor_dev_attr_temp27_label.dev_attr.attr, -- &sensor_dev_attr_temp28_label.dev_attr.attr, -- &sensor_dev_attr_temp29_label.dev_attr.attr, -- &sensor_dev_attr_temp30_label.dev_attr.attr, -- &sensor_dev_attr_temp31_label.dev_attr.attr, -- &sensor_dev_attr_temp32_label.dev_attr.attr, -- &sensor_dev_attr_temp33_label.dev_attr.attr, -- &sensor_dev_attr_temp34_label.dev_attr.attr, -- &sensor_dev_attr_temp35_label.dev_attr.attr, -- &sensor_dev_attr_temp36_label.dev_attr.attr, -- &sensor_dev_attr_temp37_label.dev_attr.attr, -- &sensor_dev_attr_temp38_label.dev_attr.attr, -- &sensor_dev_attr_temp39_label.dev_attr.attr, -- &sensor_dev_attr_temp40_label.dev_attr.attr, -- NULL -+static struct applesmc_node_group light_sensor_group[] = { -+ { "light", applesmc_light_show }, -+ { } - }; - --static struct attribute *temperature_attributes[] = { -- &sensor_dev_attr_temp1_input.dev_attr.attr, -- &sensor_dev_attr_temp2_input.dev_attr.attr, -- &sensor_dev_attr_temp3_input.dev_attr.attr, -- &sensor_dev_attr_temp4_input.dev_attr.attr, -- &sensor_dev_attr_temp5_input.dev_attr.attr, -- &sensor_dev_attr_temp6_input.dev_attr.attr, -- &sensor_dev_attr_temp7_input.dev_attr.attr, -- &sensor_dev_attr_temp8_input.dev_attr.attr, -- &sensor_dev_attr_temp9_input.dev_attr.attr, -- &sensor_dev_attr_temp10_input.dev_attr.attr, -- &sensor_dev_attr_temp11_input.dev_attr.attr, -- &sensor_dev_attr_temp12_input.dev_attr.attr, -- &sensor_dev_attr_temp13_input.dev_attr.attr, -- &sensor_dev_attr_temp14_input.dev_attr.attr, -- &sensor_dev_attr_temp15_input.dev_attr.attr, -- &sensor_dev_attr_temp16_input.dev_attr.attr, -- &sensor_dev_attr_temp17_input.dev_attr.attr, -- &sensor_dev_attr_temp18_input.dev_attr.attr, -- &sensor_dev_attr_temp19_input.dev_attr.attr, -- &sensor_dev_attr_temp20_input.dev_attr.attr, -- &sensor_dev_attr_temp21_input.dev_attr.attr, -- &sensor_dev_attr_temp22_input.dev_attr.attr, -- &sensor_dev_attr_temp23_input.dev_attr.attr, -- &sensor_dev_attr_temp24_input.dev_attr.attr, -- &sensor_dev_attr_temp25_input.dev_attr.attr, -- &sensor_dev_attr_temp26_input.dev_attr.attr, -- &sensor_dev_attr_temp27_input.dev_attr.attr, -- &sensor_dev_attr_temp28_input.dev_attr.attr, -- &sensor_dev_attr_temp29_input.dev_attr.attr, -- &sensor_dev_attr_temp30_input.dev_attr.attr, -- &sensor_dev_attr_temp31_input.dev_attr.attr, -- &sensor_dev_attr_temp32_input.dev_attr.attr, -- &sensor_dev_attr_temp33_input.dev_attr.attr, -- &sensor_dev_attr_temp34_input.dev_attr.attr, -- &sensor_dev_attr_temp35_input.dev_attr.attr, -- &sensor_dev_attr_temp36_input.dev_attr.attr, -- &sensor_dev_attr_temp37_input.dev_attr.attr, -- &sensor_dev_attr_temp38_input.dev_attr.attr, -- &sensor_dev_attr_temp39_input.dev_attr.attr, -- &sensor_dev_attr_temp40_input.dev_attr.attr, -- NULL -+static struct applesmc_node_group fan_group[] = { -+ { "fan%d_label", applesmc_show_fan_position }, -+ { "fan%d_input", applesmc_show_fan_speed, NULL, 0 }, -+ { "fan%d_min", applesmc_show_fan_speed, applesmc_store_fan_speed, 1 }, -+ { "fan%d_max", applesmc_show_fan_speed, NULL, 2 }, -+ { "fan%d_safe", applesmc_show_fan_speed, NULL, 3 }, -+ { "fan%d_output", applesmc_show_fan_speed, applesmc_store_fan_speed, 4 }, -+ { "fan%d_manual", applesmc_show_fan_manual, applesmc_store_fan_manual }, -+ { } - }; - --static const struct attribute_group temperature_attributes_group = -- { .attrs = temperature_attributes }; -- --static const struct attribute_group label_attributes_group = { -- .attrs = label_attributes -+static struct applesmc_node_group temp_group[] = { -+ { "temp%d_label", applesmc_show_sensor_label }, -+ { "temp%d_input", applesmc_show_temperature }, -+ { } - }; - - /* Module stuff */ - - /* -- * applesmc_dmi_match - found a match. return one, short-circuiting the hunt. -+ * applesmc_destroy_nodes - remove files and free associated memory - */ --static int applesmc_dmi_match(const struct dmi_system_id *id) -+static void applesmc_destroy_nodes(struct applesmc_node_group *groups) - { -- int i = 0; -- struct dmi_match_data* dmi_data = id->driver_data; -- printk(KERN_INFO "applesmc: %s detected:\n", id->ident); -- applesmc_accelerometer = dmi_data->accelerometer; -- printk(KERN_INFO "applesmc: - Model %s accelerometer\n", -- applesmc_accelerometer ? "with" : "without"); -- applesmc_light = dmi_data->light; -- printk(KERN_INFO "applesmc: - Model %s light sensors and backlight\n", -- applesmc_light ? "with" : "without"); -- -- applesmc_temperature_set = dmi_data->temperature_set; -- while (temperature_sensors_sets[applesmc_temperature_set][i] != NULL) -- i++; -- printk(KERN_INFO "applesmc: - Model with %d temperature sensors\n", i); -- return 1; -+ struct applesmc_node_group *grp; -+ struct applesmc_dev_attr *node; -+ -+ for (grp = groups; grp->nodes; grp++) { -+ for (node = grp->nodes; node->sda.dev_attr.attr.name; node++) -+ sysfs_remove_file(&pdev->dev.kobj, -+ &node->sda.dev_attr.attr); -+ kfree(grp->nodes); -+ grp->nodes = NULL; -+ } -+} -+ -+/* -+ * applesmc_create_nodes - create a two-dimensional group of sysfs files -+ */ -+static int applesmc_create_nodes(struct applesmc_node_group *groups, int num) -+{ -+ struct applesmc_node_group *grp; -+ struct applesmc_dev_attr *node; -+ struct attribute *attr; -+ int ret, i; -+ -+ for (grp = groups; grp->format; grp++) { -+ grp->nodes = kcalloc(num + 1, sizeof(*node), GFP_KERNEL); -+ if (!grp->nodes) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ for (i = 0; i < num; i++) { -+ node = &grp->nodes[i]; -+ sprintf(node->name, grp->format, i + 1); -+ node->sda.index = (grp->option << 16) | (i & 0xffff); -+ node->sda.dev_attr.show = grp->show; -+ node->sda.dev_attr.store = grp->store; -+ attr = &node->sda.dev_attr.attr; -+ attr->name = node->name; -+ attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); -+ ret = sysfs_create_file(&pdev->dev.kobj, attr); -+ if (ret) { -+ attr->name = NULL; -+ goto out; -+ } -+ } -+ } -+ -+ return 0; -+out: -+ applesmc_destroy_nodes(groups); -+ return ret; - } - - /* Create accelerometer ressources */ -@@ -1424,8 +1093,10 @@ static int applesmc_create_accelerometer(void) - struct input_dev *idev; - int ret; - -- ret = sysfs_create_group(&pdev->dev.kobj, -- &accelerometer_attributes_group); -+ if (!smcreg.has_accelerometer) -+ return 0; -+ -+ ret = applesmc_create_nodes(accelerometer_group, 1); - if (ret) - goto out; - -@@ -1462,282 +1133,132 @@ out_idev: - input_free_polled_device(applesmc_idev); - - out_sysfs: -- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); -+ applesmc_destroy_nodes(accelerometer_group); - - out: -- printk(KERN_WARNING "applesmc: driver init failed (ret=%d)!\n", ret); -+ pr_warn("driver init failed (ret=%d)!\n", ret); - return ret; - } - - /* Release all ressources used by the accelerometer */ - static void applesmc_release_accelerometer(void) - { -+ if (!smcreg.has_accelerometer) -+ return; - input_unregister_polled_device(applesmc_idev); - input_free_polled_device(applesmc_idev); -- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); -+ applesmc_destroy_nodes(accelerometer_group); - } - --static __initdata struct dmi_match_data applesmc_dmi_data[] = { --/* MacBook Pro: accelerometer, backlight and temperature set 0 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 0 }, --/* MacBook2: accelerometer and temperature set 1 */ -- { .accelerometer = 1, .light = 0, .temperature_set = 1 }, --/* MacBook: accelerometer and temperature set 2 */ -- { .accelerometer = 1, .light = 0, .temperature_set = 2 }, --/* MacMini: temperature set 3 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 3 }, --/* MacPro: temperature set 4 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 4 }, --/* iMac: temperature set 5 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 5 }, --/* MacBook3, MacBook4: accelerometer and temperature set 6 */ -- { .accelerometer = 1, .light = 0, .temperature_set = 6 }, --/* MacBook Air: accelerometer, backlight and temperature set 7 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 7 }, --/* MacBook Pro 4: accelerometer, backlight and temperature set 8 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 8 }, --/* MacBook Pro 3: accelerometer, backlight and temperature set 9 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 9 }, --/* iMac 5: light sensor only, temperature set 10 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 10 }, --/* MacBook 5: accelerometer, backlight and temperature set 11 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 11 }, --/* MacBook Pro 5: accelerometer, backlight and temperature set 12 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 12 }, --/* iMac 8: light sensor only, temperature set 13 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 13 }, --/* iMac 6: light sensor only, temperature set 14 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 14 }, --/* MacBook Air 2,1: accelerometer, backlight and temperature set 15 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 15 }, --/* MacPro3,1: temperature set 16 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 16 }, --/* iMac 9,1: light sensor only, temperature set 17 */ -- { .accelerometer = 0, .light = 0, .temperature_set = 17 }, --/* MacBook Pro 2,2: accelerometer, backlight and temperature set 18 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 18 }, --/* MacBook Pro 5,3: accelerometer, backlight and temperature set 19 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 19 }, --/* MacBook Pro 5,4: accelerometer, backlight and temperature set 20 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 20 }, --/* MacBook Pro 6,2: accelerometer, backlight and temperature set 21 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 21 }, --/* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ -- { .accelerometer = 1, .light = 1, .temperature_set = 22 }, --}; -+static int applesmc_create_light_sensor(void) -+{ -+ if (!smcreg.num_light_sensors) -+ return 0; -+ return applesmc_create_nodes(light_sensor_group, 1); -+} - --/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". -- * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ --static __initdata struct dmi_system_id applesmc_whitelist[] = { -- { applesmc_dmi_match, "Apple MacBook Air 2", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, -- &applesmc_dmi_data[15]}, -- { applesmc_dmi_match, "Apple MacBook Air", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") }, -- &applesmc_dmi_data[7]}, -- { applesmc_dmi_match, "Apple MacBook Pro 7", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro7") }, -- &applesmc_dmi_data[22]}, -- { applesmc_dmi_match, "Apple MacBook Pro 5,4", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,4") }, -- &applesmc_dmi_data[20]}, -- { applesmc_dmi_match, "Apple MacBook Pro 5,3", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,3") }, -- &applesmc_dmi_data[19]}, -- { applesmc_dmi_match, "Apple MacBook Pro 6", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro6") }, -- &applesmc_dmi_data[21]}, -- { applesmc_dmi_match, "Apple MacBook Pro 5", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5") }, -- &applesmc_dmi_data[12]}, -- { applesmc_dmi_match, "Apple MacBook Pro 4", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4") }, -- &applesmc_dmi_data[8]}, -- { applesmc_dmi_match, "Apple MacBook Pro 3", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3") }, -- &applesmc_dmi_data[9]}, -- { applesmc_dmi_match, "Apple MacBook Pro 2,2", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple Computer, Inc."), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2") }, -- &applesmc_dmi_data[18]}, -- { applesmc_dmi_match, "Apple MacBook Pro", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") }, -- &applesmc_dmi_data[0]}, -- { applesmc_dmi_match, "Apple MacBook (v2)", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") }, -- &applesmc_dmi_data[1]}, -- { applesmc_dmi_match, "Apple MacBook (v3)", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") }, -- &applesmc_dmi_data[6]}, -- { applesmc_dmi_match, "Apple MacBook 4", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBook4") }, -- &applesmc_dmi_data[6]}, -- { applesmc_dmi_match, "Apple MacBook 5", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5") }, -- &applesmc_dmi_data[11]}, -- { applesmc_dmi_match, "Apple MacBook", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, -- &applesmc_dmi_data[2]}, -- { applesmc_dmi_match, "Apple Macmini", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, -- &applesmc_dmi_data[3]}, -- { applesmc_dmi_match, "Apple MacPro2", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, -- &applesmc_dmi_data[4]}, -- { applesmc_dmi_match, "Apple MacPro3", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacPro3") }, -- &applesmc_dmi_data[16]}, -- { applesmc_dmi_match, "Apple MacPro", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") }, -- &applesmc_dmi_data[4]}, -- { applesmc_dmi_match, "Apple iMac 9,1", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), -- DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1") }, -- &applesmc_dmi_data[17]}, -- { applesmc_dmi_match, "Apple iMac 8", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") }, -- &applesmc_dmi_data[13]}, -- { applesmc_dmi_match, "Apple iMac 6", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "iMac6") }, -- &applesmc_dmi_data[14]}, -- { applesmc_dmi_match, "Apple iMac 5", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME, "iMac5") }, -- &applesmc_dmi_data[10]}, -- { applesmc_dmi_match, "Apple iMac", { -- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), -- DMI_MATCH(DMI_PRODUCT_NAME,"iMac") }, -- &applesmc_dmi_data[5]}, -- { .ident = NULL } --}; -+static void applesmc_release_light_sensor(void) -+{ -+ if (!smcreg.num_light_sensors) -+ return; -+ applesmc_destroy_nodes(light_sensor_group); -+} - --static int __init applesmc_init(void) -+static int applesmc_create_key_backlight(void) -+{ -+ if (!smcreg.has_key_backlight) -+ return 0; -+ applesmc_led_wq = create_singlethread_workqueue("applesmc-led"); -+ if (!applesmc_led_wq) -+ return -ENOMEM; -+ return led_classdev_register(&pdev->dev, &applesmc_backlight); -+} -+ -+static void applesmc_release_key_backlight(void) -+{ -+ if (!smcreg.has_key_backlight) -+ return; -+ led_classdev_unregister(&applesmc_backlight); -+ destroy_workqueue(applesmc_led_wq); -+} -+ -+static void applesmc_set_interrupt(u8 enable) -+{ -+ applesmc_write_key(NOTIFICATION_KEY, &enable, 1); -+} -+ -+static irqreturn_t applesmc_interrupt(int irq, void *dev) -+{ -+ printk("SMC Interrupt\n"); -+ return IRQ_HANDLED; -+} -+ -+static int __devinit applesmc_pnp_probe(struct pnp_dev *dev, -+ const struct pnp_device_id *dev_id) - { - int ret; -- int count; -- int i; -+ struct resource *res; -+ struct applesmc_pnp_device *applesmc_pnp_device; - -- if (!dmi_check_system(applesmc_whitelist)) { -- printk(KERN_WARNING "applesmc: supported laptop not found!\n"); -- ret = -ENODEV; -+ pdev = dev; -+ -+ applesmc_pnp_device = kzalloc(sizeof(struct applesmc_pnp_device), -+ GFP_KERNEL); -+ -+ if (!applesmc_pnp_device) { -+ ret = -ENOMEM; - goto out; - } - -- if (!request_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS, -- "applesmc")) { -+ pnp_device = applesmc_pnp_device; -+ -+ pnp_set_drvdata(dev, applesmc_pnp_device); -+ -+ res = pnp_get_resource(dev, IORESOURCE_IO, 0); -+ -+ if (!res) { - ret = -ENXIO; - goto out; - } - -- ret = platform_driver_register(&applesmc_driver); -- if (ret) -- goto out_region; -+ applesmc_pnp_device->iobase = res->start; -+ applesmc_pnp_device->iolen = res->end - res->start + 1; - -- pdev = platform_device_register_simple("applesmc", APPLESMC_DATA_PORT, -- NULL, 0); -- if (IS_ERR(pdev)) { -- ret = PTR_ERR(pdev); -- goto out_driver; -+ if (!request_region(pnp_device->iobase, pnp_device->iolen, "applesmc")) { -+ ret = -ENXIO; -+ goto out; - } - -- ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); -+ /* create register cache */ -+ ret = applesmc_init_smcreg(); - if (ret) -- goto out_device; -- -- /* Create key enumeration sysfs files */ -- ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); -- if (ret) -- goto out_name; -- -- /* create fan files */ -- count = applesmc_get_fan_count(); -- if (count < 0) -- printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); -- else -- printk(KERN_INFO "applesmc: %d fans found.\n", count); -+ goto out_region; - -- if (count > 4) { -- count = 4; -- printk(KERN_WARNING "applesmc: More than 4 fans found," -- " but at most 4 fans are supported" -- " by the driver.\n"); -- } -+ applesmc_device_init(); - -- while (fans_handled < count) { -- ret = sysfs_create_group(&pdev->dev.kobj, -- &fan_attribute_groups[fans_handled]); -- if (ret) -- goto out_fans; -- fans_handled++; -- } -+ ret = applesmc_create_nodes(info_group, 1); -+ if (ret) -+ goto out_smcreg; - -- for (i = 0; -- temperature_sensors_sets[applesmc_temperature_set][i] != NULL; -- i++) { -- if (temperature_attributes[i] == NULL || -- label_attributes[i] == NULL) { -- printk(KERN_ERR "applesmc: More temperature sensors " -- "in temperature_sensors_sets (at least %i)" -- "than available sysfs files in " -- "temperature_attributes (%i), please report " -- "this bug.\n", i, i-1); -- goto out_temperature; -- } -- ret = sysfs_create_file(&pdev->dev.kobj, -- temperature_attributes[i]); -- if (ret) -- goto out_temperature; -- ret = sysfs_create_file(&pdev->dev.kobj, -- label_attributes[i]); -- if (ret) -- goto out_temperature; -- } -+ ret = applesmc_create_nodes(fan_group, smcreg.fan_count); -+ if (ret) -+ goto out_info; - -- if (applesmc_accelerometer) { -- ret = applesmc_create_accelerometer(); -- if (ret) -- goto out_temperature; -- } -+ ret = applesmc_create_nodes(temp_group, smcreg.temp_count); -+ if (ret) -+ goto out_fans; - -- if (applesmc_light) { -- /* Add light sensor file */ -- ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_light.attr); -- if (ret) -- goto out_accelerometer; -+ ret = applesmc_create_accelerometer(); -+ if (ret) -+ goto out_temperature; - -- /* Create the workqueue */ -- applesmc_led_wq = create_singlethread_workqueue("applesmc-led"); -- if (!applesmc_led_wq) { -- ret = -ENOMEM; -- goto out_light_sysfs; -- } -+ ret = applesmc_create_light_sensor(); -+ if (ret) -+ goto out_accelerometer; - -- /* register as a led device */ -- ret = led_classdev_register(&pdev->dev, &applesmc_backlight); -- if (ret < 0) -- goto out_light_wq; -- } -+ ret = applesmc_create_key_backlight(); -+ if (ret) -+ goto out_light_sysfs; - - hwmon_dev = hwmon_device_register(&pdev->dev); - if (IS_ERR(hwmon_dev)) { -@@ -1745,65 +1266,85 @@ static int __init applesmc_init(void) - goto out_light_ledclass; - } - -- printk(KERN_INFO "applesmc: driver successfully loaded.\n"); -+ res = pnp_get_resource(dev, IORESOURCE_IRQ, 0); -+ -+ if (res) { -+ applesmc_pnp_device->irq = res->start; -+ ret = request_irq(res->start, applesmc_interrupt, IRQF_SHARED, -+ "applesmc", dev); -+ if (ret) -+ applesmc_pnp_device->irq = 0; -+ else -+ applesmc_set_interrupt(1); -+ } - - return 0; - - out_light_ledclass: -- if (applesmc_light) -- led_classdev_unregister(&applesmc_backlight); --out_light_wq: -- if (applesmc_light) -- destroy_workqueue(applesmc_led_wq); -+ applesmc_release_key_backlight(); - out_light_sysfs: -- if (applesmc_light) -- sysfs_remove_file(&pdev->dev.kobj, &dev_attr_light.attr); -+ applesmc_release_light_sensor(); - out_accelerometer: -- if (applesmc_accelerometer) -- applesmc_release_accelerometer(); -+ applesmc_release_accelerometer(); - out_temperature: -- sysfs_remove_group(&pdev->dev.kobj, &label_attributes_group); -- sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); -+ applesmc_destroy_nodes(temp_group); - out_fans: -- while (fans_handled) -- sysfs_remove_group(&pdev->dev.kobj, -- &fan_attribute_groups[--fans_handled]); -- sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); --out_name: -- sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); --out_device: -- platform_device_unregister(pdev); --out_driver: -- platform_driver_unregister(&applesmc_driver); -+ applesmc_destroy_nodes(fan_group); -+out_info: -+ applesmc_destroy_nodes(info_group); -+out_smcreg: -+ applesmc_destroy_smcreg(); - out_region: -- release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); -+ release_region(pnp_device->iobase, pnp_device->iolen); - out: -- printk(KERN_WARNING "applesmc: driver init failed (ret=%d)!\n", ret); -+ pr_warn("driver init failed (ret=%d)!\n", ret); - return ret; - } - --static void __exit applesmc_exit(void) -+static void __devexit applesmc_pnp_remove(struct pnp_dev *dev) - { -- hwmon_device_unregister(hwmon_dev); -- if (applesmc_light) { -- led_classdev_unregister(&applesmc_backlight); -- destroy_workqueue(applesmc_led_wq); -- sysfs_remove_file(&pdev->dev.kobj, &dev_attr_light.attr); -+ struct applesmc_pnp_device *applesmc_pnp_device = pnp_get_drvdata(dev); -+ -+ if (applesmc_pnp_device->irq) { -+ applesmc_set_interrupt(0); -+ free_irq(applesmc_pnp_device->irq, dev); - } -- if (applesmc_accelerometer) -- applesmc_release_accelerometer(); -- sysfs_remove_group(&pdev->dev.kobj, &label_attributes_group); -- sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); -- while (fans_handled) -- sysfs_remove_group(&pdev->dev.kobj, -- &fan_attribute_groups[--fans_handled]); -- sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); -- sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); -- platform_device_unregister(pdev); -- platform_driver_unregister(&applesmc_driver); -- release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); -- -- printk(KERN_INFO "applesmc: driver unloaded.\n"); -+ -+ hwmon_device_unregister(hwmon_dev); -+ applesmc_release_key_backlight(); -+ applesmc_release_light_sensor(); -+ applesmc_release_accelerometer(); -+ applesmc_destroy_nodes(temp_group); -+ applesmc_destroy_nodes(fan_group); -+ applesmc_destroy_nodes(info_group); -+ applesmc_destroy_smcreg(); -+ release_region(pnp_device->iobase, pnp_device->iolen); -+ kfree(applesmc_pnp_device); -+} -+ -+static const struct pnp_device_id applesmc_dev_table[] = { -+ {"APP0001", 0}, -+ {"", 0}, -+}; -+ -+static struct pnp_driver applesmc_pnp_driver = { -+ .name = "Apple SMC", -+ .probe = applesmc_pnp_probe, -+ .remove = applesmc_pnp_remove, -+ .id_table = applesmc_dev_table, -+ .driver = { -+ .pm = &applesmc_pm_ops, -+ }, -+}; -+ -+static int __init applesmc_init(void) -+{ -+ return pnp_register_driver(&applesmc_pnp_driver); -+} -+ -+static void __exit applesmc_exit(void) -+{ -+ pnp_unregister_driver(&applesmc_pnp_driver); - } - - module_init(applesmc_init); -@@ -1812,4 +1353,4 @@ module_exit(applesmc_exit); - MODULE_AUTHOR("Nicolas Boichat"); - MODULE_DESCRIPTION("Apple SMC"); - MODULE_LICENSE("GPL v2"); --MODULE_DEVICE_TABLE(dmi, applesmc_whitelist); -+MODULE_DEVICE_TABLE(pnp, applesmc_dev_table); diff --git a/config-arm b/config-arm index 22335ef..e2d8af3 100644 --- a/config-arm +++ b/config-arm @@ -89,6 +89,8 @@ CONFIG_USB_TUSB6010=y # CONFIG_USB_MUSB_DEBUG is not set CONFIG_MMC_ARMMMCI=m +CONFIG_MMC_DW=m +# CONFIG_MMC_DW_IDMAC is not set CONFIG_RTC_DRV_PL030=m CONFIG_RTC_DRV_PL031=m @@ -129,3 +131,7 @@ CONFIG_SECCOMP=y CONFIG_STRICT_DEVMEM=y # CONFIG_AMBA_PL08X is not set + +# CONFIG_HVC_DCC is not set + +CONFIG_SPARSE_IRQ=y diff --git a/config-debug b/config-debug index 5366a84..86aa2cc 100644 --- a/config-debug +++ b/config-debug @@ -97,3 +97,5 @@ CONFIG_KDB_KEYBOARD=y CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y CONFIG_TEST_LIST_SORT=y + +CONFIG_DEBUG_SET_MODULE_RONX=y diff --git a/config-generic b/config-generic index 7b5630f..45a0aca 100644 --- a/config-generic +++ b/config-generic @@ -40,6 +40,7 @@ CONFIG_SYSCTL=y CONFIG_LOG_BUF_SHIFT=17 # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set +# CONFIG_EXPERT is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y CONFIG_KALLSYMS_EXTRA_PASS=y @@ -123,6 +124,7 @@ CONFIG_SDIO_UART=m # CONFIG_MMC_TEST is not set # CONFIG_MMC_DEBUG is not set # CONFIG_MMC_UNSAFE_RESUME is not set +# CONFIG_MMC_CLKGATE is not set CONFIG_MMC_BLOCK=m CONFIG_MMC_BLOCK_MINORS=8 CONFIG_MMC_BLOCK_BOUNCE=y @@ -564,6 +566,7 @@ CONFIG_SATA_SX4=m CONFIG_SATA_ULI=m CONFIG_SATA_VIA=m CONFIG_SATA_VITESSE=m +CONFIG_SATA_ACARD_AHCI=m CONFIG_PATA_ACPI=m CONFIG_PATA_ALI=m @@ -687,6 +690,7 @@ CONFIG_DM_ZERO=y CONFIG_DM_LOG_USERSPACE=m CONFIG_DM_MULTIPATH_QL=m CONFIG_DM_MULTIPATH_ST=m +CONFIG_DM_RAID=m # # Fusion MPT device support @@ -1436,6 +1440,7 @@ CONFIG_B43_PCMCIA=y CONFIG_B43_SDIO=y # CONFIG_B43_DEBUG is not set CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_N=y # CONFIG_B43_FORCE_PIO is not set CONFIG_B43LEGACY=m # CONFIG_B43LEGACY_DEBUG is not set @@ -1503,12 +1508,12 @@ CONFIG_RT2500PCI=m CONFIG_RT61PCI=m CONFIG_RT2500USB=m CONFIG_RT2800USB=m -# CONFIG_RT2800USB_RT30XX is not set -# CONFIG_RT2800USB_RT35XX is not set -# CONFIG_RT2800USB_UNKNOWN is not set +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800PCI=m -# CONFIG_RT2800PCI_RT30XX is not set -# CONFIG_RT2800PCI_RT35XX is not set +CONFIG_RT2800PCI_RT33XX=y +CONFIG_RT2800PCI_RT35XX=y CONFIG_RT73USB=m CONFIG_RTL8180=m CONFIG_RTL8187=m @@ -1520,7 +1525,13 @@ CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set CONFIG_AR9170_USB=m -CONFIG_WL12XX=y +CONFIG_WL12XX_MENU=m +CONFIG_WL12XX=m +# CONFIG_WL12XX_HT is not set +CONFIG_WL12XX_SPI=m +CONFIG_WL12XX_SDIO=m +# CONFIG_WL12XX_SDIO_TEST is not set + CONFIG_WL1251=m CONFIG_WL1251_SPI=m CONFIG_WL1251_SDIO=m @@ -1528,6 +1539,8 @@ CONFIG_WL1271=m CONFIG_WL1271_SDIO=m CONFIG_WL1271_SPI=m +CONFIG_RTL8192CE=m + # # Token Ring devices # @@ -1583,7 +1596,8 @@ CONFIG_CAN_ESD_USB2=m CONFIG_CAN_KVASER_PCI=m CONFIG_CAN_PLX_PCI=m CONFIG_CAN_TSCAN1=m -CONFIG_PCH_CAN=m +CONFIG_CAN_SLCAN=m +# CONFIG_PCH_CAN is not set CONFIG_NETROM=m CONFIG_ROSE=m CONFIG_MKISS=m @@ -1832,6 +1846,8 @@ CONFIG_INPUT_CM109=m CONFIG_INPUT_POLLDEV=m CONFIG_INPUT_SPARSEKMAP=m # CONFIG_INPUT_ADXL34X is not set +CONFIG_INPUT_CMA3000=m +CONFIG_INPUT_CMA3000_I2C=m # # Input I/O drivers @@ -1911,6 +1927,7 @@ CONFIG_JOYSTICK_XPAD=m CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y CONFIG_JOYSTICK_ZHENHUA=m +# CONFIG_JOYSTICK_AS5011 is not set CONFIG_INPUT_TOUCHSCREEN=y # CONFIG_TOUCHSCREEN_AD7879 is not set @@ -1941,6 +1958,7 @@ CONFIG_TOUCHSCREEN_USB_COMPOSITE=m # CONFIG_TOUCHSCREEN_WM97XX is not set CONFIG_TOUCHSCREEN_W90X900=m # CONFIG_TOUCHSCREEN_BU21013 is not set +CONFIG_TOUCHSCREEN_ST1232=m CONFIG_INPUT_MISC=y CONFIG_INPUT_PCSPKR=m @@ -2067,6 +2085,7 @@ CONFIG_I2C_ALGOPCA=m # CONFIG_I2C_ISCH is not set # CONFIG_I2C_NFORCE2_S4985 is not set # CONFIG_I2C_INTEL_MID is not set +# CONFIG_I2C_EG20T is not set CONFIG_EEPROM_AT24=m CONFIG_EEPROM_LEGACY=m @@ -2198,10 +2217,13 @@ CONFIG_SENSORS_LTC4261=m # CONFIG_SENSORS_GPIO_FAN is not set CONFIG_SENSORS_W83795=m # CONFIG_SENSORS_W83795_FANCTRL is not set +CONFIG_SENSORS_DS620=m +CONFIG_SENSORS_SHT21=m # CONFIG_HMC6352 is not set # CONFIG_BMP085 is not set # CONFIG_PCH_PHUB is not set +# CONFIG_SERIAL_PCH_UART is not set CONFIG_W1=m CONFIG_W1_CON=y @@ -2218,6 +2240,8 @@ CONFIG_W1_SLAVE_DS2431=m CONFIG_W1_SLAVE_DS2433=m CONFIG_W1_SLAVE_DS2433_CRC=y CONFIG_W1_SLAVE_DS2760=m +CONFIG_W1_SLAVE_DS2423=m + # # Mice # @@ -2418,6 +2442,7 @@ CONFIG_VIDEO_EM28XX_DVB=m CONFIG_VIDEO_CX231XX=m CONFIG_VIDEO_CX231XX_ALSA=m CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_CX231XX_RC=y CONFIG_VIDEO_HEXIUM_ORION=m CONFIG_VIDEO_HEXIUM_GEMINI=m CONFIG_VIDEO_IVTV=m @@ -2447,6 +2472,7 @@ CONFIG_VIDEO_ZORAN_ZR36060=m CONFIG_VIDEO_FB_IVTV=m CONFIG_VIDEO_SAA7164=m CONFIG_VIDEO_TLG2300=m +# CONFIG_VIDEO_TIMBERDALE is not set CONFIG_USB_VIDEO_CLASS=m CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y @@ -2457,6 +2483,7 @@ CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y CONFIG_RADIO_GEMTEK_PCI=m CONFIG_RADIO_MAXIRADIO=m CONFIG_RADIO_MAESTRO=m +CONFIG_RADIO_WL1273=m CONFIG_MEDIA_ATTACH=y CONFIG_MEDIA_TUNER_CUSTOMISE=y @@ -2573,6 +2600,7 @@ CONFIG_DVB_LGS8GL5=m CONFIG_DVB_DUMMY_FE=m CONFIG_DVB_FIREDTV=m CONFIG_DVB_NGENE=m +CONFIG_DVB_MB86A20S=m # # Supported SAA7146 based PCI Adapters @@ -2637,6 +2665,8 @@ CONFIG_VIDEO_PVRUSB2=m CONFIG_VIDEO_PVRUSB2_SYSFS=y # CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_RC_CORE=m +CONFIG_RC_LOOPBACK=m CONFIG_RC_MAP=m CONFIG_IR_NEC_DECODER=m CONFIG_IR_RC5_DECODER=m @@ -3016,6 +3046,7 @@ CONFIG_HID_3M_PCT=y CONFIG_LOGIG940_FF=y CONFIG_HID_MAGICMOUSE=y CONFIG_HID_MOSART=y +CONFIG_HID_MULTITOUCH=m CONFIG_HID_NTRIG=y CONFIG_HID_QUANTA=y CONFIG_HID_STANTUM=y @@ -3041,10 +3072,12 @@ CONFIG_HID_THRUSTMASTER=m CONFIG_HID_ZEROPLUS=m CONFIG_HID_ZYDACRON=m CONFIG_HID_ACRUX_FF=m +CONFIG_HID_EMS_FF=m CONFIG_HID_ELECOM=m CONFIG_HID_UCLOGIC=m CONFIG_HID_WALTOP=m CONFIG_HID_ROCCAT_PYRA=m +CONFIG_HID_ROCCAT_KONEPLUS=m # # USB Imaging devices @@ -3127,6 +3160,7 @@ CONFIG_SOC_CAMERA_RJ54N1=m CONFIG_SOC_CAMERA_OV9640=m CONFIG_SOC_CAMERA_OV6650=m CONFIG_SOC_CAMERA_IMX074=m +CONFIG_SOC_CAMERA_OV2640=m # # USB Network adaptors @@ -3148,6 +3182,7 @@ CONFIG_USB_NET_MCS7830=m CONFIG_USB_NET_RNDIS_HOST=m CONFIG_USB_NET_CDC_SUBSET=m CONFIG_USB_NET_CDC_EEM=m +CONFIG_USB_NET_CDC_NCM=m CONFIG_USB_NET_ZAURUS=m CONFIG_USB_NET_CX82310_ETH=m CONFIG_USB_NET_INT51X1=m @@ -3355,6 +3390,7 @@ CONFIG_MFD_WM8400=m # CONFIG_MFD_RDC321X is not set # CONFIG_MFD_JANZ_CMODIO is not set # CONFIG_MFD_WM831X_I2C is not set +CONFIG_MFD_CS5535=m # # File systems @@ -3481,6 +3517,7 @@ CONFIG_CRAMFS=m CONFIG_SQUASHFS=m CONFIG_SQUASHFS_XATTR=y CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y # CONFIG_SQUASHFS_EMBEDDED is not set CONFIG_VXFS_FS=m # CONFIG_HPFS_FS is not set @@ -3695,12 +3732,14 @@ CONFIG_AUDITSYSCALL=y # CONFIG_CRYPTO=y CONFIG_CRYPTO_FIPS=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y CONFIG_CRYPTO_MANAGER_TESTS=y CONFIG_CRYPTO_HW=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_MANAGER=m # CONFIG_CRYPTO_CRYPTD is not set -CONFIG_CRYPTO_AES=m +CONFIG_CRYPTO_AES=y CONFIG_CRYPTO_ARC4=m CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_AUTHENC=m @@ -3708,14 +3747,14 @@ CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAMELLIA=m CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CTR=y CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_DEFLATE=m CONFIG_CRYPTO_DES=m -CONFIG_CRYPTO_ECB=m +CONFIG_CRYPTO_ECB=y CONFIG_CRYPTO_FCRYPT=m CONFIG_CRYPTO_GCM=m CONFIG_CRYPTO_GF128MUL=m @@ -3773,6 +3812,8 @@ CONFIG_ZLIB_DEFLATE=m CONFIG_INITRAMFS_SOURCE="" CONFIG_KEYS=y +CONFIG_TRUSTED_KEYS=m +CONFIG_ENCRYPTED_KEYS=m CONFIG_KEYS_DEBUG_PROC_KEYS=y CONFIG_CDROM_PKTCDVD=m CONFIG_CDROM_PKTCDVD_BUFFERS=8 @@ -3801,6 +3842,7 @@ CONFIG_FAIR_GROUP_SCHED=y CONFIG_SCHED_OMIT_FRAME_POINTER=y CONFIG_GROUP_SCHED=y CONFIG_RT_GROUP_SCHED=y +CONFIG_SCHED_AUTOGROUP=y CONFIG_CPUSETS=y CONFIG_PROC_PID_CPUSET=y @@ -4076,15 +4118,17 @@ CONFIG_POWER_SUPPLY=m # CONFIG_POWER_SUPPLY_DEBUG is not set # CONFIG_TEST_POWER is not set CONFIG_APM_POWER=m -CONFIG_WM831X_POWER=m +# CONFIG_WM831X_POWER is not set # CONFIG_BATTERY_DS2760 is not set # CONFIG_BATTERY_DS2782 is not set # CONFIG_BATTERY_BQ20Z75 is not set # CONFIG_CHARGER_ISP1704 is not set CONFIG_BATTERY_PMU=m -CONFIG_BATTERY_BQ27x00=m -CONFIG_BATTERY_MAX17040=m +# CONFIG_BATTERY_BQ27x00 is not set +# CONFIG_BATTERY_MAX17040 is not set # CONFIG_PDA_POWER is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_BATTERY_MAX17042 is not set CONFIG_AUXDISPLAY=y @@ -4280,6 +4324,9 @@ CONFIG_USB_ATMEL=m # CONFIG_BCM_WIMAX is not set # CONFIG_FT1000 is not set # CONFIG_SPEAKUP is not set +# CONFIG_DX_SEP is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set # # Android @@ -4322,6 +4369,7 @@ CONFIG_STRIP_ASM_SYMS=y # CONFIG_RCU_FANOUT_EXACT is not set CONFIG_RCU_FAST_NO_HZ=y +CONFIG_SRCU_SYNCHRONIZE_DELAY=10 CONFIG_KSM=y CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 @@ -4340,6 +4388,9 @@ CONFIG_PPS=m # CONFIG_PPS_CLIENT_KTIMER is not set CONFIG_PPS_CLIENT_LDISC=m # CONFIG_PPS_DEBUG is not set +CONFIG_PPS_CLIENT_PARPORT=m +CONFIG_PPS_GENERATOR_PARPORT=m +CONFIG_NTP_PPS=y # CONFIG_USB_SERIAL_QUATECH2 is not set # CONFIG_VT6655 is not set @@ -4405,6 +4456,7 @@ CONFIG_GPIO_SYSFS=y # CONFIG_GPIO_BASIC_MMIO is not set # CONFIG_GPIO_VX855 is not set # CONFIG_GPIO_PCH is not set +# CONFIG_GPIO_ML_IOH is not set CONFIG_KSYM_TRACER=y CONFIG_PROFILE_KSYM_TRACER=y @@ -4415,14 +4467,28 @@ CONFIG_KPROBE_EVENT=y CONFIG_IR_CORE=m CONFIG_IR_ENE=m CONFIG_IR_STREAMZAP=m +CONFIG_IR_WINBOND_CIR=m # CONFIG_GPIO_SX150X is not set # CONFIG_MFD_STMPE is not set # CONFIG_MFD_MAX8998 is not set # CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TC3589X is not set CONFIG_SPARSE_RCU_POINTER=y # CONFIG_PM_OPP is not set CONFIG_BKL=y + +CONFIG_EVENT_POWER_TRACING_DEPRECATED=y + +# CONFIG_XZ_DEC_TEST is not set + +CONFIG_NFC_DEVICES=y +CONFIG_PN544_NFC=m + +CONFIG_TARGET_CORE=m +CONFIG_TCM_IBLOCK=m +CONFIG_TCM_FILEIO=m +CONFIG_TCM_PSCSI=m diff --git a/config-ia64-generic b/config-ia64-generic index a178b8a..5c864b3 100644 --- a/config-ia64-generic +++ b/config-ia64-generic @@ -139,6 +139,7 @@ CONFIG_ACPI_VIDEO=m # CONFIG_ACPI_PROC_EVENT is not set CONFIG_ACPI_HED=m CONFIG_ACPI_EC_DEBUGFS=m +CONFIG_ACPI_IPMI=m CONFIG_PM=y CONFIG_HOTPLUG_PCI=y diff --git a/config-local b/config-local new file mode 100644 index 0000000..8c32be5 --- /dev/null +++ b/config-local @@ -0,0 +1,2 @@ +# This file is intentionally left empty in the stock kernel. Its a nicety +# added for those wanting to do custom rebuilds with altered config opts. diff --git a/config-nodebug b/config-nodebug index b376148..c81b03b 100644 --- a/config-nodebug +++ b/config-nodebug @@ -97,3 +97,5 @@ CONFIG_KDB_KEYBOARD=y # CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER is not set # CONFIG_TEST_LIST_SORT is not set + +# CONFIG_DEBUG_SET_MODULE_RONX is not set diff --git a/config-powerpc-generic b/config-powerpc-generic index 1b05f4a..9cd30a4 100644 --- a/config-powerpc-generic +++ b/config-powerpc-generic @@ -335,4 +335,6 @@ CONFIG_SERIAL_GRLIB_GAISLER_APBUART=m # CONFIG_PPC_MPC512x is not set +CONFIG_MPC512X_DMA=m + CONFIG_KVM_GUEST=y diff --git a/config-powerpc64 b/config-powerpc64 index e2e8f99..74f33d1 100644 --- a/config-powerpc64 +++ b/config-powerpc64 @@ -182,3 +182,5 @@ CONFIG_PPC_SMLPAR=y CONFIG_CMM=y #-- DLPAR memory remove # CONFIG_SPARSEMEM_VMEMMAP is not set + +CONFIG_PSERIES_ENERGY=m diff --git a/config-sparc64-generic b/config-sparc64-generic index 61612cb..dac8a64 100644 --- a/config-sparc64-generic +++ b/config-sparc64-generic @@ -203,3 +203,7 @@ CONFIG_FB_XVR1000=y CONFIG_CRYPTO_DEV_NIAGARA2=y CONFIG_JUMP_LABEL=y + +# CONFIG_MTD_OF_PARTS is not set +# CONFIG_MTD_PHYSMAP_OF is not set +# CONFIG_MMC_SDHCI_OF is not set diff --git a/config-x86-generic b/config-x86-generic index 93caa6f..d6feae8 100644 --- a/config-x86-generic +++ b/config-x86-generic @@ -154,6 +154,7 @@ CONFIG_ACPI_HED=m CONFIG_ACPI_APEI=y CONFIG_ACPI_APEI_GHES=m # CONFIG_ACPI_APEI_EINJ is not set +CONFIG_ACPI_IPMI=m # # CPUFreq processor drivers @@ -373,6 +374,9 @@ CONFIG_XEN_NETDEV_FRONTEND=m CONFIG_XEN_PCIDEV_FRONTEND=m CONFIG_XENFS=m CONFIG_XEN_COMPAT_XENFS=y +CONFIG_XEN_BACKEND=y +CONFIG_XEN_DEBUG_FS=y +CONFIG_XEN_PLATFORM_PCI=m CONFIG_XEN_GNTDEV=m CONFIG_MTD_ESB2ROM=m @@ -408,6 +412,8 @@ CONFIG_SENSORS_I5K_AMB=m # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set CONFIG_HP_WATCHDOG=m +CONFIG_NV_TCO=m +CONFIG_SP5100_TCO=m CONFIG_OLPC=y CONFIG_OLPC_OPENFIRMWARE=y @@ -445,7 +451,6 @@ CONFIG_X86_RESERVE_LOW_64K=y CONFIG_PANASONIC_LAPTOP=m -CONFIG_XEN_DEBUG_FS=y CONFIG_X86_PTRACE_BTS=y CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y @@ -509,7 +514,6 @@ CONFIG_HPWDT_NMI_DECODING=y # CONFIG_MFD_TPS6586X is not set # CONFIG_INTEL_MID_DMAC is not set CONFIG_PCH_DMA=m -CONFIG_XEN_PLATFORM_PCI=m # CONFIG_ACPI_QUICKSTART is not set CONFIG_IDEAPAD_ACPI=m CONFIG_INTEL_IPS=m @@ -527,3 +531,16 @@ CONFIG_PCH_GBE=m CONFIG_PCH_PHUB=m CONFIG_JUMP_LABEL=y + +CONFIG_X86_32_IRIS=m + +CONFIG_TRANSPARENT_HUGEPAGE=y + +CONFIG_CRYPTO_AES_NI_INTEL=m + +CONFIG_MTD_OF_PARTS=m +CONFIG_MTD_PHYSMAP_OF=m +CONFIG_PROC_DEVICETREE=y +CONFIG_SERIAL_OF_PLATFORM=m +CONFIG_SERIAL_GRLIB_GAISLER_APBUART=m +# CONFIG_MMC_SDHCI_OF is not set diff --git a/config-x86_64-generic b/config-x86_64-generic index d804c0d..7105455 100644 --- a/config-x86_64-generic +++ b/config-x86_64-generic @@ -13,6 +13,7 @@ CONFIG_X86_CPUID=y CONFIG_MTRR=y CONFIG_NUMA=y CONFIG_K8_NUMA=y +CONFIG_AMD_NUMA=y CONFIG_X86_64_ACPI_NUMA=y # CONFIG_NUMA_EMU is not set CONFIG_NR_CPUS=256 @@ -97,6 +98,7 @@ CONFIG_ACPI_HED=m CONFIG_ACPI_APEI=y CONFIG_ACPI_APEI_GHES=m # CONFIG_ACPI_APEI_EINJ is not set +CONFIG_ACPI_IPMI=m CONFIG_X86_PLATFORM_DEVICES=y CONFIG_ASUS_LAPTOP=m @@ -154,8 +156,8 @@ CONFIG_CRYPTO_DEV_PADLOCK=m CONFIG_CRYPTO_DEV_PADLOCK_AES=m CONFIG_CRYPTO_DEV_PADLOCK_SHA=m -CONFIG_CRYPTO_AES_X86_64=m -CONFIG_CRYPTO_AES_NI_INTEL=m +CONFIG_CRYPTO_AES_X86_64=y +CONFIG_CRYPTO_AES_NI_INTEL=y CONFIG_CRYPTO_TWOFISH_X86_64=m CONFIG_CRYPTO_SALSA20_X86_64=m @@ -304,7 +306,10 @@ CONFIG_XENFS=m CONFIG_XEN_COMPAT_XENFS=y CONFIG_XEN_DEV_EVTCHN=m CONFIG_XEN_SYS_HYPERVISOR=y +CONFIG_XEN_BACKEND=y CONFIG_XEN_GNTDEV=m +CONFIG_XEN_DEBUG_FS=y +CONFIG_XEN_PLATFORM_PCI=m CONFIG_DMADEVICES=y CONFIG_INTEL_IOATDMA=m @@ -317,6 +322,8 @@ CONFIG_PROVIDE_OHCI1394_DMA_INIT=y # CONFIG_CPA_DEBUG is not set CONFIG_HP_WATCHDOG=m +CONFIG_NV_TCO=m +CONFIG_SP5100_TCO=m CONFIG_FRAME_WARN=2048 @@ -356,7 +363,6 @@ CONFIG_X86_RESERVE_LOW_64K=y CONFIG_PANASONIC_LAPTOP=m -CONFIG_XEN_DEBUG_FS=y CONFIG_X86_PTRACE_BTS=y CONFIG_I7300_IDLE=m @@ -421,7 +427,6 @@ CONFIG_HPWDT_NMI_DECODING=y # CONFIG_MFD_TPS6586X is not set # CONFIG_INTEL_MID_DMAC is not set CONFIG_PCH_DMA=m -CONFIG_XEN_PLATFORM_PCI=m # CONFIG_ACPI_QUICKSTART is not set CONFIG_IDEAPAD_ACPI=m CONFIG_INTEL_IPS=m @@ -440,3 +445,5 @@ CONFIG_VIDEO_VIA_CAMERA=m CONFIG_JUMP_LABEL=y CONFIG_HP_ILO=m + +CONFIG_TRANSPARENT_HUGEPAGE=y diff --git a/drm-intel-big-hammer.patch b/drm-intel-big-hammer.patch index 97bb2e8..bf152af 100644 --- a/drm-intel-big-hammer.patch +++ b/drm-intel-big-hammer.patch @@ -1,13 +1,13 @@ omgwtfbbqchainsaw? --- - drivers/gpu/drm/i915/i915_gem.c | 5 +++++ + drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index 8eb8453..36fa9d7 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -3692,6 +3692,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, +diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c +index e698343..21e601d1 100644 +--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c ++++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c +@@ -1090,6 +1090,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, if (ret) goto pre_mutex_err; diff --git a/drm_i915-check-eDP-encoder-correctly-when-setting-modes.patch b/drm_i915-check-eDP-encoder-correctly-when-setting-modes.patch deleted file mode 100644 index 9f6800a..0000000 --- a/drm_i915-check-eDP-encoder-correctly-when-setting-modes.patch +++ /dev/null @@ -1,33 +0,0 @@ -From patchwork Tue Jan 4 18:46:49 2011 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: drm/i915: check eDP encoder correctly when setting modes -Date: Tue, 04 Jan 2011 18:46:49 -0000 -From: Jesse Barnes -X-Patchwork-Id: 451441 -Message-Id: <1294166809-3316-1-git-send-email-jbarnes@virtuousgeek.org> -To: intel-gfx@lists.freedesktop.org - -We were using a stale pointer in the check which caused us to use CPU -attached DP params when we should have been using PCH attached params. - -Signed-off-by: Jesse Barnes - ---- -drivers/gpu/drm/i915/intel_display.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c -index fe56cb3..28d58ef 100644 ---- a/drivers/gpu/drm/i915/intel_display.c -+++ b/drivers/gpu/drm/i915/intel_display.c -@@ -3949,7 +3949,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, - int lane = 0, link_bw, bpp; - /* CPU eDP doesn't require FDI link, so just set DP M/N - according to current link config */ -- if (has_edp_encoder && !intel_encoder_is_pch_edp(&encoder->base)) { -+ if (has_edp_encoder && !intel_encoder_is_pch_edp(&has_edp_encoder->base)) { - target_clock = mode->clock; - intel_edp_link_config(has_edp_encoder, - &lane, &link_bw); diff --git a/fs-call-security_d_instantiate-in-d_obtain_alias.patch b/fs-call-security_d_instantiate-in-d_obtain_alias.patch index b151c0a..3bce47f 100644 --- a/fs-call-security_d_instantiate-in-d_obtain_alias.patch +++ b/fs-call-security_d_instantiate-in-d_obtain_alias.patch @@ -39,14 +39,15 @@ V1->V2: 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c -index 23702a9..119d489 100644 +index 5699d4c..85388fc 100644 --- a/fs/dcache.c +++ b/fs/dcache.c -@@ -1201,9 +1201,12 @@ struct dentry *d_obtain_alias(struct inode *inode) +@@ -1577,9 +1577,13 @@ struct dentry *d_obtain_alias(struct inode *inode) spin_unlock(&tmp->d_lock); + spin_unlock(&inode->i_lock); - spin_unlock(&dcache_lock); + security_d_instantiate(tmp, inode); ++ return tmp; out_iput: @@ -55,8 +56,6 @@ index 23702a9..119d489 100644 iput(inode); return res; } --- -1.6.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in diff --git a/kernel.spec b/kernel.spec index 595d79f..34ff35d 100644 --- a/kernel.spec +++ b/kernel.spec @@ -6,7 +6,7 @@ Summary: The Linux kernel # For a stable, released kernel, released_kernel should be 1. For rawhide # and/or a kernel built from an rc or git snapshot, released_kernel should # be 0. -%global released_kernel 1 +%global released_kernel 0 # Save original buildid for later if it's defined %if 0%{?buildid:1} @@ -52,7 +52,7 @@ Summary: The Linux kernel # For non-released -rc kernels, this will be prepended with "0.", so # for example a 3 here will become 0.3 # -%global baserelease 2 +%global baserelease 1 %global fedora_build %{baserelease} # base_sublevel is the kernel version we're starting with and patching @@ -83,7 +83,7 @@ Summary: The Linux kernel # The next upstream release sublevel (base_sublevel+1) %define upstream_sublevel %(echo $((%{base_sublevel} + 1))) # The rc snapshot level -%define rcrev 0 +%define rcrev 2 # The git snapshot level %define gitrev 0 # Set rpm version accordingly @@ -104,6 +104,8 @@ Summary: The Linux kernel %define with_up %{?_without_up: 0} %{?!_without_up: 1} # kernel-smp (only valid for ppc 32-bit) %define with_smp %{?_without_smp: 0} %{?!_without_smp: 1} +# kernel-PAE (only valid for i686) +%define with_pae %{?_without_pae: 0} %{?!_without_pae: 1} # kernel-debug %define with_debug %{?_without_debug: 0} %{?!_without_debug: 1} # kernel-doc @@ -141,6 +143,8 @@ Summary: The Linux kernel %define with_baseonly %{?_with_baseonly: 1} %{?!_with_baseonly: 0} # Only build the smp kernel (--with smponly): %define with_smponly %{?_with_smponly: 1} %{?!_with_smponly: 0} +# Only build the pae kernel (--with paeonly): +%define with_paeonly %{?_with_paeonly: 1} %{?!_with_paeonly: 0} # Only build the debug kernel (--with dbgonly): %define with_dbgonly %{?_with_dbgonly: 1} %{?!_with_dbgonly: 0} @@ -222,22 +226,31 @@ Summary: The Linux kernel %define debuginfodir /usr/lib/debug # kernel-PAE is only built on i686. +%ifnarch i686 +%define with_pae 0 +%endif %ifarch i686 -%define with_pae 1 %define with_up 0 -%else -%define with_pae 0 %endif # if requested, only build base kernel %if %{with_baseonly} %define with_smp 0 +%define with_pae 0 %define with_debug 0 %endif # if requested, only build smp kernel %if %{with_smponly} %define with_up 0 +%define with_pae 0 +%define with_debug 0 +%endif + +# if requested, only build pae kernel +%if %{with_paeonly} +%define with_up 0 +%define with_smp 0 %define with_debug 0 %endif @@ -245,6 +258,7 @@ Summary: The Linux kernel %if %{with_dbgonly} %if %{debugbuildsenabled} %define with_up 0 +%define with_pae 0 %endif %define with_smp 0 %define with_pae 0 @@ -548,6 +562,10 @@ Source90: config-sparc64-generic Source100: config-arm +# This file is intentionally left empty in the stock kernel. Its a nicety +# added for those wanting to do custom rebuilds with altered config opts. +Source1000: config-local + # Here should be only the patches up to the upstream canonical Linus tree. # For a stable release kernel @@ -606,13 +624,11 @@ Patch31: linux-2.6-utrace.patch Patch32: linux-2.6-utrace-ptrace.patch Patch150: linux-2.6.29-sparc-IOC_TYPECHECK.patch -Patch151: 0001-use-__devexit-not-__exit-in-n2_unregister_algs-fixes.patch Patch160: linux-2.6-32bit-mmap-exec-randomization.patch Patch161: linux-2.6-i386-nx-emulation.patch Patch200: linux-2.6-debug-sizeof-structs.patch -Patch201: linux-2.6-debug-nmi-timeout.patch Patch202: linux-2.6-debug-taint-vm.patch Patch203: linux-2.6-debug-vm-would-have-oomkilled.patch Patch204: linux-2.6-debug-always-inline-kzalloc.patch @@ -620,7 +636,6 @@ Patch204: linux-2.6-debug-always-inline-kzalloc.patch Patch380: linux-2.6-defaults-pci_no_msi.patch Patch381: linux-2.6-defaults-pci_use_crs.patch Patch383: linux-2.6-defaults-aspm.patch -Patch384: pci-disable-aspm-if-bios-asks-us-to.patch Patch386: pci-_osc-supported-field-should-contain-supported-features-not-enabled-ones.patch Patch385: ima-allow-it-to-be-completely-disabled-and-default-off.patch @@ -629,7 +644,6 @@ Patch390: linux-2.6-defaults-acpi-video.patch Patch391: linux-2.6-acpi-video-dos.patch Patch393: acpi-ec-add-delay-before-write.patch Patch394: linux-2.6-acpi-debug-infinite-loop.patch -Patch395: acpi-update-battery-information-on-notification-0x81.patch Patch450: linux-2.6-input-kill-stupid-messages.patch Patch452: linux-2.6.30-no-pcspkr-modalias.patch @@ -665,7 +679,6 @@ Patch1824: drm-intel-next.patch # make sure the lvds comes back on lid open Patch1825: drm-intel-make-lvds-work.patch Patch1826: drm-intel-edp-fixes.patch -Patch1827: drm_i915-check-eDP-encoder-correctly-when-setting-modes.patch Patch1900: linux-2.6-intel-iommu-igfx.patch @@ -687,7 +700,7 @@ Patch2910: linux-2.6-v4l-dvb-add-lgdt3304-support.patch Patch2912: linux-2.6-v4l-dvb-ir-core-update.patch #Patch2916: lirc-staging-2.6.36-fixes.patch -Patch2917: hdpvr-ir-enable.patch +#Patch2917: hdpvr-ir-enable.patch Patch2918: flexcop-fix-xlate_proc_name-warning.patch @@ -707,14 +720,13 @@ Patch12018: neuter_intel_microcode_load.patch Patch12030: tpm-fix-stall-on-boot.patch -Patch12100: applesmc_update.patch Patch12101: apple_backlight.patch Patch12102: efifb_update.patch -Patch12103: linux-next-macbook-air-input.patch Patch12200: acpi_reboot.patch Patch12210: efi_default_physical.patch # Runtime power management +Patch12202: linux-2.6-ehci-check-port-status.patch Patch12203: linux-2.6-usb-pci-autosuspend.patch Patch12204: linux-2.6-enable-more-pci-autosuspend.patch Patch12205: runtime_pm_fixups.patch @@ -723,13 +735,8 @@ Patch12303: dmar-disable-when-ricoh-multifunction.patch Patch12401: debug-tty-print-dev-name.patch -Patch12410: mm-page-allocator-adjust-the-per-cpu-counter-threshold-when-memory-is-low.patch -Patch12411: mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-percpu-thresholds.patch - Patch12421: fs-call-security_d_instantiate-in-d_obtain_alias.patch -Patch12422: net-AF_PACKET-vmalloc.patch - # Xen patches # git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git branches Patch20000: xen.next-2.6.37.patch @@ -1138,6 +1145,14 @@ make -f %{SOURCE20} VERSION=%{version} configs done %endif +# Merge in any user-provided local config option changes +for i in %{all_arch_configs} +do + mv $i $i.tmp + ./merge.pl %{SOURCE1000} $i.tmp > $i + rm $i.tmp +done + ApplyOptionalPatch git-linus.diff ApplyPatch linux-2.6-makefile-after_link.patch @@ -1174,7 +1189,6 @@ ApplyPatch linux-2.6-utrace-ptrace.patch # SPARC64 # ApplyPatch linux-2.6.29-sparc-IOC_TYPECHECK.patch -ApplyPatch 0001-use-__devexit-not-__exit-in-n2_unregister_algs-fixes.patch # # Exec shield @@ -1206,11 +1220,9 @@ ApplyPatch linux-2.6-defaults-acpi-video.patch ApplyPatch linux-2.6-acpi-video-dos.patch ApplyPatch acpi-ec-add-delay-before-write.patch ApplyPatch linux-2.6-acpi-debug-infinite-loop.patch -ApplyPatch acpi-update-battery-information-on-notification-0x81.patch # Various low-impact patches to aid debugging. ApplyPatch linux-2.6-debug-sizeof-structs.patch -ApplyPatch linux-2.6-debug-nmi-timeout.patch ApplyPatch linux-2.6-debug-taint-vm.patch ApplyPatch linux-2.6-debug-vm-would-have-oomkilled.patch ApplyPatch linux-2.6-debug-always-inline-kzalloc.patch @@ -1223,9 +1235,8 @@ ApplyPatch linux-2.6-defaults-pci_no_msi.patch ApplyPatch linux-2.6-defaults-pci_use_crs.patch # enable ASPM by default on hardware we expect to work ApplyPatch linux-2.6-defaults-aspm.patch -ApplyPatch pci-disable-aspm-if-bios-asks-us-to.patch # rhbz#638912 -ApplyPatch pci-_osc-supported-field-should-contain-supported-features-not-enabled-ones.patch +#ApplyPatch pci-_osc-supported-field-should-contain-supported-features-not-enabled-ones.patch #ApplyPatch ima-allow-it-to-be-completely-disabled-and-default-off.patch @@ -1291,7 +1302,6 @@ ApplyPatch drm-intel-big-hammer.patch ApplyPatch drm-intel-make-lvds-work.patch ApplyPatch linux-2.6-intel-iommu-igfx.patch ApplyPatch drm-intel-edp-fixes.patch -ApplyPatch drm_i915-check-eDP-encoder-correctly-when-setting-modes.patch # linux1394 git patches #ApplyPatch linux-2.6-firewire-git-update.patch @@ -1313,7 +1323,7 @@ ApplyOptionalPatch linux-2.6-v4l-dvb-experimental.patch # http://www.lirc.org/ #ApplyOptionalPatch lirc-staging-2.6.36-fixes.patch # enable IR receiver on Hauppauge HD PVR (v4l-dvb merge pending) -ApplyPatch hdpvr-ir-enable.patch +#ApplyPatch hdpvr-ir-enable.patch # rhbz#664852 ApplyPatch flexcop-fix-xlate_proc_name-warning.patch @@ -1329,17 +1339,16 @@ ApplyPatch neuter_intel_microcode_load.patch ApplyPatch tpm-fix-stall-on-boot.patch # various fixes for Apple and EFI -ApplyPatch applesmc_update.patch ApplyPatch apple_backlight.patch ApplyPatch efifb_update.patch -ApplyPatch linux-next-macbook-air-input.patch ApplyPatch acpi_reboot.patch ApplyPatch efi_default_physical.patch # Runtime PM +ApplyPatch linux-2.6-ehci-check-port-status.patch ApplyPatch linux-2.6-usb-pci-autosuspend.patch -ApplyPatch linux-2.6-enable-more-pci-autosuspend.patch -ApplyPatch runtime_pm_fixups.patch +#ApplyPatch linux-2.6-enable-more-pci-autosuspend.patch +#ApplyPatch runtime_pm_fixups.patch # rhbz#605888 ApplyPatch dmar-disable-when-ricoh-multifunction.patch @@ -1347,16 +1356,9 @@ ApplyPatch dmar-disable-when-ricoh-multifunction.patch # rhbz#630464 ApplyPatch debug-tty-print-dev-name.patch -# backport some fixes for kswapd from mmotm, rhbz#649694 -ApplyPatch mm-page-allocator-adjust-the-per-cpu-counter-threshold-when-memory-is-low.patch -ApplyPatch mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-percpu-thresholds.patch - # rhbz#662344,600690 ApplyPatch fs-call-security_d_instantiate-in-d_obtain_alias.patch -# rhbz#637619 -ApplyPatch net-AF_PACKET-vmalloc.patch - # Xen patches ApplyPatch xen.next-2.6.37.patch #ApplyPatch xen.upstream.core.patch @@ -1627,7 +1629,7 @@ BuildKernel() { rm -f modinfo modnames # remove files that will be auto generated by depmod at rpm -i time - for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap + for i in alias alias.bin builtin.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap do rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$i done @@ -1974,8 +1976,82 @@ fi # (__)\ )\/\ # ||----w | # || || - %changelog +* Sat Jan 22 2011 Kyle McMartin 2.6.38-0.rc2.git0.1 +- Linux 2.6.38-rc2 +- linux-2.6-serial-460800.patch, drivers/serial => drivers/tty/serial + +* Thu Jan 20 2011 Kyle McMartin 2.6.38-0.rc1.git1.1 +- Linux 2.6.38-rc1-git1, should fix boot failure in -rc1. + +* Wed Jan 19 2011 Roland McGrath +- utrace update + +* Wed Jan 19 2011 Kyle McMartin 2.6.38-0.rc1.git0.1 +- Linux 2.6.38-rc1 + +* Tue Jan 18 2011 Kyle McMartin 2.6.38-0.rc0.git18.1 +- Linux 2.6.37-git18 + +* Mon Jan 17 2011 Kyle McMartin 2.6.38-0.rc0.git16.1 +- Linux 2.6.37-git16 +- config changes: + - CONFIG_SQUASHFS_XZ=y [generic] + - CONFIG_SPARSE_IRQ=y [arm] + +* Sat Jan 15 2011 Kyle McMartin 2.6.38-0.rc0.git13.1 +- Linux 2.6.37-git13 +- Drop xen_export-arbitrary_virt_to_machine.patch, upstream. + +* Fri Jan 14 2011 Kyle McMartin +- xen_export-arbitrary_virt_to_machine.patch: pull patch from upstream + to fix build error. + +* Fri Jan 14 2011 Kyle McMartin 2.6.38-0.rc0.git12.1 +- Linux 2.6.37-git12 +- 0001-use-__devexit-not-__exit-in-n2_unregister_algs-fixes.patch: drop + upstream patch. +- acpi-update-battery-information-on-notification-0x81.patch: drop upstream + patch. +- mm-*.patch: drop upstream patches. +- important config changes: + ACPI_IPMI=m + CRYPTO_AES_NI_INTEL=m [i386] + TRANSPARENT_HUGEPAGE=y + +* Wed Jan 12 2011 Kyle McMartin 2.6.38-0.rc0.git9.1 +- Linux 2.6.37-git9 +- Re-enable DEBUG_SET_MODULE_RONX since commit 94462ad3 fixed it. +- Enable some more new random HID and sensor junk as modules. + +* Tue Jan 11 2011 Matthew Garrett +- linux-2.6-ehci-check-port-status.patch - fix USB resume on some AMD systems + +* Mon Jan 10 2011 Jarod Wilson +- Add support for local rebuild config option overrides +- Add missing --with/--without pae build flag support + +* Mon Jan 10 2011 Kyle McMartin 2.6.38-0.rc0.git4.2 +- Disable DEBUG_SET_MODULE_RONX for now, it causes boot-up to fail since + dynamic ftrace is trying to rewrite instructions on module load. + +* Mon Jan 10 2011 Kyle McMartin +- Drop obsolete linux-2.6-debug-nmi-timeout.patch + +* Mon Jan 10 2011 Kyle McMartin 2.6.38-0.rc0.git4.1 +- Branch for 2.6.38 +- Rebase trivial patches. +- Switch debug configs back on. +- config changes: + DEBUG_SET_MODULE_RONX=y + B43_PHY_N=y + RT2800USB_RT33XX=y | + RT2800PCI_RT33XX=y | experimental + WL12XX=m + RTL8192CE=m + CAN_SLCAN=m + SCHED_AUTOGROUP=n + * Sun Jan 09 2011 Michael Young - reorganize xen.pcifront.fixes.patch to be a combination of stable/bug-fixes stable/generic and stable/irq.rework for fixes @@ -1990,10 +2066,10 @@ fi - update xen.pcifront.fixes.patch with IRQ fixes from stable/bug-fixes branch - skip docs - it seems to cause build failures at random points the moment. -* Wed Jan 05 2011 Dennis Gilmore +* Wed Jan 05 2011 Dennis Gilmore - build sparc headers on sparcv9 -* Tue Jan 04 2011 Dennis Gilmore +* Tue Jan 04 2011 Dennis Gilmore - add patch for sparc build failure * Tue Jan 04 2011 Kyle McMartin 2.6.37-1 diff --git a/linux-2.6-32bit-mmap-exec-randomization.patch b/linux-2.6-32bit-mmap-exec-randomization.patch index d42638c..dd40b60 100644 --- a/linux-2.6-32bit-mmap-exec-randomization.patch +++ b/linux-2.6-32bit-mmap-exec-randomization.patch @@ -14,9 +14,9 @@ --- b/mm/mmap.c +++ b/mm/mmap.c @@ -28,6 +28,7 @@ - #include #include #include + #include +#include #include diff --git a/linux-2.6-debug-nmi-timeout.patch b/linux-2.6-debug-nmi-timeout.patch deleted file mode 100644 index f54d26a..0000000 --- a/linux-2.6-debug-nmi-timeout.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 542dee6f43067fa0101b53925aadf1d08c997cd4 Mon Sep 17 00:00:00 2001 -From: Kyle McMartin -Date: Mon, 29 Mar 2010 23:40:27 -0400 -Subject: linux-2.6-debug-nmi-timeout - ---- - arch/x86/kernel/apic/nmi.c | 2 +- - lib/Kconfig.debug | 8 ++++++++ - 2 files changed, 9 insertions(+), 1 deletions(-) - -diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c -index 8aa65ad..ba7d55e 100644 ---- a/arch/x86/kernel/apic/nmi.c -+++ b/arch/x86/kernel/apic/nmi.c -@@ -439,7 +439,7 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason) - * wait a few IRQs (5 seconds) before doing the oops ... - */ - __this_cpu_inc(alert_counter); -- if (__this_cpu_read(alert_counter) == 5 * nmi_hz) -+ if (__this_cpu_read(alert_counter) == CONFIG_DEBUG_NMI_TIMEOUT * nmi_hz) - /* - * die_nmi will return ONLY if NOTIFY_STOP happens.. - */ -diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug -index 1fafb4b..963e78b 100644 ---- a/lib/Kconfig.debug -+++ b/lib/Kconfig.debug -@@ -254,6 +254,14 @@ config SCHEDSTATS - application, you can say N to avoid the very slight overhead - this adds. - -+config DEBUG_NMI_TIMEOUT -+ int "Number of seconds before NMI timeout" -+ depends on X86 -+ default 5 -+ help -+ This value is the number of seconds the NMI watchdog will tick -+ before it decides the machine has hung. -+ - config TIMER_STATS - bool "Collect kernel timers statistics" - depends on DEBUG_KERNEL && PROC_FS --- -1.7.0.1 - diff --git a/linux-2.6-ehci-check-port-status.patch b/linux-2.6-ehci-check-port-status.patch new file mode 100644 index 0000000..6182c77 --- /dev/null +++ b/linux-2.6-ehci-check-port-status.patch @@ -0,0 +1,54 @@ +commit e17a07a9e0b62d5a5f0a5683ecbabad3aa95a4d5 +Author: Matthew Garrett +Date: Tue Jan 11 12:19:40 2011 -0500 + + ehci: Check individual port status registers on resume + + If a device plug/unplug is detected on an ATI SB700 USB controller in D3, + it appears to set the port status register but not the controller status + register. As a result we'll fail to detect the plug event. Check the port + status register on resume as well in order to catch this case. + + Signed-off-by: Matthew Garrett + +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c +index 796ea0c..d9c0748 100644 +--- a/drivers/usb/host/ehci-hub.c ++++ b/drivers/usb/host/ehci-hub.c +@@ -106,6 +106,27 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci) + ehci->owned_ports = 0; + } + ++static int ehci_port_change(struct ehci_hcd *ehci) ++{ ++ int i = HCS_N_PORTS(ehci->hcs_params); ++ ++ /* First check if the controller indicates a change event */ ++ ++ if (ehci_readl(ehci, &ehci->regs->status) & STS_PCD) ++ return 1; ++ ++ /* ++ * Not all controllers appear to update this while going from D3 to D0, ++ * so check the individual port status registers as well ++ */ ++ ++ while (i--) ++ if (ehci_readl(ehci, &ehci->regs->port_status[i]) & PORT_CSC) ++ return 1; ++ ++ return 0; ++} ++ + static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, + bool suspending, bool do_wakeup) + { +@@ -168,7 +189,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, + } + + /* Does the root hub have a port wakeup pending? */ +- if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) ++ if (!suspending && ehci_port_change(ehci)) + usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); + } + diff --git a/linux-2.6-i386-nx-emulation.patch b/linux-2.6-i386-nx-emulation.patch index 24a2ed5..da84cc6 100644 --- a/linux-2.6-i386-nx-emulation.patch +++ b/linux-2.6-i386-nx-emulation.patch @@ -389,7 +389,7 @@ + else + printk(KERN_NOTICE "Notice: NX (Execute Disable) protection " - "missing in CPU or disabled in BIOS!\n"); + "missing in CPU!\n"); } else { --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c diff --git a/linux-2.6-serial-460800.patch b/linux-2.6-serial-460800.patch index 17d67ef..9aa392c 100644 --- a/linux-2.6-serial-460800.patch +++ b/linux-2.6-serial-460800.patch @@ -1,7 +1,7 @@ diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 2209620..659c1bb 100644 ---- a/drivers/serial/8250.c -+++ b/drivers/serial/8250.c +--- a/drivers/tty/serial/8250.c ++++ b/drivers/tty/serial/8250.c @@ -7,6 +7,9 @@ * * Copyright (C) 2001 Russell King. diff --git a/linux-2.6-silence-noise.patch b/linux-2.6-silence-noise.patch index 119a977..32c678b 100644 --- a/linux-2.6-silence-noise.patch +++ b/linux-2.6-silence-noise.patch @@ -1,15 +1,3 @@ ---- linux-2.6.26.noarch/drivers/base/power/main.c~ 2008-08-22 20:57:57.000000000 -0400 -+++ linux-2.6.26.noarch/drivers/base/power/main.c 2008-08-22 20:58:05.000000000 -0400 -@@ -69,9 +69,6 @@ void device_pm_unlock(void) - */ - void device_pm_add(struct device *dev) - { -- pr_debug("PM: Adding info for %s:%s\n", -- dev->bus ? dev->bus->name : "No Bus", -- kobject_name(&dev->kobj)); - mutex_lock(&dpm_list_mtx); - if (dev->parent) { - if (dev->parent->power.status >= DPM_SUSPENDING) From b4e96f34c17e5a79cd28774cc722bb33e7e02c6e Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 25 Sep 2008 16:23:33 -0400 @@ -31,7 +19,7 @@ index 170f71e..4f3e632 100644 static int i8042_controller_check(void) { - if (i8042_flush() == I8042_BUFFER_SIZE) { -- printk(KERN_ERR "i8042.c: No controller found.\n"); +- pr_err("No controller found\n"); + if (i8042_flush() == I8042_BUFFER_SIZE) return -ENODEV; - } @@ -64,3 +52,21 @@ Signed-off-by: Dave Jones } #endif +This was removed in revision 1.6 of linux-2.6-silence-noise.patch +in ye olde CVS tree. I have no idea why. Originally the pr_debug in +device_pm_remove was nuked as well, but that seems to have gotten lost in +the r1.634 of kernel.spec (2.6.26-rc2-git5.) + +diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c +index 2a52270..bacbdd2 100644 +--- a/drivers/base/power/main.c ++++ b/drivers/base/power/main.c +@@ -87,8 +87,6 @@ void device_pm_unlock(void) + */ + void device_pm_add(struct device *dev) + { +- pr_debug("PM: Adding info for %s:%s\n", +- dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); + mutex_lock(&dpm_list_mtx); + if (dev->parent && dev->parent->power.in_suspend) + dev_warn(dev, "parent %s should not be sleeping\n", diff --git a/linux-2.6-tracehook.patch b/linux-2.6-tracehook.patch index b4928fc..027c6d5 100644 --- a/linux-2.6-tracehook.patch +++ b/linux-2.6-tracehook.patch @@ -20,10 +20,10 @@ Signed-off-by: Roland McGrath 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h -index 4272521..a85fb41 100644 +index 092a04f..619cdf0 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h -@@ -105,6 +105,7 @@ extern int ptrace_traceme(void); +@@ -106,6 +106,7 @@ extern int ptrace_traceme(void); extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); extern int ptrace_attach(struct task_struct *tsk); @@ -32,10 +32,10 @@ index 4272521..a85fb41 100644 extern void ptrace_disable(struct task_struct *); extern int ptrace_check_attach(struct task_struct *task, int kill); diff --git a/include/linux/sched.h b/include/linux/sched.h -index ce160d6..5e7cc95 100644 +index 2238745..09f26df 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -2030,6 +2030,7 @@ extern int kill_pgrp(struct pid *pid, in +@@ -2061,6 +2061,7 @@ extern int kill_pgrp(struct pid *pid, in extern int kill_pid(struct pid *pid, int sig, int priv); extern int kill_proc_info(int, struct siginfo *, pid_t); extern int do_notify_parent(struct task_struct *, int); @@ -44,7 +44,7 @@ index ce160d6..5e7cc95 100644 extern void force_sig(int, struct task_struct *); extern int send_sig(int, struct task_struct *, int); diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h -index 10db010..c78b2f4 100644 +index 3a2e66d..98917e9 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h @@ -134,7 +134,7 @@ static inline __must_check int tracehook @@ -93,7 +93,7 @@ index 10db010..c78b2f4 100644 /** diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index f34d798..8049cb5 100644 +index 99bbaa3..84d9f8f 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -270,7 +270,7 @@ static int ignoring_children(struct sigh @@ -106,10 +106,10 @@ index f34d798..8049cb5 100644 __ptrace_unlink(p); diff --git a/kernel/signal.c b/kernel/signal.c -index bded651..6d13d9f 100644 +index 4e3cff1..b74324d 100644 --- a/kernel/signal.c +++ b/kernel/signal.c -@@ -1521,7 +1521,7 @@ int do_notify_parent(struct task_struct +@@ -1522,7 +1522,7 @@ int do_notify_parent(struct task_struct return ret; } @@ -118,7 +118,7 @@ index bded651..6d13d9f 100644 { struct siginfo info; unsigned long flags; -@@ -1791,7 +1791,7 @@ static int do_signal_stop(int signr) +@@ -1794,7 +1794,7 @@ static int do_signal_stop(int signr) static int ptrace_signal(int signr, siginfo_t *info, struct pt_regs *regs, void *cookie) { diff --git a/linux-2.6-utrace-ptrace.patch b/linux-2.6-utrace-ptrace.patch index caeae67..bc5681d 100644 --- a/linux-2.6-utrace-ptrace.patch +++ b/linux-2.6-utrace-ptrace.patch @@ -12,28 +12,27 @@ change to userland when CONFIG_UTRACE is enabled. Signed-off-by: Roland McGrath Signed-off-by: Oleg Nesterov --- - include/linux/ptrace.h | 2 +- + include/linux/ptrace.h | 1 + kernel/Makefile | 1 + - kernel/ptrace-utrace.c | 1138 ++++++++++++++++++++++++++++++++++++++++++++++++ - kernel/ptrace.c | 688 ++++++++++++++--------------- + kernel/ptrace-utrace.c | 1187 ++++++++++++++++++++++++++++++++++++++++++++++++ + kernel/ptrace.c | 690 ++++++++++++++-------------- kernel/utrace.c | 16 + - 5 files changed, 1494 insertions(+), 351 deletions(-) + 5 files changed, 1544 insertions(+), 351 deletions(-) diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h -index a85fb41..235c1b0 100644 +index 619cdf0..e391bdb 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h -@@ -99,7 +99,7 @@ - #include /* For unlikely. */ +@@ -100,6 +100,7 @@ #include /* For struct task_struct. */ -- + +extern void ptrace_notify_stop(struct task_struct *tracee); extern long arch_ptrace(struct task_struct *child, long request, unsigned long addr, unsigned long data); extern int ptrace_traceme(void); diff --git a/kernel/Makefile b/kernel/Makefile -index 6004913..b09c9a5 100644 +index 1172528..9a815a5 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_RESOURCE_COUNTERS) += res_c @@ -46,10 +45,10 @@ index 6004913..b09c9a5 100644 obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o diff --git a/kernel/ptrace-utrace.c b/kernel/ptrace-utrace.c new file mode 100644 -index ...a90078d 100644 +index ...a5bcb9e 100644 --- /dev/null +++ b/kernel/ptrace-utrace.c -@@ -0,0 +1,1138 @@ +@@ -0,0 +1,1187 @@ +/* + * linux/kernel/ptrace.c + * @@ -119,6 +118,7 @@ index ...a90078d 100644 +#define PT_UTRACED 0x00001000 + +#define PTRACE_O_SYSEMU 0x100 ++#define PTRACE_O_DETACHED 0x200 + +#define PTRACE_EVENT_SYSCALL (1 << 16) +#define PTRACE_EVENT_SIGTRAP (2 << 16) @@ -155,6 +155,19 @@ index ...a90078d 100644 + &ptrace_utrace_ops, NULL); +} + ++static int utrace_barrier_uninterruptible(struct task_struct *target, ++ struct utrace_engine *engine) ++{ ++ for (;;) { ++ int err = utrace_barrier(target, engine); ++ ++ if (err != -ERESTARTSYS) ++ return err; ++ ++ schedule_timeout_uninterruptible(1); ++ } ++} ++ +static struct utrace_engine * +ptrace_reuse_engine(struct task_struct *tracee) +{ @@ -167,7 +180,7 @@ index ...a90078d 100644 + return engine; + + ctx = ptrace_context(engine); -+ if (unlikely(ctx->resume == UTRACE_DETACH)) { ++ if (unlikely(ctx->options == PTRACE_O_DETACHED)) { + /* + * Try to reuse this self-detaching engine. + * The only caller which can hit this case is ptrace_attach(), @@ -181,12 +194,16 @@ index ...a90078d 100644 + if (!err || err == -EINPROGRESS) { + ctx->resume = UTRACE_RESUME; + /* synchronize with ptrace_report_signal() */ -+ err = utrace_barrier(tracee, engine); ++ err = utrace_barrier_uninterruptible(tracee, engine); + } -+ WARN_ON(!err != (engine->ops == &ptrace_utrace_ops)); + -+ if (!err) ++ if (!err) { ++ WARN_ON(engine->ops != &ptrace_utrace_ops && ++ !tracee->exit_state); + return engine; ++ } ++ ++ WARN_ON(engine->ops == &ptrace_utrace_ops); + } + + utrace_engine_put(engine); @@ -296,32 +313,60 @@ index ...a90078d 100644 + * If true, the caller is PTRACE_DETACH, otherwise + * the tracer detaches implicitly during exit. + */ -+ bool voluntary = (sig >= 0); ++ bool explicit = (sig >= 0); + struct utrace_engine *engine = ptrace_lookup_engine(tracee); + enum utrace_resume_action action = UTRACE_DETACH; ++ struct ptrace_context *ctx; + + if (unlikely(IS_ERR(engine))) + return; + -+ if (sig) { -+ struct ptrace_context *ctx = ptrace_context(engine); ++ ctx = ptrace_context(engine); ++ ++ if (!explicit) { ++ int err; ++ ++ /* ++ * We are going to detach, the tracee can be running. ++ * Ensure ptrace_report_signal() won't report a signal. ++ */ ++ ctx->resume = UTRACE_DETACH; ++ err = utrace_barrier_uninterruptible(tracee, engine); ++ ++ if (!err && ctx->siginfo) { ++ /* ++ * The tracee has already reported a signal ++ * before utrace_barrier(). ++ * ++ * Resume it like we do in PTRACE_EVENT_SIGNAL ++ * case below. The difference is that we can race ++ * with ptrace_report_signal() if the tracee is ++ * running but this doesn't matter. In any case ++ * UTRACE_SIGNAL_REPORT must be pending and it ++ * can return nothing but UTRACE_DETACH. ++ */ ++ action = UTRACE_RESUME; ++ } + ++ } else if (sig) { + switch (get_stop_event(ctx)) { + case PTRACE_EVENT_SYSCALL: -+ if (voluntary) -+ send_sig_info(sig, SEND_SIG_PRIV, tracee); ++ send_sig_info(sig, SEND_SIG_PRIV, tracee); + break; + + case PTRACE_EVENT_SIGNAL: -+ if (voluntary) -+ ctx->signr = sig; ++ ctx->signr = sig; + ctx->resume = UTRACE_DETACH; + action = UTRACE_RESUME; + break; + } + } + -+ ptrace_wake_up(tracee, engine, action, voluntary); ++ ptrace_wake_up(tracee, engine, action, explicit); ++ ++ if (action != UTRACE_DETACH) ++ ctx->options = PTRACE_O_DETACHED; ++ + utrace_engine_put(engine); +} + @@ -453,6 +498,11 @@ index ...a90078d 100644 + return UTRACE_SYSCALL_RUN | UTRACE_STOP; +} + ++static inline bool is_step_resume(enum utrace_resume_action resume) ++{ ++ return resume == UTRACE_BLOCKSTEP || resume == UTRACE_SINGLESTEP; ++} ++ +static u32 ptrace_report_syscall_exit(u32 action, struct utrace_engine *engine, + struct pt_regs *regs) +{ @@ -461,11 +511,7 @@ index ...a90078d 100644 + if (ptrace_event_pending(ctx)) + return UTRACE_STOP; + -+ if (ctx->resume != UTRACE_RESUME) { -+ WARN_ON(ctx->resume != UTRACE_BLOCKSTEP && -+ ctx->resume != UTRACE_SINGLESTEP); -+ ctx->resume = UTRACE_RESUME; -+ ++ if (is_step_resume(ctx->resume)) { + ctx->signr = SIGTRAP; + return UTRACE_INTERRUPT; + } @@ -553,10 +599,7 @@ index ...a90078d 100644 + if (WARN_ON(ctx->siginfo)) + ctx->siginfo = NULL; + -+ if (resume != UTRACE_RESUME) { -+ WARN_ON(resume != UTRACE_BLOCKSTEP && -+ resume != UTRACE_SINGLESTEP); -+ ++ if (is_step_resume(resume)) { + set_stop_code(ctx, PTRACE_EVENT_SIGTRAP); + return UTRACE_STOP | UTRACE_SIGNAL_IGN; + } @@ -583,6 +626,11 @@ index ...a90078d 100644 + } + + WARN_ON(ctx->siginfo); ++ ++ /* Raced with the exiting tracer ? */ ++ if (resume == UTRACE_DETACH) ++ return action; ++ + ctx->siginfo = info; + /* + * ctx->siginfo points to the caller's stack. @@ -811,7 +859,7 @@ index ...a90078d 100644 +static int ptrace_set_options(struct task_struct *tracee, + struct utrace_engine *engine, long data) +{ -+ BUILD_BUG_ON(PTRACE_O_MASK & PTRACE_O_SYSEMU); ++ BUILD_BUG_ON(PTRACE_O_MASK & (PTRACE_O_SYSEMU | PTRACE_O_DETACHED)); + + ptrace_set_events(tracee, engine, data & PTRACE_O_MASK); + return (data & ~PTRACE_O_MASK) ? -EINVAL : 0; @@ -1189,7 +1237,7 @@ index ...a90078d 100644 +} +#endif /* CONFIG_COMPAT */ diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 23bde94..daed9e8 100644 +index e275608..72ea65c 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -15,7 +15,6 @@ @@ -1200,7 +1248,7 @@ index 23bde94..daed9e8 100644 #include #include #include -@@ -24,7 +23,317 @@ +@@ -24,7 +23,320 @@ #include #include @@ -1412,7 +1460,8 @@ index 23bde94..daed9e8 100644 +#define arch_ptrace_attach(child) do { } while (0) +#endif + -+SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, unsigned long, data) ++SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, ++ unsigned long, data) +{ + struct task_struct *child; + long ret; @@ -1423,13 +1472,13 @@ index 23bde94..daed9e8 100644 + arch_ptrace_attach(current); + goto out; + } -+ + + child = ptrace_get_task_struct(pid); + if (IS_ERR(child)) { + ret = PTR_ERR(child); + goto out; + } - ++ + if (request == PTRACE_ATTACH) { + ret = ptrace_attach(child); + /* @@ -1453,7 +1502,8 @@ index 23bde94..daed9e8 100644 + return ret; +} + -+int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr, unsigned long data) ++int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr, ++ unsigned long data) +{ + unsigned long tmp; + int copied; @@ -1464,7 +1514,8 @@ index 23bde94..daed9e8 100644 + return put_user(tmp, (unsigned long __user *)data); +} + -+int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, unsigned long data) ++int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, ++ unsigned long data) +{ + int copied; + @@ -1518,7 +1569,7 @@ index 23bde94..daed9e8 100644 /* * ptrace a task: make the debugger its new parent and * move it to the ptrace list. -@@ -117,61 +426,6 @@ int ptrace_check_attach(struct task_stru +@@ -117,61 +429,6 @@ int ptrace_check_attach(struct task_stru return ret; } @@ -1580,7 +1631,7 @@ index 23bde94..daed9e8 100644 int ptrace_attach(struct task_struct *task) { int retval; -@@ -195,8 +449,6 @@ int ptrace_attach(struct task_struct *ta +@@ -195,8 +452,6 @@ int ptrace_attach(struct task_struct *ta task_lock(task); retval = __ptrace_may_access(task, PTRACE_MODE_ATTACH); @@ -1589,13 +1640,10 @@ index 23bde94..daed9e8 100644 task_unlock(task); if (retval) goto unlock_creds; -@@ -217,94 +469,40 @@ int ptrace_attach(struct task_struct *ta - - retval = 0; - unlock_tasklist: -- write_unlock_irq(&tasklist_lock); --unlock_creds: -- mutex_unlock(&task->signal->cred_guard_mutex); +@@ -220,91 +475,37 @@ unlock_tasklist: + write_unlock_irq(&tasklist_lock); + unlock_creds: + mutex_unlock(&task->signal->cred_guard_mutex); -out: - return retval; -} @@ -1654,9 +1702,6 @@ index 23bde94..daed9e8 100644 - * If it's a zombie, our attachedness prevented normal parent notification - * or self-reaping. Do notification now if it would have happened earlier. - * If it should reap itself, return true. -+ write_unlock_irq(&tasklist_lock); -+unlock_creds: -+ mutex_unlock(&task->signal->cred_guard_mutex); +out: + return retval; +} @@ -1711,7 +1756,7 @@ index 23bde94..daed9e8 100644 } int ptrace_detach(struct task_struct *child, unsigned int data) -@@ -366,56 +564,6 @@ void exit_ptrace(struct task_struct *tra +@@ -368,57 +569,7 @@ void exit_ptrace(struct task_struct *tra write_lock_irq(&tasklist_lock); } @@ -1765,10 +1810,12 @@ index 23bde94..daed9e8 100644 - return copied; -} - - static int ptrace_setoptions(struct task_struct *child, unsigned long data) +-static int ptrace_setoptions(struct task_struct *child, unsigned long data) ++static int ptrace_setoptions(struct task_struct *child, long data) { child->ptrace &= ~PT_TRACE_MASK; -@@ -530,47 +677,6 @@ static int ptrace_resume(struct task_str + +@@ -533,47 +683,6 @@ static int ptrace_resume(struct task_str return 0; } @@ -1816,7 +1863,7 @@ index 23bde94..daed9e8 100644 int ptrace_request(struct task_struct *child, long request, unsigned long addr, unsigned long data) { -@@ -686,91 +792,7 @@ int ptrace_request(struct task_struct *c +@@ -689,91 +798,7 @@ int ptrace_request(struct task_struct *c return ret; } @@ -1908,7 +1955,7 @@ index 23bde94..daed9e8 100644 int compat_ptrace_request(struct task_struct *child, compat_long_t request, compat_ulong_t addr, compat_ulong_t data) { -@@ -845,42 +870,5 @@ int compat_ptrace_request(struct task_st +@@ -851,42 +876,5 @@ int compat_ptrace_request(struct task_st return ret; } @@ -1953,10 +2000,10 @@ index 23bde94..daed9e8 100644 #endif /* CONFIG_COMPAT */ +#endif /* CONFIG_UTRACE */ diff --git a/kernel/utrace.c b/kernel/utrace.c -index 43f38b7..fd21b7b 100644 +index 26d6faf..37dce16 100644 --- a/kernel/utrace.c +++ b/kernel/utrace.c -@@ -809,6 +809,22 @@ relock: +@@ -816,6 +816,22 @@ relock: spin_unlock_irq(&task->sighand->siglock); spin_unlock(&utrace->lock); diff --git a/linux-2.6-utrace.patch b/linux-2.6-utrace.patch index c50b83e..366b8a1 100644 --- a/linux-2.6-utrace.patch +++ b/linux-2.6-utrace.patch @@ -35,11 +35,11 @@ Signed-off-by: Roland McGrath kernel/Makefile | 1 + kernel/fork.c | 3 + kernel/ptrace.c | 14 + - kernel/utrace.c | 2434 +++++++++++++++++++++++++++++++++++++ - 11 files changed, 3837 insertions(+), 2 deletions(-) + kernel/utrace.c | 2440 +++++++++++++++++++++++++++++++++++++ + 11 files changed, 3843 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile -index 34929f2..884c36b 100644 +index 8b6e00a..2740633 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -14,7 +14,7 @@ DOCBOOKS := z8530book.xml mcabook.xml de @@ -668,10 +668,10 @@ index fff6572..a67bd83 100644 if (p->files) fdt = files_fdtable(p->files); diff --git a/include/linux/sched.h b/include/linux/sched.h -index 5e7cc95..66a1ec8 100644 +index 09f26df..e6fa5e9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -1339,6 +1339,11 @@ struct task_struct { +@@ -1357,6 +1357,11 @@ struct task_struct { #endif seccomp_t seccomp; @@ -684,7 +684,7 @@ index 5e7cc95..66a1ec8 100644 u32 parent_exec_id; u32 self_exec_id; diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h -index c78b2f4..71fa250 100644 +index 98917e9..afba8f8 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h @@ -49,6 +49,7 @@ @@ -1620,10 +1620,10 @@ index ...f251efe 100644 + +#endif /* linux/utrace.h */ diff --git a/init/Kconfig b/init/Kconfig -index 2de5b1c..a283086 100644 +index c972899..17483b7 100644 --- a/init/Kconfig +++ b/init/Kconfig -@@ -332,6 +332,15 @@ config AUDIT_TREE +@@ -339,6 +339,15 @@ config AUDIT_TREE depends on AUDITSYSCALL select FSNOTIFY @@ -1640,7 +1640,7 @@ index 2de5b1c..a283086 100644 menu "RCU Subsystem" diff --git a/kernel/Makefile b/kernel/Makefile -index 0b72d1a..6004913 100644 +index 0b5ff08..1172528 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -70,6 +70,7 @@ obj-$(CONFIG_IKCONFIG) += configs.o @@ -1652,10 +1652,10 @@ index 0b72d1a..6004913 100644 obj-$(CONFIG_AUDITSYSCALL) += auditsc.o obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o diff --git a/kernel/fork.c b/kernel/fork.c -index 98b4508..3ceff6f 100644 +index 5447dc7..10a39fe 100644 --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -161,6 +161,7 @@ void free_task(struct task_struct *tsk) +@@ -162,6 +162,7 @@ void free_task(struct task_struct *tsk) free_thread_info(tsk->stack); rt_mutex_debug_task_free(tsk); ftrace_graph_exit_task(tsk); @@ -1663,7 +1663,7 @@ index 98b4508..3ceff6f 100644 free_task_struct(tsk); } EXPORT_SYMBOL(free_task); -@@ -1008,6 +1009,8 @@ static struct task_struct *copy_process( +@@ -1018,6 +1019,8 @@ static struct task_struct *copy_process( if (!p) goto fork_out; @@ -1673,7 +1673,7 @@ index 98b4508..3ceff6f 100644 rt_mutex_init_task(p); diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 8049cb5..23bde94 100644 +index 84d9f8f..e275608 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -15,6 +15,7 @@ @@ -1720,10 +1720,10 @@ index 8049cb5..23bde94 100644 if (!current->ptrace) { diff --git a/kernel/utrace.c b/kernel/utrace.c new file mode 100644 -index ...43f38b7 100644 +index ...26d6faf 100644 --- /dev/null +++ b/kernel/utrace.c -@@ -0,0 +1,2434 @@ +@@ -0,0 +1,2440 @@ +/* + * utrace infrastructure interface for debugging user processes + * @@ -2440,8 +2440,15 @@ index ...43f38b7 100644 + /* + * If no more engines want it stopped, wake it up. + */ -+ if (task_is_traced(task) && !(flags & ENGINE_STOP)) ++ if (task_is_traced(task) && !(flags & ENGINE_STOP)) { ++ /* ++ * It just resumes, so make sure single-step ++ * is not left set. ++ */ ++ if (utrace->resume == UTRACE_RESUME) ++ user_disable_single_step(task); + utrace_wakeup(task, utrace); ++ } + + /* + * In theory spin_lock() doesn't imply rcu_read_lock(). @@ -2865,14 +2872,7 @@ index ...43f38b7 100644 + break; + + case UTRACE_RESUME: -+ /* -+ * This and all other cases imply resuming if stopped. -+ * There might not be another report before it just -+ * resumes, so make sure single-step is not left set. -+ */ + clear_engine_wants_stop(engine); -+ if (likely(reset)) -+ user_disable_single_step(target); + break; + + case UTRACE_BLOCKSTEP: @@ -3238,6 +3238,12 @@ index ...43f38b7 100644 + engine, event))) + return NULL; + ++ if (!event) { ++ /* We only got here to report QUIESCE */ ++ report->spurious = false; ++ return NULL; ++ } ++ + /* + * finish_callback() reset utrace->reporting after the + * quiesce callback. Now we set it again (as above) @@ -3253,7 +3259,7 @@ index ...43f38b7 100644 + if (want & ENGINE_STOP) + report->action = UTRACE_STOP; + -+ if (want & (event ?: UTRACE_EVENT(QUIESCE))) { ++ if (want & event) { + report->spurious = false; + return ops; + } diff --git a/linux-next-macbook-air-input.patch b/linux-next-macbook-air-input.patch deleted file mode 100644 index 16d4d6d..0000000 --- a/linux-next-macbook-air-input.patch +++ /dev/null @@ -1,185 +0,0 @@ -Support for USB HID devices on the new Macbook Airs. From -next. - -diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c -index eaeca56..6c52203 100644 ---- a/drivers/hid/hid-apple.c -+++ b/drivers/hid/hid-apple.c -@@ -59,6 +59,27 @@ struct apple_key_translation { - u8 flags; - }; - -+static const struct apple_key_translation macbookair_fn_keys[] = { -+ { KEY_BACKSPACE, KEY_DELETE }, -+ { KEY_ENTER, KEY_INSERT }, -+ { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, -+ { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, -+ { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY }, -+ { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY }, -+ { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, -+ { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, -+ { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY }, -+ { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY }, -+ { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, -+ { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, -+ { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY }, -+ { KEY_UP, KEY_PAGEUP }, -+ { KEY_DOWN, KEY_PAGEDOWN }, -+ { KEY_LEFT, KEY_HOME }, -+ { KEY_RIGHT, KEY_END }, -+ { } -+}; -+ - static const struct apple_key_translation apple_fn_keys[] = { - { KEY_BACKSPACE, KEY_DELETE }, - { KEY_ENTER, KEY_INSERT }, -@@ -157,10 +178,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, - if (fnmode) { - int do_translate; - -- trans = apple_find_translation((hid->product < 0x21d || -- hid->product >= 0x300) ? -- powerbook_fn_keys : apple_fn_keys, -- usage->code); -+ if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && -+ hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) { -+ trans = apple_find_translation(macbookair_fn_keys, usage->code); -+ } else if (hid->product < 0x21d || hid->product >= 0x300) { -+ trans = apple_find_translation(powerbook_fn_keys, usage->code); -+ } else { -+ trans = apple_find_translation(apple_fn_keys, usage->code); -+ } -+ - if (trans) { - if (test_bit(usage->code, asc->pressed_fn)) - do_translate = 1; -@@ -436,6 +462,18 @@ static const struct hid_device_id apple_devices[] = { - .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), - .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), -+ .driver_data = APPLE_HAS_FN }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), -+ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), -+ .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), -+ .driver_data = APPLE_HAS_FN }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), -+ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), -+ .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index b3393e1..53ac909 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1274,6 +1274,12 @@ static const struct hid_device_id hid_blacklist[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, -@@ -1760,6 +1766,12 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, - { } -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 68114db..104b9f9 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -97,6 +97,12 @@ - #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f -+#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b - -diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c -index b952317..ee82851 100644 ---- a/drivers/input/mouse/bcm5974.c -+++ b/drivers/input/mouse/bcm5974.c -@@ -55,6 +55,14 @@ - #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 -+/* MacbookAir3,2 (unibody), aka wellspring5 */ -+#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f -+#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 -+/* MacbookAir3,1 (unibody), aka wellspring4 */ -+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 -+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 - - #define BCM5974_DEVICE(prod) { \ - .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ -@@ -80,6 +88,14 @@ static const struct usb_device_id bcm5974_table[] = { - BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), - BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), - BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), -+ /* MacbookAir3,2 */ -+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), -+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), -+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), -+ /* MacbookAir3,1 */ -+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), -+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), -+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), - /* Terminating entry */ - {} - }; -@@ -234,6 +250,30 @@ static const struct bcm5974_config bcm5974_config_table[] = { - { DIM_X, DIM_X / SN_COORD, -4460, 5166 }, - { DIM_Y, DIM_Y / SN_COORD, -75, 6700 } - }, -+ { -+ USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI, -+ USB_DEVICE_ID_APPLE_WELLSPRING4_ISO, -+ USB_DEVICE_ID_APPLE_WELLSPRING4_JIS, -+ HAS_INTEGRATED_BUTTON, -+ 0x84, sizeof(struct bt_data), -+ 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, -+ { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, -+ { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, -+ { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, -+ { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } -+ }, -+ { -+ USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI, -+ USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO, -+ USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS, -+ HAS_INTEGRATED_BUTTON, -+ 0x84, sizeof(struct bt_data), -+ 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, -+ { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, -+ { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, -+ { DIM_X, DIM_X / SN_COORD, -4616, 5112 }, -+ { DIM_Y, DIM_Y / SN_COORD, -142, 5234 } -+ }, - {} - }; diff --git a/mm-page-allocator-adjust-the-per-cpu-counter-threshold-when-memory-is-low.patch b/mm-page-allocator-adjust-the-per-cpu-counter-threshold-when-memory-is-low.patch deleted file mode 100644 index 561c589..0000000 --- a/mm-page-allocator-adjust-the-per-cpu-counter-threshold-when-memory-is-low.patch +++ /dev/null @@ -1,389 +0,0 @@ -From df43fae25437d7bc7dfff72599c1e825038b67cf Mon Sep 17 00:00:00 2001 -From: Mel Gorman -Date: Wed, 24 Nov 2010 22:18:23 -0500 -Subject: [PATCH 1/2] mm: page allocator: Adjust the per-cpu counter threshold when memory is low - -Commit aa45484 ("calculate a better estimate of NR_FREE_PAGES when memory -is low") noted that watermarks were based on the vmstat NR_FREE_PAGES. To -avoid synchronization overhead, these counters are maintained on a per-cpu -basis and drained both periodically and when a threshold is above a -threshold. On large CPU systems, the difference between the estimate and -real value of NR_FREE_PAGES can be very high. The system can get into a -case where pages are allocated far below the min watermark potentially -causing livelock issues. The commit solved the problem by taking a better -reading of NR_FREE_PAGES when memory was low. - -Unfortately, as reported by Shaohua Li this accurate reading can consume a -large amount of CPU time on systems with many sockets due to cache line -bouncing. This patch takes a different approach. For large machines -where counter drift might be unsafe and while kswapd is awake, the per-cpu -thresholds for the target pgdat are reduced to limit the level of drift to -what should be a safe level. This incurs a performance penalty in heavy -memory pressure by a factor that depends on the workload and the machine -but the machine should function correctly without accidentally exhausting -all memory on a node. There is an additional cost when kswapd wakes and -sleeps but the event is not expected to be frequent - in Shaohua's test -case, there was one recorded sleep and wake event at least. - -To ensure that kswapd wakes up, a safe version of zone_watermark_ok() is -introduced that takes a more accurate reading of NR_FREE_PAGES when called -from wakeup_kswapd, when deciding whether it is really safe to go back to -sleep in sleeping_prematurely() and when deciding if a zone is really -balanced or not in balance_pgdat(). We are still using an expensive -function but limiting how often it is called. - -When the test case is reproduced, the time spent in the watermark -functions is reduced. The following report is on the percentage of time -spent cumulatively spent in the functions zone_nr_free_pages(), -zone_watermark_ok(), __zone_watermark_ok(), zone_watermark_ok_safe(), -zone_page_state_snapshot(), zone_page_state(). - -vanilla 11.6615% -disable-threshold 0.2584% - -Reported-by: Shaohua Li -Signed-off-by: Mel Gorman -Reviewed-by: Christoph Lameter -Signed-off-by: Andrew Morton -[[http://userweb.kernel.org/~akpm/mmotm/broken-out/mm-page-allocator-adjust-the-per-cpu-counter-threshold-when-memory-is-low.patch]] ---- - include/linux/mmzone.h | 10 ++----- - include/linux/vmstat.h | 5 +++ - mm/mmzone.c | 21 --------------- - mm/page_alloc.c | 35 +++++++++++++++++++----- - mm/vmscan.c | 23 +++++++++------- - mm/vmstat.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++- - 6 files changed, 115 insertions(+), 47 deletions(-) - -diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h -index 3984c4e..8d789d7 100644 ---- a/include/linux/mmzone.h -+++ b/include/linux/mmzone.h -@@ -448,12 +448,6 @@ static inline int zone_is_oom_locked(const struct zone *zone) - return test_bit(ZONE_OOM_LOCKED, &zone->flags); - } - --#ifdef CONFIG_SMP --unsigned long zone_nr_free_pages(struct zone *zone); --#else --#define zone_nr_free_pages(zone) zone_page_state(zone, NR_FREE_PAGES) --#endif /* CONFIG_SMP */ -- - /* - * The "priority" of VM scanning is how much of the queues we will scan in one - * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the -@@ -651,7 +645,9 @@ typedef struct pglist_data { - extern struct mutex zonelists_mutex; - void build_all_zonelists(void *data); - void wakeup_kswapd(struct zone *zone, int order); --int zone_watermark_ok(struct zone *z, int order, unsigned long mark, -+bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, -+ int classzone_idx, int alloc_flags); -+bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, - int classzone_idx, int alloc_flags); - enum memmap_context { - MEMMAP_EARLY, -diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h -index eaaea37..e4cc21c 100644 ---- a/include/linux/vmstat.h -+++ b/include/linux/vmstat.h -@@ -254,6 +254,8 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item); - extern void __dec_zone_state(struct zone *, enum zone_stat_item); - - void refresh_cpu_vm_stats(int); -+void reduce_pgdat_percpu_threshold(pg_data_t *pgdat); -+void restore_pgdat_percpu_threshold(pg_data_t *pgdat); - #else /* CONFIG_SMP */ - - /* -@@ -298,6 +300,9 @@ static inline void __dec_zone_page_state(struct page *page, - #define dec_zone_page_state __dec_zone_page_state - #define mod_zone_page_state __mod_zone_page_state - -+static inline void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) { } -+static inline void restore_pgdat_percpu_threshold(pg_data_t *pgdat) { } -+ - static inline void refresh_cpu_vm_stats(int cpu) { } - #endif - -diff --git a/mm/mmzone.c b/mm/mmzone.c -index e35bfb8..f5b7d17 100644 ---- a/mm/mmzone.c -+++ b/mm/mmzone.c -@@ -87,24 +87,3 @@ int memmap_valid_within(unsigned long pfn, - return 1; - } - #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ -- --#ifdef CONFIG_SMP --/* Called when a more accurate view of NR_FREE_PAGES is needed */ --unsigned long zone_nr_free_pages(struct zone *zone) --{ -- unsigned long nr_free_pages = zone_page_state(zone, NR_FREE_PAGES); -- -- /* -- * While kswapd is awake, it is considered the zone is under some -- * memory pressure. Under pressure, there is a risk that -- * per-cpu-counter-drift will allow the min watermark to be breached -- * potentially causing a live-lock. While kswapd is awake and -- * free pages are low, get a better estimate for free pages -- */ -- if (nr_free_pages < zone->percpu_drift_mark && -- !waitqueue_active(&zone->zone_pgdat->kswapd_wait)) -- return zone_page_state_snapshot(zone, NR_FREE_PAGES); -- -- return nr_free_pages; --} --#endif /* CONFIG_SMP */ -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index f12ad18..0286150 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -1454,24 +1454,24 @@ static inline int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) - #endif /* CONFIG_FAIL_PAGE_ALLOC */ - - /* -- * Return 1 if free pages are above 'mark'. This takes into account the order -+ * Return true if free pages are above 'mark'. This takes into account the order - * of the allocation. - */ --int zone_watermark_ok(struct zone *z, int order, unsigned long mark, -- int classzone_idx, int alloc_flags) -+static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, -+ int classzone_idx, int alloc_flags, long free_pages) - { - /* free_pages my go negative - that's OK */ - long min = mark; -- long free_pages = zone_nr_free_pages(z) - (1 << order) + 1; - int o; - -+ free_pages -= (1 << order) + 1; - if (alloc_flags & ALLOC_HIGH) - min -= min / 2; - if (alloc_flags & ALLOC_HARDER) - min -= min / 4; - - if (free_pages <= min + z->lowmem_reserve[classzone_idx]) -- return 0; -+ return false; - for (o = 0; o < order; o++) { - /* At the next order, this order's pages become unavailable */ - free_pages -= z->free_area[o].nr_free << o; -@@ -1480,9 +1480,28 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, - min >>= 1; - - if (free_pages <= min) -- return 0; -+ return false; - } -- return 1; -+ return true; -+} -+ -+bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, -+ int classzone_idx, int alloc_flags) -+{ -+ return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, -+ zone_page_state(z, NR_FREE_PAGES)); -+} -+ -+bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, -+ int classzone_idx, int alloc_flags) -+{ -+ long free_pages = zone_page_state(z, NR_FREE_PAGES); -+ -+ if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark) -+ free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES); -+ -+ return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, -+ free_pages); - } - - #ifdef CONFIG_NUMA -@@ -2436,7 +2455,7 @@ void show_free_areas(void) - " all_unreclaimable? %s" - "\n", - zone->name, -- K(zone_nr_free_pages(zone)), -+ K(zone_page_state(zone, NR_FREE_PAGES)), - K(min_wmark_pages(zone)), - K(low_wmark_pages(zone)), - K(high_wmark_pages(zone)), -diff --git a/mm/vmscan.c b/mm/vmscan.c -index c5dfabf..3e71cb1 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2082,7 +2082,7 @@ static int sleeping_prematurely(pg_data_t *pgdat, int order, long remaining) - if (zone->all_unreclaimable) - continue; - -- if (!zone_watermark_ok(zone, order, high_wmark_pages(zone), -+ if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone), - 0, 0)) - return 1; - } -@@ -2169,7 +2169,7 @@ loop_again: - shrink_active_list(SWAP_CLUSTER_MAX, zone, - &sc, priority, 0); - -- if (!zone_watermark_ok(zone, order, -+ if (!zone_watermark_ok_safe(zone, order, - high_wmark_pages(zone), 0, 0)) { - end_zone = i; - break; -@@ -2215,7 +2215,7 @@ loop_again: - * We put equal pressure on every zone, unless one - * zone has way too many pages free already. - */ -- if (!zone_watermark_ok(zone, order, -+ if (!zone_watermark_ok_safe(zone, order, - 8*high_wmark_pages(zone), end_zone, 0)) - shrink_zone(priority, zone, &sc); - reclaim_state->reclaimed_slab = 0; -@@ -2236,7 +2236,7 @@ loop_again: - total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) - sc.may_writepage = 1; - -- if (!zone_watermark_ok(zone, order, -+ if (!zone_watermark_ok_safe(zone, order, - high_wmark_pages(zone), end_zone, 0)) { - all_zones_ok = 0; - /* -@@ -2244,7 +2244,7 @@ loop_again: - * means that we have a GFP_ATOMIC allocation - * failure risk. Hurry up! - */ -- if (!zone_watermark_ok(zone, order, -+ if (!zone_watermark_ok_safe(zone, order, - min_wmark_pages(zone), end_zone, 0)) - has_under_min_watermark_zone = 1; - } -@@ -2378,7 +2378,9 @@ static int kswapd(void *p) - */ - if (!sleeping_prematurely(pgdat, order, remaining)) { - trace_mm_vmscan_kswapd_sleep(pgdat->node_id); -+ restore_pgdat_percpu_threshold(pgdat); - schedule(); -+ reduce_pgdat_percpu_threshold(pgdat); - } else { - if (remaining) - count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY); -@@ -2417,16 +2419,17 @@ void wakeup_kswapd(struct zone *zone, int order) - if (!populated_zone(zone)) - return; - -- pgdat = zone->zone_pgdat; -- if (zone_watermark_ok(zone, order, low_wmark_pages(zone), 0, 0)) -+ if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) - return; -+ pgdat = zone->zone_pgdat; - if (pgdat->kswapd_max_order < order) - pgdat->kswapd_max_order = order; -- trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order); -- if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) -- return; - if (!waitqueue_active(&pgdat->kswapd_wait)) - return; -+ if (zone_watermark_ok_safe(zone, order, low_wmark_pages(zone), 0, 0)) -+ return; -+ -+ trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order); - wake_up_interruptible(&pgdat->kswapd_wait); - } - -diff --git a/mm/vmstat.c b/mm/vmstat.c -index 355a9e6..4d7faeb 100644 ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -81,6 +81,30 @@ EXPORT_SYMBOL(vm_stat); - - #ifdef CONFIG_SMP - -+static int calculate_pressure_threshold(struct zone *zone) -+{ -+ int threshold; -+ int watermark_distance; -+ -+ /* -+ * As vmstats are not up to date, there is drift between the estimated -+ * and real values. For high thresholds and a high number of CPUs, it -+ * is possible for the min watermark to be breached while the estimated -+ * value looks fine. The pressure threshold is a reduced value such -+ * that even the maximum amount of drift will not accidentally breach -+ * the min watermark -+ */ -+ watermark_distance = low_wmark_pages(zone) - min_wmark_pages(zone); -+ threshold = max(1, (int)(watermark_distance / num_online_cpus())); -+ -+ /* -+ * Maximum threshold is 125 -+ */ -+ threshold = min(125, threshold); -+ -+ return threshold; -+} -+ - static int calculate_threshold(struct zone *zone) - { - int threshold; -@@ -159,6 +183,48 @@ static void refresh_zone_stat_thresholds(void) - } - } - -+void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) -+{ -+ struct zone *zone; -+ int cpu; -+ int threshold; -+ int i; -+ -+ get_online_cpus(); -+ for (i = 0; i < pgdat->nr_zones; i++) { -+ zone = &pgdat->node_zones[i]; -+ if (!zone->percpu_drift_mark) -+ continue; -+ -+ threshold = calculate_pressure_threshold(zone); -+ for_each_online_cpu(cpu) -+ per_cpu_ptr(zone->pageset, cpu)->stat_threshold -+ = threshold; -+ } -+ put_online_cpus(); -+} -+ -+void restore_pgdat_percpu_threshold(pg_data_t *pgdat) -+{ -+ struct zone *zone; -+ int cpu; -+ int threshold; -+ int i; -+ -+ get_online_cpus(); -+ for (i = 0; i < pgdat->nr_zones; i++) { -+ zone = &pgdat->node_zones[i]; -+ if (!zone->percpu_drift_mark) -+ continue; -+ -+ threshold = calculate_threshold(zone); -+ for_each_online_cpu(cpu) -+ per_cpu_ptr(zone->pageset, cpu)->stat_threshold -+ = threshold; -+ } -+ put_online_cpus(); -+} -+ - /* - * For use when we know that interrupts are disabled. - */ -@@ -826,7 +892,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, - "\n scanned %lu" - "\n spanned %lu" - "\n present %lu", -- zone_nr_free_pages(zone), -+ zone_page_state(zone, NR_FREE_PAGES), - min_wmark_pages(zone), - low_wmark_pages(zone), - high_wmark_pages(zone), --- -1.7.3.2 - diff --git a/mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-percpu-thresholds.patch b/mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-percpu-thresholds.patch deleted file mode 100644 index 058b139..0000000 --- a/mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-percpu-thresholds.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 82e3d4969144377d13da97d511e849e8cf3e6dcc Mon Sep 17 00:00:00 2001 -From: Mel Gorman -Date: Wed, 24 Nov 2010 22:24:24 -0500 -Subject: [PATCH 2/2] mm: vmstat: Use a single setter function and callback for adjusting percpu thresholds - -reduce_pgdat_percpu_threshold() and restore_pgdat_percpu_threshold() exist -to adjust the per-cpu vmstat thresholds while kswapd is awake to avoid -errors due to counter drift. The functions duplicate some code so this -patch replaces them with a single set_pgdat_percpu_threshold() that takes -a callback function to calculate the desired threshold as a parameter. - -Signed-off-by: Mel Gorman -Reviewed-by: Christoph Lameter -Reviewed-by: KAMEZAWA Hiroyuki -Signed-off-by: Andrew Morton -[the various mmotm patches updating this were rolled up. --kyle] -[[http://userweb.kernel.org/~akpm/mmotm/broken-out/mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-percpu-thresholds-fix-set_pgdat_percpu_threshold-dont-use-for_each_online_cpu.patch]] ---- - include/linux/vmstat.h | 10 ++++++---- - mm/vmscan.c | 19 +++++++++++++++++-- - mm/vmstat.c | 36 +++++++----------------------------- - 3 files changed, 30 insertions(+), 35 deletions(-) - -diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h -index e4cc21c..833e676 100644 ---- a/include/linux/vmstat.h -+++ b/include/linux/vmstat.h -@@ -254,8 +254,11 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item); - extern void __dec_zone_state(struct zone *, enum zone_stat_item); - - void refresh_cpu_vm_stats(int); --void reduce_pgdat_percpu_threshold(pg_data_t *pgdat); --void restore_pgdat_percpu_threshold(pg_data_t *pgdat); -+ -+int calculate_pressure_threshold(struct zone *zone); -+int calculate_normal_threshold(struct zone *zone); -+void set_pgdat_percpu_threshold(pg_data_t *pgdat, -+ int (*calculate_pressure)(struct zone *)); - #else /* CONFIG_SMP */ - - /* -@@ -300,8 +303,7 @@ static inline void __dec_zone_page_state(struct page *page, - #define dec_zone_page_state __dec_zone_page_state - #define mod_zone_page_state __mod_zone_page_state - --static inline void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) { } --static inline void restore_pgdat_percpu_threshold(pg_data_t *pgdat) { } -+#define set_pgdat_percpu_threshold(pgdat, callback) { } - - static inline void refresh_cpu_vm_stats(int cpu) { } - #endif -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 3e71cb1..ba39948 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2378,9 +2378,24 @@ static int kswapd(void *p) - */ - if (!sleeping_prematurely(pgdat, order, remaining)) { - trace_mm_vmscan_kswapd_sleep(pgdat->node_id); -- restore_pgdat_percpu_threshold(pgdat); -+ -+ /* -+ * vmstat counters are not perfectly -+ * accurate and the estimated value -+ * for counters such as NR_FREE_PAGES -+ * can deviate from the true value by -+ * nr_online_cpus * threshold. To -+ * avoid the zone watermarks being -+ * breached while under pressure, we -+ * reduce the per-cpu vmstat threshold -+ * while kswapd is awake and restore -+ * them before going back to sleep. -+ */ -+ set_pgdat_percpu_threshold(pgdat, -+ calculate_normal_threshold); - schedule(); -- reduce_pgdat_percpu_threshold(pgdat); -+ set_pgdat_percpu_threshold(pgdat, -+ calculate_pressure_threshold); - } else { - if (remaining) - count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY); -diff --git a/mm/vmstat.c b/mm/vmstat.c -index 4d7faeb..511c2c0 100644 ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -81,7 +81,7 @@ EXPORT_SYMBOL(vm_stat); - - #ifdef CONFIG_SMP - --static int calculate_pressure_threshold(struct zone *zone) -+int calculate_pressure_threshold(struct zone *zone) - { - int threshold; - int watermark_distance; -@@ -105,7 +105,7 @@ static int calculate_pressure_threshold(struct zone *zone) - return threshold; - } - --static int calculate_threshold(struct zone *zone) -+int calculate_normal_threshold(struct zone *zone) - { - int threshold; - int mem; /* memory in 128 MB units */ -@@ -164,7 +164,7 @@ static void refresh_zone_stat_thresholds(void) - for_each_populated_zone(zone) { - unsigned long max_drift, tolerate_drift; - -- threshold = calculate_threshold(zone); -+ threshold = calculate_normal_threshold(zone); - - for_each_online_cpu(cpu) - per_cpu_ptr(zone->pageset, cpu)->stat_threshold -@@ -183,46 +183,24 @@ static void refresh_zone_stat_thresholds(void) - } - } - --void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) -+void set_pgdat_percpu_threshold(pg_data_t *pgdat, -+ int (*calculate_pressure)(struct zone *)) - { - struct zone *zone; - int cpu; - int threshold; - int i; - -- get_online_cpus(); -- for (i = 0; i < pgdat->nr_zones; i++) { -- zone = &pgdat->node_zones[i]; -- if (!zone->percpu_drift_mark) -- continue; -- -- threshold = calculate_pressure_threshold(zone); -- for_each_online_cpu(cpu) -- per_cpu_ptr(zone->pageset, cpu)->stat_threshold -- = threshold; -- } -- put_online_cpus(); --} -- --void restore_pgdat_percpu_threshold(pg_data_t *pgdat) --{ -- struct zone *zone; -- int cpu; -- int threshold; -- int i; -- -- get_online_cpus(); - for (i = 0; i < pgdat->nr_zones; i++) { - zone = &pgdat->node_zones[i]; - if (!zone->percpu_drift_mark) - continue; - -- threshold = calculate_threshold(zone); -- for_each_online_cpu(cpu) -+ threshold = (*calculate_pressure)(zone); -+ for_each_possible_cpu(cpu) - per_cpu_ptr(zone->pageset, cpu)->stat_threshold - = threshold; - } -- put_online_cpus(); - } - - /* --- -1.7.3.2 - diff --git a/net-AF_PACKET-vmalloc.patch b/net-AF_PACKET-vmalloc.patch deleted file mode 100644 index 192b5ba..0000000 --- a/net-AF_PACKET-vmalloc.patch +++ /dev/null @@ -1,254 +0,0 @@ -Author: Neil Horman -Date: Fri Dec 17 13:35:36 2010 -0500 - -Enhance AF_PACKET to support using non-contiguous memory when allocating ring -buffer space. This is a combined backport of the following commits from -net-next-2.6: -0e3125c755445664f00ad036e4fc2cd32fd52877 -bbce5a59e4e0e6e1dbc85492caaf310ff6611309 -0af55bb58f8fa7865004ac48d16affe125ac1b7f -920b8d913bd3d963d5c88bca160a272b71e0c95a - -diff -up linux-2.6.34.x86_64/net/packet/af_packet.c.orig linux-2.6.34.x86_64/net/packet/af_packet.c ---- linux-2.6.34.x86_64/net/packet/af_packet.c.orig 2010-12-17 12:16:58.000000000 -0500 -+++ linux-2.6.34.x86_64/net/packet/af_packet.c 2010-12-17 12:30:14.000000000 -0500 -@@ -61,6 +61,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -161,8 +162,14 @@ struct packet_mreq_max { - static int packet_set_ring(struct sock *sk, struct tpacket_req *req, - int closing, int tx_ring); - -+#define PGV_FROM_VMALLOC 1 -+struct pgv { -+ char *buffer; -+ unsigned char flags; -+}; -+ - struct packet_ring_buffer { -- char **pg_vec; -+ struct pgv *pg_vec; - unsigned int head; - unsigned int frames_per_block; - unsigned int frame_size; -@@ -214,6 +221,13 @@ struct packet_skb_cb { - - #define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb)) - -+static inline struct page *pgv_to_page(void *addr) -+{ -+ if (is_vmalloc_addr(addr)) -+ return vmalloc_to_page(addr); -+ return virt_to_page(addr); -+} -+ - static void __packet_set_status(struct packet_sock *po, void *frame, int status) - { - union { -@@ -226,11 +240,11 @@ static void __packet_set_status(struct p - switch (po->tp_version) { - case TPACKET_V1: - h.h1->tp_status = status; -- flush_dcache_page(virt_to_page(&h.h1->tp_status)); -+ flush_dcache_page(pgv_to_page(&h.h1->tp_status)); - break; - case TPACKET_V2: - h.h2->tp_status = status; -- flush_dcache_page(virt_to_page(&h.h2->tp_status)); -+ flush_dcache_page(pgv_to_page(&h.h2->tp_status)); - break; - default: - pr_err("TPACKET version not supported\n"); -@@ -253,10 +267,10 @@ static int __packet_get_status(struct pa - h.raw = frame; - switch (po->tp_version) { - case TPACKET_V1: -- flush_dcache_page(virt_to_page(&h.h1->tp_status)); -+ flush_dcache_page(pgv_to_page(&h.h1->tp_status)); - return h.h1->tp_status; - case TPACKET_V2: -- flush_dcache_page(virt_to_page(&h.h2->tp_status)); -+ flush_dcache_page(pgv_to_page(&h.h2->tp_status)); - return h.h2->tp_status; - default: - pr_err("TPACKET version not supported\n"); -@@ -280,7 +294,8 @@ static void *packet_lookup_frame(struct - pg_vec_pos = position / rb->frames_per_block; - frame_offset = position % rb->frames_per_block; - -- h.raw = rb->pg_vec[pg_vec_pos] + (frame_offset * rb->frame_size); -+ h.raw = rb->pg_vec[pg_vec_pos].buffer + -+ (frame_offset * rb->frame_size); - - if (status != __packet_get_status(po, h.raw)) - return NULL; -@@ -771,15 +786,11 @@ static int tpacket_rcv(struct sk_buff *s - __packet_set_status(po, h.raw, status); - smp_mb(); - { -- struct page *p_start, *p_end; -- u8 *h_end = h.raw + macoff + snaplen - 1; -+ u8 *start, *end; - -- p_start = virt_to_page(h.raw); -- p_end = virt_to_page(h_end); -- while (p_start <= p_end) { -- flush_dcache_page(p_start); -- p_start++; -- } -+ end = (u8 *)PAGE_ALIGN((unsigned long)h.raw + macoff + snaplen); -+ for (start = h.raw; start < end; start += PAGE_SIZE) -+ flush_dcache_page(pgv_to_page(start)); - } - - sk->sk_data_ready(sk, 0); -@@ -886,7 +897,6 @@ static int tpacket_fill_skb(struct packe - } - - err = -EFAULT; -- page = virt_to_page(data); - offset = offset_in_page(data); - len_max = PAGE_SIZE - offset; - len = ((to_write > len_max) ? len_max : to_write); -@@ -905,11 +915,11 @@ static int tpacket_fill_skb(struct packe - return -EFAULT; - } - -+ page = pgv_to_page(data); -+ data += len; - flush_dcache_page(page); - get_page(page); -- skb_fill_page_desc(skb, -- nr_frags, -- page++, offset, len); -+ skb_fill_page_desc(skb, nr_frags, page, offset, len); - to_write -= len; - offset = 0; - len_max = PAGE_SIZE; -@@ -2230,37 +2240,76 @@ static const struct vm_operations_struct - .close = packet_mm_close, - }; - --static void free_pg_vec(char **pg_vec, unsigned int order, unsigned int len) -+static void free_pg_vec(struct pgv *pg_vec, unsigned int order, -+ unsigned int len) - { - int i; - - for (i = 0; i < len; i++) { -- if (likely(pg_vec[i])) -- free_pages((unsigned long) pg_vec[i], order); -+ if (likely(pg_vec[i].buffer)) { -+ if (pg_vec[i].flags & PGV_FROM_VMALLOC) -+ vfree(pg_vec[i].buffer); -+ else -+ free_pages((unsigned long)pg_vec[i].buffer, -+ order); -+ pg_vec[i].buffer = NULL; -+ } - } - kfree(pg_vec); - } - --static inline char *alloc_one_pg_vec_page(unsigned long order) -+static inline char *alloc_one_pg_vec_page(unsigned long order, -+ unsigned char *flags) - { -- gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP | __GFP_ZERO | __GFP_NOWARN; -+ char *buffer = NULL; -+ gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP | -+ __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY; -+ -+ buffer = (char *) __get_free_pages(gfp_flags, order); - -- return (char *) __get_free_pages(gfp_flags, order); -+ if (buffer) -+ return buffer; -+ -+ /* -+ * __get_free_pages failed, fall back to vmalloc -+ */ -+ *flags |= PGV_FROM_VMALLOC; -+ buffer = vmalloc((1 << order) * PAGE_SIZE); -+ -+ if (buffer) { -+ memset(buffer, 0, (1 << order) * PAGE_SIZE); -+ return buffer; -+ } -+ -+ /* -+ * vmalloc failed, lets dig into swap here -+ */ -+ *flags = 0; -+ gfp_flags &= ~__GFP_NORETRY; -+ buffer = (char *)__get_free_pages(gfp_flags, order); -+ if (buffer) -+ return buffer; -+ -+ /* -+ * complete and utter failure -+ */ -+ return NULL; - } - --static char **alloc_pg_vec(struct tpacket_req *req, int order) -+static struct pgv *alloc_pg_vec(struct tpacket_req *req, int order) - { - unsigned int block_nr = req->tp_block_nr; -- char **pg_vec; -+ struct pgv *pg_vec; - int i; - -- pg_vec = kzalloc(block_nr * sizeof(char *), GFP_KERNEL); -+ pg_vec = kcalloc(block_nr, sizeof(struct pgv), GFP_KERNEL); - if (unlikely(!pg_vec)) - goto out; - - for (i = 0; i < block_nr; i++) { -- pg_vec[i] = alloc_one_pg_vec_page(order); -- if (unlikely(!pg_vec[i])) -+ pg_vec[i].buffer = alloc_one_pg_vec_page(order, -+ &pg_vec[i].flags); -+ if (unlikely(!pg_vec[i].buffer)) - goto out_free_pgvec; - } - -@@ -2276,7 +2325,7 @@ out_free_pgvec: - static int packet_set_ring(struct sock *sk, struct tpacket_req *req, - int closing, int tx_ring) - { -- char **pg_vec = NULL; -+ struct pgv *pg_vec = NULL; - struct packet_sock *po = pkt_sk(sk); - int was_running, order = 0; - struct packet_ring_buffer *rb; -@@ -2438,15 +2487,22 @@ static int packet_mmap(struct file *file - continue; - - for (i = 0; i < rb->pg_vec_len; i++) { -- struct page *page = virt_to_page(rb->pg_vec[i]); -+ struct page *page; -+ void *kaddr = rb->pg_vec[i].buffer; - int pg_num; - - for (pg_num = 0; pg_num < rb->pg_vec_pages; -- pg_num++, page++) { -+ pg_num++) { -+ if (rb->pg_vec[i].flags & PGV_FROM_VMALLOC) -+ page = vmalloc_to_page(kaddr); -+ else -+ page = virt_to_page(kaddr); -+ - err = vm_insert_page(vma, start, page); - if (unlikely(err)) - goto out; - start += PAGE_SIZE; -+ kaddr += PAGE_SIZE; - } - } - } diff --git a/pci-disable-aspm-if-bios-asks-us-to.patch b/pci-disable-aspm-if-bios-asks-us-to.patch deleted file mode 100644 index d67dda4..0000000 --- a/pci-disable-aspm-if-bios-asks-us-to.patch +++ /dev/null @@ -1,144 +0,0 @@ -From linux-kernel-owner@vger.kernel.org Mon Dec 6 14:01:17 2010 -From: Matthew Garrett -To: linux-pci@vger.kernel.org -Cc: linux-kernel@vger.kernel.org, jbarnes@virtuousgeek.org, - Matthew Garrett -Subject: [PATCH v2] PCI: Disable ASPM if BIOS asks us to -Date: Mon, 6 Dec 2010 14:00:56 -0500 -Message-Id: <1291662056-6055-1-git-send-email-mjg@redhat.com> - -We currently refuse to touch the ASPM registers if the BIOS tells us that -ASPM isn't supported. This can cause problems if the BIOS has (for any -reason) enabled ASPM on some devices anyway. Change the code such that we -explicitly clear ASPM if the FADT indicates that ASPM isn't supported, -and make sure we tidy up appropriately on device removal in order to deal -with the hotplug case. If ASPM is disabled because the BIOS doesn't hand -over control then we won't touch the registers. - -Signed-off-by: Matthew Garrett ---- - -Implement Rafael's suggestion to use two separate functions, and also -ensure that we clear the clkpm bit as well as the ASPM bits. - - drivers/pci/pci-acpi.c | 1 + - drivers/pci/pcie/aspm.c | 21 +++++++++++++++++---- - include/linux/pci-aspm.h | 5 ++++- - 3 files changed, 22 insertions(+), 5 deletions(-) - -diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c -index 24e19c5..d7ea699 100644 ---- a/drivers/pci/pci-acpi.c -+++ b/drivers/pci/pci-acpi.c -@@ -399,6 +399,7 @@ static int __init acpi_pci_init(void) - - if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { - printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n"); -+ pcie_clear_aspm(); - pcie_no_aspm(); - } - -diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c -index 7122281..8112415 100644 ---- a/drivers/pci/pcie/aspm.c -+++ b/drivers/pci/pcie/aspm.c -@@ -68,7 +68,7 @@ struct pcie_link_state { - struct aspm_latency acceptable[8]; - }; - --static int aspm_disabled, aspm_force; -+static int aspm_disabled, aspm_force, aspm_clear_state; - static DEFINE_MUTEX(aspm_lock); - static LIST_HEAD(link_list); - -@@ -139,7 +139,7 @@ static void pcie_set_clkpm(struct pcie_link_state *link, int enable) - { - /* Don't enable Clock PM if the link is not Clock PM capable */ - if (!link->clkpm_capable && enable) -- return; -+ enable = 0; - /* Need nothing if the specified equals to current state */ - if (link->clkpm_enabled == enable) - return; -@@ -498,6 +498,10 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) - struct pci_dev *child; - int pos; - u32 reg32; -+ -+ if (aspm_clear_state) -+ return -EINVAL; -+ - /* - * Some functions in a slot might not all be PCIe functions, - * very strange. Disable ASPM for the whole slot -@@ -563,12 +567,15 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev) - struct pcie_link_state *link; - int blacklist = !!pcie_aspm_sanity_check(pdev); - -- if (aspm_disabled || !pci_is_pcie(pdev) || pdev->link_state) -+ if (!pci_is_pcie(pdev) || pdev->link_state) - return; - if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && - pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) - return; - -+ if (aspm_disabled && !aspm_clear_state) -+ return; -+ - /* VIA has a strange chipset, root port is under a bridge */ - if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT && - pdev->bus->self) -@@ -641,7 +648,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev) - struct pci_dev *parent = pdev->bus->self; - struct pcie_link_state *link, *root, *parent_link; - -- if (aspm_disabled || !pci_is_pcie(pdev) || -+ if ((aspm_disabled && !aspm_clear_state) || !pci_is_pcie(pdev) || - !parent || !parent->link_state) - return; - if ((parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && -@@ -899,6 +906,12 @@ static int __init pcie_aspm_disable(char *str) - - __setup("pcie_aspm=", pcie_aspm_disable); - -+void pcie_clear_aspm(void) -+{ -+ if (!aspm_force) -+ aspm_clear_state = 1; -+} -+ - void pcie_no_aspm(void) - { - if (!aspm_force) -diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h -index 91ba0b3..ce68105 100644 ---- a/include/linux/pci-aspm.h -+++ b/include/linux/pci-aspm.h -@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev); - extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); - extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); - extern void pci_disable_link_state(struct pci_dev *pdev, int state); -+extern void pcie_clear_aspm(void); - extern void pcie_no_aspm(void); - #else - static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) -@@ -41,7 +42,9 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) - static inline void pci_disable_link_state(struct pci_dev *pdev, int state) - { - } -- -+static inline void pcie_clear_aspm(void) -+{ -+} - static inline void pcie_no_aspm(void) - { - } --- -1.7.3.2 - --- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - diff --git a/scripts/pull-upstreams.sh b/scripts/pull-upstreams.sh index 11df404..8dc8497 100755 --- a/scripts/pull-upstreams.sh +++ b/scripts/pull-upstreams.sh @@ -1,6 +1,6 @@ #!/bin/bash -utrace_base=2.6-current +utrace_base=2.6.37 url=http://people.redhat.com/roland/utrace/${1:-$utrace_base} diff --git a/sources b/sources index 864fa70..f2140a0 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ c8ee37b4fdccdb651e0603d35350b434 linux-2.6.37.tar.bz2 +4651b1512e2fba1735713aca8f1007fc patch-2.6.38-rc2.bz2