diff --git a/applesmc_update.patch b/applesmc_update.patch index d42146871..f4adad34f 100644 --- a/applesmc_update.patch +++ b/applesmc_update.patch @@ -1,7 +1,8 @@ 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 +index 87a5fd51..4c07436 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -4,6 +4,7 @@ @@ -12,39 +13,21 @@ index b6598aa..0d7e9ae 100644 * * Based on hdaps.c driver: * Copyright (C) 2005 Robert Love -@@ -26,10 +27,12 @@ +@@ -26,10 +27,13 @@ * 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 #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 */ +@@ -49,6 +53,7 @@ #define APPLESMC_MAX_DATA_LENGTH 32 @@ -52,12 +35,8 @@ index b6598aa..0d7e9ae 100644 #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 */ +@@ -73,108 +78,15 @@ -+#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) */ @@ -149,6 +128,10 @@ index b6598aa..0d7e9ae 100644 -/* Set 22: MacBook Pro 7,1 */ - { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", - "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, +-/* Set 23: MacBook Air 3,1 */ +- { "TB0T", "TB1T", "TB2T", "TC0D", "TC0E", "TC0P", "TC1E", "TCZ3", +- "TCZ4", "TCZ5", "TG0E", "TG1E", "TG2E", "TGZ3", "TGZ4", "TGZ5", +- "TH0F", "TH0O", "TM0P" }, -}; +#define FAN_ID_FMT "F%dID" /* r-o char[16] */ @@ -168,7 +151,7 @@ index b6598aa..0d7e9ae 100644 }; #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */ -@@ -184,18 +107,58 @@ static const char* fan_speed_keys[] = { +@@ -188,14 +100,48 @@ static const char* fan_speed_keys[] = { #define SENSOR_Y 1 #define SENSOR_Z 2 @@ -183,15 +166,6 @@ index b6598aa..0d7e9ae 100644 +#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 */ @@ -205,8 +179,8 @@ index b6598aa..0d7e9ae 100644 + 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 */ @@ -229,14 +203,12 @@ index b6598aa..0d7e9ae 100644 + bool has_key_backlight; /* has keyboard backlight */ + bool init_complete; /* true when fully initialized */ + struct applesmc_entry *cache; /* cached key entries */ -+} smcreg; -+ ++} smcreg = { ++ .mutex = __MUTEX_INITIALIZER(smcreg.mutex), + }; + 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]; +@@ -207,20 +153,6 @@ static u8 backlight_state[2]; static struct device *hwmon_dev; static struct input_polled_dev *applesmc_idev; @@ -257,24 +229,7 @@ index b6598aa..0d7e9ae 100644 /* * 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) +@@ -242,18 +174,10 @@ static int __wait_status(u8 val) for (us = APPLESMC_MIN_WAIT; us < APPLESMC_MAX_WAIT; us <<= 1) { udelay(us); @@ -283,10 +238,9 @@ index b6598aa..0d7e9ae 100644 - 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) { ++ if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) return 0; - } +- } } - printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n", @@ -295,16 +249,8 @@ index b6598aa..0d7e9ae 100644 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) +@@ -271,159 +195,242 @@ static int send_command(u8 cmd) + if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == 0x0c) return 0; } - printk(KERN_WARNING "applesmc: command failed: %x -> %x\n", @@ -332,8 +278,7 @@ index b6598aa..0d7e9ae 100644 - return -EIO; - for (i = 0; i < 4; i++) { -- outb(key[i], APPLESMC_DATA_PORT); -+ applesmc_write_reg(key[i], APPLESMC_DATA_PORT); + outb(key[i], APPLESMC_DATA_PORT); if (__wait_status(0x04)) return -EIO; } @@ -341,10 +286,7 @@ index b6598aa..0d7e9ae 100644 - 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; @@ -353,19 +295,20 @@ index b6598aa..0d7e9ae 100644 + pr_warn("%s: read arg fail\n", key); + return -EIO; + } -+ -+ applesmc_write_reg(len, APPLESMC_DATA_PORT); + + outb(len, APPLESMC_DATA_PORT); +- if (debug) +- printk(KERN_DEBUG ">%x", len); 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); ++ } + 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"); @@ -400,17 +343,15 @@ index b6598aa..0d7e9ae 100644 - return -EIO; } -- outb(len, APPLESMC_DATA_PORT); -+ applesmc_write_reg(len, APPLESMC_DATA_PORT); + outb(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); + outb(buffer[i], APPLESMC_DATA_PORT); } return 0; @@ -605,7 +546,7 @@ index b6598aa..0d7e9ae 100644 + entry = applesmc_get_entry_by_key(key); + if (IS_ERR(entry)) + return PTR_ERR(entry); -+ + + return applesmc_read_entry(entry, buffer, len); +} + @@ -623,7 +564,7 @@ index b6598aa..0d7e9ae 100644 +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); @@ -637,50 +578,25 @@ index b6598aa..0d7e9ae 100644 - * hold applesmc_lock. + * applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). */ - static int applesmc_read_motion_sensor(int index, s16* value) +-static int applesmc_read_motion_sensor(int index, s16* value) ++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]; + int ret; +@@ -455,50 +462,124 @@ static void applesmc_device_init(void) + int total; u8 buffer[2]; - if (!applesmc_accelerometer) -- return 0; -- -- mutex_lock(&applesmc_lock); + if (!smcreg.has_accelerometer) -+ return; + return; +- mutex_lock(&applesmc_lock); +- 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; + (buffer[0] != 0x00 || buffer[1] != 0x00)) - goto out; -- } -+ (buffer[0] != 0x00 || buffer[1] != 0x00)) + return; buffer[0] = 0xe0; buffer[1] = 0x00; @@ -692,7 +608,6 @@ index b6598aa..0d7e9ae 100644 - -out: - mutex_unlock(&applesmc_lock); -- return ret; + pr_warn("failed to init the device\n"); } @@ -713,31 +628,23 @@ index b6598aa..0d7e9ae 100644 - mutex_lock(&applesmc_lock); + if (s->init_complete) + return 0; ++ ++ ret = read_register_count(&s->key_count); ++ if (ret) ++ return ret; - 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(); +- mutex_unlock(&applesmc_lock); + ret = applesmc_read_key(FANS_COUNT, tmp, 1); if (ret) return ret; +- else +- return buffer[0]; + s->fan_count = tmp[0]; + + ret = applesmc_get_lower_bound(&s->temp_begin, "T"); @@ -769,11 +676,10 @@ index b6598aa..0d7e9ae 100644 + s->has_accelerometer, + s->num_light_sensors, + s->has_key_backlight); - -- printk(KERN_INFO "applesmc: device successfully initialized.\n"); - return 0; - } - ++ ++ return 0; ++} ++ +/* + * applesmc_init_smcreg - Initialize register cache. + * @@ -786,21 +692,40 @@ index b6598aa..0d7e9ae 100644 + + for (ms = 0; ms < INIT_TIMEOUT_MSECS; ms += INIT_WAIT_MSECS) { + ret = applesmc_init_smcreg_try(); -+ if (!ret) ++ if (!ret) { ++ if (ms) ++ pr_info("init_smcreg() took %d ms\n", ms); + return 0; -+ pr_warn("slow init, retrying\n"); ++ } + msleep(INIT_WAIT_MSECS); + } + ++ kfree(smcreg.cache); ++ smcreg.cache = NULL; ++ + return ret; +} + +static void applesmc_destroy_smcreg(void) +{ + kfree(smcreg.cache); -+ memset(&smcreg, 0, sizeof(smcreg)); -+} ++ smcreg.cache = NULL; ++ smcreg.init_complete = false; + } + + /* Device model stuff */ + static int applesmc_probe(struct platform_device *dev) + { ++ int ret; + ++ ret = applesmc_init_smcreg(); ++ if (ret) ++ return ret; ++ + applesmc_device_init(); + + return 0; +@@ -507,10 +588,8 @@ static int applesmc_probe(struct platform_device *dev) /* Synchronize device with memorized backlight state */ static int applesmc_pm_resume(struct device *dev) { @@ -812,33 +737,7 @@ index b6598aa..0d7e9ae 100644 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) +@@ -551,20 +630,15 @@ static void applesmc_idev_poll(struct input_polled_dev *dev) struct input_dev *idev = dev->input; s16 x, y; @@ -861,7 +760,7 @@ index b6598aa..0d7e9ae 100644 } /* Sysfs Files */ -@@ -601,8 +654,6 @@ static ssize_t applesmc_position_show(struct device *dev, +@@ -581,8 +655,6 @@ static ssize_t applesmc_position_show(struct device *dev, int ret; s16 x, y, z; @@ -870,7 +769,7 @@ index b6598aa..0d7e9ae 100644 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, +@@ -594,7 +666,6 @@ static ssize_t applesmc_position_show(struct device *dev, goto out; out: @@ -878,7 +777,7 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -624,20 +674,20 @@ out: +@@ -604,20 +675,20 @@ out: static ssize_t applesmc_light_show(struct device *dev, struct device_attribute *attr, char *sysfsbuf) { @@ -908,7 +807,7 @@ index b6598aa..0d7e9ae 100644 } ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); -@@ -653,7 +703,6 @@ static ssize_t applesmc_light_show(struct device *dev, +@@ -633,7 +704,6 @@ static ssize_t applesmc_light_show(struct device *dev, right = buffer[2]; out: @@ -916,7 +815,7 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -664,36 +713,48 @@ out: +@@ -644,36 +714,44 @@ out: static ssize_t applesmc_show_sensor_label(struct device *dev, struct device_attribute *devattr, char *sysfsbuf) { @@ -946,9 +845,9 @@ index b6598aa..0d7e9ae 100644 - 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); - +- mutex_lock(&applesmc_lock); + - ret = applesmc_read_key(key, buffer, 2); - temp = buffer[0]*1000; - temp += (buffer[1] >> 6) * 250; @@ -967,10 +866,6 @@ index b6598aa..0d7e9ae 100644 - 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 { @@ -981,19 +876,19 @@ index b6598aa..0d7e9ae 100644 } static ssize_t applesmc_show_fan_speed(struct device *dev, -@@ -703,21 +764,12 @@ static ssize_t applesmc_show_fan_speed(struct device *dev, +@@ -683,21 +761,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)); @@ -1004,24 +899,30 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -732,27 +784,18 @@ static ssize_t applesmc_store_fan_speed(struct device *dev, - u32 speed; +@@ -709,30 +778,19 @@ static ssize_t applesmc_store_fan_speed(struct device *dev, + const char *sysfsbuf, size_t count) + { + int ret; +- u32 speed; ++ unsigned long 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; +- +- 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; -- ++ if (strict_strtoul(sysfsbuf, 10, &speed) < 0 || speed >= 0x4000) ++ return -EINVAL; /* Bigger than a 14-bit value */ + - mutex_lock(&applesmc_lock); + sprintf(newkey, fan_speed_fmt[to_option(attr)], to_index(attr)); @@ -1033,7 +934,7 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -760,19 +803,15 @@ static ssize_t applesmc_store_fan_speed(struct device *dev, +@@ -740,19 +798,15 @@ static ssize_t applesmc_store_fan_speed(struct device *dev, } static ssize_t applesmc_show_fan_manual(struct device *dev, @@ -1055,7 +956,7 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -780,28 +819,25 @@ static ssize_t applesmc_show_fan_manual(struct device *dev, +@@ -760,18 +814,16 @@ static ssize_t applesmc_show_fan_manual(struct device *dev, } static ssize_t applesmc_store_fan_manual(struct device *dev, @@ -1065,17 +966,20 @@ index b6598aa..0d7e9ae 100644 { int ret; u8 buffer[2]; - u32 input; +- u32 input; ++ unsigned long input; u16 val; - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - - input = simple_strtoul(sysfsbuf, NULL, 10); +- +- input = simple_strtoul(sysfsbuf, NULL, 10); - mutex_lock(&applesmc_lock); -- ++ if (strict_strtoul(sysfsbuf, 10, &input) < 0) ++ return -EINVAL; + ret = applesmc_read_key(FANS_MANUAL, buffer, 2); val = (buffer[0] << 8 | buffer[1]); - if (ret) +@@ -779,9 +831,9 @@ static ssize_t applesmc_store_fan_manual(struct device *dev, goto out; if (input) @@ -1087,7 +991,7 @@ index b6598aa..0d7e9ae 100644 buffer[0] = (val >> 8) & 0xFF; buffer[1] = val & 0xFF; -@@ -809,7 +845,6 @@ static ssize_t applesmc_store_fan_manual(struct device *dev, +@@ -789,7 +841,6 @@ static ssize_t applesmc_store_fan_manual(struct device *dev, ret = applesmc_write_key(FANS_MANUAL, buffer, 2); out: @@ -1095,19 +999,19 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -822,21 +857,12 @@ static ssize_t applesmc_show_fan_position(struct device *dev, +@@ -802,21 +853,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)); @@ -1118,7 +1022,7 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -852,18 +878,14 @@ static ssize_t applesmc_calibrate_show(struct device *dev, +@@ -832,18 +874,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) { @@ -1137,7 +1041,7 @@ index b6598aa..0d7e9ae 100644 } static DECLARE_WORK(backlight_work, &applesmc_backlight_set); -@@ -886,13 +908,10 @@ static ssize_t applesmc_key_count_show(struct device *dev, +@@ -866,13 +904,10 @@ static ssize_t applesmc_key_count_show(struct device *dev, u8 buffer[4]; u32 count; @@ -1151,7 +1055,7 @@ index b6598aa..0d7e9ae 100644 if (ret) return ret; else -@@ -902,113 +921,53 @@ static ssize_t applesmc_key_count_show(struct device *dev, +@@ -882,113 +917,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) { @@ -1207,16 +1111,16 @@ index b6598aa..0d7e9ae 100644 - int ret; - - mutex_lock(&applesmc_lock); +- +- ret = applesmc_get_key_at_index(key_at_index, key); + const struct applesmc_entry *entry; -- ret = applesmc_get_key_at_index(key_at_index, key); +- if (ret || !key[0]) { +- 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]) { -- mutex_unlock(&applesmc_lock); -- - return -EINVAL; - } - @@ -1237,13 +1141,9 @@ index b6598aa..0d7e9ae 100644 - 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]) { @@ -1253,9 +1153,13 @@ index b6598aa..0d7e9ae 100644 - } - - ret = applesmc_get_key_type(key, info); -- ++ 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) - return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", info+1); - else @@ -1268,17 +1172,17 @@ index b6598aa..0d7e9ae 100644 { - 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); +- 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); +- +- mutex_unlock(&applesmc_lock); +- - if (!ret && key[0]) - return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", key); - else @@ -1287,20 +1191,25 @@ index b6598aa..0d7e9ae 100644 } 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, +@@ -1000,12 +975,13 @@ 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); +- key_at_index = simple_strtoul(sysfsbuf, NULL, 10); ++ unsigned long newkey; - mutex_unlock(&applesmc_lock); -- ++ if (strict_strtoul(sysfsbuf, 10, &newkey) < 0 ++ || newkey >= smcreg.key_count) ++ return -EINVAL; + ++ key_at_index = newkey; return count; } -@@ -1035,387 +990,101 @@ static struct led_classdev applesmc_backlight = { +@@ -1015,387 +991,102 @@ static struct led_classdev applesmc_backlight = { .brightness_set = applesmc_brightness_set, }; @@ -1751,6 +1660,7 @@ index b6598aa..0d7e9ae 100644 + node->sda.dev_attr.show = grp->show; + node->sda.dev_attr.store = grp->store; + attr = &node->sda.dev_attr.attr; ++ sysfs_attr_init(attr); + attr->name = node->name; + attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); + ret = sysfs_create_file(&pdev->dev.kobj, attr); @@ -1768,7 +1678,7 @@ index b6598aa..0d7e9ae 100644 } /* Create accelerometer ressources */ -@@ -1424,8 +1093,10 @@ static int applesmc_create_accelerometer(void) +@@ -1404,8 +1095,10 @@ static int applesmc_create_accelerometer(void) struct input_dev *idev; int ret; @@ -1781,7 +1691,7 @@ index b6598aa..0d7e9ae 100644 if (ret) goto out; -@@ -1462,282 +1133,132 @@ out_idev: +@@ -1442,190 +1135,96 @@ out_idev: input_free_polled_device(applesmc_idev); out_sysfs: @@ -1852,24 +1762,60 @@ index b6598aa..0d7e9ae 100644 - { .accelerometer = 1, .light = 1, .temperature_set = 21 }, -/* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ - { .accelerometer = 1, .light = 1, .temperature_set = 22 }, +-/* MacBook Air 3,1: accelerometer, backlight and temperature set 23 */ +- { .accelerometer = 0, .light = 0, .temperature_set = 23 }, -}; +static int applesmc_create_light_sensor(void) +{ + if (!smcreg.num_light_sensors) + return 0; + return applesmc_create_nodes(light_sensor_group, 1); ++} ++ ++static void applesmc_release_light_sensor(void) ++{ ++ if (!smcreg.num_light_sensors) ++ return; ++ applesmc_destroy_nodes(light_sensor_group); ++} ++ ++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 int applesmc_dmi_match(const struct dmi_system_id *id) ++{ ++ return 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[] = { + /* 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 3", { +- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), +- DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3") }, +- &applesmc_dmi_data[23]}, - { 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_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"), @@ -1903,7 +1849,8 @@ index b6598aa..0d7e9ae 100644 - 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", { ++ }, + { applesmc_dmi_match, "Apple MacBook Pro", { - DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), - DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") }, - &applesmc_dmi_data[0]}, @@ -1920,14 +1867,19 @@ index b6598aa..0d7e9ae 100644 - 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_BOARD_VENDOR, "Apple"), - DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5") }, - &applesmc_dmi_data[11]}, -- { applesmc_dmi_match, "Apple MacBook", { ++ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro") }, ++ }, + { 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, "MacBook") }, ++ }, + { applesmc_dmi_match, "Apple Macmini", { - DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), - DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, - &applesmc_dmi_data[3]}, @@ -1936,12 +1888,14 @@ index b6598aa..0d7e9ae 100644 - DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, - &applesmc_dmi_data[4]}, - { applesmc_dmi_match, "Apple MacPro3", { -- DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), + 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") }, ++ DMI_MATCH(DMI_PRODUCT_NAME, "Macmini") }, ++ }, + { 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."), @@ -1959,109 +1913,43 @@ index b6598aa..0d7e9ae 100644 - DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), - DMI_MATCH(DMI_PRODUCT_NAME, "iMac5") }, - &applesmc_dmi_data[10]}, -- { applesmc_dmi_match, "Apple iMac", { ++ }, + { 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); -+} ++ DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "iMac") }, ++ }, + { .ident = NULL } + }; --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) + static int __init applesmc_init(void) { int ret; - int count; - int i; -+ struct resource *res; -+ struct applesmc_pnp_device *applesmc_pnp_device; -- if (!dmi_check_system(applesmc_whitelist)) { + 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; ++ pr_warn("supported laptop not found!\n"); + ret = -ENODEV; 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; +@@ -1647,83 +1246,34 @@ static int __init applesmc_init(void) + goto out_driver; } - ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); + /* create register cache */ + ret = applesmc_init_smcreg(); if (ret) -- goto out_device; -- + goto out_device; + - /* Create key enumeration sysfs files */ - ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); -- if (ret) ++ ret = applesmc_create_nodes(info_group, 1); + if (ret) - goto out_name; - - /* create fan files */ @@ -2070,7 +1958,7 @@ index b6598aa..0d7e9ae 100644 - printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); - else - printk(KERN_INFO "applesmc: %d fans found.\n", count); -+ goto out_region; ++ goto out_smcreg; - if (count > 4) { - count = 4; @@ -2078,8 +1966,7 @@ index b6598aa..0d7e9ae 100644 - " 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]); @@ -2087,10 +1974,7 @@ index b6598aa..0d7e9ae 100644 - 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++) { @@ -2155,23 +2039,12 @@ index b6598aa..0d7e9ae 100644 hwmon_dev = hwmon_device_register(&pdev->dev); if (IS_ERR(hwmon_dev)) { -@@ -1745,65 +1266,85 @@ static int __init applesmc_init(void) +@@ -1731,32 +1281,22 @@ 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: @@ -2200,38 +2073,31 @@ index b6598aa..0d7e9ae 100644 - 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_device: + platform_device_unregister(pdev); + out_driver: +@@ -1764,32 +1304,23 @@ out_driver: out_region: -- release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); -+ release_region(pnp_device->iobase, pnp_device->iolen); + release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); 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) + static void __exit applesmc_exit(void) { -- hwmon_device_unregister(hwmon_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); @@ -2241,13 +2107,6 @@ index b6598aa..0d7e9ae 100644 - &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(); @@ -2255,39 +2114,11 @@ index b6598aa..0d7e9ae 100644 + 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); + platform_device_unregister(pdev); + platform_driver_unregister(&applesmc_driver); + release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); +- +- printk(KERN_INFO "applesmc: driver unloaded.\n"); } 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/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 9f6800a4b..000000000 --- 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/kernel.spec b/kernel.spec index 6e2655534..de34f3f8e 100644 --- a/kernel.spec +++ b/kernel.spec @@ -51,7 +51,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 @@ -63,7 +63,7 @@ Summary: The Linux kernel %if 0%{?released_kernel} # Do we have a -stable update to apply? -%define stable_update 0 +%define stable_update 2 # Is it a -stable RC? %define stable_rc 0 # Set rpm version accordingly @@ -679,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 @@ -719,8 +718,6 @@ Patch12017: prevent-runtime-conntrack-changes.patch 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 @@ -738,7 +735,6 @@ 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 @@ -1305,7 +1301,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 @@ -1339,9 +1334,6 @@ ApplyPatch add-appleir-usb-driver.patch ApplyPatch neuter_intel_microcode_load.patch -# try to fix stalls during boot (#530393) -ApplyPatch tpm-fix-stall-on-boot.patch - # various fixes for Apple and EFI ApplyPatch applesmc_update.patch ApplyPatch apple_backlight.patch @@ -1363,7 +1355,6 @@ ApplyPatch dmar-disable-when-ricoh-multifunction.patch 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 @@ -1984,6 +1975,10 @@ fi # ||----w | # || || %changelog +* Fri Mar 04 2011 Kyle McMartin 2.6.37.2-1 +- Linux 2.6.37.2 for Fedora 14 and 13 +- Drop/fixup conflicting and merged patches. + * Wed Jan 19 2011 Roland McGrath - utrace update diff --git a/linux-2.6-ehci-check-port-status.patch b/linux-2.6-ehci-check-port-status.patch index 6182c77cf..658494109 100644 --- a/linux-2.6-ehci-check-port-status.patch +++ b/linux-2.6-ehci-check-port-status.patch @@ -50,5 +50,5 @@ index 796ea0c..d9c0748 100644 - 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-next-macbook-air-input.patch b/linux-next-macbook-air-input.patch index 16d4d6d39..25fab86a5 100644 --- a/linux-next-macbook-air-input.patch +++ b/linux-next-macbook-air-input.patch @@ -119,67 +119,3 @@ index 68114db..104b9f9 100644 #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 561c5897e..000000000 --- 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/sources b/sources index 864fa7018..f2870ab01 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ c8ee37b4fdccdb651e0603d35350b434 linux-2.6.37.tar.bz2 +bb5798f2a2a5af13219d1a250c4dad11 patch-2.6.37.2.bz2 diff --git a/tpm-fix-stall-on-boot.patch b/tpm-fix-stall-on-boot.patch deleted file mode 100644 index adba40a6e..000000000 --- a/tpm-fix-stall-on-boot.patch +++ /dev/null @@ -1,24 +0,0 @@ -Fix TPM timeouts on boot (#530393) - ---- a/drivers/char/tpm/tpm.c -+++ a/drivers/char/tpm/tpm.c -@@ -354,12 +354,14 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, - tpm_protected_ordinal_duration[ordinal & - TPM_PROTECTED_ORDINAL_MASK]; - -- if (duration_idx != TPM_UNDEFINED) -+ if (duration_idx != TPM_UNDEFINED) { - duration = chip->vendor.duration[duration_idx]; -- if (duration <= 0) -+ /* if duration is 0, it's because chip->vendor.duration wasn't */ -+ /* filled yet, so we set the lowest timeout just to give enough */ -+ /* time to tpm_get_timeouts() succeed */ -+ return (duration <= 0 ? HZ : duration); -+ } else - return 2 * 60 * HZ; -- else -- return duration; - } - EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); - -