Soldes destockage massif
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDYyJmM9NDgzNjEyJmQ9MjAxMi0wNy0xOCAyMzo0MDowMSZlPTEmaD0xNjA2MSZmPTE2MDYyJmc9MTYwNjI= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDYyJmM9NDgzNjEyJmQ9MjAxMi0wNy0xOCAyMzo0MDowMSZlPTEmaD0xNjA2MSZmPTE2MDYyJmc9MTYwNjI= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
RE: [PATCH 1/4] spi/s3c64xx: Fix handling of errors in gpio_request()
Mark Brown wrote: When gpio_request() fails the driver logged the failure but while it'd try to print an error code in the non-DT case it didn't pass the error code in so garbage would be logged and in the DT case the error wasn't logged. Further, in the non-DT case the error code was then overwritten with - EBUSY depriving the caller of information and breaking automatic probe deferral pushing back from the GPIO level. Also reformat the non-DT log message so it's not word wrapped and we can grep for it. Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com --- drivers/spi/spi-s3c64xx.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 999154a0..7258b18 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -894,9 +894,9 @@ static int s3c64xx_spi_setup(struct spi_device *spi) if (!spi_get_ctldata(spi)) { err = gpio_request(cs-line, dev_name(spi-dev)); if (err) { - dev_err(spi-dev, request for slave select gpio - line [%d] failed\n, cs-line); - err = -EBUSY; + dev_err(spi-dev, + Failed to get /CS gpio [%d]: %d\n, + cs-line, err); goto err_gpio_req; } spi_set_ctldata(spi, cs); @@ -1114,7 +1114,8 @@ static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd) ret = gpio_request(gpio, spi-bus); if (ret) { - dev_err(dev, gpio [%d] request failed\n, gpio); + dev_err(dev, gpio [%d] request failed: %d\n, + gpio, ret); goto free_gpio; } } -- 1.7.10.4 Mark, thanks for your re-work 3th and 4th patches in this series :-) Looks good to me, applied this series. Thanks. Best regards, Kgene. -- Kukjin Kim kgene@samsung.com, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Solde 3ème démarques jusqu'à -80% sur tout le site
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDg5JmM9NDgzNjEyJmQ9MjAxMi0wNy0xOSAwMDoxMDowMSZlPTEmaD0xNjA4OCZmPTE2MDg5Jmc9MTYwODk= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDg5JmM9NDgzNjEyJmQ9MjAxMi0wNy0xOSAwMDoxMDowMSZlPTEmaD0xNjA4OCZmPTE2MDg5Jmc9MTYwODk= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
3 produits achetés = le 4ème offert. Livraison offerte dès 39 dachat
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDg2JmM9NDgzNjEyJmQ9MjAxMi0wNy0xOCAyMzoyMDowMSZlPTEmaD0xNjA4NSZmPTE2MDg2Jmc9MTYwODY= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDg2JmM9NDgzNjEyJmQ9MjAxMi0wNy0xOCAyMzoyMDowMSZlPTEmaD0xNjA4NSZmPTE2MDg2Jmc9MTYwODY= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Vos chaussures préférées -60%, chez vous rapidement et gratuitement
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDg3JmM9NDgzNjEyJmQ9MjAxMi0wNy0xOSAwMDowMDowMSZlPTEmaD0xNjA4NiZmPTE2MDg3Jmc9MTYwODc= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDg3JmM9NDgzNjEyJmQ9MjAxMi0wNy0xOSAwMDowMDowMSZlPTEmaD0xNjA4NiZmPTE2MDg3Jmc9MTYwODc= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
spi/omap2: mark omap2_mcspi_master_setup as __devinit
This warning recently appeared with omap2plus_defconfig: WARNING: drivers/spi/built-in.o(.devinit.text+0x3c4): Section mismatch in reference from the function omap2_mcspi_probe() to the function .init.text:omap2_mcspi_master_setup() The function __devinit omap2_mcspi_probe() references a function __init omap2_mcspi_master_setup(). If omap2_mcspi_master_setup is only used by omap2_mcspi_probe then annotate omap2_mcspi_master_setup with a matching annotation. The fix is obviously to mark the omap2_mcspi_master_setup function as __devinit, rather than __init. Signed-off-by: Arnd Bergmann a...@arndb.de diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 0c73dd4..dc02f2f 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1032,7 +1032,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, return 0; } -static int __init omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) +static int __devinit omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) { struct spi_master *master = mcspi-master; struct omap2_mcspi_regs *ctx = mcspi-ctx; -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH resend] spi: Add AD-FMCOMMS1-EBZ I2C-SPI bridge driver
This patch adds support for the I2C-SPI bridge which can be found on the Analog Devices AD-FMCOMMS1-EBZ board. Signed-off-by: Lars-Peter Clausen l...@metafoo.de --- Just a resend of the patch to Mark as he kindly takes care of the SPI subsystem while Grant is busy moving. --- drivers/spi/Kconfig |7 ++ drivers/spi/Makefile|1 + drivers/spi/spi-xcomm.c | 276 +++ 3 files changed, 284 insertions(+) create mode 100644 drivers/spi/spi-xcomm.c diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 0a72569..12468e5 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -384,6 +384,13 @@ config SPI_TXX9 help SPI driver for Toshiba TXx9 MIPS SoCs +config SPI_XCOMM + tristate Analog Devices AD-FMCOMMS1-EBZ SPI-I2C-bridge driver + depends on I2C + help + Support for the SPI-I2C bridge found on the Analog Devices + AD-FMCOMMS1-EBZ board. + config SPI_XILINX tristate Xilinx SPI controller common module depends on HAS_IOMEM EXPERIMENTAL diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 9d75d21..273f50d 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -61,5 +61,6 @@ obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o obj-$(CONFIG_SPI_TXX9) += spi-txx9.o +obj-$(CONFIG_SPI_XCOMM)+= spi-xcomm.o obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c new file mode 100644 index 000..266a847 --- /dev/null +++ b/drivers/spi/spi-xcomm.c @@ -0,0 +1,276 @@ +/* + * Analog Devices AD-FMCOMMS1-EBZ board I2C-SPI bridge driver + * + * Copyright 2012 Analog Devices Inc. + * Author: Lars-Peter Clausen l...@metafoo.de + * + * Licensed under the GPL-2 or later. + */ + +#include linux/kernel.h +#include linux/init.h +#include linux/module.h +#include linux/delay.h +#include linux/i2c.h +#include linux/spi/spi.h +#include asm/unaligned.h + +#define SPI_XCOMM_SETTINGS_LEN_OFFSET 10 +#define SPI_XCOMM_SETTINGS_3WIRE BIT(6) +#define SPI_XCOMM_SETTINGS_CS_HIGH BIT(5) +#define SPI_XCOMM_SETTINGS_SAMPLE_END BIT(4) +#define SPI_XCOMM_SETTINGS_CPHABIT(3) +#define SPI_XCOMM_SETTINGS_CPOLBIT(2) +#define SPI_XCOMM_SETTINGS_CLOCK_DIV_MASK 0x3 +#define SPI_XCOMM_SETTINGS_CLOCK_DIV_640x2 +#define SPI_XCOMM_SETTINGS_CLOCK_DIV_160x1 +#define SPI_XCOMM_SETTINGS_CLOCK_DIV_4 0x0 + +#define SPI_XCOMM_CMD_UPDATE_CONFIG0x03 +#define SPI_XCOMM_CMD_WRITE0x04 + +#define SPI_XCOMM_CLOCK 4800 + +struct spi_xcomm { + struct i2c_client *i2c; + + uint16_t settings; + uint16_t chipselect; + + unsigned int current_speed; + + uint8_t buf[63]; +}; + +static int spi_xcomm_sync_config(struct spi_xcomm *spi_xcomm, unsigned int len) +{ + uint16_t settings; + uint8_t *buf = spi_xcomm-buf; + + settings = spi_xcomm-settings; + settings |= len SPI_XCOMM_SETTINGS_LEN_OFFSET; + + buf[0] = SPI_XCOMM_CMD_UPDATE_CONFIG; + put_unaligned_be16(settings, buf[1]); + put_unaligned_be16(spi_xcomm-chipselect, buf[3]); + + return i2c_master_send(spi_xcomm-i2c, buf, 5); +} + +static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm, + struct spi_device *spi, int is_active) +{ + unsigned long cs = spi-chip_select; + uint16_t chipselect = spi_xcomm-chipselect; + + if (is_active) + chipselect |= BIT(cs); + else + chipselect = ~BIT(cs); + + spi_xcomm-chipselect = chipselect; +} + +static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, + struct spi_device *spi, struct spi_transfer *t, unsigned int *settings) +{ + unsigned int speed; + + if ((t-bits_per_word t-bits_per_word != 8) || t-len 62) + return -EINVAL; + + speed = t-speed_hz ? t-speed_hz : spi-max_speed_hz; + + if (speed != spi_xcomm-current_speed) { + unsigned int divider = DIV_ROUND_UP(SPI_XCOMM_CLOCK, speed); + if (divider = 64) + *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_64; + else if (divider = 16) + *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_16; + else + *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_4; + + spi_xcomm-current_speed = speed; + } + + if (spi-mode SPI_CPOL) + *settings |= SPI_XCOMM_SETTINGS_CPOL; + else + *settings = ~SPI_XCOMM_SETTINGS_CPOL; + + if (spi-mode SPI_CPHA) + *settings = ~SPI_XCOMM_SETTINGS_CPHA; + else + *settings |= SPI_XCOMM_SETTINGS_CPHA; + +
Re: spi/omap2: mark omap2_mcspi_master_setup as __devinit
+Mark Since Grant is moving to a new house. On Thursday 19 July 2012 08:22 PM, Arnd Bergmann wrote: This warning recently appeared with omap2plus_defconfig: WARNING: drivers/spi/built-in.o(.devinit.text+0x3c4): Section mismatch in reference from the function omap2_mcspi_probe() to the function .init.text:omap2_mcspi_master_setup() The function __devinit omap2_mcspi_probe() references a function __init omap2_mcspi_master_setup(). If omap2_mcspi_master_setup is only used by omap2_mcspi_probe then annotate omap2_mcspi_master_setup with a matching annotation. The fix is obviously to mark the omap2_mcspi_master_setup function as __devinit, rather than __init. Acked-by: Shubhrajyoti D shubhrajy...@ti.com mailto:shubhrajy...@ti.com Thanks for the patch. Apologies for breaking in one my patch series. Signed-off-by: Arnd Bergmann a...@arndb.de diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 0c73dd4..dc02f2f 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1032,7 +1032,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, return 0; } -static int __init omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) +static int __devinit omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) { struct spi_master *master = mcspi-master; struct omap2_mcspi_regs *ctx = mcspi-ctx; -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH] spi: omap2-mcspi: Fix the below warning
The dma_map and dma_unmap should have same parameter passed otherwise we get the below warn. ks8851 spi1.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x9f22] [2.066925] Modules linked in: [2.070312] [2.071929] [c001c250] (unwind_backtrace+0x0/0x130) from [c0043d84] (warn_slowpath_common+0x4c/0x64) [2.081909] [c0043d84] (warn_slowpath_common+0x4c/0x64) from [c0043e30] (warn_slowpath_fmt+0x30/0x40) [2.091949] [c0043e30] (warn_slowpath_fmt+0x30/0x40) from [c0293824] (check_unmap+0x6d0/0x7b0) [2.101348] [c0293824] (check_unmap+0x6d0/0x7b0) from [c02939cc] (debug_dma_unmap_page+0x64/0x70) [2.111053] [c02939cc] (debug_dma_unmap_page+0x64/0x70) from [c03519a4] (omap2_mcspi_txrx_dma+0x2d8/0x4fc) [2.121582] [c03519a4] (omap2_mcspi_txrx_dma+0x2d8/0x4fc) from [c03524d8] (omap2_mcspi_work.clone.4+0xf0/0x290) [2.132537] [c03524d8] (omap2_mcspi_work.clone.4+0xf0/0x290) from [c0352900] (omap2_mcspi_transfer_one_message+0x288/0x438) [2.144592] [c0352900] (omap2_mcspi_transfer_one_message+0x288/0x438) from [c03503bc] (spi_pump_messages+0x100/0x160) [2.156127] [c03503bc] (spi_pump_messages+0x100/0x160) from [c006635c] (kthread_worker_fn+0xac/0x180) [2.166168] [c006635c] (kthread_worker_fn+0xac/0x180) from [c0066578] (kthread+0x90/0x9c) [2.175140] [c0066578] (kthread+0x90/0x9c) from [c00157fc] (kernel_thread_exit+0x0/0x8) [2.183898] ---[ end trace d1830ce6e44292f2 ]--- Fix the warn by changing the unmap parameter. Reported-by: Russell King - ARM Linux li...@arm.linux.org.uk Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/spi/spi-omap2-mcspi.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 0c73dd4..37ccdb7 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -388,7 +388,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) if (tx != NULL) { wait_for_completion(mcspi_dma-dma_tx_completion); - dma_unmap_single(spi-dev, xfer-tx_dma, count, DMA_TO_DEVICE); + dma_unmap_single(mcspi-dev, xfer-tx_dma, count, +DMA_TO_DEVICE); /* for TX_ONLY mode, be sure all words have shifted out */ if (rx == NULL) { @@ -403,7 +404,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) if (rx != NULL) { wait_for_completion(mcspi_dma-dma_rx_completion); - dma_unmap_single(spi-dev, xfer-rx_dma, count, DMA_FROM_DEVICE); + dma_unmap_single(mcspi-dev, xfer-rx_dma, count, +DMA_FROM_DEVICE); omap2_mcspi_set_enable(spi, 0); if (l OMAP2_MCSPI_CHCONF_TURBO) { -- 1.7.5.4 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Soldes jusqu'à -80% : offre spéciale mobilier de jardin
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT04JmI9MTY0OTQmYz0xOTYxNjQxJmQ9MjAxMi0wNy0xOSAyMjoyMDowMSZlPTEmaD0xNjQ5MyZmPTE2NDk0Jmc9MTY0OTQ= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT04JmI9MTY0OTQmYz0xOTYxNjQxJmQ9MjAxMi0wNy0xOSAyMjoyMDowMSZlPTEmaD0xNjQ5MyZmPTE2NDk0Jmc9MTY0OTQ= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCHSET] kthread_worker: reimplement flush_kthread_work() to allow freeing during execution
Hello, kthread_worker was introduced together with concurrency managed workqueue to serve workqueue users which need a special dedicated worker - e.g. RT scheduling. This is minimal queue / flush / flush all iterface on top of kthread and each provided interface matches the workqueue counterpart so that switching isn't difficult. However, one noticeable difference was that kthread_worker doesn't allow a work item to be freed while being executed. The intention was to keep the code simpler but it didn't really and the restriction is subtle and does prevent some valid use cases. This two-patch series reimplements flush_kthread_work() so that it uses an extra work item for flushing. While this takes a bit more lines, this is easier to understand and removes the annoying difference. This patchset contains the following two patches. 0001-kthread_worker-reorganize-to-prepare-for-flush_kthre.patch 0002-kthread_worker-reimplement-flush_kthread_work-to-all.patch The first one is a prep patch which makes no functional changes. The second reimplements flush_kthread_work(). All current kthread_worker users are cc'd. If no one objects, I'll push it through the workqueue branch. This patchset is also available in the following git branch. git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git review-kthread_worker-flush diffstat follows. Thanks. include/linux/kthread.h |8 +--- kernel/kthread.c| 86 +++- 2 files changed, 52 insertions(+), 42 deletions(-) -- tejun -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 1/2] kthread_worker: reorganize to prepare for flush_kthread_work() reimplementation
From c9bba34243a86fb3ac82d1bdd0ce4bf796b79559 Mon Sep 17 00:00:00 2001 From: Tejun Heo t...@kernel.org Date: Thu, 19 Jul 2012 13:52:53 -0700 Make the following two non-functional changes. * Separate out insert_kthread_work() from queue_kthread_work(). * Relocate struct kthread_flush_work and kthread_flush_work_fn() definitions above flush_kthread_work(). Signed-off-by: Tejun Heo t...@kernel.org --- kernel/kthread.c | 40 1 files changed, 24 insertions(+), 16 deletions(-) diff --git a/kernel/kthread.c b/kernel/kthread.c index 3d3de63..7b8a678 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -378,6 +378,17 @@ repeat: } EXPORT_SYMBOL_GPL(kthread_worker_fn); +/* insert @work before @pos in @worker */ +static void insert_kthread_work(struct kthread_worker *worker, + struct kthread_work *work, + struct list_head *pos) +{ + list_add_tail(work-node, pos); + work-queue_seq++; + if (likely(worker-task)) + wake_up_process(worker-task); +} + /** * queue_kthread_work - queue a kthread_work * @worker: target kthread_worker @@ -395,10 +406,7 @@ bool queue_kthread_work(struct kthread_worker *worker, spin_lock_irqsave(worker-lock, flags); if (list_empty(work-node)) { - list_add_tail(work-node, worker-work_list); - work-queue_seq++; - if (likely(worker-task)) - wake_up_process(worker-task); + insert_kthread_work(worker, work, worker-work_list); ret = true; } spin_unlock_irqrestore(worker-lock, flags); @@ -406,6 +414,18 @@ bool queue_kthread_work(struct kthread_worker *worker, } EXPORT_SYMBOL_GPL(queue_kthread_work); +struct kthread_flush_work { + struct kthread_work work; + struct completion done; +}; + +static void kthread_flush_work_fn(struct kthread_work *work) +{ + struct kthread_flush_work *fwork = + container_of(work, struct kthread_flush_work, work); + complete(fwork-done); +} + /** * flush_kthread_work - flush a kthread_work * @work: work to flush @@ -436,18 +456,6 @@ void flush_kthread_work(struct kthread_work *work) } EXPORT_SYMBOL_GPL(flush_kthread_work); -struct kthread_flush_work { - struct kthread_work work; - struct completion done; -}; - -static void kthread_flush_work_fn(struct kthread_work *work) -{ - struct kthread_flush_work *fwork = - container_of(work, struct kthread_flush_work, work); - complete(fwork-done); -} - /** * flush_kthread_worker - flush all current works on a kthread_worker * @worker: worker to flush -- 1.7.7.3 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH 2/2] kthread_worker: reimplement flush_kthread_work() to allow freeing the work item being executed
From 06f9a06f4aeecdb9d07014713ab41b548ae219b5 Mon Sep 17 00:00:00 2001 From: Tejun Heo t...@kernel.org Date: Thu, 19 Jul 2012 13:52:53 -0700 kthread_worker provides minimalistic workqueue-like interface for users which need a dedicated worker thread (e.g. for realtime priority). It has basic queue, flush_work, flush_worker operations which mostly match the workqueue counterparts; however, due to the way flush_work() is implemented, it has a noticeable difference of not allowing work items to be freed while being executed. While the current users of kthread_worker are okay with the current behavior, the restriction does impede some valid use cases. Also, removing this difference isn't difficult and actually makes the code easier to understand. This patch reimplements flush_kthread_work() such that it uses a flush_work item instead of queue/done sequence numbers. Signed-off-by: Tejun Heo t...@kernel.org --- include/linux/kthread.h |8 +- kernel/kthread.c| 48 ++ 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 0714b24..22ccf9d 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -49,8 +49,6 @@ extern int tsk_fork_get_node(struct task_struct *tsk); * can be queued and flushed using queue/flush_kthread_work() * respectively. Queued kthread_works are processed by a kthread * running kthread_worker_fn(). - * - * A kthread_work can't be freed while it is executing. */ struct kthread_work; typedef void (*kthread_work_func_t)(struct kthread_work *work); @@ -59,15 +57,14 @@ struct kthread_worker { spinlock_t lock; struct list_headwork_list; struct task_struct *task; + struct kthread_work *current_work; }; struct kthread_work { struct list_headnode; kthread_work_func_t func; wait_queue_head_t done; - atomic_tflushing; - int queue_seq; - int done_seq; + struct kthread_worker *worker; }; #define KTHREAD_WORKER_INIT(worker){ \ @@ -79,7 +76,6 @@ struct kthread_work { .node = LIST_HEAD_INIT((work).node),\ .func = (fn), \ .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \ - .flushing = ATOMIC_INIT(0), \ } #define DEFINE_KTHREAD_WORKER(worker) \ diff --git a/kernel/kthread.c b/kernel/kthread.c index 7b8a678..4034b2b 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -360,16 +360,12 @@ repeat: struct kthread_work, node); list_del_init(work-node); } + worker-current_work = work; spin_unlock_irq(worker-lock); if (work) { __set_current_state(TASK_RUNNING); work-func(work); - smp_wmb(); /* wmb worker-b0 paired with flush-b1 */ - work-done_seq = work-queue_seq; - smp_mb(); /* mb worker-b1 paired with flush-b0 */ - if (atomic_read(work-flushing)) - wake_up_all(work-done); } else if (!freezing(current)) schedule(); @@ -384,7 +380,7 @@ static void insert_kthread_work(struct kthread_worker *worker, struct list_head *pos) { list_add_tail(work-node, pos); - work-queue_seq++; + work-worker = worker; if (likely(worker-task)) wake_up_process(worker-task); } @@ -434,25 +430,35 @@ static void kthread_flush_work_fn(struct kthread_work *work) */ void flush_kthread_work(struct kthread_work *work) { - int seq = work-queue_seq; + struct kthread_flush_work fwork = { + KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn), + COMPLETION_INITIALIZER_ONSTACK(fwork.done), + }; + struct kthread_worker *worker; + bool noop = false; + +retry: + worker = work-worker; + if (!worker) + return; - atomic_inc(work-flushing); + spin_lock_irq(worker-lock); + if (work-worker != worker) { + spin_unlock_irq(worker-lock); + goto retry; + } - /* -* mb flush-b0 paired with worker-b1, to make sure either -* worker sees the above increment or we see done_seq update. -*/ - smp_mb__after_atomic_inc(); + if (!list_empty(work-node)) + insert_kthread_work(worker, fwork.work, work-node.next); + else if (worker-current_work == work) + insert_kthread_work(worker, fwork.work, worker-work_list.next); + else + noop = true; - /* A - B = 0
Vite, la Vente Flash de Disneyland Paris est ouverte
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT0xMyZiPTE2MTU1JmM9NDgzNjEyJmQ9MjAxMi0wNy0yMCAwMDowMDowMiZlPTEmaD0xNjE1NCZmPTE2MTU1Jmc9MTYxNTU= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MTU1JmM9NDgzNjEyJmQ9MjAxMi0wNy0yMCAwMDowMDowMiZlPTEmaD0xNjE1NCZmPTE2MTU1Jmc9MTYxNTU= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Offrez-vous le soleil : jusqu'à -45% sur vos vacances
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML Lien miroir : http://m10-fr.com/mc10_m/YT0xMyZiPTE1OTQyJmM9NDgzNjEyJmQ9MjAxMi0wNy0yMCAwMjo1MDowMSZlPTEmaD0xNTk0MSZmPTE1OTQyJmc9MTU5NDI= Lien de désinscription : http://m10-fr.com/mc10_unsub/YT0xMyZiPTE1OTQyJmM9NDgzNjEyJmQ9MjAxMi0wNy0yMCAwMjo1MDowMSZlPTEmaD0xNTk0MSZmPTE1OTQyJmc9MTU5NDI= -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general