Skip to content

Commit

Permalink
Merge branch 'akpm'
Browse files Browse the repository at this point in the history
Quoth Andrew:
  "Random fixes.  And a simple new LED driver which I'm trying to sneak
   in while you're not looking."

Sneaking successful.

* akpm:
  score: fix off-by-one index into syscall table
  mm: fix rss count leakage during migration
  SHM_UNLOCK: fix Unevictable pages stranded after swap
  SHM_UNLOCK: fix long unpreemptible section
  kdump: define KEXEC_NOTE_BYTES arch specific for s390x
  mm/hugetlb.c: undo change to page mapcount in fault handler
  mm: memcg: update the correct soft limit tree during migration
  proc: clear_refs: do not clear reserved pages
  drivers/video/backlight/l4f00242t03.c: return proper error in l4f00242t03_probe if regulator_get() fails
  drivers/video/backlight/adp88x0_bl.c: fix bit testing logic
  kprobes: initialize before using a hlist
  ipc/mqueue: simplify reading msgqueue limit
  leds: add led driver for Bachmann's ot200
  mm: __count_immobile_pages(): make sure the node is online
  mm: fix NULL ptr dereference in __count_immobile_pages
  mm: fix warnings regarding enum migrate_mode
  • Loading branch information
Linus Torvalds committed Jan 23, 2012
2 parents 46c5b83 + c25a785 commit 4f57d86
Show file tree
Hide file tree
Showing 24 changed files with 388 additions and 144 deletions.
18 changes: 18 additions & 0 deletions arch/s390/include/asm/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@
/* The native architecture */
#define KEXEC_ARCH KEXEC_ARCH_S390

/*
* Size for s390x ELF notes per CPU
*
* Seven notes plus zero note at the end: prstatus, fpregset, timer,
* tod_cmp, tod_reg, control regs, and prefix
*/
#define KEXEC_NOTE_BYTES \
(ALIGN(sizeof(struct elf_note), 4) * 8 + \
ALIGN(sizeof("CORE"), 4) * 7 + \
ALIGN(sizeof(struct elf_prstatus), 4) + \
ALIGN(sizeof(elf_fpregset_t), 4) + \
ALIGN(sizeof(u64), 4) + \
ALIGN(sizeof(u64), 4) + \
ALIGN(sizeof(u32), 4) + \
ALIGN(sizeof(u64) * 16, 4) + \
ALIGN(sizeof(u32), 4) \
)

/* Provide a dummy definition to avoid build failures. */
static inline void crash_setup_regs(struct pt_regs *newregs,
struct pt_regs *oldregs) { }
Expand Down
2 changes: 1 addition & 1 deletion arch/score/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ ENTRY(handle_sys)
sw r9, [r0, PT_EPC]

cmpi.c r27, __NR_syscalls # check syscall number
bgtu illegal_syscall
bgeu illegal_syscall

slli r8, r27, 2 # get syscall routine
la r11, sys_call_table
Expand Down
7 changes: 7 additions & 0 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ config LEDS_MAX8997
This option enables support for on-chip LED drivers on
MAXIM MAX8997 PMIC.

config LEDS_OT200
tristate "LED support for the Bachmann OT200"
depends on LEDS_CLASS && HAS_IOMEM
help
This option enables support for the LEDs on the Bachmann OT200.
Say Y to enable LEDs on the Bachmann OT200.

config LEDS_TRIGGERS
bool "LED Trigger support"
depends on LEDS_CLASS
Expand Down
1 change: 1 addition & 0 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ obj-$(CONFIG_LEDS_LP5523) += leds-lp5523.o
obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
obj-$(CONFIG_LEDS_OT200) += leds-ot200.o
obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
Expand Down
171 changes: 171 additions & 0 deletions drivers/leds/leds-ot200.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* Bachmann ot200 leds driver.
*
* Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
* Christian Gmeiner <christian.gmeiner@gmail.com>
*
* License: GPL as published by the FSF.
*/

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/leds.h>
#include <linux/io.h>
#include <linux/module.h>


struct ot200_led {
struct led_classdev cdev;
const char *name;
unsigned long port;
u8 mask;
};

/*
* The device has three leds on the back panel (led_err, led_init and led_run)
* and can handle up to seven leds on the front panel.
*/

static struct ot200_led leds[] = {
{
.name = "led_run",
.port = 0x5a,
.mask = BIT(0),
},
{
.name = "led_init",
.port = 0x5a,
.mask = BIT(1),
},
{
.name = "led_err",
.port = 0x5a,
.mask = BIT(2),
},
{
.name = "led_1",
.port = 0x49,
.mask = BIT(7),
},
{
.name = "led_2",
.port = 0x49,
.mask = BIT(6),
},
{
.name = "led_3",
.port = 0x49,
.mask = BIT(5),
},
{
.name = "led_4",
.port = 0x49,
.mask = BIT(4),
},
{
.name = "led_5",
.port = 0x49,
.mask = BIT(3),
},
{
.name = "led_6",
.port = 0x49,
.mask = BIT(2),
},
{
.name = "led_7",
.port = 0x49,
.mask = BIT(1),
}
};

static DEFINE_SPINLOCK(value_lock);

/*
* we need to store the current led states, as it is not
* possible to read the current led state via inb().
*/
static u8 leds_back;
static u8 leds_front;

static void ot200_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
struct ot200_led *led = container_of(led_cdev, struct ot200_led, cdev);
u8 *val;
unsigned long flags;

spin_lock_irqsave(&value_lock, flags);

if (led->port == 0x49)
val = &leds_front;
else if (led->port == 0x5a)
val = &leds_back;
else
BUG();

if (value == LED_OFF)
*val &= ~led->mask;
else
*val |= led->mask;

outb(*val, led->port);
spin_unlock_irqrestore(&value_lock, flags);
}

static int __devinit ot200_led_probe(struct platform_device *pdev)
{
int i;
int ret;

for (i = 0; i < ARRAY_SIZE(leds); i++) {

leds[i].cdev.name = leds[i].name;
leds[i].cdev.brightness_set = ot200_led_brightness_set;

ret = led_classdev_register(&pdev->dev, &leds[i].cdev);
if (ret < 0)
goto err;
}

leds_front = 0; /* turn off all front leds */
leds_back = BIT(1); /* turn on init led */
outb(leds_front, 0x49);
outb(leds_back, 0x5a);

return 0;

err:
for (i = i - 1; i >= 0; i--)
led_classdev_unregister(&leds[i].cdev);

return ret;
}

static int __devexit ot200_led_remove(struct platform_device *pdev)
{
int i;

for (i = 0; i < ARRAY_SIZE(leds); i++)
led_classdev_unregister(&leds[i].cdev);

return 0;
}

static struct platform_driver ot200_led_driver = {
.probe = ot200_led_probe,
.remove = __devexit_p(ot200_led_remove),
.driver = {
.name = "leds-ot200",
.owner = THIS_MODULE,
},
};

module_platform_driver(ot200_led_driver);

MODULE_AUTHOR("Sebastian A. Siewior <bigeasy@linutronix.de>");
MODULE_DESCRIPTION("ot200 LED driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:leds-ot200");
2 changes: 1 addition & 1 deletion drivers/video/backlight/adp8860_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static int adp8860_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask

ret = adp8860_read(client, reg, &reg_val);

if (!ret && ((reg_val & bit_mask) == 0)) {
if (!ret && ((reg_val & bit_mask) != bit_mask)) {
reg_val |= bit_mask;
ret = adp8860_write(client, reg, reg_val);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/adp8870_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask

ret = adp8870_read(client, reg, &reg_val);

if (!ret && ((reg_val & bit_mask) == 0)) {
if (!ret && ((reg_val & bit_mask) != bit_mask)) {
reg_val |= bit_mask;
ret = adp8870_write(client, reg, reg_val);
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/video/backlight/l4f00242t03.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,15 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)

priv->io_reg = regulator_get(&spi->dev, "vdd");
if (IS_ERR(priv->io_reg)) {
ret = PTR_ERR(priv->io_reg);
dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
__func__);
goto err3;
}

priv->core_reg = regulator_get(&spi->dev, "vcore");
if (IS_ERR(priv->core_reg)) {
ret = PTR_ERR(priv->core_reg);
dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
__func__);
goto err4;
Expand Down
3 changes: 3 additions & 0 deletions fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
if (!page)
continue;

if (PageReserved(page))
continue;

/* Clear accessed and referenced bits. */
ptep_test_and_clear_young(vma, addr, pte);
ClearPageReferenced(page);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/ioctl.h>
#include <linux/blk_types.h>
#include <linux/types.h>
#include <linux/migrate_mode.h>

/*
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change
Expand Down Expand Up @@ -526,7 +527,6 @@ enum positive_aop_returns {
struct page;
struct address_space;
struct writeback_control;
enum migrate_mode;

struct iov_iter {
const struct iovec *iov;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@
* note header. For kdump, the code in vmcore.c runs in the context
* of the second kernel to combine them into one note.
*/
#ifndef KEXEC_NOTE_BYTES
#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \
KEXEC_CORE_NOTE_NAME_BYTES + \
KEXEC_CORE_NOTE_DESC_BYTES )
#endif

/*
* This structure is used to hold the arguments that are used when loading
Expand Down
14 changes: 1 addition & 13 deletions include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,10 @@

#include <linux/mm.h>
#include <linux/mempolicy.h>
#include <linux/migrate_mode.h>

typedef struct page *new_page_t(struct page *, unsigned long private, int **);

/*
* MIGRATE_ASYNC means never block
* MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
* on most operations but not ->writepage as the potential stall time
* is too significant
* MIGRATE_SYNC will block when migrating pages
*/
enum migrate_mode {
MIGRATE_ASYNC,
MIGRATE_SYNC_LIGHT,
MIGRATE_SYNC,
};

#ifdef CONFIG_MIGRATION
#define PAGE_MIGRATION 1

Expand Down
16 changes: 16 additions & 0 deletions include/linux/migrate_mode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef MIGRATE_MODE_H_INCLUDED
#define MIGRATE_MODE_H_INCLUDED
/*
* MIGRATE_ASYNC means never block
* MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
* on most operations but not ->writepage as the potential stall time
* is too significant
* MIGRATE_SYNC will block when migrating pages
*/
enum migrate_mode {
MIGRATE_ASYNC,
MIGRATE_SYNC_LIGHT,
MIGRATE_SYNC,
};

#endif /* MIGRATE_MODE_H_INCLUDED */
1 change: 1 addition & 0 deletions include/linux/shmem_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern struct file *shmem_file_setup(const char *name,
loff_t size, unsigned long flags);
extern int shmem_zero_setup(struct vm_area_struct *);
extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
extern void shmem_unlock_mapping(struct address_space *mapping);
extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
#endif

extern int page_evictable(struct page *page, struct vm_area_struct *vma);
extern void scan_mapping_unevictable_pages(struct address_space *);
extern void check_move_unevictable_pages(struct page **, int nr_pages);

extern unsigned long scan_unevictable_pages;
extern int scan_unevictable_handler(struct ctl_table *, int,
Expand Down
3 changes: 1 addition & 2 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb,

if (S_ISREG(mode)) {
struct mqueue_inode_info *info;
struct task_struct *p = current;
unsigned long mq_bytes, mq_msg_tblsz;

inode->i_fop = &mqueue_file_operations;
Expand Down Expand Up @@ -159,7 +158,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,

spin_lock(&mq_lock);
if (u->mq_bytes + mq_bytes < u->mq_bytes ||
u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) {
u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) {
spin_unlock(&mq_lock);
/* mqueue_evict_inode() releases info->messages */
ret = -EMFILE;
Expand Down
Loading

0 comments on commit 4f57d86

Please sign in to comment.