[PATCH v4 0/3] dma: imx-sdma: add support for sdma memory copy
Add memory copy interface to sdma driver, the patch set is based on v3: http://www.spinics.net/lists/dmaengine/msg00850.html. change from v3: 1.split two patches from v3 patch for Vinod's comments. change from v2: 1.remove redundant check for bus width. change from v1: 1. correct some printk format, such as %pad for dma_addr_t 2. split duplicated code in prep_dma_memcpy and prep_dma_sg to make code clean Robin Gong (3): dma: imx-sdma: add support for sdma memory copy dma: imx-sdma: correct print format dma: imx-sdma: reorg code to make code clean drivers/dma/imx-sdma.c | 247 + 1 file changed, 190 insertions(+), 57 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 2/3] dma: imx-sdma: correct print format
correct print format for 'size_t', 'dma_address_t',etc. Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index fc4a0df..7e8aa2d 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1041,7 +1041,7 @@ static struct dma_async_tx_descriptor *sdma_prep_memcpy( return NULL; if (len >= NUM_BD * SDMA_BD_MAX_CNT) { - dev_err(sdma->dev, "channel%d: maximum bytes exceeded:%d > %d\n" + dev_err(sdma->dev, "channel%d: maximum bytes exceeded:%zu > %d\n" , channel, len, NUM_BD * SDMA_BD_MAX_CNT); goto err_out; } @@ -1050,8 +1050,8 @@ static struct dma_async_tx_descriptor *sdma_prep_memcpy( sdmac->buf_tail = 0; - dev_dbg(sdma->dev, "memcpy: %x->%x, len=%d, channel=%d.\n", - dma_src, dma_dst, len, channel); + dev_dbg(sdma->dev, "memcpy: %pad->%pad, len=%zu, channel=%d.\n", + &dma_src, &dma_dst, len, channel); sdmac->direction = DMA_MEM_TO_MEM; @@ -1104,7 +1104,7 @@ static struct dma_async_tx_descriptor *sdma_prep_memcpy( param &= ~BD_CONT; } - dev_dbg(sdma->dev, "entry %d: count: %d dma: 0x%08x %s%s\n", + dev_dbg(sdma->dev, "entry %d: count: %d dma: 0x%u %s%s\n", i, count, bd->buffer_addr, param & BD_WRAP ? "wrap" : "", param & BD_INTR ? " intr" : ""); @@ -1220,8 +1220,8 @@ static struct dma_async_tx_descriptor *sdma_prep_sg( param &= ~BD_CONT; } - dev_dbg(sdma->dev, "entry %d: count: %d dma: 0x%08x %s%s\n", - i, count, sg_src->dma_address, + dev_dbg(sdma->dev, "entry %d: count: %d dma: 0x%pad %s%s\n", + i, count, &sg_src->dma_address, param & BD_WRAP ? "wrap" : "", param & BD_INTR ? " intr" : ""); @@ -1291,7 +1291,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( } if (period_len > SDMA_BD_MAX_CNT) { - dev_err(sdma->dev, "SDMA channel %d: maximum period size exceeded: %d > %d\n", + dev_err(sdma->dev, "SDMA channel %d: maximum period size exceeded: %zu > %d\n", channel, period_len, SDMA_BD_MAX_CNT); goto err_out; } @@ -1315,8 +1315,8 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( if (i + 1 == num_periods) param |= BD_WRAP; - dev_dbg(sdma->dev, "entry %d: count: %d dma: %#llx %s%s\n", - i, period_len, (u64)dma_addr, + dev_dbg(sdma->dev, "entry %d: count: %d dma: %pad %s%s\n", + i, period_len, &dma_addr, param & BD_WRAP ? "wrap" : "", param & BD_INTR ? " intr" : ""); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 1/3] dma: imx-sdma: add support for sdma memory copy
Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 188 ++--- 1 file changed, 164 insertions(+), 24 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index f7626e3..fc4a0df 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -229,6 +229,7 @@ struct sdma_context_data { } __attribute__ ((packed)); #define NUM_BD (int)(PAGE_SIZE / sizeof(struct sdma_buffer_descriptor)) +#define SDMA_BD_MAX_CNT(0xfffc) /* align with 4 bytes */ struct sdma_engine; @@ -261,6 +262,7 @@ struct sdma_channel { unsigned intpc_from_device, pc_to_device; unsigned long flags; dma_addr_t per_address; + unsigned intpc_to_pc; unsigned long event_mask[2]; unsigned long watermark_level; u32 shp_addr, per_addr; @@ -701,6 +703,7 @@ static void sdma_get_pc(struct sdma_channel *sdmac, sdmac->pc_from_device = 0; sdmac->pc_to_device = 0; + sdmac->pc_to_pc = 0; switch (peripheral_type) { case IMX_DMATYPE_MEMORY: @@ -775,6 +778,7 @@ static void sdma_get_pc(struct sdma_channel *sdmac, sdmac->pc_from_device = per_2_emi; sdmac->pc_to_device = emi_2_per; + sdmac->pc_to_pc = emi_2_emi; } static int sdma_load_context(struct sdma_channel *sdmac) @@ -787,11 +791,12 @@ static int sdma_load_context(struct sdma_channel *sdmac) int ret; unsigned long flags; - if (sdmac->direction == DMA_DEV_TO_MEM) { + if (sdmac->direction == DMA_DEV_TO_MEM) load_address = sdmac->pc_from_device; - } else { + else if (sdmac->direction == DMA_MEM_TO_MEM) + load_address = sdmac->pc_to_pc; + else load_address = sdmac->pc_to_device; - } if (load_address < 0) return load_address; @@ -1021,16 +1026,118 @@ static void sdma_free_chan_resources(struct dma_chan *chan) clk_disable(sdma->clk_ahb); } -static struct dma_async_tx_descriptor *sdma_prep_slave_sg( - struct dma_chan *chan, struct scatterlist *sgl, - unsigned int sg_len, enum dma_transfer_direction direction, - unsigned long flags, void *context) +static struct dma_async_tx_descriptor *sdma_prep_memcpy( + struct dma_chan *chan, dma_addr_t dma_dst, + dma_addr_t dma_src, size_t len, unsigned long flags) +{ + struct sdma_channel *sdmac = to_sdma_chan(chan); + struct sdma_engine *sdma = sdmac->sdma; + int channel = sdmac->channel; + size_t count; + int i = 0, param, ret; + struct sdma_buffer_descriptor *bd; + + if (!chan || !len || sdmac->status == DMA_IN_PROGRESS) + return NULL; + + if (len >= NUM_BD * SDMA_BD_MAX_CNT) { + dev_err(sdma->dev, "channel%d: maximum bytes exceeded:%d > %d\n" + , channel, len, NUM_BD * SDMA_BD_MAX_CNT); + goto err_out; + } + + sdmac->status = DMA_IN_PROGRESS; + + sdmac->buf_tail = 0; + + dev_dbg(sdma->dev, "memcpy: %x->%x, len=%d, channel=%d.\n", + dma_src, dma_dst, len, channel); + + sdmac->direction = DMA_MEM_TO_MEM; + + ret = sdma_load_context(sdmac); + if (ret) + goto err_out; + + sdmac->chn_count = 0; + + do { + count = min_t(size_t, len, SDMA_BD_MAX_CNT); + bd = &sdmac->bd[i]; + bd->buffer_addr = dma_src; + bd->ext_buffer_addr = dma_dst; + bd->mode.count = count; + + if (sdmac->word_size > DMA_SLAVE_BUSWIDTH_4_BYTES) { + ret = -EINVAL; + goto err_out; + } + + switch (sdmac->word_size) { + case DMA_SLAVE_BUSWIDTH_4_BYTES: + bd->mode.command = 0; + if ((count | dma_dst | dma_src) & 3) + return NULL; + break; + case DMA_SLAVE_BUSWIDTH_2_BYTES: + bd->mode.command = 2; + if ((count | dma_dst | dma_src) & 1) + return NULL; + break; + case DMA_SLAVE_BUSWIDTH_1_BYTE: + bd->mode.command = 1; + break; + default: + return NULL; + } + + dma_src += count; + dma_dst += count; + len -= count; + i++; + + param = BD_DONE | BD_EXTD | BD_CONT; + /* last bd */ + if (!len) { + param |= BD_INTR; + param |= BD_LAST; + param &
Re: [PATCH v6 1/2] mtd: nand: add sunxi NAND flash controller support
On Mon, Oct 20, 2014 at 01:45:19PM +0200, Boris Brezillon wrote: > Add support for the sunxi NAND Flash Controller (NFC). > > Signed-off-by: Boris Brezillon This driver looks mostly good. Sorry for the delays, and thanks for the patience. > --- > drivers/mtd/nand/Kconfig |6 + > drivers/mtd/nand/Makefile |1 + > drivers/mtd/nand/sunxi_nand.c | 1400 > + > 3 files changed, 1407 insertions(+) > create mode 100644 drivers/mtd/nand/sunxi_nand.c > > diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig > index dd10646..4c51d2c 100644 > --- a/drivers/mtd/nand/Kconfig > +++ b/drivers/mtd/nand/Kconfig > @@ -516,4 +516,10 @@ config MTD_NAND_XWAY > Enables support for NAND Flash chips on Lantiq XWAY SoCs. NAND is > attached > to the External Bus Unit (EBU). > > +config MTD_NAND_SUNXI > + tristate "Support for NAND on Allwinner SoCs" > + depends on ARCH_SUNXI > + help > + Enables support for NAND Flash chips on Allwinner SoCs. > + > endif # MTD_NAND > diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile > index 9c847e4..bd38f21 100644 > --- a/drivers/mtd/nand/Makefile > +++ b/drivers/mtd/nand/Makefile > @@ -50,5 +50,6 @@ obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o > obj-$(CONFIG_MTD_NAND_GPMI_NAND) += gpmi-nand/ > obj-$(CONFIG_MTD_NAND_XWAY) += xway_nand.o > obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH) += bcm47xxnflash/ > +obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o > > nand-objs := nand_base.o nand_bbt.o nand_timings.o > diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c > new file mode 100644 > index 000..c4e0559 > --- /dev/null > +++ b/drivers/mtd/nand/sunxi_nand.c > @@ -0,0 +1,1400 @@ > +/* > + * Copyright (C) 2013 Boris BREZILLON > + * > + * Derived from: > + * https://github.com/yuq/sunxi-nfc-mtd > + * Copyright (C) 2013 Qiang Yu > + * > + * https://github.com/hno/Allwinner-Info > + * Copyright (C) 2013 Henrik Nordström > + * > + * Copyright (C) 2013 Dmitriy B. > + * Copyright (C) 2013 Sergey Lapin > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define NFC_REG_CTL 0x > +#define NFC_REG_ST 0x0004 > +#define NFC_REG_INT 0x0008 > +#define NFC_REG_TIMING_CTL 0x000C > +#define NFC_REG_TIMING_CFG 0x0010 > +#define NFC_REG_ADDR_LOW 0x0014 > +#define NFC_REG_ADDR_HIGH0x0018 > +#define NFC_REG_SECTOR_NUM 0x001C > +#define NFC_REG_CNT 0x0020 > +#define NFC_REG_CMD 0x0024 > +#define NFC_REG_RCMD_SET 0x0028 > +#define NFC_REG_WCMD_SET 0x002C > +#define NFC_REG_IO_DATA 0x0030 > +#define NFC_REG_ECC_CTL 0x0034 > +#define NFC_REG_ECC_ST 0x0038 > +#define NFC_REG_DEBUG0x003C > +#define NFC_REG_ECC_CNT0 0x0040 > +#define NFC_REG_ECC_CNT1 0x0044 > +#define NFC_REG_ECC_CNT2 0x0048 > +#define NFC_REG_ECC_CNT3 0x004c > +#define NFC_REG_USER_DATA_BASE 0x0050 > +#define NFC_REG_SPARE_AREA 0x00A0 > +#define NFC_RAM0_BASE0x0400 > +#define NFC_RAM1_BASE0x0800 > + > +/* define bit use in NFC_CTL */ > +#define NFC_EN BIT(0) > +#define NFC_RESETBIT(1) > +#define NFC_BUS_WIDYHBIT(2) > +#define NFC_RB_SEL BIT(3) > +#define NFC_CE_SEL GENMASK(26, 24) > +#define NFC_CE_CTL BIT(6) > +#define NFC_CE_CTL1 BIT(7) > +#define NFC_PAGE_SIZEGENMASK(11, 8) > +#define NFC_SAM BIT(12) > +#define NFC_RAM_METHOD BIT(14) > +#define NFC_DEBUG_CTLBIT(31) > + > +/* define bit use in NFC_ST */ > +#define NFC_RB_B2R BIT(0) > +#define NFC_CMD_INT_FLAG BIT(1) > +#define NFC_DMA_INT_FLAG BIT(2) > +#define NFC_CMD_FIFO_STATUS BIT(3) > +#define NFC_STA BIT(4) > +#define NFC_NATCH_INT_FLAG BIT(5) > +#define NFC_RB_STATE0BIT(8) > +#define NFC_RB_STATE1BIT(9) > +#define NFC_RB_STATE2BIT(10) > +#define NFC_RB_STATE3BIT(11) > + > +/* define bit
[PATCH v2 0/3] i2c/at91: add support PM functions
Hi Wolfram, The patches is to add the PM functions support for the at91 i2c controller. It is based on the i2c/for-next branch of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git. Best Regards, Wenyou Yang -- Change log: v2.0 According to the advice from Kevin Hilman, 1./ Wrap the runtime suspend/resume functions in CONFIG_PM instead of CONFIG_PM_RUNTIME. 2./ Call the runtime suspend/resume functions directly in the system suspend/resume. Wenyou Yang (3): i2c/at91: add support for runtime PM i2c/at91: add support for system PM i2c/at91: adopt pinctrl support drivers/i2c/busses/i2c-at91.c | 74 - 1 file changed, 66 insertions(+), 8 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/3] i2c/at91: add support for runtime PM
Drivers should put the device into low power states proactively whenever the device is not in use. Thus implement support for runtime PM and use the autosuspend feature to make sure that we can still perform well in case we see lots of i2c traffic within short period of time. Signed-off-by: Wenyou Yang --- drivers/i2c/busses/i2c-at91.c | 42 + 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 917d545..1b43b08 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -31,10 +31,12 @@ #include #include #include +#include #define DEFAULT_TWI_CLK_HZ 10 /* max 400 Kbits/s */ #define AT91_I2C_TIMEOUT msecs_to_jiffies(100) /* transfer timeout */ #define AT91_I2C_DMA_THRESHOLD 8 /* enable DMA if transfer size is bigger than this threshold */ +#define AUTOSUSPEND_TIMEOUT2000 /* AT91 TWI register definitions */ #defineAT91_TWI_CR 0x /* Control Register */ @@ -481,6 +483,10 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num); + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0) + goto out; + /* * The hardware can handle at most two messages concatenated by a * repeated start via it's internal address feature. @@ -488,18 +494,21 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) if (num > 2) { dev_err(dev->dev, "cannot handle more than two concatenated messages.\n"); - return 0; + ret = 0; + goto out; } else if (num == 2) { int internal_address = 0; int i; if (msg->flags & I2C_M_RD) { dev_err(dev->dev, "first transfer must be write.\n"); - return -EINVAL; + ret = -EINVAL; + goto out; } if (msg->len > 3) { dev_err(dev->dev, "first message size must be <= 3.\n"); - return -EINVAL; + ret = -EINVAL; + goto out; } /* 1st msg is put into the internal address, start with 2nd */ @@ -523,7 +532,12 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) ret = at91_do_twi_transfer(dev); - return (ret < 0) ? ret : num; + ret = (ret < 0) ? ret : num; +out: + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); + + return ret; } static u32 at91_twi_func(struct i2c_adapter *adapter) @@ -795,11 +809,20 @@ static int at91_twi_probe(struct platform_device *pdev) dev->adapter.timeout = AT91_I2C_TIMEOUT; dev->adapter.dev.of_node = pdev->dev.of_node; + pm_runtime_set_autosuspend_delay(dev->dev, AUTOSUSPEND_TIMEOUT); + pm_runtime_use_autosuspend(dev->dev); + pm_runtime_set_active(dev->dev); + pm_runtime_enable(dev->dev); + rc = i2c_add_numbered_adapter(&dev->adapter); if (rc) { dev_err(dev->dev, "Adapter %s registration failed\n", dev->adapter.name); clk_disable_unprepare(dev->clk); + + pm_runtime_disable(dev->dev); + pm_runtime_set_suspended(dev->dev); + return rc; } @@ -814,6 +837,9 @@ static int at91_twi_remove(struct platform_device *pdev) i2c_del_adapter(&dev->adapter); clk_disable_unprepare(dev->clk); + pm_runtime_disable(dev->dev); + pm_runtime_set_suspended(dev->dev); + return 0; } @@ -823,7 +849,7 @@ static int at91_twi_runtime_suspend(struct device *dev) { struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); - clk_disable(twi_dev->clk); + clk_disable_unprepare(twi_dev->clk); return 0; } @@ -832,12 +858,12 @@ static int at91_twi_runtime_resume(struct device *dev) { struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); - return clk_enable(twi_dev->clk); + return clk_prepare_enable(twi_dev->clk); } static const struct dev_pm_ops at91_twi_pm = { - .runtime_suspend= at91_twi_runtime_suspend, - .runtime_resume = at91_twi_runtime_resume, + SET_RUNTIME_PM_OPS(at91_twi_runtime_suspend, + at91_twi_runtime_resume, NULL) }; #define at91_twi_pm_ops (&at91_twi_pm) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read t
[PATCH v4 3/3] dma: imx-sdma: reorg code to make code clean
code reorg for transfer prepare and bus width check. Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 127 +++-- 1 file changed, 60 insertions(+), 67 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 7e8aa2d..b0365c2 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1026,6 +1026,52 @@ static void sdma_free_chan_resources(struct dma_chan *chan) clk_disable(sdma->clk_ahb); } +static int sdma_transfer_init(struct sdma_channel *sdmac, + enum dma_transfer_direction direction) +{ + int ret = 0; + + sdmac->status = DMA_IN_PROGRESS; + sdmac->buf_tail = 0; + sdmac->flags = 0; + sdmac->direction = direction; + + ret = sdma_load_context(sdmac); + if (ret) + return ret; + + sdmac->chn_count = 0; + + return ret; +} + +static int check_bd_buswidth(struct sdma_buffer_descriptor *bd, +struct sdma_channel *sdmac, int count, +dma_addr_t dma_dst, dma_addr_t dma_src) +{ + int ret = 0; + + switch (sdmac->word_size) { + case DMA_SLAVE_BUSWIDTH_4_BYTES: + bd->mode.command = 0; + if ((count | dma_dst | dma_src) & 3) + ret = -EINVAL; + break; + case DMA_SLAVE_BUSWIDTH_2_BYTES: + bd->mode.command = 2; + if ((count | dma_dst | dma_src) & 1) + ret = -EINVAL; + break; + case DMA_SLAVE_BUSWIDTH_1_BYTE: +bd->mode.command = 1; +break; + default: +return -EINVAL; + } + + return ret; +} + static struct dma_async_tx_descriptor *sdma_prep_memcpy( struct dma_chan *chan, dma_addr_t dma_dst, dma_addr_t dma_src, size_t len, unsigned long flags) @@ -1034,7 +1080,7 @@ static struct dma_async_tx_descriptor *sdma_prep_memcpy( struct sdma_engine *sdma = sdmac->sdma; int channel = sdmac->channel; size_t count; - int i = 0, param, ret; + int i = 0, param; struct sdma_buffer_descriptor *bd; if (!chan || !len || sdmac->status == DMA_IN_PROGRESS) @@ -1046,21 +1092,12 @@ static struct dma_async_tx_descriptor *sdma_prep_memcpy( goto err_out; } - sdmac->status = DMA_IN_PROGRESS; - - sdmac->buf_tail = 0; - dev_dbg(sdma->dev, "memcpy: %pad->%pad, len=%zu, channel=%d.\n", &dma_src, &dma_dst, len, channel); - sdmac->direction = DMA_MEM_TO_MEM; - - ret = sdma_load_context(sdmac); - if (ret) + if (sdma_transfer_init(sdmac, DMA_MEM_TO_MEM)) goto err_out; - sdmac->chn_count = 0; - do { count = min_t(size_t, len, SDMA_BD_MAX_CNT); bd = &sdmac->bd[i]; @@ -1068,28 +1105,8 @@ static struct dma_async_tx_descriptor *sdma_prep_memcpy( bd->ext_buffer_addr = dma_dst; bd->mode.count = count; - if (sdmac->word_size > DMA_SLAVE_BUSWIDTH_4_BYTES) { - ret = -EINVAL; + if (check_bd_buswidth(bd, sdmac, count, dma_dst, dma_src)) goto err_out; - } - - switch (sdmac->word_size) { - case DMA_SLAVE_BUSWIDTH_4_BYTES: - bd->mode.command = 0; - if ((count | dma_dst | dma_src) & 3) - return NULL; - break; - case DMA_SLAVE_BUSWIDTH_2_BYTES: - bd->mode.command = 2; - if ((count | dma_dst | dma_src) & 1) - return NULL; - break; - case DMA_SLAVE_BUSWIDTH_1_BYTE: - bd->mode.command = 1; - break; - default: - return NULL; - } dma_src += count; dma_dst += count; @@ -1141,21 +1158,10 @@ static struct dma_async_tx_descriptor *sdma_prep_sg( if (sdmac->status == DMA_IN_PROGRESS) return NULL; - sdmac->status = DMA_IN_PROGRESS; - - sdmac->flags = 0; - - sdmac->buf_tail = 0; dev_dbg(sdma->dev, "setting up %d entries for channel %d.\n", src_nents, channel); - sdmac->direction = direction; - - ret = sdma_load_context(sdmac); - if (ret) - goto err_out; - if (src_nents > NUM_BD) { dev_err(sdma->dev, "SDMA channel %d: maximum number of sg exceeded: %d > %d\n", channel, src_nents, NUM_BD); @@ -1163,7 +1169,9 @@ static struct dma_async_tx_descriptor *sdma_prep_sg( goto err_out; } - sdmac->chn_count = 0; +
[PATCH v2 2/3] i2c/at91: add support for system PM
Signed-off-by: Wenyou Yang Acked-by: Ludovic Desroches --- drivers/i2c/busses/i2c-at91.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 1b43b08..8f8fd2a 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -861,7 +861,32 @@ static int at91_twi_runtime_resume(struct device *dev) return clk_prepare_enable(twi_dev->clk); } +static int at91_twi_suspend(struct device *dev) +{ + if (!pm_runtime_suspended(dev)) + at91_twi_runtime_suspend(dev); + + return 0; +} + +static int at91_twi_resume(struct device *dev) +{ + int ret; + + if (!pm_runtime_suspended(dev)) { + ret = at91_twi_runtime_resume(dev); + if (ret) + return ret; + } + + pm_runtime_mark_last_busy(dev); + pm_request_autosuspend(dev); + + return 0; +} + static const struct dev_pm_ops at91_twi_pm = { + SET_SYSTEM_SLEEP_PM_OPS(at91_twi_suspend, at91_twi_resume) SET_RUNTIME_PM_OPS(at91_twi_runtime_suspend, at91_twi_runtime_resume, NULL) }; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 3/3] i2c/at91: adopt pinctrl support
Amend the i2c at91 pin controller to optionally take a pin control handle and set the state of the pins to: - "default" on boot, resume and before performing an transfer - "sleep" on suspend() This should make it possible to optimize energy usage for the pins both for the suspend/resume cycle Signed-off-by: Wenyou Yang Acked-by: Ludovic Desroches --- drivers/i2c/busses/i2c-at91.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 8f8fd2a..7075834 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -32,6 +32,7 @@ #include #include #include +#include #define DEFAULT_TWI_CLK_HZ 10 /* max 400 Kbits/s */ #define AT91_I2C_TIMEOUT msecs_to_jiffies(100) /* transfer timeout */ @@ -747,6 +748,8 @@ static int at91_twi_probe(struct platform_device *pdev) u32 phy_addr; u32 bus_clk_rate; + pinctrl_pm_select_default_state(&pdev->dev); + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; @@ -851,6 +854,8 @@ static int at91_twi_runtime_suspend(struct device *dev) clk_disable_unprepare(twi_dev->clk); + pinctrl_pm_select_sleep_state(dev); + return 0; } @@ -858,6 +863,8 @@ static int at91_twi_runtime_resume(struct device *dev) { struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); + pinctrl_pm_select_default_state(dev); + return clk_prepare_enable(twi_dev->clk); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
> -Original Message- > From: Thomas Gleixner [mailto:t...@linutronix.de] > Sent: Tuesday, October 21, 2014 2:28 AM > To: Thomas Shao > Cc: gre...@linuxfoundation.org; LKML; de...@linuxdriverproject.org; > o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; KY Srinivasan; > John Stultz > Subject: Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for > do_adjtimex() > > On Wed, 15 Oct 2014, Thomas Shao wrote: > > And again you forgot to cc John Stultz on this I'll cc John Stultz in the future. Sorry for that. > > > Export do_adjtimex function for hyper-v Time Synchronization component > > > > Signed-off-by: Thomas Shao > > --- > > kernel/time/timekeeping.c |1 + > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > > index ec1791f..205a4b3 100644 > > --- a/kernel/time/timekeeping.c > > +++ b/kernel/time/timekeeping.c > > @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) > > > > return ret; > > } > > +EXPORT_SYMBOL_GPL(do_adjtimex); > > > > #ifdef CONFIG_NTP_PPS > > /** > > -- > > 1.7.1 > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] x86, e820: panic on sanitizing invalid memory map
sanitize_e820_map returns two possible values: -1: Returned when either the provided memory map has length 1 (ok) or when the provided memory map is invalid (not ok). 0: Returned when the memory map was correctly sanitized. In addition, most code ignores the returned value, and none actually handles it (except possibly by panicking). This patch changes the behavior so that sanitize_e820_map is a void function. When the provided memory map has length 1 or it is sanitized (both ok cases), it returns nothing. If the provided memory map is invalid, then it panics. Signed-off-by: Martin Kelly --- Changes in v2: - Fixed compiler warnings: * return 0 from void function * early_panic declared but not used --- --- arch/x86/include/asm/e820.h | 2 +- arch/x86/kernel/e820.c | 103 2 files changed, 47 insertions(+), 58 deletions(-) diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index 779c2ef..739f8db 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h @@ -18,7 +18,7 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned type); extern int e820_all_mapped(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); extern void e820_print_map(char *who); -extern int +extern void sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, u32 *pnr_map); extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 49f8864..7ca23fb 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -188,47 +188,48 @@ void __init e820_print_map(char *who) * be updated on return, with the new number of valid entries * (something no more than max_nr_map.) * - * The return value from sanitize_e820_map() is zero if it - * successfully 'sanitized' the map entries passed in, and is -1 - * if it did nothing, which can happen if either of (1) it was - * only passed one map entry, or (2) any of the input map entries - * were invalid (start + size < start, meaning that the size was - * so big the described memory range wrapped around through zero.) + * There are three possible actions that sanitize_e820_map() can take: + * (1) If the map entry count is 1, do nothing and return. + * (2) If any of the input map entries were invalid + * (start + size < start), then the size was so big that the described + * memory range wrapped around through zero. In this case, panic. + * (3) If the map entry count is greater than 1 and the map is valid, + * sanitize the map and return. * - * Visually we're performing the following - * (1,2,3,4 = memory types)... + * Visually we're performing the following + * (1,2,3,4 = memory types)... * - * Sample memory map (w/overlaps): - *22__ - *__4_ - * - *_44_ - * - *33__ - *___44___ - *__3_ - *__22 - *____ - *_1__ - *_11_ - *_4__ + * Sample memory map (w/overlaps): + *22__ + *__4_ + * + *_44_ + * + *33__ + *___44___ + *__3_ + *__22 + *____ + *_1__ + *_11_ + *_4__ * - * Sanitized equivalent (no overlap): - *1___ - *_44_ - *___1 - *22__ - *__11 - *_1__ - *__3_ - *___44___ - *_33_ - *___2 - *1___ - *_4__ - *___2 - *33__ - *__4_ + * Sanitized equivalent (no overlap): + *1___ + *_44_ + *___1 + *22__ + *__11 + *_1__ + *__3_ + *___44___ + *_33_ + *___2 + *1___ + *_4__ + *___2 + *33__ + *__4_ */ struct change_member { struct e82
Re: [PATCH] x86, e820: panic on sanitizing invalid memory map
On 10/17/2014 09:41 PM, Martin Kelly wrote: > sanitize_e820_map returns two possible values: > -1: Returned when either the provided memory map has length 1 (ok) or > when the provided memory map is invalid (not ok). > 0: Returned when the memory map was correctly sanitized. > > In addition, most code ignores the returned value, and none actually > handles it (except possibly by panicking). > > This patch changes the behavior so that sanitize_e820_map is a void > function. When the provided memory map has length 1 or it is sanitized > (both ok cases), it returns nothing. If the provided memory map is > invalid, then it panics. > > Signed-off-by: Martin Kelly > --- > arch/x86/include/asm/e820.h | 2 +- > arch/x86/kernel/e820.c | 95 > ++--- > 2 files changed, 47 insertions(+), 50 deletions(-) > > diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h > index 779c2ef..739f8db 100644 > --- a/arch/x86/include/asm/e820.h > +++ b/arch/x86/include/asm/e820.h > @@ -18,7 +18,7 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned > type); > extern int e820_all_mapped(u64 start, u64 end, unsigned type); > extern void e820_add_region(u64 start, u64 size, int type); > extern void e820_print_map(char *who); > -extern int > +extern void > sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, u32 *pnr_map); > extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, > unsigned new_type); > diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c > index 49f8864..96ad559 100644 > --- a/arch/x86/kernel/e820.c > +++ b/arch/x86/kernel/e820.c > @@ -188,47 +188,48 @@ void __init e820_print_map(char *who) > * be updated on return, with the new number of valid entries > * (something no more than max_nr_map.) > * > - * The return value from sanitize_e820_map() is zero if it > - * successfully 'sanitized' the map entries passed in, and is -1 > - * if it did nothing, which can happen if either of (1) it was > - * only passed one map entry, or (2) any of the input map entries > - * were invalid (start + size < start, meaning that the size was > - * so big the described memory range wrapped around through zero.) > + * There are three possible actions that sanitize_e820_map() can take: > + * (1) If the map entry count is 1, do nothing and return. > + * (2) If any of the input map entries were invalid > + * (start + size < start), then the size was so big that the > described > + * memory range wrapped around through zero. In this case, panic. > + * (3) If the map entry count is greater than 1 and the map is valid, > + * sanitize the map and return. > * > - * Visually we're performing the following > - * (1,2,3,4 = memory types)... > + * Visually we're performing the following > + * (1,2,3,4 = memory types)... > * > - * Sample memory map (w/overlaps): > - * 22__ > - * __4_ > - * > - * _44_ > - * > - * 33__ > - * ___44___ > - * __3_ > - * __22 > - * ____ > - * _1__ > - * _11_ > - * _4__ > + * Sample memory map (w/overlaps): > + *22__ > + *__4_ > + * > + *_44_ > + * > + *33__ > + *___44___ > + *__3_ > + *__22 > + *____ > + *_1__ > + *_11_ > + *_4__ > * > - * Sanitized equivalent (no overlap): > - * 1___ > - * _44_ > - * ___1 > - * 22__ > - * __11 > - * _1__ > - * __3_ > - * ___44___ > - * _33_ > - * ___2 > - * 1___ > - * _4__ > - * ___2 > - * 33__ > - * __4_ > + * Sanitized equivalent (no overlap): > + *1___ > + *_44_ > + *___1 > + *22__ > + *__11 > + *_1__ > + *__3_ > + *___44___ > + *_33_ > + *___2 > + *1___ > + *_4__ > + *___2 > + *
Re: [PATCH v6 2/2] mtd: nand: add sunxi NFC dt bindings doc
Hi Boris, On Mon, Oct 20, 2014 at 01:45:20PM +0200, Boris Brezillon wrote: > Add the sunxi NAND Flash Controller dt bindings documentation. > > Signed-off-by: Boris Brezillon > --- > .../devicetree/bindings/mtd/sunxi-nand.txt | 45 > ++ > 1 file changed, 45 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mtd/sunxi-nand.txt > > diff --git a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt > b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt > new file mode 100644 > index 000..0273adb > --- /dev/null > +++ b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt > @@ -0,0 +1,45 @@ > +Allwinner NAND Flash Controller (NFC) > + > +Required properties: > +- compatible : "allwinner,sun4i-a10-nand". > +- reg : shall contain registers location and length for data and reg. > +- interrupts : shall define the nand controller interrupt. > +- #address-cells: shall be set to 1. Encode the nand CS. > +- #size-cells : shall be set to 0. > +- clocks : shall reference nand controller clocks. > +- clock-names : nand controller internal clock names. Shall contain : > +* "ahb" : AHB gating clock > +* "mod" : nand controller clock > + > +Optional children nodes: > +Children nodes represent the available nand chips. > + > +Optional properties: > +- allwinner,rb : shall contain the native Ready/Busy ids. > + or > +- rb-gpios : shall contain the gpios used as R/B pins. I think you're relying on a named GPIO in your driver ("nand-rb"). That should be documented here. > +- nand-ecc-mode : one of the supported ECC modes ("hw", "hw_syndrome", > "soft", > + "soft_bch" or "none") I think you're utilizing an undocumented 'nand-name' property for this node in your driver too. Please document it. (That also goes for any other undocumented properties I may have missed.) > + > +see Documentation/devicetree/mtd/nand.txt for generic bindings. > + > + > +Examples: > +nfc: nand@01c03000 { > + compatible = "allwinner,sun4i-a10-nand"; > + reg = <0x01c03000 0x1000>; > + interrupts = <0 37 1>; > + clocks = <&ahb_gates 13>, <&nand_clk>; > + clock-names = "ahb", "mod"; > + #address-cells = <1>; > + #size-cells = <0>; > + pinctrl-names = "default"; > + pinctrl-0 = <&nand_pins_a &nand_cs0_pins_a &nand_rb0_pins_a>; > + status = "okay"; > + > + nand@0 { > + reg = <0>; > + allwinner,rb = <0>; > + nand-ecc-mode = "soft_bch"; > + }; > +}; Brian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/2] Staging: iio: adc: Checkpatch.pl warning cleanups
This patch-set fixes 2 checkpatch.pl warnings dealing with lines over 80 characters. Brian Vandre (2): Staging: iio: adc: fix line over 80 characters Staging: iio: adc: fix line over 80 characters drivers/staging/iio/adc/mxs-lradc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] Staging: iio: adc: fix line over 80 characters
This fixes the checkpatch.pl warning: WARNING: line over 80 characters Signed-off-by: Brian Vandre --- drivers/staging/iio/adc/mxs-lradc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 7d4b068..62449a6 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -514,7 +514,8 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1, * SoC's delay unit and start the conversion later * and automatically. */ - mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */ + mxs_lradc_reg_wrt(lradc, + LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */ LRADC_DELAY_TRIGGER_DELAYS(1 << 3) | /* trigger DELAY unit#3 */ LRADC_DELAY_KICK | LRADC_DELAY_DELAY(lradc->settling_delay), LRADC_DELAY(2)); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] Staging: iio: adc: fix line over 80 characters
This fixes the checkpatch.pl warning: WARNING: line over 80 characters Signed-off-by: Brian Vandre --- drivers/staging/iio/adc/mxs-lradc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 32a1926..7d4b068 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -455,7 +455,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) * SoC's delay unit and start the conversion later * and automatically. */ - mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */ + mxs_lradc_reg_wrt(lradc, + LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */ LRADC_DELAY_TRIGGER_DELAYS(1 << 3) | /* trigger DELAY unit#3 */ LRADC_DELAY_KICK | LRADC_DELAY_DELAY(lradc->settling_delay), -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] drivers: base: update cpu offline info when do hotplug
Hi Neil and Dan, (2014/10/21 2:02), Dan Streetman wrote: On Mon, Oct 20, 2014 at 3:40 AM, Neil Zhang wrote: Greg, -Original Message- From: Greg KH [mailto:gre...@linuxfoundation.org] Sent: 2014年10月20日 14:48 To: Neil Zhang Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: base: update cpu offline info when do hotplug On Sun, Oct 19, 2014 at 11:39:23PM -0700, Neil Zhang wrote: How much noise is this going to cause on a big/little system that constantly hot unplug/plugs processors all of the time? Can you explain more what kind of noise will be introduced on a big/little system? Have you tested this on such a machine? I didn't have such kind of machine on hand. Can anyone has such machine to verify it? Thanks! I tested this on a ppc PowerVM system, using dlpar operations to remove/add cpus. Without this patch the cpu online nodes get out of sync with the main online node (and the actual state of the cpus), because they aren't updated as the cpus are brought up/down: [root@br10p02 cpu]$ pwd /sys/devices/system/cpu [root@br10p02 cpu]$ cat online 0-39 [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 How is the issue reproduced. Here is a result on my x86 box with linux-3.18-rc1. - before offline CPU # cd /sys/devices/system/cpu/ # cat online 0-59 # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 - after offline CPU{1..59} # for n in {1..59} ; do echo 0 > cpu$n/online; done # cat online 0 # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 It seems that dev->offline is set to correct valute. Thanks, Yasuaki Ishimatsu While with the patch, the cpu online nodes are kept up to date as the cpus are brought up/down: [root@br10p02 cpu]$ pwd /sys/devices/system/cpu [root@br10p02 cpu]$ cat online 0-39 [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 Feel free to add Tested-by: Dan Streetman As I know IKS on arm will use cpu_suspend way to power down a core. Are you sure that it also doesn't use that same functionality to drop a processor to save power? As I know it use cpu_suspend to switch out a processor in IKS and there is no cpu hotplug notifier in this procedure. Why do you need/want this notification? What are you going to do with this information that you don't already have? The offline won't be updated if an in kernel hotplug governor plug in / out a core which cause the sysfs interface report a wrong status. thanks, greg k-h Best Regards, Neil Zhang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: Tree for Oct 21
Hi all, Changes since 20141020: The sound-asoc tree gained a build failure so I used the version from next-20141020. Non-merge commits (relative to Linus' tree): 960 986 files changed, 21989 insertions(+), 34927 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master. You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc and an allmodconfig for x86_64 and a multi_v7_defconfig for arm. After the final fixups (if any), it is also built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and allyesconfig (this fails its final link) and i386, sparc, sparc64 and arm defconfig. Below is a summary of the state of the merge. I am currently merging 225 trees (counting Linus' and 32 trees of patches pending for Linus' tree). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. -- Cheers, Stephen Rothwells...@canb.auug.org.au $ git checkout master $ git reset --hard stable Merging origin/master (c2661b806092 Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4) Merging fixes/master (b94d525e58dc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net) Merging kbuild-current/rc-fixes (7d1311b93e58 Linux 3.17-rc1) Merging arc-current/for-curr (2ce7598c9a45 Linux 3.17-rc4) Merging arm-current/fixes (7fc150543c73 ARM: Blacklist GCC 4.8.0 to GCC 4.8.2 - PR58854) Merging m68k-current/for-linus (24cae7934cf1 m68k: Reformat arch/m68k/mm/hwtest.c) Merging metag-fixes/fixes (ffe6902b66aa asm-generic: remove _STK_LIM_MAX) Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5) Merging powerpc-merge/merge (396a34340cdf powerpc: Fix endianness of flash_block_list in rtas_flash) Merging powerpc-merge-mpe/for-linus (e89dafb5ca50 powerpc: Only do dynamic DMA zone limits on platforms that need it) Merging sparc/master (61ed53deb1c6 Merge tag 'ntb-3.18' of git://github.com/jonmason/ntb) Merging net/master (d10845fc85b2 Merge branch 'gso_encap_fixes') Merging ipsec/master (b8c203b2d2fc xfrm: Generate queueing routes only from route lookup functions) Merging sound-current/for-linus (6acce400d9da ALSA: hda - hdmi: Fix missing ELD change event on plug/unplug) Merging pci-current/for-linus (8c33e57e6fb3 Merge branch 'remove-weak-function-declarations' into for-linus) Merging wireless/master (f8adaf0ae978 brcmfmac: Fix off by one bug in brcmf_count_20mhz_channels()) Merging driver-core.current/driver-core-linus (f114040e3ea6 Linux 3.18-rc1) Merging tty.current/tty-linus (f114040e3ea6 Linux 3.18-rc1) Merging usb.current/usb-linus (f114040e3ea6 Linux 3.18-rc1) Merging usb-gadget-fixes/fixes (0b93a4c838fa usb: dwc3: fix TRB completion when multiple TRBs are started) Merging usb-serial-fixes/usb-linus (f114040e3ea6 Linux 3.18-rc1) Merging staging.current/staging-linus (54d5c5cd0fb2 staging: rtl8723au: Fix alignment of mac_addr for ether_addr_copy() usage) Merging char-misc.current/char-misc-linus (f114040e3ea6 Linux 3.18-rc1) Merging input-current/for-linus (4dfb15cd5aaa Input: xpad - add Thrustmaster as Xbox 360 controller vendor) Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" stripe) Merging crypto-current/master (be34c4ef693f crypto: sha - Handle unaligned input data in generic sha256 and sha512.) Merging ide/master (7546e52b5e3d Drivers: ide: Remove typedef atiixp_ide_timing) Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff) Merging devicetree-current/devicetree/merge (e66c98c7a0ea of: Fix NULL dereference in selftest removal code) Merging rr-fixes/fixes (f49819560f53 virtio-rng: skip reading when we start to remove the device) Merging vfio-fixes/for-linus (239a87020b26 Merge branch 'for-joerg/arm-smmu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into for-linus) Merging kselftest-fixes/fixes (ce6a144a0d01 selftests/memfd: Run test on all architectures) Merging drm-intel-fixes/for-linux-next-fixes (f114040e3ea6 L
Qemu hang introduced between next-20141013 and next-20141017
Hi, I have a minimal qemu setup that I used for testing development kernels. I have noticed that somewhere between next-20141013 and next-20141017, qemu started to hang at boot time, with no messages displayed on the console (previously, it would boot to a full userspace). I attempted to bisect it, but the next tree has so many merges that git bisect takes a very long time. I have attached the config I'm using and have pasted the qemu command below. The image I'm using is a minimal Wheezy image created with debootstrap. qemu command-line: qemu-system-x86_64 -kernel arch/x86_64/boot/bzImage \ -smp 1 \ -drive file=wheezy.img,if=virtio \ -append 'root=/dev/vda console=hvc0' \ -chardev stdio,id=stdio,mux=on,signal=off \ -device virtio-serial-pci \ -device virtconsole,chardev=stdio \ -mon chardev=stdio \ -display none Any idea what may have caused this or suggestions for debugging it? Thanks, Martin # # Automatically generated file; DO NOT EDIT. # Linux/x86 3.17.0 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_MMU=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_HWEIGHT=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ZONE_DMA32=y CONFIG_AUDIT_ARCH=y CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_X86_64_SMP=y CONFIG_X86_HT=y CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y # # General setup # CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_BZIP2 is not set # CONFIG_KERNEL_LZMA is not set # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set CONFIG_DEFAULT_HOSTNAME="(none)" CONFIG_SWAP=y # CONFIG_SYSVIPC is not set # CONFIG_POSIX_MQUEUE is not set # CONFIG_CROSS_MEMORY_ATTACH is not set CONFIG_FHANDLE=y # CONFIG_USELIB is not set # CONFIG_AUDIT is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y # # IRQ subsystem # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y CONFIG_GENERIC_PENDING_IRQ=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y CONFIG_GENERIC_CMOS_UPDATE=y # # Timers subsystem # CONFIG_HZ_PERIODIC=y # CONFIG_NO_HZ_IDLE is not set # CONFIG_NO_HZ_FULL is not set # CONFIG_NO_HZ is not set # CONFIG_HIGH_RES_TIMERS is not set # # CPU/Task time and stats accounting # CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_TASKSTATS is not set # # RCU Subsystem # CONFIG_TREE_RCU=y # CONFIG_PREEMPT_RCU is not set # CONFIG_TASKS_RCU is not set CONFIG_RCU_STALL_COMMON=y # CONFIG_RCU_USER_QS is not set CONFIG_RCU_FANOUT=64 CONFIG_RCU_FANOUT_LEAF=16 # CONFIG_RCU_FANOUT_EXACT is not set # CONFIG_TREE_RCU_TRACE is not set # CONFIG_RCU_NOCB_CPU is not set # CONFIG_BUILD_BIN2C is not set # CONFIG_IKCONFIG is not set CONFIG_LOG_BUF_SHIFT=17 CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y CONFIG_ARCH_SUPPORTS_INT128=y # CONFIG_CGROUPS is not set # CONFIG_CHECKPOINT_RESTORE is not set # CONFIG_NAMESPACES is not set # CONFIG_SCHED_AUTOGROUP is not set # CONFIG_SYSFS_DEPRECATED is not set # CONFIG_RELAY is not set # CONFIG_BLK_DEV_INITRD is not set # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # CONFIG_LTO_MENU is not set CONFIG_SYSCTL=y CONFIG_ANON_INODES=y CONFIG_HAVE_UID16=y CONFIG_SYSCTL_EXCEPTION_TRA
RE: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
> -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Thomas Gleixner > Sent: Tuesday, October 21, 2014 2:41 AM > To: Thomas Shao > Cc: gre...@linuxfoundation.org; LKML; de...@linuxdriverproject.org; > o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; KY Srinivasan; > John Stultz; Richard Cochran > Subject: Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for > do_adjtimex() > > On Mon, 20 Oct 2014, Thomas Gleixner wrote: > > > On Wed, 15 Oct 2014, Thomas Shao wrote: > > > > And again you forgot to cc John Stultz on this > > > > > Export do_adjtimex function for hyper-v Time Synchronization > > > component > > Aside of that, we really want to see the use case for this and how you > addressed the problems which were pointed out by various folks. > In some situation, the user is not able to enable guest VM to sync with external time source, like NTP. But the host is still synced with a trusted time source. In this case, host-guest time synchronization is useful. Hyper-v host will send time sample to guest VM every 5 seconds. We will use these time samples to adjust guest VM time. I've got some feedbacks from Richard and Mike, including reference NTP implementation and do the adjustment in the host side. I've already referenced some NTP design in my patch. I would consider my patch as a simplified implementation. I've also considered the host side implementation. But in host, we can only set time but not gradually slew/adjust time, which is not acceptable for the time sync solution.We still recommend user to configure NTP on the guest, which provides better accuracy. But if NTP is not applicable, this could be another option. > I still do not have a consistent argument from you WHY you need to abuse > do_adjtimex() to do that host - guest synchronization in the first place. > I need a function to gradually slew guest time. do_adjtimex() provides all the functionality. Also I could not find any other exposed func to do this. I'd like to hear any feedback from you for this. > Thanks, > > tglx > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the > body of a message to majord...@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] drivers: base: update cpu offline info when do hotplug
Yasuaki, > -Original Message- > From: Yasuaki Ishimatsu [mailto:isimatu.yasu...@jp.fujitsu.com] > Sent: 2014年10月21日 10:57 > To: Dan Streetman; Neil Zhang > Cc: Greg KH; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] drivers: base: update cpu offline info when do hotplug > > Hi Neil and Dan, > > (2014/10/21 2:02), Dan Streetman wrote: > > On Mon, Oct 20, 2014 at 3:40 AM, Neil Zhang wrote: > >> Greg, > >> > >> > >> -Original Message- > >> From: Greg KH [mailto:gre...@linuxfoundation.org] > >> Sent: 2014年10月20日 14:48 > >> To: Neil Zhang > >> Cc: linux-kernel@vger.kernel.org > >> Subject: Re: [PATCH] drivers: base: update cpu offline info when do > >> hotplug > >> > >> On Sun, Oct 19, 2014 at 11:39:23PM -0700, Neil Zhang wrote: > How much noise is this going to cause on a big/little system that > constantly hot unplug/plugs processors all of the time? > >>> > >>> Can you explain more what kind of noise will be introduced on a big/little > system? > >> > >> Have you tested this on such a machine? > >> > >> I didn't have such kind of machine on hand. > >> Can anyone has such machine to verify it? > >> Thanks! > > > > I tested this on a ppc PowerVM system, using dlpar operations to > > remove/add cpus. > > > > Without this patch the cpu online nodes get out of sync with the main > > online node (and the actual state of the cpus), because they aren't > > updated as the cpus are brought up/down: > > > > > [root@br10p02 cpu]$ pwd > > /sys/devices/system/cpu > > [root@br10p02 cpu]$ cat online > > 0-39 > > [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) > > -eq 1 && echo -n "$n " ; done ; echo "" > > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 > > 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 > > How is the issue reproduced. > > Here is a result on my x86 box with linux-3.18-rc1. > > - before offline CPU > # cd /sys/devices/system/cpu/ > # cat online > 0-59 > # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; > done ; echo "" > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 > 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 > 55 > 56 57 58 59 > > - after offline CPU{1..59} > # for n in {1..59} ; do echo 0 > cpu$n/online; done # cat online > 0 > # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; > done ; echo "" > 0 > > It seems that dev->offline is set to correct valute. > Please use an in kernel governor to up / down a core instead of sysfs interface. > Thanks, > Yasuaki Ishimatsu > > > > > > > While with the patch, the cpu online nodes are kept up to date as the > > cpus are brought up/down: > > > > [root@br10p02 cpu]$ pwd > > /sys/devices/system/cpu > > [root@br10p02 cpu]$ cat online > > 0-39 > > [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) > > -eq 1 && echo -n "$n " ; done ; echo "" > > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 > > 27 28 29 30 31 32 33 34 35 36 37 38 39 > > > > > > Feel free to add > > > > Tested-by: Dan Streetman > > > >> > >>> As I know IKS on arm will use cpu_suspend way to power down a core. > >> > >> Are you sure that it also doesn't use that same functionality to drop a > processor to save power? > >> > >> As I know it use cpu_suspend to switch out a processor in IKS and there is > no cpu hotplug notifier in this procedure. > >> > >> > >> Why do you need/want this notification? What are you going to do with this > information that you don't already have? > >> > >> The offline won't be updated if an in kernel hotplug governor plug in / out > a core which cause the sysfs interface report a wrong status. > >> > >> > >> thanks, > >> > >> greg k-h > >> > >> > >> Best Regards, > >> Neil Zhang > > -- > > To unsubscribe from this list: send the line "unsubscribe > > linux-kernel" in the body of a message to majord...@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > Please read the FAQ at http://www.tux.org/lkml/ > > > Best Regards, Neil Zhang
Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
On Mon, Oct 20, 2014 at 8:18 PM, Thomas Shao wrote: > >> -Original Message- >> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- >> ow...@vger.kernel.org] On Behalf Of Thomas Gleixner >> Sent: Tuesday, October 21, 2014 2:41 AM >> To: Thomas Shao >> Cc: gre...@linuxfoundation.org; LKML; de...@linuxdriverproject.org; >> o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; KY Srinivasan; >> John Stultz; Richard Cochran >> Subject: Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for >> do_adjtimex() >> >> On Mon, 20 Oct 2014, Thomas Gleixner wrote: >> >> > On Wed, 15 Oct 2014, Thomas Shao wrote: >> > >> > And again you forgot to cc John Stultz on this >> > >> > > Export do_adjtimex function for hyper-v Time Synchronization >> > > component >> >> Aside of that, we really want to see the use case for this and how you >> addressed the problems which were pointed out by various folks. >> > > In some situation, the user is not able to enable guest VM to sync with > external > time source, like NTP. But the host is still synced with a trusted time > source. > In this case, host-guest time synchronization is useful. Hyper-v host will > send time > sample to guest VM every 5 seconds. We will use these time samples to adjust > guest > VM time. > > I've got some feedbacks from Richard and Mike, including reference NTP > implementation > and do the adjustment in the host side. I've already referenced some NTP > design in > my patch. I would consider my patch as a simplified implementation. I've also > considered > the host side implementation. But in host, we can only set time but not > gradually slew/adjust > time, which is not acceptable for the time sync solution.We still recommend > user to configure > NTP on the guest, which provides better accuracy. But if NTP is not > applicable, this could be > another option. > >> I still do not have a consistent argument from you WHY you need to abuse >> do_adjtimex() to do that host - guest synchronization in the first place. >> > > I need a function to gradually slew guest time. do_adjtimex() provides all the > functionality. Also I could not find any other exposed func to do this. I'd > like to > hear any feedback from you for this. Do you have any protections from both your kernel module trying to slew time if the guest is also running NTPd? That seems like it could cause some strange behavior. thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] drivers: base: update cpu offline info when do hotplug
(2014/10/21 12:18), Neil Zhang wrote: Yasuaki, -Original Message- From: Yasuaki Ishimatsu [mailto:isimatu.yasu...@jp.fujitsu.com] Sent: 2014年10月21日 10:57 To: Dan Streetman; Neil Zhang Cc: Greg KH; linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: base: update cpu offline info when do hotplug Hi Neil and Dan, (2014/10/21 2:02), Dan Streetman wrote: On Mon, Oct 20, 2014 at 3:40 AM, Neil Zhang wrote: Greg, -Original Message- From: Greg KH [mailto:gre...@linuxfoundation.org] Sent: 2014年10月20日 14:48 To: Neil Zhang Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: base: update cpu offline info when do hotplug On Sun, Oct 19, 2014 at 11:39:23PM -0700, Neil Zhang wrote: How much noise is this going to cause on a big/little system that constantly hot unplug/plugs processors all of the time? Can you explain more what kind of noise will be introduced on a big/little system? Have you tested this on such a machine? I didn't have such kind of machine on hand. Can anyone has such machine to verify it? Thanks! I tested this on a ppc PowerVM system, using dlpar operations to remove/add cpus. Without this patch the cpu online nodes get out of sync with the main online node (and the actual state of the cpus), because they aren't updated as the cpus are brought up/down: [root@br10p02 cpu]$ pwd /sys/devices/system/cpu [root@br10p02 cpu]$ cat online 0-39 [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 How is the issue reproduced. Here is a result on my x86 box with linux-3.18-rc1. - before offline CPU # cd /sys/devices/system/cpu/ # cat online 0-59 # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 - after offline CPU{1..59} # for n in {1..59} ; do echo 0 > cpu$n/online; done # cat online 0 # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 It seems that dev->offline is set to correct valute. Please use an in kernel governor to up / down a core instead of sysfs interface. Thank you for the information. But I don't know the in kernel governor? Could you point a documentation of it? Thanks, Yasuaki Ishimatsu Thanks, Yasuaki Ishimatsu While with the patch, the cpu online nodes are kept up to date as the cpus are brought up/down: [root@br10p02 cpu]$ pwd /sys/devices/system/cpu [root@br10p02 cpu]$ cat online 0-39 [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) -eq 1 && echo -n "$n " ; done ; echo "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 Feel free to add Tested-by: Dan Streetman As I know IKS on arm will use cpu_suspend way to power down a core. Are you sure that it also doesn't use that same functionality to drop a processor to save power? As I know it use cpu_suspend to switch out a processor in IKS and there is no cpu hotplug notifier in this procedure. Why do you need/want this notification? What are you going to do with this information that you don't already have? The offline won't be updated if an in kernel hotplug governor plug in / out a core which cause the sysfs interface report a wrong status. thanks, greg k-h Best Regards, Neil Zhang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ Best Regards, Neil Zhang �{.n�+���+%��lzwm��b�맲��r��zX���w��{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�iO��z��v�^�mnƊ��Y&� -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ASoC: rt5677: fix rt5677 spi driver build
Create a separate module for rt5677 spi driver. Without this patch, the build fails due to multiple defs of 'init_module' and 'cleanup_module'. module_spi_driver() defines its own module, so it can't be part of the rt5677 module. Signed-off-by: Ben Zhang --- sound/soc/codecs/Kconfig | 4 sound/soc/codecs/Makefile | 4 +++- sound/soc/codecs/rt5677-spi.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 2c7482e..6f21a76 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -504,6 +504,10 @@ config SND_SOC_RT5670 config SND_SOC_RT5677 tristate +config SND_SOC_RT5677_SPI + tristate + default SND_SOC_RT5677 + #Freescale sgtl5000 codec config SND_SOC_SGTL5000 tristate "Freescale SGTL5000 CODEC" diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 4435f9f..3e57edc 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -79,7 +79,8 @@ snd-soc-rt5640-objs := rt5640.o snd-soc-rt5645-objs := rt5645.o snd-soc-rt5651-objs := rt5651.o snd-soc-rt5670-objs := rt5670.o -snd-soc-rt5677-objs := rt5677.o rt5677-spi.o +snd-soc-rt5677-objs := rt5677.o +snd-soc-rt5677-spi-objs := rt5677-spi.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o snd-soc-alc5632-objs := alc5632.o @@ -256,6 +257,7 @@ obj-$(CONFIG_SND_SOC_RT5645)+= snd-soc-rt5645.o obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o obj-$(CONFIG_SND_SOC_RT5670) += snd-soc-rt5670.o obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o +obj-$(CONFIG_SND_SOC_RT5677_SPI) += snd-soc-rt5677-spi.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o obj-$(CONFIG_SND_SOC_SIGMADSP_I2C) += snd-soc-sigmadsp-i2c.o diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c index 11c38f3..ef6348c 100644 --- a/sound/soc/codecs/rt5677-spi.c +++ b/sound/soc/codecs/rt5677-spi.c @@ -52,6 +52,7 @@ int rt5677_spi_write(u8 *txbuf, size_t len) return status; } +EXPORT_SYMBOL_GPL(rt5677_spi_write); /** * rt5677_spi_burst_write - Write data to SPI by rt5677 dsp memory address. @@ -107,6 +108,7 @@ int rt5677_spi_burst_write(u32 addr, const struct firmware *fw) return 0; } +EXPORT_SYMBOL_GPL(rt5677_spi_burst_write); static int rt5677_spi_probe(struct spi_device *spi) { -- 2.1.0.rc2.206.gedb03e5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] Thermal:Remove usless if(!result) before return tz
On 2014/10/20 20:10, Eduardo Valentin wrote: > Hello Yao > > On Mon, Oct 20, 2014 at 04:27:59PM +0800, Yao Dongdong wrote: >> result is always zero when comes here. >> >> Signed-off-by:yaodongd...@huawei.com >> >> --- >> drivers/thermal/thermal_core.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c >> index 5b7d466..19cac8e 100644 >> --- a/drivers/thermal/thermal_core.c >> +++ b/drivers/thermal/thermal_core.c >> @@ -1568,8 +1568,7 @@ struct thermal_zone_device >> *thermal_zone_device_register(const char *type, >> >> thermal_zone_device_update(tz); >> >> - if (!result) >> - return tz; >> + return tz; >> > Adding a return here will make the resource release below not reachable > in the fail path. But all fails above followed a "goto unregister", so i think it must be successful when come here. Thanks. >> unregister: >> release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); >> -- >> 1.8.0.1 >> >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] drivers: base: update cpu offline info when do hotplug
> -Original Message- > From: Yasuaki Ishimatsu [mailto:isimatu.yasu...@jp.fujitsu.com] > Sent: 2014年10月21日 11:27 > To: Neil Zhang; Dan Streetman > Cc: Greg KH; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] drivers: base: update cpu offline info when do hotplug > > (2014/10/21 12:18), Neil Zhang wrote: > > Yasuaki, > > > >> -Original Message- > >> From: Yasuaki Ishimatsu [mailto:isimatu.yasu...@jp.fujitsu.com] > >> Sent: 2014年10月21日 10:57 > >> To: Dan Streetman; Neil Zhang > >> Cc: Greg KH; linux-kernel@vger.kernel.org > >> Subject: Re: [PATCH] drivers: base: update cpu offline info when do > >> hotplug > >> > >> Hi Neil and Dan, > >> > >> (2014/10/21 2:02), Dan Streetman wrote: > >>> On Mon, Oct 20, 2014 at 3:40 AM, Neil Zhang wrote: > Greg, > > > -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: 2014年10月20日 14:48 > To: Neil Zhang > Cc: linux-kernel@vger.kernel.org > Subject: Re: [PATCH] drivers: base: update cpu offline info when do > hotplug > > On Sun, Oct 19, 2014 at 11:39:23PM -0700, Neil Zhang wrote: > >> How much noise is this going to cause on a big/little system that > >> constantly hot unplug/plugs processors all of the time? > > > > Can you explain more what kind of noise will be introduced on a > > big/little > >> system? > > Have you tested this on such a machine? > > I didn't have such kind of machine on hand. > Can anyone has such machine to verify it? > Thanks! > >>> > >>> I tested this on a ppc PowerVM system, using dlpar operations to > >>> remove/add cpus. > >>> > >>> Without this patch the cpu online nodes get out of sync with the > >>> main online node (and the actual state of the cpus), because they > >>> aren't updated as the cpus are brought up/down: > >>> > >> > >>> [root@br10p02 cpu]$ pwd > >>> /sys/devices/system/cpu > >>> [root@br10p02 cpu]$ cat online > >>> 0-39 > >>> [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) > >>> -eq 1 && echo -n "$n " ; done ; echo "" > >>> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > >>> 26 > >>> 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 > >> > >> How is the issue reproduced. > >> > >> Here is a result on my x86 box with linux-3.18-rc1. > >> > >> - before offline CPU > >> # cd /sys/devices/system/cpu/ > >> # cat online > >> 0-59 > >> # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n > >> "$n " ; done ; echo "" > >> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > >> 26 27 28 > >> 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 > >> 52 53 54 > >> 55 > >> 56 57 58 59 > >> > >> - after offline CPU{1..59} > >> # for n in {1..59} ; do echo 0 > cpu$n/online; done # cat online > >> 0 > >> # for n in {0..59} ; do test $( cat cpu$n/online ) -eq 1 && echo -n > >> "$n " ; done ; echo "" > >> 0 > >> > >> It seems that dev->offline is set to correct valute. > >> > > > > > Please use an in kernel governor to up / down a core instead of sysfs > interface. > > Thank you for the information. But I don't know the in kernel governor? > Could you point a documentation of it? > Simply means that you call cpu_down / cpu_up directly in kernel base on the profiler. > Thanks, > Yasuaki Ishimatsu > > > > >> Thanks, > >> Yasuaki Ishimatsu > >> > >>> > >>> > >>> While with the patch, the cpu online nodes are kept up to date as > >>> the cpus are brought up/down: > >>> > >>> [root@br10p02 cpu]$ pwd > >>> /sys/devices/system/cpu > >>> [root@br10p02 cpu]$ cat online > >>> 0-39 > >>> [root@br10p02 cpu]$ for n in {0..47} ; do test $( cat cpu$n/online ) > >>> -eq 1 && echo -n "$n " ; done ; echo "" > >>> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > >>> 26 > >>> 27 28 29 30 31 32 33 34 35 36 37 38 39 > >>> > >>> > >>> Feel free to add > >>> > >>> Tested-by: Dan Streetman > >>> > > > As I know IKS on arm will use cpu_suspend way to power down a core. > > Are you sure that it also doesn't use that same functionality to > drop a > >> processor to save power? > > As I know it use cpu_suspend to switch out a processor in IKS and > there is > >> no cpu hotplug notifier in this procedure. > > > Why do you need/want this notification? What are you going to do > with this > >> information that you don't already have? > > The offline won't be updated if an in kernel hotplug governor plug > in / out > >> a core which cause the sysfs interface report a wrong status. > > > thanks, > > greg k-h > > > Best Regards, > Neil Zhang > >>> -- > >>> To unsubscribe from this list: send the line "unsubscribe > >>> linux-kernel" in the body of a message to majord...@vger.kernel.org > >>> More majordomo info at http://vger.kernel.org/majordomo-info.html > >>> Please
[PATCH v3 0/6] add suspend support for RK3288
From: Chris Zhong this is the 1st version of suspend. RK3288 can shut down the cpu, gpu and other device controllers in suspend, and it will pull the GLOBAL_PWROFF pin to high in the final stage of the process of suspend, pull the pin to low again when resume. Changes in v3: - move the pinmux of gpio6_c6 save and restore to pinctrl-rockchip Changes in v2: - __raw_readl/__raw_writel replaced by readl_relaxed/writel_relaxed - add the regulator calls in prepare and finish. - add the pinmux of gpio6_c6 save and restore - put "rockchip,rk3288-pmu-sram" to first Chris (1): pinctrl: rockchip: add suspend/resume functions Chris Zhong (5): pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume clk: rockchip: RK3288: add suspend and resume ARM: rockchip: add suspend and resume for RK3288 ARM: rockchip: Add pmu-sram binding ARM: dts: add RK3288 suspend support .../devicetree/bindings/arm/rockchip/pmu-sram.txt | 15 + arch/arm/boot/dts/rk3288.dtsi | 11 + arch/arm/mach-rockchip/Makefile|1 + arch/arm/mach-rockchip/pm.c| 316 arch/arm/mach-rockchip/pm.h| 102 +++ arch/arm/mach-rockchip/rockchip.c | 11 +- arch/arm/mach-rockchip/sleep.S | 87 ++ drivers/clk/rockchip/clk-rk3288.c | 63 drivers/pinctrl/pinctrl-rockchip.c | 57 9 files changed, 661 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt create mode 100644 arch/arm/mach-rockchip/pm.c create mode 100644 arch/arm/mach-rockchip/pm.h create mode 100644 arch/arm/mach-rockchip/sleep.S -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/6] pinctrl: rockchip: add suspend/resume functions
From: Chris support suspend/resume of pinctrl, it allows handling sleep mode for hogged pins in pinctrl Signed-off-by: Chris Signed-off-by: Chris Zhong --- Changes in v3: None Changes in v2: None drivers/pinctrl/pinctrl-rockchip.c | 29 + 1 file changed, 29 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index d0f3c18..d384d99 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1795,6 +1795,31 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( return ctrl; } +#ifdef CONFIG_PM +static int rockchip_pinctrl_suspend(struct platform_device *pdev, + pm_message_t state) +{ + struct rockchip_pinctrl *info; + + info = platform_get_drvdata(pdev); + if (!info) + return -EINVAL; + + return pinctrl_force_sleep(info->pctl_dev); +} + +static int rockchip_pinctrl_resume(struct platform_device *pdev) +{ + struct rockchip_pinctrl *info; + + info = platform_get_drvdata(pdev); + if (!info) + return -EINVAL; + + return pinctrl_force_default(info->pctl_dev); +} +#endif + static int rockchip_pinctrl_probe(struct platform_device *pdev) { struct rockchip_pinctrl *info; @@ -2010,6 +2035,10 @@ static struct platform_driver rockchip_pinctrl_driver = { .owner = THIS_MODULE, .of_match_table = rockchip_pinctrl_dt_match, }, + #ifdef CONFIG_PM + .suspend = rockchip_pinctrl_suspend, + .resume = rockchip_pinctrl_resume, + #endif }; static int __init rockchip_pinctrl_drv_register(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 2/6] pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume
From: Chris Zhong Save and restore the gpio6_c6 pinmux setting, since Maskrom of RK3288 would modify it to sdmmc0_det, so it need to be restored to the correct setting after resume from Maskrom. Signed-off-by: Chris Zhong --- Changes in v3: None Changes in v2: None drivers/pinctrl/pinctrl-rockchip.c | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index d384d99..85134e4 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1796,26 +1796,54 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( } #ifdef CONFIG_PM + +#define RK3288_GRF_GPIO6C_IOMUX0x64 +#define GPIO6C6_SEL_WRITE_ENABLE BIT(28) + +static u32 rk3288_grf_gpio6c_iomux; + static int rockchip_pinctrl_suspend(struct platform_device *pdev, pm_message_t state) { struct rockchip_pinctrl *info; + int ret; info = platform_get_drvdata(pdev); if (!info) return -EINVAL; - return pinctrl_force_sleep(info->pctl_dev); + ret = pinctrl_force_sleep(info->pctl_dev); + if (ret) + return ret; + + /* +* RK3288 GPIO6_C6 mux would be modified by Maskrom when resume, so save +* the setting here, and restore it at resume. +*/ + if (info->ctrl->type == RK3288) { + ret = regmap_read(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, + &rk3288_grf_gpio6c_iomux); + if (ret) + return ret; + } + + return 0; } static int rockchip_pinctrl_resume(struct platform_device *pdev) { struct rockchip_pinctrl *info; + int ret; info = platform_get_drvdata(pdev); if (!info) return -EINVAL; + ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, + rk3288_grf_gpio6c_iomux | GPIO6C6_SEL_WRITE_ENABLE); + if (ret) + return ret; + return pinctrl_force_default(info->pctl_dev); } #endif -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 3/6] clk: rockchip: RK3288: add suspend and resume
From: Chris Zhong save and restore some clks, which might be changed in suspend. Signed-off-by: Tony Xie Signed-off-by: Chris Zhong --- Changes in v3: None Changes in v2: - __raw_readl/__raw_writel replaced by readl_relaxed/writel_relaxed drivers/clk/rockchip/clk-rk3288.c | 63 + 1 file changed, 63 insertions(+) diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index b22a2d2..415b928 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "clk.h" @@ -680,6 +681,67 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS), }; +#ifdef CONFIG_PM_SLEEP +static void __iomem *rk3288_cru_base; +static const int rk3288_saved_cru_reg_ids[] = { + RK3288_MODE_CON, + RK3288_CLKSEL_CON(0), + RK3288_CLKSEL_CON(1), + RK3288_CLKSEL_CON(10), + RK3288_CLKSEL_CON(33), + RK3288_CLKSEL_CON(37), +}; + +static u32 rk3288_saved_cru_regs[ARRAY_SIZE(rk3288_saved_cru_reg_ids)]; + +/* + * cru will be set in maskrom when system wake up from fastboot + * mode in suspend, + * so the operation is saving the changed regs. + * The apll/cpll/gpll will be set into slow mode in maskrom. + * It is mean that resume code run in 24m quit slowly! + * so we must resume these plls as soon as possible. + */ +static int rk3288_clk_suspend(void) +{ + int i, reg_id; + + for (i = 0; i < ARRAY_SIZE(rk3288_saved_cru_reg_ids); i++) { + reg_id = rk3288_saved_cru_reg_ids[i]; + + rk3288_saved_cru_regs[i] = + readl_relaxed(rk3288_cru_base + reg_id); + } + return 0; +} + +static void rk3288_clk_resume(void) +{ + int i, reg_id; + + for (i = ARRAY_SIZE(rk3288_saved_cru_reg_ids) - 1; i >= 0; i--) { + reg_id = rk3288_saved_cru_reg_ids[i]; + + writel_relaxed(rk3288_saved_cru_regs[i] | 0x, + rk3288_cru_base + reg_id); + } +} + +static struct syscore_ops rk3288_clk_syscore_ops = { + .suspend = rk3288_clk_suspend, + .resume = rk3288_clk_resume, +}; + +static void rk3288_clk_sleep_init(void __iomem *reg_base) +{ + rk3288_cru_base = reg_base; + register_syscore_ops(&rk3288_clk_syscore_ops); +} + +#else /* CONFIG_PM_SLEEP */ +static void rk3288_clk_sleep_init(void __iomem *reg_base) {} +#endif + static void __init rk3288_clk_init(struct device_node *np) { void __iomem *reg_base; @@ -713,5 +775,6 @@ static void __init rk3288_clk_init(struct device_node *np) rockchip_register_softrst(np, 9, reg_base + RK3288_SOFTRST_CON(0), ROCKCHIP_SOFTRST_HIWORD_MASK); + rk3288_clk_sleep_init(reg_base); } CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/6] ARM: rockchip: add suspend and resume for RK3288
From: Chris Zhong It's a basic version of suspend and resume for rockchip, it only support RK3288 now. Signed-off-by: Tony Xie Signed-off-by: Chris Zhong --- Changes in v3: - move the pinmux of gpio6_c6 save and restore to pinctrl-rockchip Changes in v2: - add the regulator calls in prepare and finish. - add the pinmux of gpio6_c6 save and restore arch/arm/mach-rockchip/Makefile |1 + arch/arm/mach-rockchip/pm.c | 316 + arch/arm/mach-rockchip/pm.h | 102 arch/arm/mach-rockchip/rockchip.c | 11 +- arch/arm/mach-rockchip/sleep.S| 87 ++ 5 files changed, 515 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-rockchip/pm.c create mode 100644 arch/arm/mach-rockchip/pm.h create mode 100644 arch/arm/mach-rockchip/sleep.S diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index b29d8ea..5c3a9b2 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -1,4 +1,5 @@ CFLAGS_platsmp.o := -march=armv7-a obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o +obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o obj-$(CONFIG_SMP) += headsmp.o platsmp.o diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c new file mode 100644 index 000..e0d6594 --- /dev/null +++ b/arch/arm/mach-rockchip/pm.c @@ -0,0 +1,316 @@ +/* + * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd + * Author: Tony Xie + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "pm.h" + +struct rockchip_pm_device_id { + const char *compatible; + const struct platform_suspend_ops *ops; + int (*init)(void); +}; + +static char bootram_save_data[SZ_4K]; + +static void __iomem *rk3288_bootram_base; +static phys_addr_t rk3288_bootram_phy; + +static struct regmap *pmu_regmap; +static struct regmap *grf_regmap; +static struct regmap *sgrf_regmap; + +static inline void rk3288_copy_data_to_sram(void) +{ + u32 resume_code_size = (u32)&rkpm_bootdata_cpu_code - + (u32)rockchip_slp_cpu_resume + 4; + + /* save root sram data in ddr mem */ + memcpy(rk3288_bootram_base, bootram_save_data, SZ_4K); + /* move resume code and data to bootsram */ + memcpy(rk3288_bootram_base, rockchip_slp_cpu_resume, + resume_code_size); +} + +static inline void rk3288_restore_original_sram(void) +{ + memcpy(bootram_save_data, rk3288_bootram_base, SZ_4K); +} + +static inline u32 rk3288_l2_config(void) +{ + u32 l2ctlr; + + asm("mrc p15, 1, %0, c9, c0, 2" : "=r" (l2ctlr)); + return l2ctlr; +} + +static void rk3288_fill_in_bootram(u32 level) +{ + rkpm_bootdata_cpusp = rk3288_bootram_phy + (SZ_4K - 8); + rkpm_bootdata_cpu_code = virt_to_phys(cpu_resume); + + rkpm_bootdata_l2ctlr_f = 1; + rkpm_bootdata_l2ctlr = rk3288_l2_config(); + + if (level == ROCKCHIP_ARM_OFF_LOGIC_DEEP) { + /* + * In this mode the SDRAM power domain will be off, + * so it need to be resumed, + * but now the sdram resume code is not ready. + * i have to set "rkpm_bootdata_ddr_code" 0. + */ + rkpm_bootdata_ddr_code = 0; + } else { + rkpm_bootdata_ddr_code = 0; + } + + rk3288_copy_data_to_sram(); +} + +static u32 rk3288_pmu_pwr_mode_con; +static u32 rk3288_sgrf_soc_con0; + +static void rk3288_slp_mode_set(int level) +{ + u32 mode_set, mode_set1; + + regmap_read(sgrf_regmap, RK3288_SGRF_SOC_CON0, &rk3288_sgrf_soc_con0); + + regmap_read(pmu_regmap, RK3288_PMU_PWRMODE_CON, + &rk3288_pmu_pwr_mode_con); + + /* set bit 8 so that system will resume to FAST_BOOT_ADDR */ + regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0, +BIT(SGRF_FAST_BOOT_EN) | BIT(SGRF_FAST_BOOT_EN + 16)); + + /* booting address of resuming system is from this register value */ + regmap_write(sgrf_regmap, RK3288_SGRF_FAST_BOOT_ADDR, +rk3288_bootram_phy); + + regmap_write(pmu_regmap, RK3288_PMU_WAKEUP_CFG1, +PMU_ARMINT_WAKEUP_EN); + + mode_set = BIT(PMU_GLOBAL_INT_DISABLE) | BIT(PMU_L2FLUSH_EN) | + BIT(PMU_SREF0_ENTER_EN) | BIT(PMU_SREF1_ENTER_EN) | + BIT(PMU_DDR0_GATING_EN) | BIT(PMU_DDR1_GATING_EN) | +
[PATCH v3 5/6] ARM: rockchip: Add pmu-sram binding
From: Chris Zhong The pmu-sram is used to store resume code, suspend/resume need get the address of it. Therefore add a binding and documentation for it. Signed-off-by: Tony Xie Signed-off-by: Chris Zhong --- Changes in v3: None Changes in v2: None .../devicetree/bindings/arm/rockchip/pmu-sram.txt | 15 +++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt diff --git a/Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt b/Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt new file mode 100644 index 000..77284c0 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt @@ -0,0 +1,15 @@ +Rockchip SRAM for pmu: +-- + +The sram of pmu is used to store the function of resume from maskrom(the 1st +level loader). + +Required node properties: +- compatible : should be "rockchip,rk3288-pmu-sram" +- reg : physical base address and the size of the registers window + +Example: + pmu_intmem@ff72 { + compatible = "rockchip,rk3288-pmu-sram", "mmio-sram"; + reg = <0xff72 0x4000>; + }; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] init: Remove CONFIG_INIT_FALLBACK
On 10/20/14 17:04, Andy Lutomirski wrote: > --- a/init/main.c > +++ b/init/main.c > @@ -960,13 +960,8 @@ static int __ref kernel_init(void *unused) > ret = run_init_process(execute_command); > if (!ret) > return 0; > -#ifndef CONFIG_INIT_FALLBACK > panic("Requested init %s failed (error %d).", > execute_command, ret); > -#else > - pr_err("Failed to execute %s (error %d). Attempting > defaults...\n", > -execute_command, ret); > -#endif > } > if (!try_to_run_init_process("/sbin/init") || > !try_to_run_init_process("/etc/init") || > Would you like to remove the try_to_run_init_process() stack of random hardwired names that we can never reach if we panic, or do you just want to remove the error message? Confused, Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 6/6] ARM: dts: add RK3288 suspend support
From: Chris Zhong add pmu_intmem node for suspend, add global_pwroff pinctrl. The pmu_intmem is used to store the resume code. global_pwroff is held low level at work, it would be pull to high when entering suspend. PMICs can get this singal, then shut down some power rails. So please reference the global_pwroff pinctrl as part of the PMIC config. Signed-off-by: Tony Xie Signed-off-by: Chris Zhong --- Changes in v3: None Changes in v2: - put "rockchip,rk3288-pmu-sram" to first arch/arm/boot/dts/rk3288.dtsi | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 5950b0a..fcbe929 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -241,6 +241,11 @@ status = "disabled"; }; + pmu_intmem@ff72 { + compatible = "rockchip,rk3288-pmu-sram", "mmio-sram"; + reg = <0xff72 0x4000>; + }; + pmu: power-management@ff73 { compatible = "rockchip,rk3288-pmu", "syscon"; reg = <0xff73 0x100>; @@ -421,6 +426,12 @@ bias-disable; }; + sleep { + global_pwroff: global-pwroff { + rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + i2c0 { i2c0_xfer: i2c0-xfer { rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>, -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] spi/atmel: improve the system suspend/resume functions implementation
To make it cleaner, the system suspend/resume directly call the runtime suspend/resume functions and remove the wapper of CONFIG_PM_RUNTIME, CONFIG_PM_SLEEP. Signed-off-by: Wenyou Yang --- drivers/spi/spi-atmel.c | 61 --- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 3f50014..6ed1893 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1451,11 +1451,30 @@ static int atmel_spi_remove(struct platform_device *pdev) } #ifdef CONFIG_PM -#ifdef CONFIG_PM_SLEEP +static int atmel_spi_runtime_suspend(struct device *dev) +{ + struct spi_master *master = dev_get_drvdata(dev); + struct atmel_spi *as = spi_master_get_devdata(master); + + clk_disable_unprepare(as->clk); + pinctrl_pm_select_sleep_state(dev); + + return 0; +} + +static int atmel_spi_runtime_resume(struct device *dev) +{ + struct spi_master *master = dev_get_drvdata(dev); + struct atmel_spi *as = spi_master_get_devdata(master); + + pinctrl_pm_select_default_state(dev); + + return clk_prepare_enable(as->clk); +} + static int atmel_spi_suspend(struct device *dev) { - struct spi_master *master = dev_get_drvdata(dev); - struct atmel_spi*as = spi_master_get_devdata(master); + struct spi_master *master = dev_get_drvdata(dev); int ret; /* Stop the queue running */ @@ -1465,23 +1484,19 @@ static int atmel_spi_suspend(struct device *dev) return ret; } - if (!pm_runtime_suspended(dev)) { - clk_disable_unprepare(as->clk); - pinctrl_pm_select_sleep_state(dev); - } + if (!pm_runtime_suspended(dev)) + atmel_spi_runtime_suspend(dev); return 0; } static int atmel_spi_resume(struct device *dev) { - struct spi_master *master = dev_get_drvdata(dev); - struct atmel_spi*as = spi_master_get_devdata(master); + struct spi_master *master = dev_get_drvdata(dev); int ret; if (!pm_runtime_suspended(dev)) { - pinctrl_pm_select_default_state(dev); - ret = clk_prepare_enable(as->clk); + ret = atmel_spi_runtime_resume(dev); if (ret) return ret; } @@ -1493,30 +1508,6 @@ static int atmel_spi_resume(struct device *dev) return ret; } -#endif - -#ifdef CONFIG_PM_RUNTIME -static int atmel_spi_runtime_suspend(struct device *dev) -{ - struct spi_master *master = dev_get_drvdata(dev); - struct atmel_spi *as = spi_master_get_devdata(master); - - clk_disable_unprepare(as->clk); - pinctrl_pm_select_sleep_state(dev); - - return 0; -} - -static int atmel_spi_runtime_resume(struct device *dev) -{ - struct spi_master *master = dev_get_drvdata(dev); - struct atmel_spi *as = spi_master_get_devdata(master); - - pinctrl_pm_select_default_state(dev); - - return clk_prepare_enable(as->clk); -} -#endif static const struct dev_pm_ops atmel_spi_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 1/2] kprobes: introduce ARCH_HANDLES_KPROBES_ON_FTRACE
(2014/10/20 19:59), Heiko Carstens wrote: > Allow architectures to implement handling of kprobes on function > tracer call sites on their own, without depending on common code. > > This patch removes the kprobes check if a kprobe is being placed > on a function tracer call site and therefore gives full responsibility > of handling this correctly to the architecture. > > This patch also introduces a user space visible change: if a kprobe > is placed into the middle of an ftrace instruction the return value > is changed from -EINVAL to -EILSEQ also for architectures which do > not support KPROBES_ON_FTRACE. > However in reality this change shouldn't matter at all. Could you try to remove new kconfig by using a weak function? This could be done with below functions: In kernel/kprobes.c: int __weak arch_check_ftrace_location(struct kprobe *p) { unsigned long ftrace_addr = ftrace_location((unsigned long)p->addr); if (ftrace_addr) { ... } And in arch/s390/kernel/kprobes.c: int arch_check_ftrace_location(struct kprobe *p) { return 0; } And in include/linux/kprobes.h int arch_check_ftrace_location(struct kprobe *p); Then, we don't need to add any macros or kconfigs. Thank you, > > Signed-off-by: Heiko Carstens > --- > arch/Kconfig | 8 > kernel/kprobes.c | 36 +--- > 2 files changed, 29 insertions(+), 15 deletions(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index 05d7a8a458d5..e1a8e0edf03f 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -85,6 +85,14 @@ config KPROBES_ON_FTRACE >passing of pt_regs to function tracing, then kprobes can >optimize on top of function tracing. > > +config ARCH_HANDLES_KPROBES_ON_FTRACE > + def_bool n > + help > + If an architecture can handle kprobes on function tracer call > + sites on own, then this option should be selected. This option > + removes the check which otherwise prevents to set kprobes on > + function tracer call sites. > + > config UPROBES > def_bool n > select PERCPU_RWSEM > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 3995f546d0f3..4b57fe9fbeb7 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -1410,28 +1410,34 @@ static inline int check_kprobe_rereg(struct kprobe *p) > return ret; > } > > -static int check_kprobe_address_safe(struct kprobe *p, > - struct module **probed_mod) > +static int check_ftrace_location(struct kprobe *p) > { > - int ret = 0; > unsigned long ftrace_addr; > > - /* > - * If the address is located on a ftrace nop, set the > - * breakpoint to the following instruction. > - */ > ftrace_addr = ftrace_location((unsigned long)p->addr); > - if (ftrace_addr) { > -#ifdef CONFIG_KPROBES_ON_FTRACE > - /* Given address is not on the instruction boundary */ > - if ((unsigned long)p->addr != ftrace_addr) > - return -EILSEQ; > + if (!ftrace_addr) > + return 0; > + /* Given address is not on the instruction boundary */ > + if ((unsigned long)p->addr != ftrace_addr) > + return -EILSEQ; > + /* If an architecture handles kprobes on ftrace, we're done */ > + if (IS_ENABLED(CONFIG_ARCH_HANDLES_KPROBES_ON_FTRACE)) > + return 0; > + if (IS_ENABLED(CONFIG_KPROBES_ON_FTRACE)) { > p->flags |= KPROBE_FLAG_FTRACE; > -#else/* !CONFIG_KPROBES_ON_FTRACE */ > - return -EINVAL; > -#endif > + return 0; > } > + return -EINVAL; > +} > + > +static int check_kprobe_address_safe(struct kprobe *p, > + struct module **probed_mod) > +{ > + int ret; > > + ret = check_ftrace_location(p); > + if (ret) > + return ret; > jump_label_lock(); > preempt_disable(); > > -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu...@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: storage: Convert usb_stor_dbg to return void
No caller or macro uses the return value so make it void. Signed-off-by: Joe Perches --- This change is associated to a desire to eventually change printk to return void. drivers/usb/storage/debug.c | 7 ++- drivers/usb/storage/debug.h | 10 ++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c index e08f647..05bc379 100644 --- a/drivers/usb/storage/debug.c +++ b/drivers/usb/storage/debug.c @@ -179,17 +179,14 @@ void usb_stor_show_sense(const struct us_data *us, US_DEBUGPX("\n"); } -int usb_stor_dbg(const struct us_data *us, const char *fmt, ...) +void usb_stor_dbg(const struct us_data *us, const char *fmt, ...) { va_list args; - int r; va_start(args, fmt); - r = dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args); + dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args); va_end(args); - - return r; } EXPORT_SYMBOL_GPL(usb_stor_dbg); diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h index b1273f0..f525203 100644 --- a/drivers/usb/storage/debug.h +++ b/drivers/usb/storage/debug.h @@ -50,15 +50,17 @@ void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb); void usb_stor_show_sense(const struct us_data *us, unsigned char key, unsigned char asc, unsigned char ascq); -__printf(2, 3) int usb_stor_dbg(const struct us_data *us, - const char *fmt, ...); +__printf(2, 3) void usb_stor_dbg(const struct us_data *us, +const char *fmt, ...); #define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__) #define US_DEBUG(x)x #else __printf(2, 3) -static inline int _usb_stor_dbg(const struct us_data *us, - const char *fmt, ...) {return 1;} +static inline void _usb_stor_dbg(const struct us_data *us, +const char *fmt, ...) +{ +} #define usb_stor_dbg(us, fmt, ...) \ do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0) #define US_DEBUGPX(fmt, ...) \ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf tools: fix incorrect header string
On 2014/10/16 22:55, Arnaldo Carvalho de Melo wrote: > Em Thu, Oct 16, 2014 at 11:21:13AM +0800, Wang Nan escreveu: >> On 2014/10/15 23:13, Arnaldo Carvalho de Melo wrote: >>> Em Wed, Oct 15, 2014 at 11:28:53AM +0800, Wang Nan escreveu: Commit fbe96f29 (perf tools: Make perf.data more self-descriptive) read '/proc/cpuinfo' to form cpu descriptor. For ARM, it finds 'Processor' field. It is correct when the patch merged, but due to commit b4b8f770 (ARM: kernel: update cpuinfo to print all online CPUs features), the corresponding information becomes 'model name' field. This patch simply corrects it. >>> >>> It doesn't :-) >>> >>> It makes it work with kernels >= b4b8f770, and fail with older kernels. >>> >>> We need to somehow figure out where the right information is regardless >>> of the kernel. >>> >>> - Arnaldo >>> >> >> However it is a real problem. Look at output on arm platform at the >> bottom of this mail, especially "cpudesc", "total memory" and "cmdline" >> field. > > Yeah, I haven't said it wasn't a problem, just that the proposed fix > wasn't enough. > > - Arnaldo > >> By further debugging I found that the real problem resides in return value >> checking >> when write header error. Please see my other patches: >> >> https://lkml.org/lkml/2014/10/15/612 >> https://lkml.org/lkml/2014/10/15/611 So what's your opinion on these two patches? >> >> I think at least one of them is required. >> >> Thanks. >> Signed-off-by: Wang Nan --- tools/perf/perf-sys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index 937e432..4293970 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h @@ -113,7 +113,7 @@ #define mb() ((void(*)(void))0x0fa0)() #define wmb() ((void(*)(void))0x0fa0)() #define rmb() ((void(*)(void))0x0fa0)() -#define CPUINFO_PROC "Processor" +#define CPUINFO_PROC "model name" #endif #ifdef __aarch64__ -- 1.8.4 >> >> >> >> bash-4.2# perf record ls >> ... >> [ perf record: Woken up 1 times to write data ] >> [ perf record: Captured and wrote 0.001 MB perf.data (~36 samples) ] >> bash-4.2# perf report --stdio --header >> Error: >> The perf.data file has no samples! >> # >> # captured on: Fri Sep 12 10:09:10 2014 >> # hostname : arma15el >> # os release : 3.17.0+ >> # perf version : 3.10.53 >> # arch : armv7l >> # nrcpus online : 4 >> # nrcpus avail : 1 >> # cpudesc : (null) >> # total memory : 0 kB >> # cmdline : >> # event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = >> 0x0, excl_usr = 0, excl_kern = 0, excl_host = 0, excl_guest = 1, precise_ip >> = 0 >> # pmu mappings: not available >> # >> # >> >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
On Tue, Oct 21, 2014 at 03:18:58AM +, Thomas Shao wrote: > In some situation, the user is not able to enable guest VM to sync with > external > time source, like NTP. But the host is still synced with a trusted time > source. > In this case, host-guest time synchronization is useful. It's interesting to imagine that a virtualization host could present a time service to the guest *userspace*, even when the guest is not otherwise exposed to the internet at large. This could take the form of an NTP server on a private network, or as an implementation of a time source directly usable by ntpd in the guest, for instance as an emulated serial port with synthetic NEMA GPS signal + PPS signal, for instance. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] init: Remove CONFIG_INIT_FALLBACK
On Mon, Oct 20, 2014 at 8:45 PM, Rob Landley wrote: > On 10/20/14 17:04, Andy Lutomirski wrote: >> --- a/init/main.c >> +++ b/init/main.c >> @@ -960,13 +960,8 @@ static int __ref kernel_init(void *unused) >> ret = run_init_process(execute_command); >> if (!ret) >> return 0; >> -#ifndef CONFIG_INIT_FALLBACK >> panic("Requested init %s failed (error %d).", >> execute_command, ret); >> -#else >> - pr_err("Failed to execute %s (error %d). Attempting >> defaults...\n", >> -execute_command, ret); >> -#endif >> } >> if (!try_to_run_init_process("/sbin/init") || >> !try_to_run_init_process("/etc/init") || >> > > Would you like to remove the try_to_run_init_process() stack of random > hardwired names that we can never reach if we panic, or do you just want > to remove the error message? > I'm confused. That code is reachable if there's no initramfs and init= is not specified. --Andy > Confused, > > Rob -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
> -Original Message- > From: John Stultz [mailto:john.stu...@linaro.org] > Sent: Tuesday, October 21, 2014 11:24 AM > To: Thomas Shao > Cc: Thomas Gleixner; gre...@linuxfoundation.org; LKML; > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > jasow...@redhat.com; KY Srinivasan; Richard Cochran > Subject: Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for > do_adjtimex() > > On Mon, Oct 20, 2014 at 8:18 PM, Thomas Shao > wrote: > > > >> -Original Message- > >> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > >> ow...@vger.kernel.org] On Behalf Of Thomas Gleixner > >> Sent: Tuesday, October 21, 2014 2:41 AM > >> To: Thomas Shao > >> Cc: gre...@linuxfoundation.org; LKML; de...@linuxdriverproject.org; > >> o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; KY > >> Srinivasan; John Stultz; Richard Cochran > >> Subject: Re: [PATCH v2 1/2] timekeeping: add EXPORT_SYMBOL_GPL for > >> do_adjtimex() > >> > >> On Mon, 20 Oct 2014, Thomas Gleixner wrote: > >> > >> > On Wed, 15 Oct 2014, Thomas Shao wrote: > >> > > >> > And again you forgot to cc John Stultz on this > >> > > >> > > Export do_adjtimex function for hyper-v Time Synchronization > >> > > component > >> > >> Aside of that, we really want to see the use case for this and how > >> you addressed the problems which were pointed out by various folks. > >> > > > > In some situation, the user is not able to enable guest VM to sync > > with external time source, like NTP. But the host is still synced with a > trusted time source. > > In this case, host-guest time synchronization is useful. Hyper-v host > > will send time sample to guest VM every 5 seconds. We will use these > > time samples to adjust guest VM time. > > > > I've got some feedbacks from Richard and Mike, including reference NTP > > implementation and do the adjustment in the host side. I've already > > referenced some NTP design in my patch. I would consider my patch as a > > simplified implementation. I've also considered the host side > > implementation. But in host, we can only set time but not gradually > > slew/adjust time, which is not acceptable for the time sync > > solution.We still recommend user to configure NTP on the guest, which > provides better accuracy. But if NTP is not applicable, this could be another > option. > > > >> I still do not have a consistent argument from you WHY you need to > >> abuse > >> do_adjtimex() to do that host - guest synchronization in the first place. > >> > > > > I need a function to gradually slew guest time. do_adjtimex() provides > > all the functionality. Also I could not find any other exposed func to > > do this. I'd like to hear any feedback from you for this. > > Do you have any protections from both your kernel module trying to slew > time if the guest is also running NTPd? That seems like it could cause some > strange behavior. Thanks John. I didn't find a way to detect whether NTPd is running in the hyper-v module. In http://doc.ntp.org/4.1.0/ntpd.htm, it mentioned: Normally, the time is slewed if the offset is less than the step threshold, which is 128 ms by default, and stepped if above the threshold. In my implementation, I use 100ms as the threshold (maybe I should change to 128?). If the time difference is less than 100ms, I just do nothing. So, if NTPd is running, ideally it could keep the time drift less than 128, so the adjustment in my patch will not get triggered. And moreover, by default, the guest-host time sync is turn off. There is a module parameter to control it. We'll also document customer that do not turn on this if NTP is configured. > > thanks > -john
Re: [RFC 0/5] CR4 handling improvements
On Tue, 14 Oct 2014, Andy Lutomirski wrote: > This little series tightens up rdpmc permissions. With it applied, > rdpmc can only be used if a perf_event is actually mmapped. For now, > this is only really useful for seccomp. So just to be difficult... I am aware of at least one group who is doing low-latency performance measures using rdpmc on Linux. They start the counters manually by poking the MSRs directly (bypassing perf_event_open()). They use rdpmc, grateful for the fact that currently CR4 is set up so they can do this w/o patching the kernel. These patches of course would break this use case... Vince -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 03/47] hibernate: Call have_kernel_power_off instead of checking pm_power_off
Poweroff handlers may now be installed with register_power_off_handler. Use the new API function have_kernel_power_off to determine if a poweroff handler has been installed. Cc: Rafael J. Wysocki Cc: Pavel Machek Cc: Len Brown Acked-by: Rafael J. Wysocki Signed-off-by: Guenter Roeck --- v2: - have_kernel_poweroff -> have_kernel_power_off kernel/power/hibernate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index a9dfa79..69225b7 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -602,7 +602,7 @@ static void power_down(void) case HIBERNATION_PLATFORM: hibernation_platform_enter(); case HIBERNATION_SHUTDOWN: - if (pm_power_off) + if (have_kernel_power_off()) kernel_power_off(); break; #ifdef CONFIG_SUSPEND -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 00/47] kernel: Add support for poweroff handler call chain
Various drivers implement architecture and/or device specific means to remove power from the system. For the most part, those drivers set the global variable pm_power_off to point to a function within the driver. This mechanism has a number of drawbacks. Typically only one means to remove power is supported (at least if pm_power_off is used). At least in theory there can be multiple means to remove power, some of which may be less desirable. For example, one mechanism might power off the entire system through an I/O port or gpio pin, while another might power off a board by disabling its power controller. Other mechanisms may really just execute a restart sequence or drop into the ROM monitor, or put the CPU into sleep mode. Using pm_power_off can also be racy if the function pointer is set from a driver built as module, as the driver may be in the process of being unloaded when pm_power_off is called. If there are multiple poweroff handlers in the system, removing a module with such a handler may inadvertently reset the pointer to pm_power_off to NULL, leaving the system with no means to remove power. Introduce a system poweroff handler call chain to solve the described problems. This call chain is expected to be executed from the architecture specific machine_power_off() function. Drivers providing system poweroff functionality are expected to register with this call chain. By using the priority field in the notifier block, callers can control poweroff handler execution sequence and thus ensure that the poweroff handler with the optimal capabilities to remove power for a given system is called first. Patch 01/47 implements the poweroff handler API. Patches 02/47 to 04/47 are cleanup patches to prepare for the move of pm_power_off to a common location. Patches 05/47 to 07/47 remove references to pm_power_off from devicetree bindings descriptions. Patch 08/47 moves the pm_power_off variable from architecture code to kernel/reboot.c. Patches 09/47 to 34/47 convert various drivers to register with the kernel poweroff handler instead of setting pm_power_off directly. Patches 35/47 to 46/47 do the same for architecture code. Patch 47/47 finally removes pm_power_off. For the most part, the individual patches include explanations why specific priorities were chosen, at least if the selected priority is not the default priority. Subsystem and architecture maintainers are encouraged to have a look at the selected priorities and suggest improvements. I ran the final code through my normal build and qemu tests. Results are available at http://server.roeck-us.net:8010/builders in the 'poweroff-handler' column. I also built all available configurations for arm, mips, powerpc, m68k, and sh architectures. The series is available in branch poweroff-handler of my repository at git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git. It is based on 3.18-rc1. A note on Cc: In the initial submission I had way too many Cc:, causing the patchset to be treated as spam by many mailers and mailing list handlers, which of course defeated the purpose. This time around I am cutting down the distribution list down significantly. My apologies to anyone I may have failed to copy this time around. Important changes since v1: - Rebased series to v3.18-rc1. - Use raw notifier with spinlock protection instead of atomic notifiers, since some poweroff handlers need to have interrupts enabled. - Renamed API functions from _poweroff to _power_off. - Added various Acks. - Build tested all configurations for arm, powerpc, and mips architectures. - Fixed two compile errors in mips patch. - Replaced dev_err and pr_err with dev_warn and pr_warn if an error is not fatal. - Provide managed resources API and use where appropriate. - Provide and use definitions for standard priorities. - Added patches to convert newly introduced poweroff handlers. - Various minor changes. Important changes since RFC: - Move API to new file kernel/power/power_off_handler.c. - Move pm_power_off pointer to kernel/power/power_off_handler.c. Call pm_power_off from do_kernel_power_off, and only call do_kernel_power_off from architecture code instead of calling both pm_power_off and do_kernel_power_off. - Provide additional API function register_power_off_handler_simple to simplify conversion of architecture code. - Provide additional API function have_kernel_power_off to check if a poweroff handler was installed. - Convert all drivers and architecture code to use the new API. - Remove pm_power_off as last patch of the series. Cc: Alan Cox Cc: Alexander Graf Cc: Andrew Morton Cc: Geert Uytterhoeven cc: Heiko Stuebner Cc: Lee Jones Cc: Len Brown Cc: Pavel Machek Cc: Rafael J. Wysocki Cc: Romain Perier Guenter Roeck (47): kernel: Add support for poweroff handler call chain memory: emif: Use API function to determine poweroff capability
[PATCH v2 06/47] gpio-poweroff: Drop reference to pm_power_off from devicetree bindings
pm_power_off is an implementation detail. Replace it with a more generic description of the driver's functionality. Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Acked-by: Mark Rutland Acked-by: Andrew Lunn Signed-off-by: Guenter Roeck --- v2: No change Documentation/devicetree/bindings/gpio/gpio-poweroff.txt | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt index d4eab92..c95a1a6 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt @@ -2,12 +2,12 @@ Driver a GPIO line that can be used to turn the power off. The driver supports both level triggered and edge triggered power off. At driver load time, the driver will request the given gpio line and -install a pm_power_off handler. If the optional properties 'input' is -not found, the GPIO line will be driven in the inactive +install a handler to power off the system. If the optional properties +'input' is not found, the GPIO line will be driven in the inactive state. Otherwise its configured as an input. -When the pm_power_off is called, the gpio is configured as an output, -and drive active, so triggering a level triggered power off +When the the poweroff handler is called, the gpio is configured as an +output, and drive active, so triggering a level triggered power off condition. This will also cause an inactive->active edge condition, so triggering positive edge triggered power off. After a delay of 100ms, the GPIO is set to inactive, thus causing an active->inactive edge, @@ -24,7 +24,7 @@ Required properties: Optional properties: - input : Initially configure the GPIO line as an input. Only reconfigure - it to an output when the pm_power_off function is called. If this optional + it to an output when the poweroff handler is called. If this optional property is not specified, the GPIO is initialized as an output in its inactive state. -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 21/47] ipmi: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority to reflect that the original code overwrites pm_power_off unconditionally. Register poweroff handler after the ipmi system is ready, and unregister it prior to cleanup. This avoids having to check for the ready variable in the poweroff callback. Reviewed-by: Corey Minyard Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use pr_warn instead of pr_err - Call unregister_power_off_handler on exit only if not already unregistered drivers/char/ipmi/ipmi_poweroff.c | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index 9f2e3be..41067da 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -63,9 +64,6 @@ static ipmi_user_t ipmi_user; static int ipmi_ifnum; static void (*specific_poweroff_func)(ipmi_user_t user); -/* Holds the old poweroff function so we can restore it on removal. */ -static void (*old_poweroff_func)(void); - static int set_param_ifnum(const char *val, struct kernel_param *kp) { int rv = param_set_int(val, kp); @@ -544,15 +542,20 @@ static struct poweroff_function poweroff_functions[] = { /* Called on a powerdown request. */ -static void ipmi_poweroff_function(void) +static int ipmi_poweroff_function(struct notifier_block *this, + unsigned long unused1, void *unused2) { - if (!ready) - return; - /* Use run-to-completion mode, since interrupts may be off. */ specific_poweroff_func(ipmi_user); + + return NOTIFY_DONE; } +static struct notifier_block ipmi_poweroff_nb = { + .notifier_call = ipmi_poweroff_function, + .priority = POWEROFF_PRIORITY_HIGH, +}; + /* Wait for an IPMI interface to be installed, the first one installed will be grabbed by this code and used to perform the powerdown. */ static void ipmi_po_new_smi(int if_num, struct device *device) @@ -631,9 +634,12 @@ static void ipmi_po_new_smi(int if_num, struct device *device) printk(KERN_INFO PFX "Found a %s style poweroff function\n", poweroff_functions[i].platform_type); specific_poweroff_func = poweroff_functions[i].poweroff_func; - old_poweroff_func = pm_power_off; - pm_power_off = ipmi_poweroff_function; + ready = 1; + + rv = register_power_off_handler(&ipmi_poweroff_nb); + if (rv) + pr_warn(PFX "failed to register poweroff handler\n"); } static void ipmi_po_smi_gone(int if_num) @@ -644,9 +650,10 @@ static void ipmi_po_smi_gone(int if_num) if (ipmi_ifnum != if_num) return; + unregister_power_off_handler(&ipmi_poweroff_nb); + ready = 0; ipmi_destroy_user(ipmi_user); - pm_power_off = old_poweroff_func; } static struct ipmi_smi_watcher smi_watcher = { @@ -733,11 +740,11 @@ static void __exit ipmi_poweroff_cleanup(void) ipmi_smi_watcher_unregister(&smi_watcher); if (ready) { + unregister_power_off_handler(&ipmi_poweroff_nb); rv = ipmi_destroy_user(ipmi_user); if (rv) printk(KERN_ERR PFX "could not cleanup the IPMI" " user: 0x%x\n", rv); - pm_power_off = old_poweroff_func; } } module_exit(ipmi_poweroff_cleanup); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 25/47] power/reset: qnap-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority to reflect that the original code generates an error if another poweroff handler has already been registered when the driver is loaded. Drop remove function since it is no longer needed. Cc: Sebastian Reichel Cc: Dmitry Eremin-Solenikov Cc: David Woodhouse Acked-by: Andrew Lunn Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use devm_register_power_off_handler - Drop remove function since it is no longer needed drivers/power/reset/qnap-poweroff.c | 32 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/power/reset/qnap-poweroff.c b/drivers/power/reset/qnap-poweroff.c index a75db7f..da3d58a 100644 --- a/drivers/power/reset/qnap-poweroff.c +++ b/drivers/power/reset/qnap-poweroff.c @@ -16,7 +16,9 @@ #include #include +#include #include +#include #include #include #include @@ -55,7 +57,8 @@ static void __iomem *base; static unsigned long tclk; static const struct power_off_cfg *cfg; -static void qnap_power_off(void) +static int qnap_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud)); @@ -72,14 +75,20 @@ static void qnap_power_off(void) /* send the power-off command to PIC */ writel(cfg->cmd, UART1_REG(TX)); + + return NOTIFY_DONE; } +static struct notifier_block qnap_poweroff_nb = { + .notifier_call = qnap_power_off, + .priority = POWEROFF_PRIORITY_DEFAULT, +}; + static int qnap_power_off_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct resource *res; struct clk *clk; - char symname[KSYM_NAME_LEN]; const struct of_device_id *match = of_match_node(qnap_power_off_of_match_table, np); @@ -106,28 +115,11 @@ static int qnap_power_off_probe(struct platform_device *pdev) tclk = clk_get_rate(clk); - /* Check that nothing else has already setup a handler */ - if (pm_power_off) { - lookup_symbol_name((ulong)pm_power_off, symname); - dev_err(&pdev->dev, - "pm_power_off already claimed %p %s", - pm_power_off, symname); - return -EBUSY; - } - pm_power_off = qnap_power_off; - - return 0; -} - -static int qnap_power_off_remove(struct platform_device *pdev) -{ - pm_power_off = NULL; - return 0; + return devm_register_power_off_handler(&pdev->dev, &qnap_poweroff_nb); } static struct platform_driver qnap_power_off_driver = { .probe = qnap_power_off_probe, - .remove = qnap_power_off_remove, .driver = { .owner = THIS_MODULE, .name = "qnap_power_off", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 27/47] power/reset: vexpress-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Select default priority to reflect that the original code sets pm_power_off unconditionally. Signed-off-by: Guenter Roeck --- v2: Use define to specify poweroff handler priority drivers/power/reset/vexpress-poweroff.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c index 4dc102e2..1ea2f2e 100644 --- a/drivers/power/reset/vexpress-poweroff.c +++ b/drivers/power/reset/vexpress-poweroff.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -36,11 +37,19 @@ static void vexpress_reset_do(struct device *dev, const char *what) static struct device *vexpress_power_off_device; -static void vexpress_power_off(void) +static int vexpress_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { vexpress_reset_do(vexpress_power_off_device, "power off"); + + return NOTIFY_DONE; } +static struct notifier_block vexpress_poweroff_nb = { + .notifier_call = vexpress_power_off, + .priority = POWEROFF_PRIORITY_DEFAULT, +}; + static struct device *vexpress_restart_device; static void vexpress_restart(enum reboot_mode reboot_mode, const char *cmd) @@ -92,6 +101,7 @@ static int vexpress_reset_probe(struct platform_device *pdev) const struct of_device_id *match = of_match_device(vexpress_reset_of_match, &pdev->dev); struct regmap *regmap; + int ret; if (match) func = (enum vexpress_reset_func)match->data; @@ -106,7 +116,12 @@ static int vexpress_reset_probe(struct platform_device *pdev) switch (func) { case FUNC_SHUTDOWN: vexpress_power_off_device = &pdev->dev; - pm_power_off = vexpress_power_off; + ret = register_power_off_handler(&vexpress_poweroff_nb); + if (ret) { + dev_err(&pdev->dev, + "Failed to register poweroff handler\n"); + return ret; + } break; case FUNC_RESET: if (!vexpress_restart_device) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 19/47] mfd: rk808: Register poweroff handler with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Chris Zhong Cc: Zhang Qing Signed-off-by: Guenter Roeck --- v2: - New patch drivers/mfd/rk808.c | 30 -- include/linux/mfd/rk808.h | 2 ++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index bd02150..7f07279 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include struct rk808_reg_data { @@ -147,23 +149,19 @@ static struct regmap_irq_chip rk808_irq_chip = { .init_ack_masked = true, }; -static struct i2c_client *rk808_i2c_client; -static void rk808_device_shutdown(void) +static int rk808_device_shutdown(struct notifier_block *this, +unsigned long unused1, void *unused2) { + struct rk808 *rk808 = container_of(this, struct rk808, poweroff_nb); int ret; - struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); - - if (!rk808) { - dev_warn(&rk808_i2c_client->dev, -"have no rk808, so do nothing here\n"); - return; - } ret = regmap_update_bits(rk808->regmap, RK808_DEVCTRL_REG, DEV_OFF_RST, DEV_OFF_RST); if (ret) - dev_err(&rk808_i2c_client->dev, "power off error!\n"); + dev_err(&rk808->i2c->dev, "power off error!\n"); + + return NOTIFY_DONE; } static int rk808_probe(struct i2c_client *client, @@ -222,9 +220,14 @@ static int rk808_probe(struct i2c_client *client, pm_off = of_property_read_bool(np, "rockchip,system-power-controller"); - if (pm_off && !pm_power_off) { - rk808_i2c_client = client; - pm_power_off = rk808_device_shutdown; + if (pm_off) { + rk808->poweroff_nb.notifier_call = rk808_device_shutdown; + rk808->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = devm_register_power_off_handler(&client->dev, + &rk808->poweroff_nb); + if (ret) + dev_warn(&client->dev, +"Failed to register poweroff handler\n"); } return 0; @@ -240,7 +243,6 @@ static int rk808_remove(struct i2c_client *client) regmap_del_irq_chip(client->irq, rk808->irq_data); mfd_remove_devices(&client->dev); - pm_power_off = NULL; return 0; } diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index fb09312..abc80cc 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -19,6 +19,7 @@ #ifndef __LINUX_REGULATOR_rk808_H #define __LINUX_REGULATOR_rk808_H +#include #include #include @@ -192,5 +193,6 @@ struct rk808 { struct i2c_client *i2c; struct regmap_irq_chip_data *irq_data; struct regmap *regmap; + struct notifier_block poweroff_nb; }; #endif /* __LINUX_REGULATOR_rk808_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 40/47] mips: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. If there is an indication that there can be more than one poweroff handler, use register_power_off_handler, otherwise use register_power_off_handler_simple to register the poweroff handler. If the poweroff handler only resets or stops the system, select the fallback priority to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select the default priority, unless the poweroff handler installation code suggests that there can be more than one poweroff handler and the new handler is only installed conditionally. In this case, install the handler with low priority. Cc: Ralf Baechle Cc: Maciej W. Rozycki Signed-off-by: Guenter Roeck --- - Use defines to specify poweroff handler priorities arch/mips/alchemy/board-gpr.c | 3 ++- arch/mips/alchemy/board-mtx1.c | 3 ++- arch/mips/alchemy/board-xxs1500.c | 3 ++- arch/mips/alchemy/devboards/platform.c | 17 +++-- arch/mips/ar7/setup.c | 3 ++- arch/mips/ath79/setup.c| 3 ++- arch/mips/bcm47xx/setup.c | 3 ++- arch/mips/bcm63xx/setup.c | 3 ++- arch/mips/cobalt/setup.c | 3 ++- arch/mips/dec/setup.c | 3 ++- arch/mips/emma/markeins/setup.c| 3 ++- arch/mips/jz4740/reset.c | 3 ++- arch/mips/lantiq/falcon/reset.c| 3 ++- arch/mips/lantiq/xway/reset.c | 3 ++- arch/mips/lasat/reset.c| 3 ++- arch/mips/loongson/common/reset.c | 3 ++- arch/mips/loongson1/common/reset.c | 3 ++- arch/mips/mti-malta/malta-reset.c | 3 ++- arch/mips/mti-sead3/sead3-reset.c | 3 ++- arch/mips/netlogic/xlp/setup.c | 3 ++- arch/mips/netlogic/xlr/setup.c | 3 ++- arch/mips/pmcs-msp71xx/msp_setup.c | 3 ++- arch/mips/pnx833x/common/setup.c | 3 ++- arch/mips/ralink/reset.c | 3 ++- arch/mips/rb532/setup.c| 3 ++- arch/mips/sgi-ip22/ip22-reset.c| 3 ++- arch/mips/sgi-ip27/ip27-reset.c| 3 ++- arch/mips/sgi-ip32/ip32-reset.c| 3 ++- arch/mips/sibyte/common/cfe.c | 3 ++- arch/mips/sni/setup.c | 3 ++- arch/mips/txx9/generic/setup.c | 3 ++- arch/mips/vr41xx/common/pmu.c | 3 ++- 32 files changed, 77 insertions(+), 33 deletions(-) diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c index acf9a2a..3e06384 100644 --- a/arch/mips/alchemy/board-gpr.c +++ b/arch/mips/alchemy/board-gpr.c @@ -89,7 +89,8 @@ void __init board_setup(void) { printk(KERN_INFO "Trapeze ITS GPR board\n"); - pm_power_off = gpr_power_off; + register_power_off_handler_simple(gpr_power_off, + POWEROFF_PRIORITY_FALLBACK); _machine_halt = gpr_power_off; _machine_restart = gpr_reset; diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index 1e3b102..4fd3cee 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c @@ -98,7 +98,8 @@ void __init board_setup(void) alchemy_gpio_direction_output(211, 1); /* green on */ alchemy_gpio_direction_output(212, 0); /* red off */ - pm_power_off = mtx1_power_off; + register_power_off_handler_simple(mtx1_power_off, + POWEROFF_PRIORITY_FALLBACK); _machine_halt = mtx1_power_off; _machine_restart = mtx1_reset; diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c index 0fc53e0..92d6d28 100644 --- a/arch/mips/alchemy/board-xxs1500.c +++ b/arch/mips/alchemy/board-xxs1500.c @@ -79,7 +79,8 @@ void __init board_setup(void) { u32 pin_func; - pm_power_off = xxs1500_power_off; + register_power_off_handler_simple(xxs1500_power_off, + POWEROFF_PRIORITY_FALLBACK); _machine_halt = xxs1500_power_off; _machine_restart = xxs1500_reset; diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index be139a0..1e1722a 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -64,10 +65,22 @@ static void db1x_reset(char *c) bcsr_write(BCSR_SYSTEM, 0); } +static int db1x_power_off_notify(struct notifier_block *this, +unsigned long unused1, void *unused2) +{ + db1x_power_off(); + return NOTIFY_DONE; +} + +static struct notifier_block db1x_poweroff_nb = { + .notifier_call = db1x_power_off_notify, + .priority = POWEROFF_PRIORITY_LOW, +}; + static int __init db1x_late_setup(void) { - if (!pm_power_off) - pm_power_off = db1x_power_off; +
[PATCH v2 33/47] staging: nvec: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority since we don't know any better. Cc: Julian Andres Klode Cc: Marc Dietrich Cc: Greg Kroah-Hartman Acked-by: Greg Kroah-Hartman Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err drivers/staging/nvec/nvec.c | 24 +++- drivers/staging/nvec/nvec.h | 2 ++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index a93208a..78b68a3 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -80,8 +81,6 @@ enum nvec_sleep_subcmds { #define LID_SWITCH BIT(1) #define PWR_BUTTON BIT(15) -static struct nvec_chip *nvec_power_handle; - static const struct mfd_cell nvec_devices[] = { { .name = "nvec-kbd", @@ -759,12 +758,17 @@ static void nvec_disable_i2c_slave(struct nvec_chip *nvec) } #endif -static void nvec_power_off(void) +static int nvec_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { + struct nvec_chip *nvec = container_of(this, struct nvec_chip, + poweroff_nb); char ap_pwr_down[] = { NVEC_SLEEP, AP_PWR_DOWN }; - nvec_toggle_global_events(nvec_power_handle, false); - nvec_write_async(nvec_power_handle, ap_pwr_down, 2); + nvec_toggle_global_events(nvec, false); + nvec_write_async(nvec, ap_pwr_down, 2); + + return NOTIFY_DONE; } /* @@ -878,8 +882,11 @@ static int tegra_nvec_probe(struct platform_device *pdev) nvec->nvec_status_notifier.notifier_call = nvec_status_notifier; nvec_register_notifier(nvec, &nvec->nvec_status_notifier, 0); - nvec_power_handle = nvec; - pm_power_off = nvec_power_off; + nvec->poweroff_nb.notifier_call = nvec_power_off; + nvec->poweroff_nb.priority = POWEROFF_PRIORITY_DEFAULT; + ret = register_power_off_handler(&nvec->poweroff_nb); + if (ret) + dev_warn(nvec->dev, "Failed to register poweroff handler\n"); /* Get Firmware Version */ msg = nvec_write_sync(nvec, get_firmware_version, 2); @@ -914,13 +921,12 @@ static int tegra_nvec_remove(struct platform_device *pdev) { struct nvec_chip *nvec = platform_get_drvdata(pdev); + unregister_power_off_handler(&nvec->poweroff_nb); nvec_toggle_global_events(nvec, false); mfd_remove_devices(nvec->dev); nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier); cancel_work_sync(&nvec->rx_work); cancel_work_sync(&nvec->tx_work); - /* FIXME: needs check wether nvec is responsible for power off */ - pm_power_off = NULL; return 0; } diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h index e271375..e5ee2af 100644 --- a/drivers/staging/nvec/nvec.h +++ b/drivers/staging/nvec/nvec.h @@ -163,6 +163,8 @@ struct nvec_chip { struct nvec_msg *last_sync_msg; int state; + + struct notifier_block poweroff_nb; }; extern int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 35/47] arm: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_power_off_handler_simple as there is no indication that more than one poweroff handler is registered. If the poweroff handler only resets the system or puts the CPU in sleep mode, select the fallback priority to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select the default priority. Cc: Russell King Signed-off-by: Guenter Roeck --- - Use defines to specify poweroff handler priorities - Drop changes in arch/arm/mach-at91/setup.c (file removed upstream) arch/arm/kernel/psci.c | 3 ++- arch/arm/mach-at91/board-gsia18s.c | 3 ++- arch/arm/mach-bcm/board_bcm2835.c | 3 ++- arch/arm/mach-cns3xxx/cns3420vb.c | 3 ++- arch/arm/mach-cns3xxx/core.c | 3 ++- arch/arm/mach-highbank/highbank.c | 3 ++- arch/arm/mach-imx/mach-mx31moboard.c | 3 ++- arch/arm/mach-iop32x/em7210.c | 3 ++- arch/arm/mach-iop32x/glantank.c| 3 ++- arch/arm/mach-iop32x/iq31244.c | 3 ++- arch/arm/mach-iop32x/n2100.c | 3 ++- arch/arm/mach-ixp4xx/dsmg600-setup.c | 3 ++- arch/arm/mach-ixp4xx/nas100d-setup.c | 3 ++- arch/arm/mach-ixp4xx/nslu2-setup.c | 3 ++- arch/arm/mach-omap2/board-omap3touchbook.c | 3 ++- arch/arm/mach-orion5x/board-mss2.c | 3 ++- arch/arm/mach-orion5x/dns323-setup.c | 9 ++--- arch/arm/mach-orion5x/kurobox_pro-setup.c | 3 ++- arch/arm/mach-orion5x/ls-chl-setup.c | 3 ++- arch/arm/mach-orion5x/ls_hgl-setup.c | 3 ++- arch/arm/mach-orion5x/lsmini-setup.c | 3 ++- arch/arm/mach-orion5x/mv2120-setup.c | 3 ++- arch/arm/mach-orion5x/net2big-setup.c | 3 ++- arch/arm/mach-orion5x/terastation_pro2-setup.c | 3 ++- arch/arm/mach-orion5x/ts209-setup.c| 3 ++- arch/arm/mach-orion5x/ts409-setup.c| 3 ++- arch/arm/mach-pxa/corgi.c | 3 ++- arch/arm/mach-pxa/mioa701.c| 3 ++- arch/arm/mach-pxa/poodle.c | 3 ++- arch/arm/mach-pxa/spitz.c | 3 ++- arch/arm/mach-pxa/tosa.c | 3 ++- arch/arm/mach-pxa/viper.c | 3 ++- arch/arm/mach-pxa/z2.c | 7 --- arch/arm/mach-pxa/zeus.c | 7 --- arch/arm/mach-s3c24xx/mach-gta02.c | 3 ++- arch/arm/mach-s3c24xx/mach-jive.c | 3 ++- arch/arm/mach-s3c24xx/mach-vr1000.c| 3 ++- arch/arm/mach-s3c64xx/mach-smartq.c| 3 ++- arch/arm/mach-sa1100/generic.c | 3 ++- arch/arm/mach-sa1100/simpad.c | 3 ++- arch/arm/mach-u300/regulator.c | 3 ++- arch/arm/mach-vt8500/vt8500.c | 3 ++- arch/arm/xen/enlighten.c | 3 ++- 43 files changed, 94 insertions(+), 49 deletions(-) diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c index f73891b..4917c99 100644 --- a/arch/arm/kernel/psci.c +++ b/arch/arm/kernel/psci.c @@ -264,7 +264,8 @@ static int psci_0_2_init(struct device_node *np) arm_pm_restart = psci_sys_reset; - pm_power_off = psci_sys_poweroff; + register_power_off_handler_simple(psci_sys_poweroff, + POWEROFF_PRIORITY_DEFAULT); out_put_node: of_node_put(np); diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c index bf5cc55..cb5d1c3 100644 --- a/arch/arm/mach-at91/board-gsia18s.c +++ b/arch/arm/mach-at91/board-gsia18s.c @@ -521,7 +521,8 @@ static void gsia18s_power_off(void) static int __init gsia18s_power_off_init(void) { - pm_power_off = gsia18s_power_off; + register_power_off_handler_simple(gsia18s_power_off, + POWEROFF_PRIORITY_DEFAULT); return 0; } diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c index 70f2f39..307ebc1 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -111,7 +111,8 @@ static void __init bcm2835_init(void) bcm2835_setup_restart(); if (wdt_regs) - pm_power_off = bcm2835_power_off; + register_power_off_handler_simple(bcm2835_power_off, + POWEROFF_PRIORITY_FALLBACK); bcm2835_init_clocks(); diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c index 6428bcc7..3f48979 100644 --- a/arch/arm/mach-cns3xxx/cns3420vb.c +++ b/arch/arm/mach-cns3xxx/cns3420vb.c @@ -224,7 +224,8 @@ static void __init cns3420_init(void) cns3xxx_ahci_init(); cns3xxx_sdhci_init(); - pm_power_off = cns3xxx_power_off; + register_powe
[PATCH v2 44/47] x86: intel-mid: Drop registration of dummy poweroff handlers
A dummy poweroff handler does not serve any purpose. Drop it. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority arch/x86/platform/intel-mid/intel-mid.c | 5 - arch/x86/platform/intel-mid/mfld.c | 5 - 2 files changed, 10 deletions(-) diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index 1bbedc4..4b70666 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c @@ -67,10 +67,6 @@ static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT; enum intel_mid_cpu_type __intel_mid_cpu_chip; EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); -static void intel_mid_power_off(void) -{ -}; - static void intel_mid_reboot(void) { intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); @@ -183,7 +179,6 @@ void __init x86_intel_mid_early_setup(void) legacy_pic = &null_legacy_pic; - pm_power_off = intel_mid_power_off; machine_ops.emergency_restart = intel_mid_reboot; /* Avoid searching for BIOS MP tables */ diff --git a/arch/x86/platform/intel-mid/mfld.c b/arch/x86/platform/intel-mid/mfld.c index 23381d2..cf6842f 100644 --- a/arch/x86/platform/intel-mid/mfld.c +++ b/arch/x86/platform/intel-mid/mfld.c @@ -23,10 +23,6 @@ static struct intel_mid_ops penwell_ops = { .arch_setup = penwell_arch_setup, }; -static void mfld_power_off(void) -{ -} - static unsigned long __init mfld_calibrate_tsc(void) { unsigned long fast_calibrate; @@ -61,7 +57,6 @@ static unsigned long __init mfld_calibrate_tsc(void) static void __init penwell_arch_setup(void) { x86_platform.calibrate_tsc = mfld_calibrate_tsc; - pm_power_off = mfld_power_off; } void *get_penwell_ops(void) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 46/47] efi: Register poweroff handler with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority since the efi code states that this is a poweroff handler of last resort. Cc: Matt Fleming Acked-by: Matt Fleming Acked-by: Mark Salter Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority drivers/firmware/efi/reboot.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c index 9c59d1c..e1c4f7a 100644 --- a/drivers/firmware/efi/reboot.c +++ b/drivers/firmware/efi/reboot.c @@ -3,6 +3,8 @@ * Copyright (c) 2014 Red Hat, Inc., Mark Salter */ #include +#include +#include #include int efi_reboot_quirk_mode = -1; @@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void) return false; } -static void efi_power_off(void) +static int efi_power_off(struct notifier_block *this, +unsigned long unused1, void *unused2) { efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL); + + return NOTIFY_DONE; } +static struct notifier_block efi_poweroff_nb = { + .notifier_call = efi_power_off, + .priority = POWEROFF_PRIORITY_LOW, +}; + static int __init efi_shutdown_init(void) { + int ret = 0; + if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENODEV; - if (efi_poweroff_required()) - pm_power_off = efi_power_off; + if (efi_poweroff_required()) { + ret = register_power_off_handler(&efi_poweroff_nb); + if (ret) + pr_err("efi: Failed to register poweroff handler\n"); + } - return 0; + return ret; } late_initcall(efi_shutdown_init); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 47/47] kernel: Remove pm_power_off
No users of pm_power_off are left, so it is safe to remove the function. Cc: Rafael J. Wysocki Cc: Pavel Machek Cc: Len Brown Acked-by: Rafael J. Wysocki Signed-off-by: Guenter Roeck --- v2: poweroff -> power_off include/linux/pm.h | 1 - kernel/power/poweroff_handler.c | 10 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index 7e0cb36..316271d 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -31,7 +31,6 @@ /* * Callbacks for platform drivers to implement. */ -extern void (*pm_power_off)(void); extern void (*pm_power_off_prepare)(void); /* diff --git a/kernel/power/poweroff_handler.c b/kernel/power/poweroff_handler.c index 37f0b88..d2d164e 100644 --- a/kernel/power/poweroff_handler.c +++ b/kernel/power/poweroff_handler.c @@ -22,12 +22,6 @@ #include /* - * If set, calling this function will power off the system immediately. - */ -void (*pm_power_off)(void); -EXPORT_SYMBOL(pm_power_off); - -/* * Notifier list for kernel code which wants to be called * to power off the system. */ @@ -242,8 +236,6 @@ EXPORT_SYMBOL(devm_register_power_off_handler); void do_kernel_power_off(void) { spin_lock(&power_off_handler_lock); - if (pm_power_off) - pm_power_off(); raw_notifier_call_chain(&power_off_handler_list, 0, NULL); spin_unlock(&power_off_handler_lock); } @@ -255,6 +247,6 @@ void do_kernel_power_off(void) */ bool have_kernel_power_off(void) { - return pm_power_off != NULL || power_off_handler_list.head != NULL; + return power_off_handler_list.head != NULL; } EXPORT_SYMBOL(have_kernel_power_off); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] init: Remove CONFIG_INIT_FALLBACK
On 10/20/14 23:02, Andy Lutomirski wrote: > On Mon, Oct 20, 2014 at 8:45 PM, Rob Landley wrote: >> On 10/20/14 17:04, Andy Lutomirski wrote: >>> --- a/init/main.c >>> +++ b/init/main.c >>> @@ -960,13 +960,8 @@ static int __ref kernel_init(void *unused) >>> ret = run_init_process(execute_command); >>> if (!ret) >>> return 0; >>> -#ifndef CONFIG_INIT_FALLBACK >>> panic("Requested init %s failed (error %d).", >>> execute_command, ret); >>> -#else >>> - pr_err("Failed to execute %s (error %d). Attempting >>> defaults...\n", >>> -execute_command, ret); >>> -#endif >>> } >>> if (!try_to_run_init_process("/sbin/init") || >>> !try_to_run_init_process("/etc/init") || >>> >> >> Would you like to remove the try_to_run_init_process() stack of random >> hardwired names that we can never reach if we panic, or do you just want >> to remove the error message? >> > > I'm confused. That code is reachable if there's no initramfs and > init= is not specified. Ah, I thought the purpose of the original patch was to make init= required, but if not then fine. /etc/init is still crazy, though. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 43/47] x86: ce4100: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority arch/x86/platform/ce4100/ce4100.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index 701fd58..379260e 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c @@ -164,5 +164,6 @@ void __init x86_ce4100_early_setup(void) */ reboot_type = BOOT_KBD; - pm_power_off = ce4100_power_off; + register_power_off_handler_simple(ce4100_power_off, + POWEROFF_PRIORITY_DEFAULT); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 45/47] x86: pmc_atom: Register poweroff handler with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err arch/x86/kernel/pmc_atom.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 0ee5025e..7799cdf 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include @@ -92,7 +94,8 @@ static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val) writel(val, pmc->regmap + reg_offset); } -static void pmc_power_off(void) +static int pmc_power_off(struct notifier_block *this, unsigned long unused1, +void *unused2) { u16 pm1_cnt_port; u32 pm1_cnt_value; @@ -107,8 +110,15 @@ static void pmc_power_off(void) pm1_cnt_value |= SLEEP_ENABLE; outl(pm1_cnt_value, pm1_cnt_port); + + return NOTIFY_DONE; } +static struct notifier_block pmc_poweroff_nb = { + .notifier_call = pmc_power_off, + .priority = POWEROFF_PRIORITY_LOW, +}; + static void pmc_hw_reg_setup(struct pmc_dev *pmc) { /* @@ -252,8 +262,12 @@ static int pmc_setup_dev(struct pci_dev *pdev) acpi_base_addr &= ACPI_BASE_ADDR_MASK; /* Install power off function */ - if (acpi_base_addr != 0 && pm_power_off == NULL) - pm_power_off = pmc_power_off; + if (acpi_base_addr != 0) { + ret = register_power_off_handler(&pmc_poweroff_nb); + if (ret) + dev_warn(&pdev->dev, +"Failed to install poweroff handler\n"); + } pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr); pmc->base_addr &= PMC_BASE_ADDR_MASK; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 41/47] sh: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Signed-off-by: Guenter Roeck --- - Use defines to specify poweroff handler priorities arch/sh/boards/board-sh7785lcr.c | 3 ++- arch/sh/boards/board-urquell.c | 3 ++- arch/sh/boards/mach-highlander/setup.c | 3 ++- arch/sh/boards/mach-landisk/setup.c| 3 ++- arch/sh/boards/mach-r2d/setup.c| 3 ++- arch/sh/boards/mach-sdk7786/setup.c| 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c index 2c4771e..ada9f6a 100644 --- a/arch/sh/boards/board-sh7785lcr.c +++ b/arch/sh/boards/board-sh7785lcr.c @@ -332,7 +332,8 @@ static void __init sh7785lcr_setup(char **cmdline_p) printk(KERN_INFO "Renesas Technology Corp. R0P7785LC0011RL support.\n"); - pm_power_off = sh7785lcr_power_off; + register_power_off_handler_simple(sh7785lcr_power_off, + POWEROFF_PRIORITY_DEFAULT); /* sm501 DRAM configuration */ sm501_reg = ioremap_nocache(SM107_REG_ADDR, SM501_DRAM_CONTROL); diff --git a/arch/sh/boards/board-urquell.c b/arch/sh/boards/board-urquell.c index b52abcc..2188fee 100644 --- a/arch/sh/boards/board-urquell.c +++ b/arch/sh/boards/board-urquell.c @@ -204,7 +204,8 @@ static void __init urquell_setup(char **cmdline_p) { printk(KERN_INFO "Renesas Technology Corp. Urquell support.\n"); - pm_power_off = urquell_power_off; + register_power_off_handler_simple(urquell_power_off, + POWEROFF_PRIORITY_DEFAULT); register_smp_ops(&shx3_smp_ops); } diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c index 4a52590..efb848a 100644 --- a/arch/sh/boards/mach-highlander/setup.c +++ b/arch/sh/boards/mach-highlander/setup.c @@ -385,7 +385,8 @@ static void __init highlander_setup(char **cmdline_p) __raw_writew(__raw_readw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */ - pm_power_off = r7780rp_power_off; + register_power_off_handler_simple(r7780rp_power_off, + POWEROFF_PRIORITY_DEFAULT); } static unsigned char irl2irq[HL_NR_IRL]; diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c index f1147ca..50d9388 100644 --- a/arch/sh/boards/mach-landisk/setup.c +++ b/arch/sh/boards/mach-landisk/setup.c @@ -89,7 +89,8 @@ static void __init landisk_setup(char **cmdline_p) __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED); printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n"); - pm_power_off = landisk_power_off; + register_power_off_handler_simple(landisk_power_off, + POWEROFF_PRIORITY_DEFAULT); } /* diff --git a/arch/sh/boards/mach-r2d/setup.c b/arch/sh/boards/mach-r2d/setup.c index 4b98a52..28add25 100644 --- a/arch/sh/boards/mach-r2d/setup.c +++ b/arch/sh/boards/mach-r2d/setup.c @@ -279,7 +279,8 @@ static void __init rts7751r2d_setup(char **cmdline_p) (ver >> 4) & 0xf, ver & 0xf); __raw_writew(0x, PA_OUTPORT); - pm_power_off = rts7751r2d_power_off; + register_power_off_handler_simple(rts7751r2d_power_off, + POWEROFF_PRIORITY_DEFAULT); /* sm501 dram configuration: * ColSizeX = 11 - External Memory Column Size: 256 words. diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c index c29268b..eee7b9c 100644 --- a/arch/sh/boards/mach-sdk7786/setup.c +++ b/arch/sh/boards/mach-sdk7786/setup.c @@ -252,7 +252,8 @@ static void __init sdk7786_setup(char **cmdline_p) pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf); machine_ops.restart = sdk7786_restart; - pm_power_off = sdk7786_power_off; + register_power_off_handler_simple(sdk7786_power_off, + POWEROFF_PRIORITY_DEFAULT); register_smp_ops(&shx3_smp_ops); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 39/47] m68k: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Cc: Geert Uytterhoeven Cc: Joshua Thompson Acked-by: Geert Uytterhoeven Signed-off-by: Guenter Roeck --- - Use defines to specify poweroff handler priorities arch/m68k/emu/natfeat.c | 3 ++- arch/m68k/mac/config.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c index 91e2ae7..b105681 100644 --- a/arch/m68k/emu/natfeat.c +++ b/arch/m68k/emu/natfeat.c @@ -91,5 +91,6 @@ void __init nf_init(void) pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16, version & 0x); - pm_power_off = nf_poweroff; + register_power_off_handler_simple(nf_poweroff, + POWEROFF_PRIORITY_DEFAULT); } diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 677913ff..07e853e 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -160,7 +160,8 @@ void __init config_mac(void) mach_set_clock_mmss = mac_set_clock_mmss; mach_reset = mac_reset; mach_halt = mac_poweroff; - pm_power_off = mac_poweroff; + register_power_off_handler_simple(mac_poweroff, + POWEROFF_PRIORITY_DEFAULT); mach_max_dma_address = 0x; #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) mach_beep = mac_mksound; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks
On Tue, Oct 14, 2014 at 09:06:37PM -0400, Martin K. Petersen wrote: > > "Sitsofe" == Sitsofe Wheeler writes: > > Sitsofe> A previous patch attempted to add a quirk to workaround this > Sitsofe> but the quirk was only enabled after the features had been > Sitsofe> scanned for, wouldn't work for "small" disks > > What does that mean, exactly? It means: 1. The committed patches never worked because the running of the code to test whether the quirk should be enabled happened after the probing code the quirk would have affected ran. So roughly: bflag = 0; if (feature || bflag) { do_stuff(); } if (matching_dev) { bflag = 1; // Too late... } See https://lkml.org/lkml/2014/7/23/615 for prior details. 2. On top of the above, when a disk is "small" (has less than 2^32 sectors which is typically < 2 TBytes in size) READ CAPACITY(16) won't be triggered. If READ CAPACITY(16) isn't triggered then the lbpme bytes won't be checked, thin provisioning will never be enabled and the committed patch would doubly not work for such disks. Apologies for the delay in replying. -- Sitsofe | http://sucs.org/~sits/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 36/47] arm64: psci: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority arch/arm64/kernel/psci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 866c1c8..150ac1c 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c @@ -359,7 +359,8 @@ static int __init psci_0_2_init(struct device_node *np) arm_pm_restart = psci_sys_reset; - pm_power_off = psci_sys_poweroff; + register_power_off_handler_simple(psci_sys_poweroff, + POWEROFF_PRIORITY_DEFAULT); out_put_node: of_node_put(np); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 42/47] x86: lguest: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Cc: Rusty Russell Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority arch/x86/lguest/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index aae9413..913a95e 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -1441,7 +1441,8 @@ __init void lguest_init(void) * the Guest routine to power off, and the reboot hook to our restart * routine. */ - pm_power_off = lguest_power_off; + register_power_off_handler_simple(lguest_power_off, + POWEROFF_PRIORITY_DEFAULT); machine_ops.restart = lguest_restart; /* -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 38/47] ia64: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the call is expected to be replaced at some point in the future. Cc: Tony Luck Cc: Fenghua Yu Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority arch/ia64/sn/kernel/setup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index 5f6b6b4..1888aeb 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c @@ -488,12 +488,13 @@ void __init sn_setup(char **cmdline_p) sn_timer_init(); /* -* set pm_power_off to a SAL call to allow +* set poweroff handler to a SAL call to allow * sn machines to power off. The SAL call can be replaced * by an ACPI interface call when ACPI is fully implemented * for sn. */ - pm_power_off = ia64_sn_power_down; + register_power_off_handler_simple(ia64_sn_power_down, + POWEROFF_PRIORITY_LOW); current->thread.flags |= IA64_THREAD_MIGRATION; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 31/47] x86: apm: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority to reflect that the original code overwrites existing poweroff handlers. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: Jiri Kosina Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority arch/x86/kernel/apm_32.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 5848744..b03a65e 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c @@ -219,6 +219,7 @@ #include #include #include +#include #include #include #include @@ -981,7 +982,8 @@ recalc: * on their first cpu. */ -static void apm_power_off(void) +static int apm_power_off(struct notifier_block *this, unsigned long unused1, +void *unused2) { /* Some bioses don't like being called from CPU != 0 */ if (apm_info.realmode_power_off) { @@ -990,8 +992,14 @@ static void apm_power_off(void) } else { (void)set_system_power_state(APM_STATE_OFF); } + return NOTIFY_DONE; } +static struct notifier_block apm_poweroff_nb = { + .notifier_call = apm_power_off, + .priority = POWEROFF_PRIORITY_HIGH, +}; + #ifdef CONFIG_APM_DO_ENABLE /** @@ -1847,8 +1855,11 @@ static int apm(void *unused) } /* Install our power off handler.. */ - if (power_off) - pm_power_off = apm_power_off; + if (power_off) { + error = register_power_off_handler(&apm_poweroff_nb); + if (error) + pr_err("apm: Failed to register poweroff handler\n"); + } if (num_online_cpus() == 1 || smp) { #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT) @@ -2408,9 +2419,8 @@ static void __exit apm_exit(void) apm_error("disengage power management", error); } misc_deregister(&apm_device); + unregister_power_off_handler(&apm_poweroff_nb); remove_proc_entry("apm", NULL); - if (power_off) - pm_power_off = NULL; if (kapmd_task) { kthread_stop(kapmd_task); kapmd_task = NULL; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 34/47] acpi: Register poweroff handler with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority to reflect that the driver explicitly overrides existing poweroff handlers. Cc: Rafael J. Wysocki Cc: Len Brown Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use pr_warn instead of pr_err drivers/acpi/sleep.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 05a31b5..1eba563 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -827,14 +829,22 @@ static void acpi_power_off_prepare(void) acpi_disable_all_gpes(); } -static void acpi_power_off(void) +static int acpi_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ printk(KERN_DEBUG "%s called\n", __func__); local_irq_disable(); acpi_enter_sleep_state(ACPI_STATE_S5); + + return NOTIFY_DONE; } +static struct notifier_block acpi_poweroff_nb = { + .notifier_call = acpi_power_off, + .priority = POWEROFF_PRIORITY_HIGH, +}; + int __init acpi_sleep_init(void) { char supported[ACPI_S_STATE_COUNT * 3 + 1]; @@ -851,7 +861,8 @@ int __init acpi_sleep_init(void) if (acpi_sleep_state_supported(ACPI_STATE_S5)) { sleep_states[ACPI_STATE_S5] = 1; pm_power_off_prepare = acpi_power_off_prepare; - pm_power_off = acpi_power_off; + if (register_power_off_handler(&acpi_poweroff_nb)) + pr_warn("acpi: Failed to register poweroff handler\n"); } supported[0] = 0; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 32/47] x86: olpc: Register xo1 poweroff handler with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority to reflect that the driver explicitly wants to override default poweroff handlers. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Signed-off-by: Guenter Roeck --- v2: Use define to specify poweroff handler priority arch/x86/platform/olpc/olpc-xo1-pm.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/x86/platform/olpc/olpc-xo1-pm.c b/arch/x86/platform/olpc/olpc-xo1-pm.c index a9acde7..a8e427f 100644 --- a/arch/x86/platform/olpc/olpc-xo1-pm.c +++ b/arch/x86/platform/olpc/olpc-xo1-pm.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -92,7 +93,8 @@ asmlinkage __visible int xo1_do_sleep(u8 sleep_state) return 0; } -static void xo1_power_off(void) +static int xo1_power_off(struct notifier_block *this, unsigned long unused1, +void *unused2) { printk(KERN_INFO "OLPC XO-1 power off sequence...\n"); @@ -108,8 +110,15 @@ static void xo1_power_off(void) /* Write SLP_EN bit to start the machinery */ outl(0x2000, acpi_base + CS5536_PM1_CNT); + + return NOTIFY_DONE; } +static struct notifier_block xo1_poweroff_nb = { + .notifier_call = xo1_power_off, + .priority = POWEROFF_PRIORITY_HIGH, +}; + static int xo1_power_state_valid(suspend_state_t pm_state) { /* suspend-to-RAM only */ @@ -146,8 +155,12 @@ static int xo1_pm_probe(struct platform_device *pdev) /* If we have both addresses, we can override the poweroff hook */ if (pms_base && acpi_base) { + err = register_power_off_handler(&xo1_poweroff_nb); + if (err) { + dev_err(&pdev->dev, "Failed to register poweroff handler\n"); + return err; + } suspend_set_ops(&xo1_suspend_ops); - pm_power_off = xo1_power_off; printk(KERN_INFO "OLPC XO-1 support registered\n"); } @@ -158,12 +171,13 @@ static int xo1_pm_remove(struct platform_device *pdev) { mfd_cell_disable(pdev); + unregister_power_off_handler(&xo1_poweroff_nb); + if (strcmp(pdev->name, "cs5535-pms") == 0) pms_base = 0; else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0) acpi_base = 0; - pm_power_off = NULL; return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 30/47] x86: iris: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority to reflect that the original code overwrites existing poweroff handlers. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use devm_register_power_off_handler arch/x86/platform/iris/iris.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/iris/iris.c b/arch/x86/platform/iris/iris.c index 4d171e8..dd36815 100644 --- a/arch/x86/platform/iris/iris.c +++ b/arch/x86/platform/iris/iris.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -47,15 +48,21 @@ static bool force; module_param(force, bool, 0); MODULE_PARM_DESC(force, "Set to one to force poweroff handler installation."); -static void (*old_pm_power_off)(void); - -static void iris_power_off(void) +static int iris_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT); msleep(850); outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT); + + return NOTIFY_DONE; } +static struct notifier_block iris_poweroff_nb = { + .notifier_call = iris_power_off, + .priority = POWEROFF_PRIORITY_HIGH, +}; + /* * Before installing the power_off handler, try to make sure the OS is * running on an Iris. Since Iris does not support DMI, this is done @@ -65,20 +72,25 @@ static void iris_power_off(void) static int iris_probe(struct platform_device *pdev) { unsigned char status = inb(IRIS_GIO_INPUT); + int ret; + if (status == IRIS_GIO_NODEV) { printk(KERN_ERR "This machine does not seem to be an Iris. " "Power off handler not installed.\n"); return -ENODEV; } - old_pm_power_off = pm_power_off; - pm_power_off = &iris_power_off; + + ret = devm_register_power_off_handler(&pdev->dev, &iris_poweroff_nb); + if (ret) { + dev_err(&pdev->dev, "Failed to register poweroff handler\n"); + return ret; + } printk(KERN_INFO "Iris power_off handler installed.\n"); return 0; } static int iris_remove(struct platform_device *pdev) { - pm_power_off = old_pm_power_off; printk(KERN_INFO "Iris power_off handler uninstalled.\n"); return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 37/47] avr32: atngw100: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Cc: Haavard Skinnemoen Cc: Hans-Christian Egtvedt Signed-off-by: Guenter Roeck --- - Use define to specify poweroff handler priority arch/avr32/boards/atngw100/mrmt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c index 91146b4..833212e 100644 --- a/arch/avr32/boards/atngw100/mrmt.c +++ b/arch/avr32/boards/atngw100/mrmt.c @@ -274,7 +274,8 @@ static int __init mrmt1_init(void) { gpio_set_value( PIN_PWR_ON, 1 );/* Ensure PWR_ON is enabled */ - pm_power_off = mrmt_power_off; + register_power_off_handler_simple(mrmt_power_off, + POWEROFF_PRIORITY_DEFAULT); /* Setup USARTS (other than console) */ at32_map_usart(2, 1, 0);/* USART 2: /dev/ttyS1, RMT1:DB9M */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 24/47] power/reset: as3722-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Drop remove function since it is no longer needed. Cc: Sebastian Reichel Cc: Dmitry Eremin-Solenikov Cc: David Woodhouse Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use devm_register_power_off_handler - Drop remove function since it is no longer needed drivers/power/reset/as3722-poweroff.c | 39 ++- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/power/reset/as3722-poweroff.c b/drivers/power/reset/as3722-poweroff.c index 6849711..9f878e7 100644 --- a/drivers/power/reset/as3722-poweroff.c +++ b/drivers/power/reset/as3722-poweroff.c @@ -17,32 +17,33 @@ #include #include +#include #include #include #include +#include #include struct as3722_poweroff { struct device *dev; struct as3722 *as3722; + struct notifier_block poweroff_nb; }; -static struct as3722_poweroff *as3722_pm_poweroff; - -static void as3722_pm_power_off(void) +static int as3722_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { + struct as3722_poweroff *as3722_poweroff = + container_of(this, struct as3722_poweroff, poweroff_nb); int ret; - if (!as3722_pm_poweroff) { - pr_err("AS3722 poweroff is not initialised\n"); - return; - } - - ret = as3722_update_bits(as3722_pm_poweroff->as3722, + ret = as3722_update_bits(as3722_poweroff->as3722, AS3722_RESET_CONTROL_REG, AS3722_POWER_OFF, AS3722_POWER_OFF); if (ret < 0) - dev_err(as3722_pm_poweroff->dev, + dev_err(as3722_poweroff->dev, "RESET_CONTROL_REG update failed, %d\n", ret); + + return NOTIFY_DONE; } static int as3722_poweroff_probe(struct platform_device *pdev) @@ -63,20 +64,11 @@ static int as3722_poweroff_probe(struct platform_device *pdev) as3722_poweroff->as3722 = dev_get_drvdata(pdev->dev.parent); as3722_poweroff->dev = &pdev->dev; - as3722_pm_poweroff = as3722_poweroff; - if (!pm_power_off) - pm_power_off = as3722_pm_power_off; - - return 0; -} - -static int as3722_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == as3722_pm_power_off) - pm_power_off = NULL; - as3722_pm_poweroff = NULL; + as3722_poweroff->poweroff_nb.notifier_call = as3722_power_off; + as3722_poweroff->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; - return 0; + return devm_register_power_off_handler(&pdev->dev, + &as3722_poweroff->poweroff_nb); } static struct platform_driver as3722_poweroff_driver = { @@ -85,7 +77,6 @@ static struct platform_driver as3722_poweroff_driver = { .owner = THIS_MODULE, }, .probe = as3722_poweroff_probe, - .remove = as3722_poweroff_remove, }; module_platform_driver(as3722_poweroff_driver); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 26/47] power/reset: msm-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Select fallback priority since the code does not really poweroff the system but resets it instead. Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Fix headline and description - Merge with restart handler code now used in same driver - Use dev_warn instead of dev_err drivers/power/reset/msm-poweroff.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index 4702efd..d44f332 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -19,10 +19,12 @@ #include #include #include +#include #include #include static void __iomem *msm_ps_hold; + static int do_msm_restart(struct notifier_block *nb, unsigned long action, void *data) { @@ -37,11 +39,11 @@ static struct notifier_block restart_nb = { .priority = 128, }; -static void do_msm_poweroff(void) -{ +static struct notifier_block msm_poweroff_nb = { /* TODO: Add poweroff capability */ - do_msm_restart(&restart_nb, 0, NULL); -} + .notifier_call = do_msm_restart, + .priority = POWEROFF_PRIORITY_FALLBACK, +}; static int msm_restart_probe(struct platform_device *pdev) { @@ -55,7 +57,8 @@ static int msm_restart_probe(struct platform_device *pdev) register_restart_handler(&restart_nb); - pm_power_off = do_msm_poweroff; + if (register_power_off_handler(&msm_poweroff_nb)) + dev_warn(&pdev->dev, "Failed to register poweroff handler\n"); return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 28/47] power/reset: at91-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Select default priority to reflect that the original code sets pm_power_off unconditionally. Signed-off-by: Guenter Roeck --- v2: Added patch drivers/power/reset/at91-poweroff.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/power/reset/at91-poweroff.c b/drivers/power/reset/at91-poweroff.c index c610003..ac49a83 100644 --- a/drivers/power/reset/at91-poweroff.c +++ b/drivers/power/reset/at91-poweroff.c @@ -12,8 +12,10 @@ #include #include +#include #include #include +#include #include #define AT91_SHDW_CR 0x00/* Shut Down Control Register */ @@ -66,11 +68,19 @@ static void __init at91_wakeup_status(void) pr_info("AT91: Wake-Up source: %s\n", reason); } -static void at91_poweroff(void) +static int at91_poweroff(struct notifier_block *this, unsigned long unused1, +void *unused2) { writel(AT91_SHDW_KEY | AT91_SHDW_SHDW, at91_shdwc_base + AT91_SHDW_CR); + + return NOTIFY_DONE; } +static struct notifier_block at91_poweroff_nb = { + .notifier_call = at91_poweroff, + .priority = POWEROFF_PRIORITY_DEFAULT, +}; + const enum wakeup_type at91_poweroff_get_wakeup_mode(struct device_node *np) { const char *pm; @@ -134,9 +144,7 @@ static int at91_poweroff_probe(struct platform_device *pdev) if (pdev->dev.of_node) at91_poweroff_dt_set_wakeup_mode(pdev); - pm_power_off = at91_poweroff; - - return 0; + return devm_register_power_off_handler(&pdev->dev, &at91_poweroff_nb); } static struct of_device_id at91_poweroff_of_match[] = { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 29/47] power/reset: ltc2952-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code sets pm_power_off only if it was not already set. Signed-off-by: Guenter Roeck --- v2: Added patch drivers/power/reset/ltc2952-poweroff.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c index 116a1ce..da9abd2 100644 --- a/drivers/power/reset/ltc2952-poweroff.c +++ b/drivers/power/reset/ltc2952-poweroff.c @@ -80,6 +80,8 @@ struct ltc2952_poweroff_data { * 2: kill */ struct gpio_desc *gpio[3]; + + struct notifier_block poweroff_nb; }; static int ltc2952_poweroff_panic; @@ -180,9 +182,13 @@ irq_ok: return IRQ_HANDLED; } -static void ltc2952_poweroff_kill(void) +static int ltc2952_poweroff_kill(struct notifier_block *this, +unsigned long unused1, void *unused2) + { gpiod_set_value(ltc2952_data->gpio[POWERPATH_IO_KILL], 1); + + return NOTIFY_DONE; } static int ltc2952_poweroff_suspend(struct platform_device *pdev, @@ -285,12 +291,7 @@ err_io: static int ltc2952_poweroff_probe(struct platform_device *pdev) { - int ret; - - if (pm_power_off) { - dev_err(&pdev->dev, "pm_power_off already registered"); - return -EBUSY; - } + int i, ret; ltc2952_data = kzalloc(sizeof(*ltc2952_data), GFP_KERNEL); if (!ltc2952_data) @@ -302,12 +303,20 @@ static int ltc2952_poweroff_probe(struct platform_device *pdev) if (ret) goto err; - pm_power_off =poweroff_nb.notifier_call = ltc2952_poweroff_kill; + ltc2952_data->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = register_power_off_handler( poweroff_nb); + if (ret) + goto err_power; dev_info(&pdev->dev, "probe successful\n"); return 0; +err_power: + free_irq(ltc2952_data->virq, ltc2952_data); + for (i = 0; i < ARRAY_SIZE(ltc2952_data->gpio); i++) + gpiod_put(ltc2952_data->gpio[i]); err: kfree(ltc2952_data); return ret; @@ -317,7 +326,7 @@ static int ltc2952_poweroff_remove(struct platform_device *pdev) { unsigned int i; - pm_power_off = NULL; + unregister_power_off_handler( poweroff_nb); if (ltc2952_data) { free_irq(ltc2952_data->virq, ltc2952_data); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] scsi: add try_rc16 blacklist flag
On Tue, Oct 14, 2014 at 09:08:28PM -0400, Martin K. Petersen wrote: > > "Sitsofe" == Sitsofe Wheeler writes: > > Sitsofe> Microsoft Hyper-V virtual disks currently only claim SPC-2 > Sitsofe> compliance causing the kernel skip checks for features such as > Sitsofe> thin provisioning even though the virtual disk advertises them. > > Last time around we identified this as a problem with Microsoft's > interpretation of the T10 SBC spec. And they promised that they are > going to fix that. OK but if we were happy to wait for Microsoft to fix the problem on the host why were the (broken and incomplete) BLIST_SKIP_VPD_PAGES patches committed to 3.17 rather than withdrawn? What's going to be done about those patches now? -- Sitsofe | http://sucs.org/~sits/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 20/47] mfd: rn5t618: Register poweroff handler with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Beniamino Galvani Signed-off-by: Guenter Roeck --- v2: New patch drivers/mfd/rn5t618.c | 32 include/linux/mfd/rn5t618.h | 2 ++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c index 6668571..045cd43 100644 --- a/drivers/mfd/rn5t618.c +++ b/drivers/mfd/rn5t618.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include static const struct mfd_cell rn5t618_cells[] = { @@ -47,16 +49,20 @@ static const struct regmap_config rn5t618_regmap_config = { .cache_type = REGCACHE_RBTREE, }; -static struct rn5t618 *rn5t618_pm_power_off; - -static void rn5t618_power_off(void) +static int rn5t618_power_off(struct notifier_block *this, +unsigned long unused1, void *unused2) { + struct rn5t618 *rn5t618 = container_of(this, struct rn5t618, + poweroff_nb); + /* disable automatic repower-on */ - regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT, + regmap_update_bits(rn5t618->regmap, RN5T618_REPCNT, RN5T618_REPCNT_REPWRON, 0); /* start power-off sequence */ - regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT, + regmap_update_bits(rn5t618->regmap, RN5T618_SLPCNT, RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF); + + return NOTIFY_DONE; } static int rn5t618_i2c_probe(struct i2c_client *i2c, @@ -85,23 +91,17 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c, return ret; } - if (!pm_power_off) { - rn5t618_pm_power_off = priv; - pm_power_off = rn5t618_power_off; - } + priv->poweroff_nb.notifier_call = rn5t618_power_off; + priv->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = devm_register_power_off_handler(&i2c->dev, &priv->poweroff_nb); + if (ret) + dev_warn(&i2c->dev, "Failed to register poweroff handler\n"); return 0; } static int rn5t618_i2c_remove(struct i2c_client *i2c) { - struct rn5t618 *priv = i2c_get_clientdata(i2c); - - if (priv == rn5t618_pm_power_off) { - rn5t618_pm_power_off = NULL; - pm_power_off = NULL; - } - mfd_remove_devices(&i2c->dev); return 0; } diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h index c72d534..3b0f0e6 100644 --- a/include/linux/mfd/rn5t618.h +++ b/include/linux/mfd/rn5t618.h @@ -14,6 +14,7 @@ #ifndef __LINUX_MFD_RN5T618_H #define __LINUX_MFD_RN5T618_H +#include #include #define RN5T618_LSIVER 0x00 @@ -223,6 +224,7 @@ enum { struct rn5t618 { struct regmap *regmap; + struct notifier_block poweroff_nb; }; #endif /* __LINUX_MFD_RN5T618_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 23/47] power/reset: gpio-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Other changes: Drop note that there can not be an additional instance of this driver. The original reason no longer applies, it should be obvious that there can only be one instance of the driver if static variables are used to reflect its state, and support for multiple instances can now be added easily if needed by avoiding static variables. Do not create an error message if another poweroff handler has already been registered. This is perfectly normal and acceptable. Drop remove function since it is no longer needed. Cc: Sebastian Reichel Cc: Dmitry Eremin-Solenikov Cc: David Woodhouse Acked-by: Andrew Lunn Signed-off-by: Guenter Roeck --- v2; - Use define to specify poweroff handler priority - Use devm_register_power_off_handler - Drop remove function as it is no longer needed drivers/power/reset/gpio-poweroff.c | 40 - 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index ce849bc..5d35f13 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c @@ -14,18 +14,18 @@ #include #include #include +#include +#include #include #include #include #include -/* - * Hold configuration here, cannot be more than one instance of the driver - * since pm_power_off itself is global. - */ static struct gpio_desc *reset_gpio; -static void gpio_poweroff_do_poweroff(void) +static int gpio_poweroff_do_poweroff(struct notifier_block *this, +unsigned long unused1, void *unused2) + { BUG_ON(!reset_gpio); @@ -43,19 +43,19 @@ static void gpio_poweroff_do_poweroff(void) mdelay(3000); WARN_ON(1); + + return NOTIFY_DONE; } +static struct notifier_block gpio_poweroff_nb = { + .notifier_call = gpio_poweroff_do_poweroff, + .priority = POWEROFF_PRIORITY_LOW, +}; + static int gpio_poweroff_probe(struct platform_device *pdev) { bool input = false; - - /* If a pm_power_off function has already been added, leave it alone */ - if (pm_power_off != NULL) { - dev_err(&pdev->dev, - "%s: pm_power_off function already registered", - __func__); - return -EBUSY; - } + int err; reset_gpio = devm_gpiod_get(&pdev->dev, NULL); if (IS_ERR(reset_gpio)) @@ -77,16 +77,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) } } - pm_power_off = &gpio_poweroff_do_poweroff; - return 0; -} - -static int gpio_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == &gpio_poweroff_do_poweroff) - pm_power_off = NULL; + err = devm_register_power_off_handler(&pdev->dev, &gpio_poweroff_nb); + if (err) + dev_err(&pdev->dev, "Failed to register poweroff handler\n"); - return 0; + return err; } static const struct of_device_id of_gpio_poweroff_match[] = { @@ -96,7 +91,6 @@ static const struct of_device_id of_gpio_poweroff_match[] = { static struct platform_driver gpio_poweroff_driver = { .probe = gpio_poweroff_probe, - .remove = gpio_poweroff_remove, .driver = { .name = "poweroff-gpio", .owner = THIS_MODULE, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 22/47] power/reset: restart-poweroff: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register as poweroff handler of last resort since the driver does not really power off the system but executes a restart. Drop remove function since it is no longer needed. Cc: Sebastian Reichel Cc: Dmitry Eremin-Solenikov Cc: David Woodhouse Acked-by: Andrew Lunn Signed-off-by: Guenter Roeck --- v2: - Use define to sepcify poweroff handler priority - Use devm_register_power_off_handler - Drop remove function since it is no longer needed drivers/power/reset/restart-poweroff.c | 33 + 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/power/reset/restart-poweroff.c b/drivers/power/reset/restart-poweroff.c index edd707e..e8f8e59 100644 --- a/drivers/power/reset/restart-poweroff.c +++ b/drivers/power/reset/restart-poweroff.c @@ -12,37 +12,31 @@ */ #include #include +#include #include #include #include +#include #include -#include -static void restart_poweroff_do_poweroff(void) +static int restart_poweroff_do_poweroff(struct notifier_block *this, + unsigned long unused1, void *unused2) { reboot_mode = REBOOT_HARD; machine_restart(NULL); -} - -static int restart_poweroff_probe(struct platform_device *pdev) -{ - /* If a pm_power_off function has already been added, leave it alone */ - if (pm_power_off != NULL) { - dev_err(&pdev->dev, - "pm_power_off function already registered"); - return -EBUSY; - } - pm_power_off = &restart_poweroff_do_poweroff; - return 0; + return NOTIFY_DONE; } -static int restart_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == &restart_poweroff_do_poweroff) - pm_power_off = NULL; +static struct notifier_block restart_power_off_handler = { + .notifier_call = restart_poweroff_do_poweroff, + .priority = POWEROFF_PRIORITY_FALLBACK, +}; - return 0; +static int restart_poweroff_probe(struct platform_device *pdev) +{ + return devm_register_power_off_handler(&pdev->dev, + &restart_power_off_handler); } static const struct of_device_id of_restart_poweroff_match[] = { @@ -52,7 +46,6 @@ static const struct of_device_id of_restart_poweroff_match[] = { static struct platform_driver restart_poweroff_driver = { .probe = restart_poweroff_probe, - .remove = restart_poweroff_remove, .driver = { .name = "poweroff-restart", .owner = THIS_MODULE, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 17/47] mfd: tps65910: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err drivers/mfd/tps65910.c | 27 ++- include/linux/mfd/tps65910.h | 3 +++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 7612d89..88ea108 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -437,19 +439,20 @@ struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, } #endif -static struct i2c_client *tps65910_i2c_client; -static void tps65910_power_off(void) +static int tps65910_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { - struct tps65910 *tps65910; - - tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); + struct tps65910 *tps65910 = container_of(this, struct tps65910, +poweroff_nb); if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, DEVCTRL_PWR_OFF_MASK) < 0) - return; + return NOTIFY_DONE; tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, DEVCTRL_DEV_ON_MASK); + + return NOTIFY_DONE; } static int tps65910_i2c_probe(struct i2c_client *i2c, @@ -505,9 +508,13 @@ static int tps65910_i2c_probe(struct i2c_client *i2c, tps65910_ck32k_init(tps65910, pmic_plat_data); tps65910_sleepinit(tps65910, pmic_plat_data); - if (pmic_plat_data->pm_off && !pm_power_off) { - tps65910_i2c_client = i2c; - pm_power_off = tps65910_power_off; + if (pmic_plat_data->pm_off) { + tps65910->poweroff_nb.notifier_call = tps65910_power_off; + tps65910->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = register_power_off_handler(&tps65910->poweroff_nb); + if (ret) + dev_warn(&i2c->dev, +"failed to register poweroff handler\n"); } ret = mfd_add_devices(tps65910->dev, -1, @@ -527,6 +534,8 @@ static int tps65910_i2c_remove(struct i2c_client *i2c) { struct tps65910 *tps65910 = i2c_get_clientdata(i2c); + unregister_power_off_handler(&tps65910->poweroff_nb); + tps65910_irq_exit(tps65910); mfd_remove_devices(tps65910->dev); diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 6483a6f..65cae2c 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -905,6 +905,9 @@ struct tps65910 { /* IRQ Handling */ int chip_irq; struct regmap_irq_chip_data *irq_data; + + /* Poweroff handling */ + struct notifier_block poweroff_nb; }; struct tps65910_platform_data { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 18/47] mfd: twl4030-power: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Make twl4030_power_off static as it is only called from the twl4030-power driver. Drop remove function as it is no longer needed. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err - Use devm_register_power_off_handler - Drop remove function as it is no longer needed. drivers/mfd/twl4030-power.c | 29 +++-- include/linux/i2c/twl.h | 1 - 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index cf92a6d..85e4aa4 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -25,9 +25,10 @@ */ #include -#include +#include #include #include +#include #include #include @@ -611,7 +612,8 @@ twl4030_power_configure_resources(const struct twl4030_power_data *pdata) * After a successful execution, TWL shuts down the power to the SoC * and all peripherals connected to it. */ -void twl4030_power_off(void) +static int twl4030_power_off(struct notifier_block *this, unsigned long unused1, +void *unused2) { int err; @@ -619,8 +621,15 @@ void twl4030_power_off(void) TWL4030_PM_MASTER_P1_SW_EVENTS); if (err) pr_err("TWL4030 Unable to power off\n"); + + return NOTIFY_DONE; } +static struct notifier_block twl4030_poweroff_nb = { + .notifier_call = twl4030_power_off, + .priority = POWEROFF_PRIORITY_LOW, +}; + static bool twl4030_power_use_poweroff(const struct twl4030_power_data *pdata, struct device_node *node) { @@ -839,7 +848,9 @@ static int twl4030_power_probe(struct platform_device *pdev) } /* Board has to be wired properly to use this feature */ - if (twl4030_power_use_poweroff(pdata, node) && !pm_power_off) { + if (twl4030_power_use_poweroff(pdata, node)) { + int ret; + /* Default for SEQ_OFFSYNC is set, lets ensure this */ err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val, TWL4030_PM_MASTER_CFG_P123_TRANSITION); @@ -856,7 +867,11 @@ static int twl4030_power_probe(struct platform_device *pdev) } } - pm_power_off = twl4030_power_off; + ret = devm_register_power_off_handler(&pdev->dev, + &twl4030_poweroff_nb); + if (ret) + dev_warn(&pdev->dev, +"Failed to register poweroff handler\n"); } relock: @@ -870,11 +885,6 @@ relock: return err; } -static int twl4030_power_remove(struct platform_device *pdev) -{ - return 0; -} - static struct platform_driver twl4030_power_driver = { .driver = { .name = "twl4030_power", @@ -882,7 +892,6 @@ static struct platform_driver twl4030_power_driver = { .of_match_table = of_match_ptr(twl4030_power_of_match), }, .probe = twl4030_power_probe, - .remove = twl4030_power_remove, }; module_platform_driver(twl4030_power_driver); diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 8cfb50f..f8544f1 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -680,7 +680,6 @@ struct twl4030_power_data { }; extern int twl4030_remove_script(u8 flags); -extern void twl4030_power_off(void); struct twl4030_codec_data { unsigned int digimic_delay; /* in ms */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 13/47] mfd: max8907: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Note that this patch fixes a problem on driver unload as side effect: The old code did not restore or clean up pm_power_off on remove, meaning the pointer was left in an undefined state. Cc: Lee Jones Cc: Samuel Ortiz Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err drivers/mfd/max8907.c | 24 ++-- include/linux/mfd/max8907.h | 2 ++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c index 232749c..daacdbc 100644 --- a/drivers/mfd/max8907.c +++ b/drivers/mfd/max8907.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -177,11 +178,16 @@ static const struct regmap_irq_chip max8907_rtc_irq_chip = { .num_irqs = ARRAY_SIZE(max8907_rtc_irqs), }; -static struct max8907 *max8907_pm_off; -static void max8907_power_off(void) +static int max8907_power_off(struct notifier_block *this, unsigned long unused1, +void *unused2) { - regmap_update_bits(max8907_pm_off->regmap_gen, MAX8907_REG_RESET_CNFG, + struct max8907 *max8907 = container_of(this, struct max8907, + poweroff_nb); + + regmap_update_bits(max8907->regmap_gen, MAX8907_REG_RESET_CNFG, MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF); + + return NOTIFY_DONE; } static int max8907_i2c_probe(struct i2c_client *i2c, @@ -267,9 +273,13 @@ static int max8907_i2c_probe(struct i2c_client *i2c, goto err_add_devices; } - if (pm_off && !pm_power_off) { - max8907_pm_off = max8907; - pm_power_off = max8907_power_off; + if (pm_off) { + max8907->poweroff_nb.notifier_call = max8907_power_off; + max8907->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = register_power_off_handler(&max8907->poweroff_nb); + if (ret) + dev_warn(&i2c->dev, +"Failed to register poweroff handler"); } return 0; @@ -293,6 +303,8 @@ static int max8907_i2c_remove(struct i2c_client *i2c) { struct max8907 *max8907 = i2c_get_clientdata(i2c); + unregister_power_off_handler(&max8907->poweroff_nb); + mfd_remove_devices(max8907->dev); regmap_del_irq_chip(max8907->i2c_gen->irq, max8907->irqc_rtc); diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h index b06f7a6..016428e 100644 --- a/include/linux/mfd/max8907.h +++ b/include/linux/mfd/max8907.h @@ -13,6 +13,7 @@ #define __LINUX_MFD_MAX8907_H #include +#include #include #define MAX8907_GEN_I2C_ADDR (0x78 >> 1) @@ -247,6 +248,7 @@ struct max8907 { struct regmap_irq_chip_data *irqc_chg; struct regmap_irq_chip_data *irqc_on_off; struct regmap_irq_chip_data *irqc_rtc; + struct notifier_block poweroff_nb; }; #endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 16/47] mfd: tps6586x: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err drivers/mfd/tps6586x.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 8e1dbc4..01c2714 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -21,10 +21,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -133,6 +135,8 @@ struct tps6586x { u32 irq_en; u8 mask_reg[5]; struct irq_domain *irq_domain; + + struct notifier_block poweroff_nb; }; static inline struct tps6586x *dev_to_tps6586x(struct device *dev) @@ -472,13 +476,18 @@ static const struct regmap_config tps6586x_regmap_config = { .cache_type = REGCACHE_RBTREE, }; -static struct device *tps6586x_dev; -static void tps6586x_power_off(void) +static int tps6586x_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { - if (tps6586x_clr_bits(tps6586x_dev, TPS6586X_SUPPLYENE, EXITSLREQ_BIT)) - return; + struct tps6586x *tps6586x = container_of(this, struct tps6586x, +poweroff_nb); + + if (tps6586x_clr_bits(tps6586x->dev, TPS6586X_SUPPLYENE, EXITSLREQ_BIT)) + return NOTIFY_DONE; - tps6586x_set_bits(tps6586x_dev, TPS6586X_SUPPLYENE, SLEEP_MODE_BIT); + tps6586x_set_bits(tps6586x->dev, TPS6586X_SUPPLYENE, SLEEP_MODE_BIT); + + return NOTIFY_DONE; } static void tps6586x_print_version(struct i2c_client *client, int version) @@ -575,9 +584,13 @@ static int tps6586x_i2c_probe(struct i2c_client *client, goto err_add_devs; } - if (pdata->pm_off && !pm_power_off) { - tps6586x_dev = &client->dev; - pm_power_off = tps6586x_power_off; + if (pdata->pm_off) { + tps6586x->poweroff_nb.notifier_call = tps6586x_power_off; + tps6586x->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = register_power_off_handler(&tps6586x->poweroff_nb); + if (ret) + dev_warn(&client->dev, +"failed to register poweroff handler\n"); } return 0; @@ -594,6 +607,8 @@ static int tps6586x_i2c_remove(struct i2c_client *client) { struct tps6586x *tps6586x = i2c_get_clientdata(client); + unregister_power_off_handler(&tps6586x->poweroff_nb); + tps6586x_remove_subdevs(tps6586x); mfd_remove_devices(tps6586x->dev); if (client->irq) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 15/47] mfd: dm355evm_msp: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err drivers/mfd/dm355evm_msp.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c index 4c826f7..3ec49a7 100644 --- a/drivers/mfd/dm355evm_msp.c +++ b/drivers/mfd/dm355evm_msp.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -352,14 +354,22 @@ static void dm355evm_command(unsigned command) command, status); } -static void dm355evm_power_off(void) +static int dm355evm_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { dm355evm_command(MSP_COMMAND_POWEROFF); + + return NOTIFY_DONE; } +static struct notifier_block dm355evm_msp_poweroff_nb = { + .notifier_call = dm355evm_power_off, + .priority = POWEROFF_PRIORITY_LOW, +}; + static int dm355evm_msp_remove(struct i2c_client *client) { - pm_power_off = NULL; + unregister_power_off_handler(&dm355evm_msp_poweroff_nb); msp430 = NULL; return 0; } @@ -398,7 +408,9 @@ dm355evm_msp_probe(struct i2c_client *client, const struct i2c_device_id *id) goto fail; /* PM hookup */ - pm_power_off = dm355evm_power_off; + status = register_power_off_handler(&dm355evm_msp_poweroff_nb); + if (status) + dev_warn(&client->dev, "Failed to register poweroff handler\n"); return 0; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 12/47] mfd: ab8500-sysctrl: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. sysctrl_dev is set prior to poweroff handler registration, and the poweroff handler is unregistered prior to clearing sysrctrl_dev. It is therefore not necessary to check if sysctrl_dev is NULL in the poweroff handler, and the check was removed. Setting sysctrl_dev to NULL in the remove function was also removed as unnecessary. With those changes, devm_register_power_off_handler can be used to register the poeroff handler. The now empty remove function was retained since the ab8500_restart function, which is currently unused, would likely need some cleanup if it was ever used. Cc: Linus Walleij Cc: Lee Jones Cc: Samuel Ortiz Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use devm_register_power_off_handler - Use dev_warn instead of dev_err - Since we use devm_register_power_off_handler, we need to check if sysctrl_dev in the poweroff handler to avoid a race condition on unload, so this check is no longer removed drivers/mfd/ab8500-sysctrl.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c index 8e0dae5..dc634d5 100644 --- a/drivers/mfd/ab8500-sysctrl.c +++ b/drivers/mfd/ab8500-sysctrl.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -23,7 +24,8 @@ static struct device *sysctrl_dev; -static void ab8500_power_off(void) +static int ab8500_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { sigset_t old; sigset_t all; @@ -36,7 +38,7 @@ static void ab8500_power_off(void) if (sysctrl_dev == NULL) { pr_err("%s: sysctrl not initialized\n", __func__); - return; + return NOTIFY_DONE; } /* @@ -83,8 +85,15 @@ shutdown: AB8500_STW4500CTRL1_SWRESET4500N); (void)sigprocmask(SIG_SETMASK, &old, NULL); } + + return NOTIFY_DONE; } +static struct notifier_block ab8500_poweroff_nb = { + .notifier_call = ab8500_power_off, + .priority = POWEROFF_PRIORITY_LOW, +}; + /* * Use the AB WD to reset the platform. It will perform a hard * reset instead of a soft reset. Write the reset reason to @@ -185,6 +194,7 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev) struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); struct ab8500_platform_data *plat; struct ab8500_sysctrl_platform_data *pdata; + int err; plat = dev_get_platdata(pdev->dev.parent); @@ -193,8 +203,9 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev) sysctrl_dev = &pdev->dev; - if (!pm_power_off) - pm_power_off = ab8500_power_off; + err = devm_register_power_off_handler(sysctrl_dev, &ab8500_poweroff_nb); + if (err) + dev_warn(&pdev->dev, "Failed to register poweroff handler\n"); pdata = plat->sysctrl; if (pdata) { @@ -228,9 +239,6 @@ static int ab8500_sysctrl_remove(struct platform_device *pdev) { sysctrl_dev = NULL; - if (pm_power_off == ab8500_power_off) - pm_power_off = NULL; - return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 14/47] mfd: tps80031: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use dev_warn instead of dev_err drivers/mfd/tps80031.c | 30 ++ include/linux/mfd/tps80031.h | 2 ++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c index ed6c5b0..926c62a 100644 --- a/drivers/mfd/tps80031.c +++ b/drivers/mfd/tps80031.c @@ -147,7 +147,6 @@ static const struct tps80031_pupd_data tps80031_pupds[] = { [TPS80031_CTLI2C_SCL] = PUPD_DATA(4, 0, BIT(2)), [TPS80031_CTLI2C_SDA] = PUPD_DATA(4, 0, BIT(3)), }; -static struct tps80031 *tps80031_power_off_dev; int tps80031_ext_power_req_config(struct device *dev, unsigned long ext_ctrl_flag, int preq_bit, @@ -209,11 +208,17 @@ int tps80031_ext_power_req_config(struct device *dev, } EXPORT_SYMBOL_GPL(tps80031_ext_power_req_config); -static void tps80031_power_off(void) +static int tps80031_power_off(struct notifier_block *this, + unsigned long unused1, void *unused2) { - dev_info(tps80031_power_off_dev->dev, "switching off PMU\n"); - tps80031_write(tps80031_power_off_dev->dev, TPS80031_SLAVE_ID1, - TPS80031_PHOENIX_DEV_ON, TPS80031_DEVOFF); + struct tps80031 *tps80031 = container_of(this, struct tps80031, +poweroff_nb); + + dev_info(tps80031->dev, "switching off PMU\n"); + tps80031_write(tps80031->dev, TPS80031_SLAVE_ID1, + TPS80031_PHOENIX_DEV_ON, TPS80031_DEVOFF); + + return NOTIFY_DONE; } static void tps80031_pupd_init(struct tps80031 *tps80031, @@ -501,9 +506,13 @@ static int tps80031_probe(struct i2c_client *client, goto fail_mfd_add; } - if (pdata->use_power_off && !pm_power_off) { - tps80031_power_off_dev = tps80031; - pm_power_off = tps80031_power_off; + if (pdata->use_power_off) { + tps80031->poweroff_nb.notifier_call = tps80031_power_off; + tps80031->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = register_power_off_handler(&tps80031->poweroff_nb); + if (ret) + dev_warn(&client->dev, +"Failed to register poweroff handler\n"); } return 0; @@ -523,10 +532,7 @@ static int tps80031_remove(struct i2c_client *client) struct tps80031 *tps80031 = i2c_get_clientdata(client); int i; - if (tps80031_power_off_dev == tps80031) { - tps80031_power_off_dev = NULL; - pm_power_off = NULL; - } + unregister_power_off_handler(&tps80031->poweroff_nb); mfd_remove_devices(tps80031->dev); diff --git a/include/linux/mfd/tps80031.h b/include/linux/mfd/tps80031.h index 2c75c9c..49bc006 100644 --- a/include/linux/mfd/tps80031.h +++ b/include/linux/mfd/tps80031.h @@ -24,6 +24,7 @@ #define __LINUX_MFD_TPS80031_H #include +#include #include /* Pull-ups/Pull-downs */ @@ -513,6 +514,7 @@ struct tps80031 { struct i2c_client *clients[TPS80031_NUM_SLAVES]; struct regmap *regmap[TPS80031_NUM_SLAVES]; struct regmap_irq_chip_data *irq_data; + struct notifier_block poweroff_nb; }; struct tps80031_pupd_init_data { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 11/47] mfd: retu: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Lee Jones Cc: Samuel Ortiz Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use devm_register_power_off_handler - Use dev_warn instead of dev_err drivers/mfd/retu-mfd.c | 33 +++-- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c index 663f8a3..3c720cb 100644 --- a/drivers/mfd/retu-mfd.c +++ b/drivers/mfd/retu-mfd.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -43,6 +45,7 @@ struct retu_dev { struct device *dev; struct mutexmutex; struct regmap_irq_chip_data *irq_data; + struct notifier_block poweroff_nb; }; static struct resource retu_pwrbutton_res[] = { @@ -81,9 +84,6 @@ static struct regmap_irq_chip retu_irq_chip = { .ack_base = RETU_REG_IDR, }; -/* Retu device registered for the power off. */ -static struct retu_dev *retu_pm_power_off; - static struct resource tahvo_usb_res[] = { { .name = "tahvo-usb", @@ -165,12 +165,14 @@ int retu_write(struct retu_dev *rdev, u8 reg, u16 data) } EXPORT_SYMBOL_GPL(retu_write); -static void retu_power_off(void) +static int retu_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { - struct retu_dev *rdev = retu_pm_power_off; + struct retu_dev *rdev = container_of(this, struct retu_dev, +poweroff_nb); int reg; - mutex_lock(&retu_pm_power_off->mutex); + mutex_lock(&rdev->mutex); /* Ignore power button state */ regmap_read(rdev->regmap, RETU_REG_CC1, ®); @@ -183,7 +185,9 @@ static void retu_power_off(void) for (;;) cpu_relax(); - mutex_unlock(&retu_pm_power_off->mutex); + mutex_unlock(&rdev->mutex); + + return NOTIFY_DONE; } static int retu_regmap_read(void *context, const void *reg, size_t reg_size, @@ -279,9 +283,14 @@ static int retu_probe(struct i2c_client *i2c, const struct i2c_device_id *id) return ret; } - if (i2c->addr == 1 && !pm_power_off) { - retu_pm_power_off = rdev; - pm_power_off = retu_power_off; + if (i2c->addr == 1) { + rdev->poweroff_nb.notifier_call = retu_power_off; + rdev->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = devm_register_power_off_handler(rdev->dev, + &rdev->poweroff_nb); + if (ret) + dev_warn(rdev->dev, +"Failed to register poweroff handler\n"); } return 0; @@ -291,10 +300,6 @@ static int retu_remove(struct i2c_client *i2c) { struct retu_dev *rdev = i2c_get_clientdata(i2c); - if (retu_pm_power_off == rdev) { - pm_power_off = NULL; - retu_pm_power_off = NULL; - } mfd_remove_devices(rdev->dev); regmap_del_irq_chip(i2c->irq, rdev->irq_data); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 08/47] kernel: Move pm_power_off to common code
pm_power_off is defined for all architectures. Move it to common code. Have all architectures call do_kernel_power_off instead of pm_power_off. Some architectures point pm_power_off to machine_power_off. For those, call do_kernel_power_off from machine_power_off instead. Acked-by: David Vrabel Acked-by: Geert Uytterhoeven Acked-by: Hirokazu Takata Acked-by: Jesper Nilsson Acked-by: Max Filippov Acked-by: Rafael J. Wysocki Acked-by: Richard Weinberger Acked-by: Xuetao Guan Signed-off-by: Guenter Roeck --- v2: - do_kernel_poweroff -> do_kernel_power_off - have_kernel_poweroff -> have_kernel_power_off arch/alpha/kernel/process.c| 9 +++-- arch/arc/kernel/reset.c| 5 + arch/arm/kernel/process.c | 5 + arch/arm64/kernel/process.c| 5 + arch/avr32/kernel/process.c| 6 +- arch/blackfin/kernel/process.c | 3 --- arch/blackfin/kernel/reboot.c | 2 ++ arch/c6x/kernel/process.c | 9 + arch/cris/kernel/process.c | 4 +--- arch/frv/kernel/process.c | 5 ++--- arch/hexagon/kernel/reset.c| 5 ++--- arch/ia64/kernel/process.c | 5 + arch/m32r/kernel/process.c | 8 arch/m68k/kernel/process.c | 6 +- arch/metag/kernel/process.c| 6 +- arch/microblaze/kernel/process.c | 3 --- arch/microblaze/kernel/reset.c | 1 + arch/mips/kernel/reset.c | 6 +- arch/mn10300/kernel/process.c | 8 ++-- arch/openrisc/kernel/process.c | 8 +--- arch/parisc/kernel/process.c | 8 arch/powerpc/kernel/setup-common.c | 6 +++--- arch/s390/kernel/setup.c | 8 ++-- arch/score/kernel/process.c| 8 arch/sh/kernel/reboot.c| 6 +- arch/sparc/kernel/process_32.c | 10 ++ arch/sparc/kernel/reboot.c | 8 ++-- arch/tile/kernel/reboot.c | 7 +++ arch/um/kernel/reboot.c| 2 -- arch/unicore32/kernel/process.c| 9 + arch/x86/kernel/reboot.c | 11 +++ arch/x86/xen/enlighten.c | 3 +-- arch/xtensa/kernel/process.c | 4 drivers/parisc/power.c | 3 +-- kernel/power/poweroff_handler.c| 8 kernel/reboot.c| 4 ++-- 36 files changed, 68 insertions(+), 146 deletions(-) diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 1941a07..81c43f8 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -40,12 +41,6 @@ #include "proto.h" #include "pci_impl.h" -/* - * Power off function, if any - */ -void (*pm_power_off)(void) = machine_power_off; -EXPORT_SYMBOL(pm_power_off); - #ifdef CONFIG_ALPHA_WTINT /* * Sleep the CPU. @@ -184,6 +179,8 @@ machine_halt(void) void machine_power_off(void) { + do_kernel_power_off(); + common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL); } diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c index 2768fa1..0758d9d 100644 --- a/arch/arc/kernel/reset.c +++ b/arch/arc/kernel/reset.c @@ -26,9 +26,6 @@ void machine_restart(char *__unused) void machine_power_off(void) { - /* FIXME :: power off ??? */ + do_kernel_power_off(); machine_halt(); } - -void (*pm_power_off) (void) = NULL; -EXPORT_SYMBOL(pm_power_off); diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index fe972a2..aa3f656 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -117,8 +117,6 @@ void soft_restart(unsigned long addr) /* * Function pointers to optional machine specific functions */ -void (*pm_power_off)(void); -EXPORT_SYMBOL(pm_power_off); void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); @@ -205,8 +203,7 @@ void machine_power_off(void) local_irq_disable(); smp_send_stop(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } /* diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index c3065db..46a483a 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -68,8 +68,6 @@ void soft_restart(unsigned long addr) /* * Function pointers to optional machine specific functions */ -void (*pm_power_off)(void); -EXPORT_SYMBOL_GPL(pm_power_off); void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); @@ -129,8 +127,7 @@ void machine_power_off(void) { local_irq_disable(); smp_send_stop(); - if (pm_power_off) - pm_power_off(); + do_kernel_power_off(); } /* diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c index 42a53e74..529c1f6 100644 --- a/arch/avr32/kernel/process.c +++ b/arch/avr32/kernel/process.c @@ -23,9 +23,6 @@ #include -void (*pm_power_off)(void); -EXPORT_SYMBOL(pm_power_of
[PATCH v2 10/47] mfd: axp20x: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with a low priority value of 64 to reflect that the original code only sets pm_power_off if it was not already set. Cc: Lee Jones Cc: Samuel Ortiz Signed-off-by: Guenter Roeck --- v2: - Use define to specify powroff handler priority - Use devm_register_power_off_handler - Use dev_warn instead of dev_err drivers/mfd/axp20x.c | 30 -- include/linux/mfd/axp20x.h | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 6231adb..9e6406c 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -17,7 +17,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -150,11 +151,16 @@ static struct mfd_cell axp20x_cells[] = { }, }; -static struct axp20x_dev *axp20x_pm_power_off; -static void axp20x_power_off(void) +static int axp20x_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) + { - regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, -AXP20X_OFF); + struct axp20x_dev *axp20x = container_of(this, struct axp20x_dev, +poweroff_nb); + + regmap_write(axp20x->regmap, AXP20X_OFF_CTRL, AXP20X_OFF); + + return NOTIFY_DONE; } static int axp20x_i2c_probe(struct i2c_client *i2c, @@ -204,10 +210,11 @@ static int axp20x_i2c_probe(struct i2c_client *i2c, return ret; } - if (!pm_power_off) { - axp20x_pm_power_off = axp20x; - pm_power_off = axp20x_power_off; - } + axp20x->poweroff_nb.notifier_call = axp20x_power_off; + axp20x->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret = devm_register_power_off_handler(&i2c->dev, &axp20x->poweroff_nb); + if (ret) + dev_warn(&i2c->dev, "failed to register poweroff handler\n"); dev_info(&i2c->dev, "AXP20X driver loaded\n"); @@ -218,11 +225,6 @@ static int axp20x_i2c_remove(struct i2c_client *i2c) { struct axp20x_dev *axp20x = i2c_get_clientdata(i2c); - if (axp20x == axp20x_pm_power_off) { - axp20x_pm_power_off = NULL; - pm_power_off = NULL; - } - mfd_remove_devices(axp20x->dev); regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc); diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index d0e31a2..8f23b39 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -175,6 +175,7 @@ struct axp20x_dev { struct regmap *regmap; struct regmap_irq_chip_data *regmap_irqc; longvariant; + struct notifier_block poweroff_nb; }; #endif /* __LINUX_MFD_AXP20X_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 09/47] mfd: palmas: Register with kernel poweroff handler
Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority to reflect that the original code only sets pm_power_off if it was not already set. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Guenter Roeck --- v2: - Use define to specify poweroff handler priority - Use devm_register_power_off_handler - Use dev_warn instead of dev_err drivers/mfd/palmas.c | 31 +-- include/linux/mfd/palmas.h | 3 +++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 28cb048..2fda979 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -425,20 +426,18 @@ static void palmas_dt_to_pdata(struct i2c_client *i2c, "ti,system-power-controller"); } -static struct palmas *palmas_dev; -static void palmas_power_off(void) +static int palmas_power_off(struct notifier_block *this, unsigned long unused1, + void *unused2) { + struct palmas *palmas = container_of(this, struct palmas, poweroff_nb); unsigned int addr; int ret, slave; - if (!palmas_dev) - return; - slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE); addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL); ret = regmap_update_bits( - palmas_dev->regmap[slave], + palmas->regmap[slave], addr, PALMAS_DEV_CTRL_DEV_ON, 0); @@ -446,6 +445,8 @@ static void palmas_power_off(void) if (ret) pr_err("%s: Unable to write to DEV_CTRL_DEV_ON: %d\n", __func__, ret); + + return NOTIFY_DONE; } static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST; @@ -668,9 +669,16 @@ no_irq: ret = of_platform_populate(node, NULL, NULL, &i2c->dev); if (ret < 0) { goto err_irq; - } else if (pdata->pm_off && !pm_power_off) { - palmas_dev = palmas; - pm_power_off = palmas_power_off; + } else if (pdata->pm_off) { + int ret2; + + palmas->poweroff_nb.notifier_call = palmas_power_off; + palmas->poweroff_nb.priority = POWEROFF_PRIORITY_LOW; + ret2 = devm_register_power_off_handler(palmas->dev, + &palmas->poweroff_nb); + if (ret2) + dev_warn(palmas->dev, +"Failed to register poweroff handler"); } } @@ -698,11 +706,6 @@ static int palmas_i2c_remove(struct i2c_client *i2c) i2c_unregister_device(palmas->i2c_clients[i]); } - if (palmas == palmas_dev) { - pm_power_off = NULL; - palmas_dev = NULL; - } - return 0; } diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index fb0390a..4715057 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -68,6 +69,8 @@ struct palmas { struct i2c_client *i2c_clients[PALMAS_NUM_CLIENTS]; struct regmap *regmap[PALMAS_NUM_CLIENTS]; + struct notifier_block poweroff_nb; + /* Stored chip id */ int id; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 05/47] mfd: as3722: Drop reference to pm_power_off from devicetree bindings
Devicetree bindings are supposed to be operating system independent and should thus not describe how a specific functionality is implemented in Linux. Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Acked-by: Mark Rutland Signed-off-by: Guenter Roeck --- v2: No change Documentation/devicetree/bindings/mfd/as3722.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/as3722.txt b/Documentation/devicetree/bindings/mfd/as3722.txt index 4f64b2a..0b2a609 100644 --- a/Documentation/devicetree/bindings/mfd/as3722.txt +++ b/Documentation/devicetree/bindings/mfd/as3722.txt @@ -122,8 +122,7 @@ Following are properties of regulator subnode. Power-off: = -AS3722 supports the system power off by turning off all its rail. This -is provided through pm_power_off. +AS3722 supports the system power off by turning off all its rails. The device node should have the following properties to enable this functionality ams,system-power-controller: Boolean, to enable the power off functionality -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 07/47] qnap-poweroff: Drop reference to pm_power_off from devicetree bindings
Replace reference to pm_power_off (which is an implementation detail) and replace it with a more generic description of the driver's functionality. Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Acked-by: Mark Rutland Acked-by: Andrew Lunn Signed-off-by: Guenter Roeck --- v2: Drop implementation details Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt index af25e77..c363d71 100644 --- a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt +++ b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt @@ -3,8 +3,7 @@ QNAP NAS devices have a microcontroller controlling the main power supply. This microcontroller is connected to UART1 of the Kirkwood and Orion5x SoCs. Sending the character 'A', at 19200 baud, tells the -microcontroller to turn the power off. This driver adds a handler to -pm_power_off which is called to turn the power off. +microcontroller to turn the power off. Synology NAS devices use a similar scheme, but a different baud rate, 9600, and a different character, '1'. -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 02/47] memory: emif: Use API function to determine poweroff capability
Use have_kernel_power_off() to determine if the kernel is able to power off the system. Cc: Santosh Shilimkar Signed-off-by: Guenter Roeck --- v2: - poweroff -> power_off drivers/memory/emif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 04644e7..874403a 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -1053,10 +1053,10 @@ static irqreturn_t emif_threaded_isr(int irq, void *dev_id) dev_emerg(emif->dev, "SDRAM temperature exceeds operating limit.. Needs shut down!!!\n"); /* If we have Power OFF ability, use it, else try restarting */ - if (pm_power_off) { + if (have_kernel_power_off()) { kernel_power_off(); } else { - WARN(1, "FIXME: NO pm_power_off!!! trying restart\n"); + WARN(1, "FIXME: NO kernel poweroff capability!!! trying restart\n"); kernel_restart("SDRAM Over-temp Emergency restart"); } return IRQ_HANDLED; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 04/47] m68k: Replace mach_power_off with pm_power_off
Replace mach_power_off with pm_power_off to simplify the subsequent move of pm_power_off to generic code. Cc: Geert Uytterhoeven Cc: Greg Ungerer Cc: Joshua Thompson Acked-by: Geert Uytterhoeven Signed-off-by: Guenter Roeck --- v2: - have_kernel_poweroff -> have_kernel_power_off arch/m68k/emu/natfeat.c | 3 ++- arch/m68k/include/asm/machdep.h | 1 - arch/m68k/kernel/process.c | 5 +++-- arch/m68k/kernel/setup_mm.c | 1 - arch/m68k/kernel/setup_no.c | 1 - arch/m68k/mac/config.c | 3 ++- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c index 71b78ec..91e2ae7 100644 --- a/arch/m68k/emu/natfeat.c +++ b/arch/m68k/emu/natfeat.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -90,5 +91,5 @@ void __init nf_init(void) pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16, version & 0x); - mach_power_off = nf_poweroff; + pm_power_off = nf_poweroff; } diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h index 953ca21..f9fac51 100644 --- a/arch/m68k/include/asm/machdep.h +++ b/arch/m68k/include/asm/machdep.h @@ -24,7 +24,6 @@ extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); extern int (*mach_set_clock_mmss)(unsigned long); extern void (*mach_reset)( void ); extern void (*mach_halt)( void ); -extern void (*mach_power_off)( void ); extern unsigned long (*mach_hd_init) (unsigned long, unsigned long); extern void (*mach_hd_setup)(char *, int *); extern long mach_max_dma_address; diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index c55ff71..afe3d6e 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -77,8 +78,8 @@ void machine_halt(void) void machine_power_off(void) { - if (mach_power_off) - mach_power_off(); + if (pm_power_off) + pm_power_off(); for (;;); } diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 5b8ec4d..002fea6 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -96,7 +96,6 @@ EXPORT_SYMBOL(mach_get_rtc_pll); EXPORT_SYMBOL(mach_set_rtc_pll); void (*mach_reset)( void ); void (*mach_halt)( void ); -void (*mach_power_off)( void ); long mach_max_dma_address = 0x00ff; /* default set to the lower 16MB */ #ifdef CONFIG_HEARTBEAT void (*mach_heartbeat) (int); diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 88c27d9..1520156 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -55,7 +55,6 @@ int (*mach_hwclk) (int, struct rtc_time*); /* machine dependent reboot functions */ void (*mach_reset)(void); void (*mach_halt)(void); -void (*mach_power_off)(void); #ifdef CONFIG_M68000 #if defined(CONFIG_M68328) diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index a471eab..677913ff 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -16,6 +16,7 @@ #include #include #include +#include /* keyb */ #include #include @@ -159,7 +160,7 @@ void __init config_mac(void) mach_set_clock_mmss = mac_set_clock_mmss; mach_reset = mac_reset; mach_halt = mac_poweroff; - mach_power_off = mac_poweroff; + pm_power_off = mac_poweroff; mach_max_dma_address = 0x; #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) mach_beep = mac_mksound; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] i8k: Ignore temperature sensors which report invalid values
On 10/20/2014 09:46 AM, Pali Rohár wrote: Ok, I will describe my problem. Guenter, maybe you can find another solution/fix for it. Calling i8k_get_temp(3) on my laptop without I8K_TEMPERATURE_BUG always returns value 193 (which is above I8K_MAX_TEMP). When I8K_TEMPERATURE_BUG is enabled (by default) then i8k_get_temp(3) returns value from prev[3] and store new value I8K_TEMPERATURE_BUG to prev[3]. Value in prev[3] is initialized to 0. What I want to achieve is: when i8k_get_temp() for particular sensor id always returns invalid value (> I8K_MAX_TEMP) then we should totally ignore sensor with that id and do not export it via hwmon. My solution is: initialize prev[id] to I8K_MAX_TEMP, so on invalid data first call to i8k_get_temp(id) returns I8K_MAX_TEMP. Then in i8k_init_hwmon check if value is < I8K_MAX_TEMP and if not ignore sensor id. Guenter, it is clear now? Are you ok that we should ignore sensor if always report value above I8K_MAX_TEMP? If you do not like my solution/patch for it, can you specify how other can it be fixed? I still don't see the point in initializing prev[]. Yes, I am ok with ignoring sensor values if the reported temperature is above I8K_MAX_TEMP. I am just not sure if we should check against I8K_MAX_TEMP or against, say, 192. Reason is that we do know that the sensor can erroneously return 0x99 on some systems once in a while. We would not want to ignore those sensors just because they happen to report 0x99 during initialization. So maybe make it if (err >= 0 && err < 192) and add a note before the first if(), explaining that higher values suggest that there is no sensor attached. Thanks, Guenter On Sunday 19 October 2014 17:13:29 Guenter Roeck wrote: On 10/19/2014 07:46 AM, Pali Rohár wrote: On some machines some temperature sensors report too high values which are What is "too high", and what is "some machines" ? Would be great if you can be more specific. invalid. When value is invalid function i8k_get_temp() returns previous value and at next call it returns I8K_MAX_TEMP. With this patch also firt i8k_get_temp() call returns I8K_MAX_TEMP and fix ? Also, I am not entirely sure I understand what exactly you are fixing here. i8k_init_hwmon() will ignore all sensor ids which report incorrect values. Signed-off-by: Pali Rohár --- drivers/char/i8k.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 7272b08..bc327fa 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c @@ -298,7 +298,7 @@ static int i8k_get_temp(int sensor) int temp; #ifdef I8K_TEMPERATURE_BUG - static int prev[4]; + static int prev[4] = { I8K_MAX_TEMP, I8K_MAX_TEMP, I8K_MAX_TEMP, I8K_MAX_TEMP }; I am not sure I understand what this change is expected to accomplish. Please explain. #endif regs.ebx = sensor & 0xff; rc = i8k_smm(®s); @@ -610,17 +610,17 @@ static int __init i8k_init_hwmon(void) /* CPU temperature attributes, if temperature reading is OK */ err = i8k_get_temp(0); - if (err >= 0) + if (err >= 0 && err < I8K_MAX_TEMP) I8K_MAX_TEMP is, at least in theory, a valid temperature, so this should be "<=". It would be important to understand what the "too high" temperature is to possibly be able to distinguish it from the buggy temperature that the code is trying to fix. Thanks, Guenter i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP1; /* check for additional temperature sensors */ err = i8k_get_temp(1); - if (err >= 0) + if (err >= 0 && err < I8K_MAX_TEMP) i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP2; err = i8k_get_temp(2); - if (err >= 0) + if (err >= 0 && err < I8K_MAX_TEMP) i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP3; err = i8k_get_temp(3); - if (err >= 0) + if (err >= 0 && err < I8K_MAX_TEMP) i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP4; /* Left fan attributes, if left fan is present */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 01/47] kernel: Add support for poweroff handler call chain
Various drivers implement architecture and/or device specific means to remove power from the system. For the most part, those drivers set the global variable pm_power_off to point to a function within the driver. This mechanism has a number of drawbacks. Typically only one scheme to remove power is supported (at least if pm_power_off is used). At least in theory there can be multiple means remove power, some of which may be less desirable. For example, some mechanisms may only power off the CPU or the CPU card, while another may power off the entire system. Others may really just execute a restart sequence or drop into the ROM monitor. Using pm_power_off can also be racy if the function pointer is set from a driver built as module, as the driver may be in the process of being unloaded when pm_power_off is called. If there are multiple poweroff handlers in the system, removing a module with such a handler may inadvertently reset the pointer to pm_power_off to NULL, leaving the system with no means to remove power. Introduce a system poweroff handler call chain to solve the described problems. This call chain is expected to be executed from the architecture specific machine_power_off() function. Drivers providing system poweroff functionality are expected to register with this call chain. By using the priority field in the notifier block, callers can control poweroff handler execution sequence and thus ensure that the poweroff handler with the optimal capabilities to remove power for a given system is called first. Cc: Alan Cox Cc: Alexander Graf Cc: Andrew Morton Cc: Geert Uytterhoeven cc: Heiko Stuebner Cc: Lee Jones Cc: Len Brown Cc: Pavel Machek Cc: Philippe Rétornaz Cc: Rafael J. Wysocki Cc: Romain Perier Signed-off-by: Guenter Roeck --- v2: - poweroff -> power_off - Add defines for default priorities - Use raw notifiers protected by spinlocks instead of atomic notifiers - Add register_poweroff_handler_simple - Add devm_register_power_off_handler include/linux/pm.h | 22 kernel/power/Makefile | 1 + kernel/power/poweroff_handler.c | 252 3 files changed, 275 insertions(+) create mode 100644 kernel/power/poweroff_handler.c diff --git a/include/linux/pm.h b/include/linux/pm.h index 383fd68..7e0cb36 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -34,7 +34,29 @@ extern void (*pm_power_off)(void); extern void (*pm_power_off_prepare)(void); +/* + * Callbacks to manage poweroff handlers + */ + +struct notifier_block; struct device; /* we have a circular dep with device.h */ + +int register_power_off_handler(struct notifier_block *); +int devm_register_power_off_handler(struct device *, struct notifier_block *); +int register_power_off_handler_simple(void (*function)(void), int priority); +int unregister_power_off_handler(struct notifier_block *); +void do_kernel_power_off(void); +bool have_kernel_power_off(void); + +/* + * Pre-defined poweroff handler priorities + */ +#define POWEROFF_PRIORITY_FALLBACK 0 +#define POWEROFF_PRIORITY_LOW 64 +#define POWEROFF_PRIORITY_DEFAULT 128 +#define POWEROFF_PRIORITY_HIGH 192 +#define POWEROFF_PRIORITY_HIGHEST 255 + #ifdef CONFIG_VT_CONSOLE_SLEEP extern void pm_vt_switch_required(struct device *dev, bool required); extern void pm_vt_switch_unregister(struct device *dev); diff --git a/kernel/power/Makefile b/kernel/power/Makefile index 29472bf..4d9f0c7 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile @@ -2,6 +2,7 @@ ccflags-$(CONFIG_PM_DEBUG) := -DDEBUG obj-y += qos.o +obj-y += poweroff_handler.o obj-$(CONFIG_PM) += main.o obj-$(CONFIG_VT_CONSOLE_SLEEP) += console.o obj-$(CONFIG_FREEZER) += process.o diff --git a/kernel/power/poweroff_handler.c b/kernel/power/poweroff_handler.c new file mode 100644 index 000..aeb4736 --- /dev/null +++ b/kernel/power/poweroff_handler.c @@ -0,0 +1,252 @@ +/* + * linux/kernel/power/poweroff_handler.c - Poweroff handling functions + * + * Copyright (c) 2014 Guenter Roeck + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ + +#define pr_fmt(fmt)"poweroff: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Notifier list for kernel code which wants to be called + * to power off the system. + */ +static RAW_NOTIFIER_HEAD(power_off_handler_list); +static DEFINE_SPINLOCK(power_off_handler_lock); + +/* + * Internal function to register poweroff notifier. + * Must be called with poweroff spinlock acquired. + */ +static int _register_power_off_handler(struct notifier_block *nb) +{ + return raw_notifier_chain_register(&
Re: [RFC 0/5] CR4 handling improvements
On Mon, Oct 20, 2014 at 9:06 PM, Vince Weaver wrote: > On Tue, 14 Oct 2014, Andy Lutomirski wrote: > >> This little series tightens up rdpmc permissions. With it applied, >> rdpmc can only be used if a perf_event is actually mmapped. For now, >> this is only really useful for seccomp. > > So just to be difficult... > > I am aware of at least one group who is doing low-latency performance > measures using rdpmc on Linux. > > They start the counters manually by poking the MSRs directly (bypassing > perf_event_open()). > > They use rdpmc, grateful for the fact that currently CR4 is set up so they > can do this w/o patching the kernel. > > These patches of course would break this use case... ISTM it would be a lot better to use the perf subsystem for this. You can probably pin an event to a pmu. I don't know whether you can pin an event systemwide. I also don't know whether pinning an event will prevent perf from changing its value periodically, and it certainly doesn't magically make wraparound issues go away. It would be easy to add a new setting for rdpmc to deal with the PCE part. E.g. rdpmc = 2 could allow all tasks to use rdpmc regardless of whether they have an event mapped. (And I would have to re-add the static key. Sigh.) --Andy P.S. Hey, Intel, you forgot to add rdpmcp :-/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: vga and 64-bit memcpy's
On 13 September 2014 01:11, Linus Torvalds wrote: > On Fri, Sep 12, 2014 at 3:48 AM, Dave Airlie wrote: >> >> Well I'm not shocked that an SMI GPU is out of spec, just not sure how >> we can workaround it. > > Try just removing the > > #define scr_memcpyw(d, s, c) memcpy(d, s, c) > #define VT_BUF_HAVE_MEMCPYW > > (and perhaps MEMMOVEW case too) from the default implementation, and > see if doing things 16-bit words at a time using the fallbacks ends up > working. As Alan said, write combining might defeat that, but quite > frankly, we already do this for the MEMSETW case (probably because we > forgot, possibly because it's not as performance-sensitive) > > My gut feel is that we don't care deeply about performance here, > because (a) true text-modes are less common anyway and (b) true text > modes are pretty damn fast anyway compared to the more usual "write > the whole glyph as graphics" fbcon case. > > And *maybe* it works. And maybe that SMI GPU is a piece of shit that > isn't worth worrying about in VGA text-mode. Where the hell are they > found anyway? Sorry I let this fall off the planet, some huawei x86 server has this behaviour, works with RHEL5 32-bit, fails with RHEL6 64-bit. //#define scr_memcpyw(d, s, c) memcpy(d, s, c) //#define scr_memmovew(d, s, c) memmove(d, s, c) //#define VT_BUF_HAVE_MEMCPYW //#define VT_BUF_HAVE_MEMMOVEW was tested and found to work, just a question if we care enough to fix it I suppose. Dave. The info I have > >Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv4 RESEND 0/3] syscalls,x86: Add execveat() system call
Andy Lutomirski writes: > On Mon, Oct 20, 2014 at 6:48 AM, David Drysdale wrote: >> On Sun, Oct 19, 2014 at 1:20 AM, Eric W. Biederman >> wrote: >>> Andy Lutomirski writes: >>> [Added Eric Biederman, since I think your tree might be a reasonable route forward for these patches.] On Thu, Jun 5, 2014 at 6:40 AM, David Drysdale wrote: > Resending, adding cc:linux-api. > > Also, it may help to add a little more background -- this patch is > needed as a (small) part of implementing Capsicum in the Linux kernel. > > Capsicum is a security framework that has been present in FreeBSD since > version 9.0 (Jan 2012), and is based on concepts from object-capability > security [1]. > > One of the features of Capsicum is capability mode, which locks down > access to global namespaces such as the filesystem hierarchy. In > capability mode, /proc is thus inaccessible and so fexecve(3) doesn't > work -- hence the need for a kernel-space I just found myself wanting this syscall for another reason: injecting programs into sandboxes or otherwise heavily locked-down namespaces. For example, I want to be able to reliably do something like nsenter --namespace-flags-here toybox sh. Toybox's shell is unusual in that it is more or less fully functional, so this should Just Work (tm), except that the toybox binary might not exist in the namespace being entered. If execveat were available, I could rig nsenter or a similar tool to open it with O_CLOEXEC, enter the namespace, and then call execveat. Is there any reason that these patches can't be merged more or less as is for 3.19? >>> >>> Yes. There is a silliness in how it implements fexecve. The fexecve >>> case should be use the empty string "" not a NULL pointer to indication >>> that. That change will then harmonize execveat with the other ...at >>> system calls and simplify the code and remove a special case. I believe >>> using the empty string "" requires implementing the AT_EMPTY_PATH flag. >> >> Good point -- I'll shift to "" + AT_EMPTY_PATH. > > Pending a better idea, I would also see if the patches can be changed > to return an error if d_path ends up with an "(unreachable)" thing > rather than failing inexplicably later on. For my reference we are talking about > @@ -1489,7 +1524,21 @@ static int do_execve_common(struct filename *filename, > sched_exec(); > > bprm->file = file; > - bprm->filename = bprm->interp = filename->name; > + if (filename && fd == AT_FDCWD) { > + bprm->filename = filename->name; > + } else { > + pathbuf = kmalloc(PATH_MAX, GFP_TEMPORARY); > + if (!pathbuf) { > + retval = -ENOMEM; > + goto out_unmark; > + } > + bprm->filename = d_path(&file->f_path, pathbuf, PATH_MAX); > + if (IS_ERR(bprm->filename)) { > + retval = PTR_ERR(bprm->filename); > + goto out_unmark; > + } > + } > + bprm->interp = bprm->filename; > > retval = bprm_mm_init(bprm); > if (retval) The interesting case for fexecve is when we either don't know what files are present or we don't want to depend on which files are present. As Al pointed out d_path really isn't the right solution. It fails when printing /proc/self/fd/${fd}/${filename->name} would work, and the "(deleted)" or "(unreachable)" strings are wrong. The test for today's cases should be: if ((filename->name[0] == '/') || fd == AT_FDCWD) { bprm->filename = filename->name; } To handle the case where the file descriptor is relevant. For the case where the file descriptor is relevant let me suggest setting bprm->filename and bprm->interp to: /dev/fd/${fd}/${filename->name} It is more a description of what we have done but as a magic string it is descriptive. Documetation/devices.txt documents that /dev/fd/ should exist, making it an unambiguous path. Further these days the kernel sets the device naming policy in dev, so I think we are strongly safe in using that path in any event. I think execveat is interesting in the kernel because the motivating cases are the cases where anything except a static executable is uninteresting. Now it has been suggested creating a dupfs or a mini-proc. I think that sounds like a nice companion, to the concept of a locked down root. But I don't think it removes the need for execveat (because we still have the case where we don't want to care what is mounted, and are happy to use static executables). Eric -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Wire up sys_bpf() syscall
On Fri, 2014-10-10 at 05:53:45 UTC, Pranith Kumar wrote: > This patch wires up the new syscall sys_bpf() on powerpc. Is there a test suite we can run to verify it works? cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/8] x86: Disentangle the vdso and clean it up
On Mon, Oct 20, 2014 at 3:41 PM, Andy Lutomirski wrote: > On Mon, Oct 20, 2014 at 3:03 PM, H. Peter Anvin wrote: >> On 10/20/2014 02:57 PM, Andy Lutomirski wrote: >>> >>> Should I send a replacement for patch 8 or should I let you merge 1-7 >>> and fold this into the followup series? >>> >> >> Please send a replacement. > > Sending in a sec. > > Also, this is really weird. Unless I'm completely nuts, lsl is faster > in KVM than it is on bare metal. This makes me wonder whether > something's suboptimal about the way that the GDT is set up. sgdt is > faster, too. This is Sandy Bridge E, one socket. The difference is > big enough that tracking it down might be a significant win on context > switches. Any hints? > This may just be a weird cpufreq artifact. I need to improve my test tools :/ --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks
On Sun, Oct 12, 2014 at 01:21:01AM +, KY Srinivasan wrote: > > > -Original Message- > > From: Jeff Leung [mailto:jle...@v10networks.ca] > > Sent: Saturday, October 11, 2014 1:22 PM > > > > > On the current release of Windows (windows 10), we are advertising > > > SPC3 compliance. > > > We are ok with declaring compliance to SPC3 in our drivers. > > If you are going to declare SPC3 compliance in the drivers, are you going to > > put in checks to ensure that SPC-3 compliance doesn't get accidentally > > enabled for hypervisors below Win10? > > > > I do know for a fact that Ubuntu's kernels already force SPC3 compliance to > > enable specific features such as TRIM on earlier versions of Hyper-V (Namely > > Hyper-V 2012 and 2012 R2). > You are right; Ubuntu has been carrying a patch that was doing just > this and this has been working without any issues on many earlier > versions of Windows. (2012 and 2012 R2). On windows 10 we don't need > any changes in the Linux driver as the host itself is advertising SPC3 > compliance. Based on the testing we have done with Ubuntu, we are > comfortable picking up that patch. OK this seems to be the patch currently carried by Ubuntu: >From ff2c5fa3fa9adf0b919b9425e71a8ba044c31a7d Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Fri, 13 Sep 2013 17:49:16 +0100 Subject: [PATCH] scsi: hyper-v storsvc switch up to SPC-3 Suggested-By: James Bottomley Signed-off-by: Andy Whitcroft --- drivers/scsi/storvsc_drv.c |8 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 9969fa1..3903c8a 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1441,6 +1441,14 @@ static int storvsc_device_configure(struct scsi_device *sdevice) sdevice->no_write_same = 1; + /* +* hyper-v lies about its capabilities indicating it is only SPC-2 +* compliant, but actually implements the core SPC-3 features. +* If we pretend to be SPC-3, we send RC16 which activates trim and +* will query the appropriate VPD pages to enable trim. +*/ + sdevice->scsi_level = SCSI_SPC_3; + return 0; } -- 1.7.9.5 (Downloaded from http://kernel.ubuntu.com/git?p=jsalisbury/stable/trusty/ubuntu-trusty.git;a=patch;h=ff2c5fa3fa9adf0b919b9425e71a8ba044c31a7d ). I think it's unwise to override the scsi_level at this particular point because you are going to do it for ALL Hyper-V "disks" (perhaps all Hyper-V SCSI devices?)... Here's the SCSI inquiry information reported by a USB 2 hard disk being passed passed-through by one of my 2012 R2 hosts: # sg_inq /dev/sdc standard INQUIRY: PQual=0 Device_type=0 RMB=0 version=0x02 [SCSI-2] [AERC=0] [TrmTsk=0] NormACA=0 HiSUP=0 Resp_data_format=1 SCCS=0 ACC=0 TPGS=0 3PC=0 Protect=0 [BQue=0] EncServ=0 MultiP=0 [MChngr=0] [ACKREQQ=0] Addr16=0 [RelAdr=0] WBus16=0 Sync=0 Linked=0 [TranDis=0] CmdQue=0 length=36 (0x24) Peripheral device type: disk Vendor identification: MDT MD50 Product identification: 00AAKS-00TMA0 Product revision level: Is it OK to replace a scsi_level of SCSI-2 with SCSI_SPC_3? Additionally is it also OK to force SCSI_SPC_3 on Hyper-V 2008? > > > NryزXvؖ){nlj{zX}zj:v zZzf~zwڢ)jyA > > > > > > i > N?r??yb?X??ǧv?^?){.n?+{zX????ܨ}???Ơz?&j:+v???zZ+??+zf???h???~i???z??w?&?)ߢf??^jǫy?m??@A?a??? > 0??h???i ^^^ Where do these characters come from? I've occasionally seen them on emails from other Microsoft folks posting to LKML too... -- Sitsofe | http://sucs.org/~sits/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/