Re: [PATCH 5/13] arch/arm: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Pankaj Jangra
Hi,

On Sun, Aug 26, 2012 at 9:30 PM, Julia Lawall  wrote:
> From: Julia Lawall 
>
> Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
> clk_enable, and clk_disable and clk_unprepare.  They make the code more
> concise, and ensure that clk_unprepare is called when clk_enable fails.
>
> A simplified version of the semantic patch that introduces calls to these
> functions is as follows: (http://coccinelle.lip6.fr/)
>
> // 
> @@
> expression e;
> @@
>
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
>
> @@
> expression e;
> @@
>
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> // 
>
> Signed-off-by: Julia Lawall 
>
> ---
>  arch/arm/common/sa.c   |3 +--
>  arch/arm/common/timer-sp.c |   16 
>  arch/arm/kernel/smp_twd.c  |   13 +++--
>  3 files changed, 8 insertions(+), 24 deletions(-)
>

Reviewed-by: Pankaj Jangra 

Regards,
Pankaj Jangra
--
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/


[PATCHv3 0/4] modem_shm: U8500 SHaRed Memory driver(SHRM)

2012-08-26 Thread Arun Murthy
In u8500 platform the communication between the APE(Application Processor) and
the modem subsystem(CMT) is by means of a shared DDR. The series of patches
include a protocol called ShaRed Memory(SHRM) protocol for communicating
between the APE and the CMT.
Interrupt generation registers in CMT and PRCMU on APE side are used to support
the shrm protocol.

v2 - Included netdev mailing list
v3 - Implemented comments from Alan Cox and Greg KH

Arun Murthy (4):
  modem_shm: Add Modem Access Framework
  modem_shm: Register u8500 client for MAF
  modem_shm: u8500-shm: U8500 Shared Memory Driver
  Doc: Add u8500_shrm document

 Documentation/DocBook/Makefile  |2 +-
 Documentation/DocBook/shrm.tmpl |  125 +++
 Documentation/modem_shm/u8500_shrm.txt  |  254 +
 drivers/Kconfig |2 +
 drivers/Makefile|1 +
 drivers/modem_shm/Kconfig   |   22 +
 drivers/modem_shm/Makefile  |3 +
 drivers/modem_shm/modem_access.c|  413 +++
 drivers/modem_shm/modem_u8500.c |   96 ++
 drivers/modem_shm/u8500_shm/Kconfig |   43 +
 drivers/modem_shm/u8500_shm/Makefile|7 +
 drivers/modem_shm/u8500_shm/shrm.h  |   23 +
 drivers/modem_shm/u8500_shm/shrm_char.c |  816 ++
 drivers/modem_shm/u8500_shm/shrm_config.h   |  114 ++
 drivers/modem_shm/u8500_shm/shrm_driver.c   |  733 
 drivers/modem_shm/u8500_shm/shrm_driver.h   |  226 
 drivers/modem_shm/u8500_shm/shrm_fifo.c |  838 ++
 drivers/modem_shm/u8500_shm/shrm_ioctl.h|   43 +
 drivers/modem_shm/u8500_shm/shrm_net.c  |  313 ++
 drivers/modem_shm/u8500_shm/shrm_net.h  |   46 +
 drivers/modem_shm/u8500_shm/shrm_private.h  |  184 +++
 drivers/modem_shm/u8500_shm/shrm_protocol.c | 1591 +++
 include/linux/modem_shm/modem.h |   64 ++
 include/linux/modem_shm/modem_client.h  |   55 +
 24 files changed, 6013 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/DocBook/shrm.tmpl
 create mode 100644 Documentation/modem_shm/u8500_shrm.txt
 create mode 100644 drivers/modem_shm/Kconfig
 create mode 100644 drivers/modem_shm/Makefile
 create mode 100644 drivers/modem_shm/modem_access.c
 create mode 100644 drivers/modem_shm/modem_u8500.c
 create mode 100644 drivers/modem_shm/u8500_shm/Kconfig
 create mode 100644 drivers/modem_shm/u8500_shm/Makefile
 create mode 100644 drivers/modem_shm/u8500_shm/shrm.h
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_char.c
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_config.h
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_driver.c
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_driver.h
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_fifo.c
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_ioctl.h
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_net.c
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_net.h
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_private.h
 create mode 100644 drivers/modem_shm/u8500_shm/shrm_protocol.c
 create mode 100644 include/linux/modem_shm/modem.h
 create mode 100644 include/linux/modem_shm/modem_client.h

-- 
1.7.4.3

--
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/


[PATCHv3 4/4] Doc: Add u8500_shrm document

2012-08-26 Thread Arun Murthy
Add document for u8500 shared memory(shrm)and kernel Docbook.

Signed-off-by: Arun Murthy 
---
 Documentation/DocBook/Makefile |2 +-
 Documentation/DocBook/shrm.tmpl|  125 
 Documentation/modem_shm/u8500_shrm.txt |  254 
 3 files changed, 380 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/DocBook/shrm.tmpl
 create mode 100644 Documentation/modem_shm/u8500_shrm.txt

diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index bc3d9f8..673ea06 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -14,7 +14,7 @@ DOCBOOKS := z8530book.xml device-drivers.xml \
genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
80211.xml debugobjects.xml sh.xml regulator.xml \
alsa-driver-api.xml writing-an-alsa-driver.xml \
-   tracepoint.xml drm.xml media_api.xml
+   tracepoint.xml drm.xml media_api.xml shrm.xml
 
 include $(srctree)/Documentation/DocBook/media/Makefile
 
diff --git a/Documentation/DocBook/shrm.tmpl b/Documentation/DocBook/shrm.tmpl
new file mode 100644
index 000..400f9b2
--- /dev/null
+++ b/Documentation/DocBook/shrm.tmpl
@@ -0,0 +1,125 @@
+
+http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd; []>
+
+
+ 
+  Shared Memory
+  
+   
+Arun
+Murthy
+
+ 
+  arun.mur...@stericsson.com
+ 
+
+   
+  
+
+  
+   2009-2010
+   ST-Ericsson
+  
+
+  
+
+  Linux standard functions
+
+  
+
+  
+   
+   
+ Licence terms: GNU General Public Licence (GPL) version 2.
+   
+  
+ 
+
+
+  
+Introduction
+
+   This Documentation describes the ST-Ericsson's adaptation on protocol 
used for CMT/APE communication when SHaRedMemory is used as IPC link.
+
+  
+
+  
+Design
+
+   The APE consists Cortex A9 dual core SMP, a multimedia DSP and PRCMU. 
Modem consists of 2 Cortex R4 ARM processor.
+   The exchange of messages between CMT(Cellular Mobile Terminal) and APE 
includes copying the data to a shared area DDR.
+   This region is accessible by both CMT and APE. The design includes 2 
channels common and audio. Common channel is used for exchanging ISI, RPC and 
SECURITY messages.
+   udio channel is used for exchanging AUDIO messages. Each channel 
consists of 2 FIFO. One FIFO for sending message from CMT to APE and other from 
APE to CMT.
+   ach of these FIFO have write and read pointer shared between APE and 
CMT. Writer pointer is updated on copying the message to FIFO and reader will 
read the messages from the read pointer upto the writer pointer. Writer and 
reader notifications are used to notify the completion of read/write 
operation(seperate for APE and CMT).
+   river includes 4 queues. Once the messages are sent from CMT to APE it 
resides in the FIFO and then copied to one of the 4 queues based on the message 
type(ISI, RPC, AUDIO, SECURITY) and then the net/char device interface fetches 
this message from the queue and copies to the user space buffer.
+
+  
+
+  
+Concepts
+
+   The user space application sends ISI/RPC/AUDIO/SECURITY messages. ISI 
is sent through the phonet to shrm driver. For achieving this there are 2 
interfaces to the shrm driver. Net interface used for exchanging the ISI 
message and char interface for RPC, AUDIO and SECURITY messages. On receiving 
any of these messages from the user space application, it is copied to a memory 
in kernel space. From here it is then copied to respective FIFO from where the 
CMT reads the message.
+   CMT(Cellular Mobile Terminal) writes messages to the respective FIFO 
and thereafter to respective queue. The net/char device copies this message 
from the queue to the user space buffer.
+
+  
+
+  
+ Known Bugs And Assumptions
+  
+ 
+ 
+   None
+   
+ 
+   Assumptions
+   1. ApeShmFifo#0 is of 128kB in size. As this is used for 
transmission except CS audio call data. Expected message size is 1.5kB with a 
max of 16kB.
+   2. ApeShmFifo#1 is of 4kB in size. This is used for 
transmission of CS audio call data. Expected message size is 24kb.
+   3. CmtShmFifo#0 is of 128kB in size. As this is used for 
transmission except CS audio call data. Expected message size is 1.5kB with a 
max of 16kB.
+   4. CmtShmFifo#1 is of 4kB in size. This is used for 
transmission of CS audio call data. Expected message size is 24kb.
+   The total size of the FIFO is 264 kB.
+ 
+   
+ 
+ 
+  
+  
+
+  
+ Public Functions Provided
+ 
+   This Section lists the API's provided by the SHRM driver to phonet 
drivers.
+ 
+!Edrivers/modem_shm/u8500_shm/shrm_fifo.c
+ 
+   This Section lists the API's provided by the SHRM driver used in 
transmission of RPC, AUDIO and SECURITY messages.
+ 
+!Edrivers/modem_shm/u8500_shm/shrm_char.c
+

[PATCHv3 1/4] modem_shm: Add Modem Access Framework

2012-08-26 Thread Arun Murthy
Adds Modem Access Framework, which allows for registering platform specific
modem access mechanisms. The framework also exposes APIs for client drivers
for getting and releasing access to modem, regardless of the underlying
platform specific access mechanism.

Signed-off-by: Arun Murthy 
---
 drivers/Kconfig|2 +
 drivers/Makefile   |1 +
 drivers/modem_shm/Kconfig  |9 +
 drivers/modem_shm/Makefile |1 +
 drivers/modem_shm/modem_access.c   |  413 
 include/linux/modem_shm/modem.h|   64 +
 include/linux/modem_shm/modem_client.h |   55 +
 7 files changed, 545 insertions(+), 0 deletions(-)
 create mode 100644 drivers/modem_shm/Kconfig
 create mode 100644 drivers/modem_shm/Makefile
 create mode 100644 drivers/modem_shm/modem_access.c
 create mode 100644 include/linux/modem_shm/modem.h
 create mode 100644 include/linux/modem_shm/modem_client.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index ece958d..dc7c14a 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -152,4 +152,6 @@ source "drivers/vme/Kconfig"
 
 source "drivers/pwm/Kconfig"
 
+source "drivers/modem_shm/Kconfig"
+
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 5b42184..902dfec 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -139,3 +139,4 @@ obj-$(CONFIG_EXTCON)+= extcon/
 obj-$(CONFIG_MEMORY)   += memory/
 obj-$(CONFIG_IIO)  += iio/
 obj-$(CONFIG_VME_BUS)  += vme/
+obj-$(CONFIG_MODEM_SHM)+= modem_shm/
diff --git a/drivers/modem_shm/Kconfig b/drivers/modem_shm/Kconfig
new file mode 100644
index 000..f4b7e54
--- /dev/null
+++ b/drivers/modem_shm/Kconfig
@@ -0,0 +1,9 @@
+config MODEM_SHM
+bool "Modem Access Framework"
+default n
+help
+ Add support for Modem Access Framework. It allows different
+platform specific drivers to register modem access mechanisms
+and allows transparent access to modem to the client drivers.
+
+If unsure, say N.
diff --git a/drivers/modem_shm/Makefile b/drivers/modem_shm/Makefile
new file mode 100644
index 000..b77bcc0
--- /dev/null
+++ b/drivers/modem_shm/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_MODEM_SHM):= modem_access.o
diff --git a/drivers/modem_shm/modem_access.c b/drivers/modem_shm/modem_access.c
new file mode 100644
index 000..b4bb4b7
--- /dev/null
+++ b/drivers/modem_shm/modem_access.c
@@ -0,0 +1,413 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2011
+ *
+ * License Terms: GNU General Public License v2
+ * Author: Kumar Sanghvi
+ * Arun Murthy 
+ *
+ * Heavily adapted from Regulator framework.
+ * Provides mechanisms for registering platform specific access
+ * mechanisms for modem.
+ * Also, exposes APIs for gettng/releasing the access and even
+ * query the access status, and the modem usage status.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static DEFINE_MUTEX(modem_list_mutex);
+static LIST_HEAD(modem_list);
+
+struct modem {
+   struct device *dev;
+   struct list_head list;
+   char *modem_name;
+   struct device_attribute dev_attr;
+   struct modem_dev *mdev;
+   atomic_t use;
+};
+
+static enum mod_state {
+   MOD_RELEASED,
+   MOD_ACCESSED,
+};
+
+static const char *mdev_get_name(struct modem_dev *mdev)
+{
+   if (mdev->desc->name)
+   return mdev->desc->name;
+   else
+   return "";
+}
+
+static int _modem_is_requested(struct modem_dev *mdev)
+{
+   /* If we don't know then assume that the modem is always on */
+   if (!mdev->desc->ops->is_requested)
+   return 0;
+
+   return mdev->desc->ops->is_requested(mdev);
+}
+
+/**
+ * modem_is_requested - check if modem access is requested
+ * @modem: modem device
+ *
+ * Checks whether modem is accessed or not by querying
+ * the underlying platform specific modem access
+ * implementation.
+ */
+int modem_is_requested(struct modem *modem)
+{
+   int ret;
+
+   mutex_lock(>mdev->mutex);
+   ret = _modem_is_requested(modem->mdev);
+   mutex_unlock(>mdev->mutex);
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(modem_is_requested);
+
+static int _modem_request(struct modem_dev *mdev)
+{
+   int ret;
+
+   if (++mdev->use_count == 1) {
+   ret = _modem_is_requested(mdev);
+   if (ret == 0)
+   mdev->desc->ops->request(mdev);
+   }
+
+   return 0;
+}
+
+/**
+ * modem_request - Request access the modem
+ * @modem: modem device
+ *
+ * API to access the modem. It keeps a client
+ * specific check on whether the particular modem
+ * requested is accessed or not.
+ */
+int modem_request(struct modem *modem)
+{
+   struct modem_dev *mdev = modem->mdev;
+   int ret = 0;
+
+
+   mutex_lock(>mutex);
+   if (atomic_read(>use) == 1) {
+   mutex_unlock(>mutex);
+   

[PATCHv3 2/4] modem_shm: Register u8500 client for MAF

2012-08-26 Thread Arun Murthy
Register with Modem Access Framework(MAF) for u8500 platform. This will provide
interface to enable and disable modem access and also provide the status.

Signed-off-by: Arun Murthy 
---
 drivers/modem_shm/Kconfig   |   11 +
 drivers/modem_shm/Makefile  |1 +
 drivers/modem_shm/modem_u8500.c |   96 +++
 3 files changed, 108 insertions(+), 0 deletions(-)
 create mode 100644 drivers/modem_shm/modem_u8500.c

diff --git a/drivers/modem_shm/Kconfig b/drivers/modem_shm/Kconfig
index f4b7e54..f59d3dc 100644
--- a/drivers/modem_shm/Kconfig
+++ b/drivers/modem_shm/Kconfig
@@ -7,3 +7,14 @@ config MODEM_SHM
 and allows transparent access to modem to the client drivers.
 
 If unsure, say N.
+
+config MODEM_U8500
+   bool "Modem Access driver for STE U8500 platform"
+   depends on MODEM_SHM
+   default n
+   help
+Add support for Modem Access driver on STE U8500 platform which
+uses Shared Memroy as IPC mechanism between Modem processor and
+Application processor.
+
+If unsure, say N.
diff --git a/drivers/modem_shm/Makefile b/drivers/modem_shm/Makefile
index b77bcc0..a9aac0f 100644
--- a/drivers/modem_shm/Makefile
+++ b/drivers/modem_shm/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_MODEM_SHM):= modem_access.o
+obj-$(CONFIG_MODEM_U8500)  += modem_u8500.o
diff --git a/drivers/modem_shm/modem_u8500.c b/drivers/modem_shm/modem_u8500.c
new file mode 100644
index 000..86966fc
--- /dev/null
+++ b/drivers/modem_shm/modem_u8500.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2011
+ *
+ * License Terms: GNU General Public License v2
+ * Author: Kumar Sanghvi
+ * Arun Murthy 
+ *
+ * Platform driver implementing access mechanisms to modem
+ * on U8500 which uses Shared Memroy as IPC between Application
+ * Processor and Modem processor.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int u8500_modem_request(struct modem_dev *mdev)
+{
+   return prcmu_ac_wake_req();
+}
+
+static void u8500_modem_release(struct modem_dev *mdev)
+{
+   prcmu_ac_sleep_req();
+}
+
+static int u8500_modem_is_requested(struct modem_dev *mdev)
+{
+   return prcmu_is_ac_wake_requested();
+}
+
+static struct modem_ops u8500_modem_ops = {
+   .request = u8500_modem_request,
+   .release = u8500_modem_release,
+   .is_requested = u8500_modem_is_requested,
+};
+
+static struct modem_desc u8500_modem_desc = {
+   .name   = "u8500-shrm-modem",
+   .id = 0,
+   .ops= _modem_ops,
+   .owner  = THIS_MODULE,
+};
+
+
+static int __devinit u8500_modem_probe(struct platform_device *pdev)
+{
+   struct modem_dev *mdev;
+   int err;
+
+   mdev = modem_register(_modem_desc, >dev,
+   NULL);
+   if (IS_ERR(mdev)) {
+   err = PTR_ERR(mdev);
+   pr_err("failed to register %s: err %i\n",
+   u8500_modem_desc.name, err);
+   }
+
+   return 0;
+}
+
+static int __devexit u8500_modem_remove(struct platform_device *pdev)
+{
+
+   return 0;
+}
+
+static struct platform_driver u8500_modem_driver = {
+   .driver = {
+   .name = "u8500-modem",
+   .owner = THIS_MODULE,
+   },
+   .probe = u8500_modem_probe,
+   .remove = __devexit_p(u8500_modem_remove),
+};
+
+static int __init u8500_modem_init(void)
+{
+   int ret;
+
+   ret = platform_driver_register(_modem_driver);
+   if (ret < 0) {
+   printk(KERN_ERR "u8500_modem: platform driver reg failed\n");
+   return -ENODEV;
+   }
+
+   return 0;
+}
+
+static void __exit u8500_modem_exit(void)
+{
+   platform_driver_unregister(_modem_driver);
+}
+
+arch_initcall(u8500_modem_init);
-- 
1.7.4.3

--
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/4] Input: cyttsp4 - core driver for Cypress TMA4XX touchscreen devices

2012-08-26 Thread Ferruh Yigit

On 08/24/2012 05:21 PM, Michal Marek wrote:

Dne 7.8.2012 15:09, Ferruh Yigit napsal(a):

+static int __init cyttsp4_core_init(void)
+{
+   int rc = 0;
+
+   rc = cyttsp4_register_core_driver(_core_driver);
+   pr_info("%s: Cypress TTSP v4 core driver (Built %s @ %s) rc=%d\n",
+__func__, __DATE__, __TIME__, rc);

Hi,

please drop the __DATE__ and __TIME__ macros to keep the build
deterministic.

thanks,
Michal


Thank you Michal,

Will replace them with fixed release date macro.

Regards,
ferruh

--

Regards,
ferruh


This message and any attachments may contain Cypress (or its subsidiaries) 
confidential information. If it has been received in error, please advise the 
sender and immediately delete this message.
--
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: Shutdown problem in SMP system happened on Tegra20

2012-08-26 Thread Bill Huang
> On Sat, Aug 25, 2012 at 08:00:56AM +0800, Bill Huang wrote:
> > nvpublic
> > > So what you're asking for is a feature to do what
> > > CONFIG_PM_SLEEP_SMP does, but without CONFIG_PM_SLEEP_SMP enabled?
> >
> > Yeah pretty much, I'm actually asking should we take care of this
> > since maybe not all platforms will have this config enabled?
> > >
> > > Why not just ensure that CONFIG_PM_SLEEP_SMP is enabled if your
> > > platform requires that the lowest CPU number be the CPU dealing with 
> > > reboot?
> >
> > Someday we will have it enabled, but before that we'll hit the issue,
> > so you don't think this should be taken care of? Thanks.
> 
> Well, just enable CONFIG_PM_SLEEP_SMP then - it'll be far better than trying 
> to implement something in
> the ARM code, especially as sysrq can be used for poweroff/reboot etc (which 
> will run from atomic
> contexts where you can't switch to another CPU.)
> 
> What you're asking for will make these callbacks fragile for other platforms.

OK, thanks.
--
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] mfd: dt: tps6586x: Add power off control

2012-08-26 Thread Bill Huang
nvpublic
> On 08/24/2012 06:36 PM, Bill Huang wrote:
> >>> On Sun, Aug 19, 2012 at 06:07:55PM -0700, Bill Huang wrote:
>  Add DT property "ti,system-power-controller" telling whether or not
>  this pmic is in charge of controlling the system power, so the
>  power off routine can be hooked up to system call "pm_power_off".
> ...
> >>> I've seen the following while trying this patch applied on top of 
> >>> next-20120817:
> >>>
> >>> [   40.581151] Power down.
> >>> [   41.583160] [ cut here ]
> >>> [   41.587784] WARNING: at 
> >>> /home/thierry.reding/src/kernel/linux-ipmp.git/drivers/i2c/busses/i2c-
> >>> tegra.c:525 tegra_i2c_xfer+0x21c/0x29c()
> ...
> >> Thanks Thierry, I can repro this on Tegra20 inconsistently and found,
> >> if current cpu is not cpu0 when doing "machine_shutdown" (it will
> >> call "smp_send_stop"), i2c controller will failed to do any transaction 
> >> (looks like gic interrupt
> will be disabled), I'll debug further to find out the root cause.
> >>
> >> By the way, Tegra30 is good since it will always be cpu0 when doing
> >> "machine_shutdown", I still don't know why it makes the difference
> >> against Tegra20 since I'm not familiar with those cpu stuffs and what make 
> >> it behave differently,
> I'll study a bit, thanks.
> >
> > I've sent the shutdown issue for discussion in ARM list: Shutdown problem 
> > in SMP system happened on
> Tegra20.
> > The cause of the i2c timeout is pretty clear now and it is not
> > directly related to this patch, so is this patch series acceptable? Any 
> > thoughts or comment? Thanks.
> 
> I tend to agree; power off never worked without this patch, and sometimes 
> does with the patch, due to
> nothing wrong with this patch.
> 
> Bill, please do follow up on getting the underlying Tegra issue solved 
> somehow though. IIRC, Joseph Lo
> or Prashant has a patch which enabled the config option that Russell 
> mentioned, so the fix may just be
> to wait for that patch to get finalized, but please double-check that solves 
> it.
> Thanks!

As per the shutdown issue discussion, enabling CONFIG_PM_SLEEP_SMP is the only 
solution and I've confirmed that fix the issue, thanks. 
--
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: [BUG]: fsnotify oops on 3.5.2

2012-08-26 Thread Guo Chao
On Sun, Aug 26, 2012 at 03:44:54PM -0500, Andrew Watts wrote:
> BUG: unable to handle kernel NULL pointer dereference at 0064
> IP: [] fsnotify+0x8b/0x270
> *pde = 
> Oops:  [#1]
> Pid: 14083, comm: firefox Tainted: G O 3.5.2
> EIP: 0060:[] EFLAGS: 00210246 CPU: 0
> EIP is at fsnotify+0x8b/0x270
> EAX:  EBX: fff0 ECX: f5988910 EDX: f5988910
> ESI: 0010 EDI:  EBP: dea1de5c ESP: dea1de14
> DS: 007b ES: 007b FS:  GS: 00e0 SS: 0068
> CR0: 80050033 CR2: 0064 CR3: 34c52000 CR4: 07d0
> DR0:  DR1:  DR2:  DR3: 
> DR6: 0ff0 DR7: 0400
> Process firefox (pid: 14083, ti=dea1c000 task=ed2d1880 task.ti=dea1c000)
> Stack:
> dea1de34 c10ee498  dea1deec dea1df78 8000 0001 c10f21c3
> eeb43688 f5988910 0010 dea1de48    eeb43680
> 0010 f6003600 dea1de8c c10de255 0001   
> Call Trace:
> [] ? dput+0x156/0x1c5
> [] ? mntput+0x19/0x28
> [] fput+0x196/0x1ed
> [] release_open_intent+0x1d/0x29
> [] path_openat+0xc5/0x33f
> [] do_filp_open+0x2a/0x79
> [] ? alloc_fd+0x5c/0xcb
> [] ? getname_flags+0x31/0xb1
> [] do_sys_open+0xef/0x1da
> [] sys_open+0x27/0x2f
> [] sysenter_do_call+0x12/0x22
> [] ? netlbl_mgmt_add_common+0x1ec/0x306
> Code: 02 00 00 b8 20 82 93 c1 e8 41 35 f4 ff 89 45 d0 8b 4d dc 85 b1 24 01 00 
> 00 0f 85 2b 01 00 00 85 db 0f 84 37 01 00 00 85 ff 75 09 <85> 73 74 0f 84 2a 
> 01 00 00 8b 43 70 89 45 ec 8b 4d dc 8b 91 28
> EIP: [] fsnotify+0x8b/0x270 SS:ESP 0068:dea1de14
> CR2: 0064
> ---[ end trace b9a1d764aab1963e ]---

Problematic instruction seems to be this one:

   85 73 74 test   %esi,0x74(%ebx)

And correspond to indicated line in following code: 

if (!(mask & FS_MODIFY) &&
!(test_mask & to_tell->i_fsnotify_mask) &&
*!(mnt && test_mask & mnt->mnt_fsnotify_mask))
return 0;

mnt (a 'struct mount*') is derived from a NULL 'struct vfsmount *',
thus got a value of 0xfff0, which is what's in ebx. 

When reference ->mnt_fsnotify_mask (offset 0x74), it get 
0xfff0 + 0x74 = 0x0064, account for the fault address.

But have no idea how 'struct path' contained a NULL 
'struct vfsmount *' ... ...

--
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] x86: mce: Honour bios-set CMCI threshold

2012-08-26 Thread Naveen N. Rao

On 08/22/2012 06:16 PM, Borislav Petkov wrote:

On Wed, Aug 22, 2012 at 06:00:54PM +0530, Naveen N. Rao wrote:

The ACPI spec doesn't provide for a way for the bios to pass down
recommended thresholds to the OS on a _per-bank_ basis. This patch adds
a new boot option, which if passed, allows bios to initialize the CMCI
threshold. In such a case, we simply skip programming any threshold
value.

As fail-safe, we initialize threshold to 1 if some banks have not been
initialized by the bios and warn the user.

Signed-off-by: Naveen N. Rao 
---
  Documentation/x86/x86_64/boot-options.txt |5 
  arch/x86/include/asm/mce.h|1 +
  arch/x86/kernel/cpu/mcheck/mce.c  |4 +++
  arch/x86/kernel/cpu/mcheck/mce_intel.c|   39 +++--
  4 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Documentation/x86/x86_64/boot-options.txt 
b/Documentation/x86/x86_64/boot-options.txt
index c54b4f5..ec92540 100644
--- a/Documentation/x86/x86_64/boot-options.txt
+++ b/Documentation/x86/x86_64/boot-options.txt
@@ -50,6 +50,11 @@ Machine check
monarchtimeout:
Sets the time in us to wait for other CPUs on machine checks. 0
to disable.
+   mce=bios_cmci_threshold
+   Don't overwrite the bios-set CMCI threshold. This boot option
+   prevents Linux from overwriting the CMCI threshold set by the
+   bios. Without this option, Linux always sets the CMCI
+   threshold to 1.

 nomce (for compatibility with i386): same as mce=off

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index a3ac52b..8ad5078 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -171,6 +171,7 @@ DECLARE_PER_CPU(struct device *, mce_device);
  #ifdef CONFIG_X86_MCE_INTEL
  extern int mce_cmci_disabled;
  extern int mce_ignore_ce;
+extern int mce_bios_cmci_threshold;
  void mce_intel_feature_init(struct cpuinfo_x86 *c);
  void cmci_clear(void);
  void cmci_reenable(void);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 292d025..401359d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -82,6 +82,7 @@ static intmce_panic_timeout   
__read_mostly;
  static intmce_dont_log_ce __read_mostly;
  int   mce_cmci_disabled   __read_mostly;
  int   mce_ignore_ce   __read_mostly;
+intmce_bios_cmci_threshold __read_mostly;
  int   mce_ser __read_mostly;


AFAICT, this is actually a single-bit flag but we're using a whole
integer for it and from looking at the other boot options a couple of
them are used as flags too.

Care to define a

struct boot_flags {
__u64   mce_bios_cmci_threshold : 1,
__reserved  : 63;
};

and use

boot_flags.mce_bios_cmci_threshold

in the conditionals below instead?


Sure - sounds like a good idea. Further, a #define could eliminate the 
need to change other references, but I'm not sure that's GENERALLacceptable


#define mce_bios_cmci_threshold boot_flags.mce_bios_cmci_threshold

could eliminate the need to change other references, but I'm not sure 
that's acceptable


But, I just had a quick look and it seems to me that these were defined 
as integers since they are exposed via sysfs. For instance:


static struct dev_ext_attribute dev_attr_cmci_disabled = {
__ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled),
_cmci_disabled
};

Converting mce_cmci_disabled to a bit-field doesn't work since we take 
its address above. We could ignore and not set the second field at all 
(dev_ext_attribute->var) and define our own callbacks, but that'll be 
more work and I'm not sure if we work fine without





I'll try to convert the rest of them to that struct and thus save some
more space...

Thanks.



--
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: [ 08/32] drm/i915: correctly order the ring init sequence

2012-08-26 Thread Greg Kroah-Hartman
On Fri, Aug 24, 2012 at 08:03:14PM -0300, Herton Ronaldo Krzesinski wrote:
> On Sun, Aug 19, 2012 at 08:57:04PM -0700, Greg Kroah-Hartman wrote:
> > From: Greg KH 
> > 
> > 3.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Daniel Vetter 
> > 
> > commit 0d8957c8a90bbb5d34fab9a304459448a5131e06 upstream.
> > 
> > We may only start to set up the new register values after having
> > confirmed that the ring is truely off. Otherwise the hw might lose the
> > newly written register values. This is caught later on in the init
> > sequence, when we check whether the register writes have stuck.
> > 
> > Reviewed-by: Jani Nikula 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50522
> > Tested-by: Yang Guang 
> > Signed-off-by: Daniel Vetter 
> > Signed-off-by: Greg Kroah-Hartman 
> 
> I think with this commit also the following commits should be picked for
> 3.4 right? (as suggested for 3.0):
> 
> f01db988ef6f6c70a6cc36ee71e4a98a68901229
> b7884eb45ec98c0d34c7f49005ae9d4b4b4e38f6
> 
> Just reporting that I tested this 3.4.10 proposed update with the two
> commits above cherry-picked/backported applied, and worked ok.

3.4.10 as-is works fine for me, so I'm a bit leary of wanting to add
more patches to it (or 3.0.42), until I get some kind of confirmation
that these two patches are really needed.

Anyone else having problems here?

thanks,

greg k-h
--
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: INFO: suspicious RCU usage in rcu_torture_writer()

2012-08-26 Thread Fengguang Wu
On Sat, Aug 25, 2012 at 05:01:49PM -0700, Paul E. McKenney wrote:
> On Sat, Aug 25, 2012 at 11:36:23AM +0800, Fengguang Wu wrote:
> > Greetings,
> > 
> > I got this warning on 3.6.0-rc2. Full dmesg/config attached.
> > 
> > [3.051375] Initializing RT-Tester: OK
> > [3.052491] rcu-torture:--- Start of test: nreaders=2 nfakewriters=4 
> > stat_interval=0 verbose=0 test_no_idle_hz=0 shuffle_interval=3 stut
> > ter=5 irqreader=1 fqs_duration=0 fqs_holdoff=0 fqs_stutter=3 test_boost=1/1 
> > test_boost_interval=7 test_boost_duration=4 shutdown_secs=0 
> > onoff_interval=0 onoff_holdoff=0
> > [3.059084] 
> > [3.059451] ===
> > [3.060454] [ INFO: suspicious RCU usage. ]
> > [3.061482] 3.6.0-rc2-00010-g4c58c42 #59 Not tainted
> > [3.062686] ---
> > [3.063744] /c/kernel-tests/src/stable/kernel/rcutorture.c:990 
> > suspicious rcu_dereference_check() usage!
> > 
> >  982 do {
> >  983 schedule_timeout_uninterruptible(1);
> >  984 rp = rcu_torture_alloc();
> >  985 if (rp == NULL)
> >  986 continue;
> >  987 rp->rtort_pipe_count = 0;
> >  988 udelay(rcu_random() & 0x3ff);
> >  989 old_rp = rcu_dereference_check(rcu_torture_current,
> > >990current == writer_task);
> >  991 rp->rtort_mbtest = 1;
> >  992 rcu_assign_pointer(rcu_torture_current, rp);
> >  993 smp_wmb(); /* Mods to old_rp must follow 
> > rcu_assign_pointer() */
> >  994 if (old_rp) {
> 
> 
> Does the following clear this up?

Sorry I'm still trying to reproduce this. It must be a rare bug
because it only showed up in several of the tens of thousands of test
boots. To reproduce it, I've done near 1000 boots however still not
caught it yet. Let's run it for more time...

Thanks,
Fengguang

>   Thanx, Paul
> 
> 
> 
> rcu: Prevent initialization race in rcutorture kthreads
> 
> When you do something like "t = kthread_run(...)", it is possible that
> the kthread will start running before the assignment to "t" happens.
> If the child kthread expects to find a pointer to its task_struct in "t",
> it will then be fatally disappointed.  This commit therefore switches
> such cases to kthread_create() followed by wake_up_process(), guaranteeing
> that the assignment happens before the child kthread starts running.
> 
> Reported-by: Fengguang Wu 
> Signed-off-by: Paul E. McKenney 
> 
> diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> index 7a97b5b..8ff4fad 100644
> --- a/kernel/rcutorture.c
> +++ b/kernel/rcutorture.c
> @@ -2028,14 +2028,15 @@ rcu_torture_init(void)
>   /* Start up the kthreads. */
>  
>   VERBOSE_PRINTK_STRING("Creating rcu_torture_writer task");
> - writer_task = kthread_run(rcu_torture_writer, NULL,
> -   "rcu_torture_writer");
> + writer_task = kthread_create(rcu_torture_writer, NULL,
> +  "rcu_torture_writer");
>   if (IS_ERR(writer_task)) {
>   firsterr = PTR_ERR(writer_task);
>   VERBOSE_PRINTK_ERRSTRING("Failed to create writer");
>   writer_task = NULL;
>   goto unwind;
>   }
> + wake_up_process(writer_task);
>   fakewriter_tasks = kzalloc(nfakewriters * sizeof(fakewriter_tasks[0]),
>  GFP_KERNEL);
>   if (fakewriter_tasks == NULL) {
> @@ -2150,14 +2151,15 @@ rcu_torture_init(void)
>   }
>   if (shutdown_secs > 0) {
>   shutdown_time = jiffies + shutdown_secs * HZ;
> - shutdown_task = kthread_run(rcu_torture_shutdown, NULL,
> - "rcu_torture_shutdown");
> + shutdown_task = kthread_create(rcu_torture_shutdown, NULL,
> +"rcu_torture_shutdown");
>   if (IS_ERR(shutdown_task)) {
>   firsterr = PTR_ERR(shutdown_task);
>   VERBOSE_PRINTK_ERRSTRING("Failed to create shutdown");
>   shutdown_task = NULL;
>   goto unwind;
>   }
> + wake_up_process(shutdown_task);
>   }
>   i = rcu_torture_onoff_init();
>   if (i != 0) {
--
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] dmaengine: use kmem_cache_zalloc instead of kmem_cache_alloc/memset

2012-08-26 Thread Wei Yongjun
From: Wei Yongjun 

Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun 
---
 drivers/dma/ioat/dma_v2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 8689576..b9d6678 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -434,12 +434,11 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct 
dma_chan *chan, gfp_t f
return NULL;
memset(hw, 0, sizeof(*hw));
 
-   desc = kmem_cache_alloc(ioat2_cache, flags);
+   desc = kmem_cache_zalloc(ioat2_cache, flags);
if (!desc) {
pci_pool_free(dma->dma_pool, hw, phys);
return NULL;
}
-   memset(desc, 0, sizeof(*desc));
 
dma_async_tx_descriptor_init(>txd, chan);
desc->txd.tx_submit = ioat2_tx_submit_unlock;

--
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/9] pinctrl: mvebu: pinctrl driver core

2012-08-26 Thread Stephen Warren
On 08/25/2012 08:53 AM, Sebastian Hesselbarth wrote:
> On 08/24/2012 05:34 AM, Stephen Warren wrote:
>> On 08/23/2012 05:01 PM, Sebastian Hesselbarth wrote:
>>> So possible, valid combinations for uart1 would be:
>>> (a) mpp_uart1;
>>> (b) mpp_uart1, mpp2, mpp3;
>>> (c) mpp_uart1, mpp21, mpp22;
>>> (d) mpp_uart1, mpp2, mpp22;
>>> (e) mpp_uart1, mpp21, mpp3;
>>>  [...]
>> In the example above, there is a single function named "uart1". If this
>> was all the HW supported, I'd expect the driver's
>> pinmux_ops.get_functions_count() to return 1,
>> pinmux_ops.get_function_name(0) to return "uart1", and
>> pinmux_ops.get_function_name(n>0) to return an error.
>>
>> In practice, I assume there are many other options that can be muxed
>> onto mpp2/3/21/22/uart1, so they'd be included in the list as well.
>>
>> I don't expect any scanning, no. I'd expect that tables provided by the
>> SoC-specific drivers to be:
>>
>> * A table of pins
>> * A table of groups
>> * A table of functions
>>
>> No scanning involved.
> 
> Stephen,
> 
> now I do understand but in the current driver we pass pingroups associated
> with the available functions, i.e. "mpp2" with "uart1", "uart2",
> "sdio0", aso.
> IMHO for the above three functions it would be better to have functions
> associated
> with the corresponding groups, i.e. "uart1" with "mpp_uart1", "mpp2",
> "mpp3", aso.

The pinctrl subsystem does expect a list of functions, and for each
function, a list of the groups where it can be selected. I admit that
when I think about this, it's slightly backward, since HW typically has
a list of pins/groups, and for each, a certain set of functions can be
selected. Oh well...
--
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] xen/blkback: use kmem_cache_zalloc instead of kmem_cache_alloc/memset

2012-08-26 Thread Wei Yongjun
From: Wei Yongjun 

Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun 
---
 drivers/block/xen-blkback/xenbus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index 4f66171..c0bbc46 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
 {
struct xen_blkif *blkif;
 
-   blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL);
+   blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL);
if (!blkif)
return ERR_PTR(-ENOMEM);
 
-   memset(blkif, 0, sizeof(*blkif));
blkif->domid = domid;
spin_lock_init(>blk_ring_lock);
atomic_set(>refcnt, 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] dma: tegra: add const to of_device_id.data's structure

2012-08-26 Thread Stephen Warren
On 08/26/2012 03:14 AM, Laxman Dewangan wrote:
> The membe "data" of structure of_device_id is changed to const
> pointer. Hence initializing this with const type data.
> This will fix the compilation warning like
> drivers/dma/tegra20-apb-dma.c:1217:9: warning: assignment discards 'const' 
> qualifier from
> pointer target type [enabled by default]
> 
> This warning came after the change
> -
> commit 98d7bbb9929bcc14e11ac8a55245a4f2dc174e17
> Author: Uwe Kleine-König 
> of: add const to struct *of_device_id.data
> -

Acked-by: Stephen Warren 

I wonder if this should go through Uwe's branch that made similar
changes for all other drivers though? Uwe now CC'd.

--
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 10/13] drivers/watchdog/sp805_wdt.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread viresh kumar
On Sun, Aug 26, 2012 at 9:31 PM, Julia Lawall  wrote:
> From: Julia Lawall 
>
> Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
> clk_enable, and clk_disable and clk_unprepare.  They make the code more
> concise, and ensure that clk_unprepare is called when clk_enable fails.
>
> A simplified version of the semantic patch that introduces calls to these
> functions is as follows: (http://coccinelle.lip6.fr/)

Acked-by: Viresh Kumar 
--
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 1/13] drivers/staging/iio/adc/spear_adc.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread viresh kumar
On Sun, Aug 26, 2012 at 9:30 PM, Julia Lawall  wrote:
> From: Julia Lawall 
>
> Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
> clk_enable, and clk_disable and clk_unprepare.  They make the code more
> concise, and ensure that clk_unprepare is called when clk_enable fails.
>
> A simplified version of the semantic patch that introduces calls to these
> functions is as follows: (http://coccinelle.lip6.fr/)

Reviewed-by: Viresh Kumar 

@Stefan/Shiraz: Can you update spear-devel mailing list in MAINTAINERS file
for this driver?
--
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] af_unix: fix shutdown parameter checking

2012-08-26 Thread Xi Wang
Return -EINVAL rather than 0 given an invalid "mode" parameter.

Signed-off-by: Xi Wang 
---
Another way to check "mode" is as in inet_shutdown():

mode++;
if ((mode & ~SHUTDOWN_MASK) || !mode)
return -EINVAL;

This patch uses a simpler form, to check if "mode" is in the range
SHUT_RD ... SHUT_RDWR.
---
 net/unix/af_unix.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index c5ee4ff..8a84ab6 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2060,10 +2060,14 @@ static int unix_shutdown(struct socket *sock, int mode)
struct sock *sk = sock->sk;
struct sock *other;
 
-   mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN);
-
-   if (!mode)
-   return 0;
+   if (mode < SHUT_RD || mode > SHUT_RDWR)
+   return -EINVAL;
+   /* This maps:
+* SHUT_RD   (0) -> RCV_SHUTDOWN  (1)
+* SHUT_WR   (1) -> SEND_SHUTDOWN (2)
+* SHUT_RDWR (2) -> SHUTDOWN_MASK (3)
+*/
+   ++mode;
 
unix_state_lock(sk);
sk->sk_shutdown |= mode;
-- 
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] decnet: fix shutdown parameter checking

2012-08-26 Thread Xi Wang
The allowed value of "how" is SHUT_RD/SHUT_WR/SHUT_RDWR (0/1/2),
rather than SHUTDOWN_MASK (3).

Signed-off-by: Xi Wang 
---
 net/decnet/af_decnet.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 2ba1a28..307c322 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1313,10 +1313,10 @@ static int dn_shutdown(struct socket *sock, int how)
if (scp->state == DN_O)
goto out;
 
-   if (how != SHUTDOWN_MASK)
+   if (how != SHUT_RDWR)
goto out;
 
-   sk->sk_shutdown = how;
+   sk->sk_shutdown = SHUTDOWN_MASK;
dn_destroy_sock(sk);
err = 0;
 
-- 
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] memory-hotplug: add build zonelists when offline pages

2012-08-26 Thread qiuxishi
From: Xishi Qiu 

online_pages() does build_all_zonelists() and zone_pcp_update(),
I think offline_pages() should do it too.
When the zone has no  memory to allocate, remove it form other
nodes' zonelists. zone_batchsize() depends on zone's present pages,
if zone's present pages are changed, zone's pcp should be updated.


Signed-off-by: Xishi Qiu 
---
 mm/memory_hotplug.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index bc7e7a2..5f6997f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -973,8 +973,13 @@ repeat:

init_per_zone_wmark_min();

-   if (!populated_zone(zone))
+   if (!populated_zone(zone)) {
zone_pcp_reset(zone);
+   mutex_lock(_mutex);
+   build_all_zonelists(NULL, NULL);
+   mutex_unlock(_mutex);
+   } else
+   zone_pcp_update(zone);

if (!node_present_pages(node)) {
node_clear_state(node, N_HIGH_MEMORY);
-- 
1.7.6.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 RESEND] x86_dump_trace: avoiding endless " " is printed

2012-08-26 Thread Liu, Chuansheng
From: liu chuansheng 
Subject: [PATCH] x86_dump_trace: avoiding endless "  " is printed

Found the case that endless "  " printing in dump_trace,
and no real meaningful stack traces are output, so there should
be one rare case that possibly context->previous_esp = context or
other cases.

The endless "  " is as below:
...
[   82.215244,0]  
[   82.215399,0]  
[   82.215554,0]  
[   82.215710,0]  
[   82.215865,0]  
[   82.216022,0]  
[   82.216178,0]  
[   82.216333,0]  
[   82.216488,0]  
[   82.216643,0]  
[   82.216798,0]  
[   82.216953,0]  
...

This patch aim is:
1/ Limiting the "  " outputing, currently the max IRQ contexts
is 2(softirq+harirq combination);
2/ When the max IRQ contexts 2 is reached, print the context content
to confirm;

Change-Id: I6d72aa71c4c5ff8f9e6ae133b3f6bfec8887750d
Signed-off-by: liu chuansheng 
---
 arch/x86/kernel/dumpstack_32.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 1038a41..410fa38 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -22,6 +22,7 @@ void dump_trace(struct task_struct *task, struct pt_regs 
*regs,
const struct stacktrace_ops *ops, void *data)
 {
int graph = 0;
+   int dump_irq_count = 0;
 
if (!task)
task = current;
@@ -47,8 +48,18 @@ void dump_trace(struct task_struct *task, struct pt_regs 
*regs,
stack = (unsigned long *)context->previous_esp;
if (!stack)
break;
+
+   if (dump_irq_count > 2) {
+   pr_warn("break multi-IRQ print,"
+   "context=%p, stack=%p\n",
+   context,
+   stack);
+   break;
+   }
+
if (ops->stack(data, "IRQ") < 0)
break;
+   dump_irq_count++;
touch_nmi_watchdog();
}
 }
-- 
1.7.0.4
--
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: pci: question about the life cycle of pci_dev and its parent pci_bus

2012-08-26 Thread Liu ping fan
On Fri, Aug 24, 2012 at 10:30 PM, Jiang Liu  wrote:
> Hi Pingfan,
>
> We have realized the same when implementing lock mechanisms for PCI 
> hotplug
> operations, and we are planning to holding a reference to parent bus for each 
> pci dev.

Thanks! You save me from searching such codes.
Regards,
pingfan

> Regards!
> Gerry
>
> On 08/23/2012 01:24 PM, Liu ping fan wrote:
>> Hi,
>>
>> I have a question about the life cycle of pci_dev and its parent pci_bus.
>> In pci_destroy_dev(), we remove the pci_dev from the bus_list, so
>> pci_dev is isolated from its parent pci_bus, and their life cycle are
>> independent too. But it seems that in pci_dev, we can still access the
>> pci_bus from the pointer pci_dev->bus.  To resolve such issue, I think
>> during the pci_dev removal,  there should be process to 1.prevent the
>> reader incoming 2. ensure the current reader has exit.  But can not
>> find them.
>>
>> Could anyone tell me?
>>
>> Thanx, pingfan
>> --
>> 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 4/13] i2c: sirf: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Barry Song
2012/8/27 Julia Lawall :
> From: Julia Lawall 
>
> Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
> clk_enable, and clk_disable and clk_unprepare.  They make the code more
> concise, and ensure that clk_unprepare is called when clk_enable fails.
>
> A simplified version of the semantic patch that introduces calls to these
> functions is as follows: (http://coccinelle.lip6.fr/)
>
> // 
> @@
> expression e;
> @@
>
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
>
> @@
> expression e;
> @@
>
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> // 
>
> Signed-off-by: Julia Lawall 

Acked-by: Barry Song <21cn...@gmail.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/


Re: [PATCH v2] leds: triggers: send uevent when changing triggers

2012-08-26 Thread Bryan Wu
My bad. I apologize to the delay. I missed the v2 original patch email
in this thread, but googled and found it.
Applied to my for-next branch now.

Thanks,
-Bryan

On Tue, Aug 14, 2012 at 7:34 PM, Bryan Wu  wrote:
> On Wed, Aug 8, 2012 at 10:16 AM, Bryan Wu  wrote:
>> On Wed, Aug 8, 2012 at 9:12 AM, Henrique de Moraes Holschuh
>>  wrote:
>>> On Tue, 07 Aug 2012, Colin Cross wrote:
 Some triggers create sysfs files when they are enabled.  Send a uevent
 "change" notification whenever the trigger is changed to allow userspace
 processes such as udev to modify permissions on the new files.

 A change notification will also be sent during registration of led class
 devices or led triggers if the default trigger of an led class device
 is found.

 Signed-off-by: Colin Cross 
>>>
>>> Acked-by: Henrique de Moraes Holschuh 
>>>
>>
>> Colin, could you please resend an update patch with some
>> documentations as Henrique pointed out? Then I will add Ack from
>> Henrique and Greg and apply this patch.
>>
>
> Colin, will you update the patch or just keep this one.
>
> -Bryan



-- 
Bryan Wu 
Kernel Developer+86.186-168-78255 Mobile
Canonical Ltd.  www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.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 1/1] x86/oprofile: Fix the calltrace upon profiling some specified events with oprofile

2012-08-26 Thread Wei.Yang
From: Wei Yang 

Upon enabling the call-graph functionality of oprofile, A few minutes
later the following calltrace will always occur.

BUG: unable to handle kernel paging request at 656d6153
IP: [] print_context_stack+0x55/0x110
*pde = 
Oops:  [#1] PREEMPT SMP
Modules linked in:
Pid: 0, comm: swapper/0 Not tainted 3.6.0-rc3-WR5.0+snapshot-20120820_standard
EIP: 0060:[] EFLAGS: 00010093 CPU: 0
EIP is at print_context_stack+0x55/0x110
EAX: 656d7ffc EBX: 656d6153 ECX: c1837ee0 EDX: 656d6153
ESI:  EDI: e000 EBP: f600deac ESP: f600de88
DS: 007b ES: 007b FS: 00d8 GS:  SS: 0068
CR0: 8005003b CR2: 656d6153 CR3: 01934000 CR4: 07d0
DR0:  DR1:  DR2:  DR3: 
DR6: 0ff0 DR7: 0400
Process swapper/0 (pid: 0, ti=f600c000 task=c18411a0 task.ti=c1836000)
Stack:
1a7f76ea 656d7ffc 656d6000 c1837ee0 e000 c1837ee0 656d6153 c188e27c
656d6000 f600dedc c10040f8 c188e27c f600def0  f600dec8 c1837ee0
 f600ded4 c1837ee0 f600dfc4 001f f600df08 c1564d22 
Call Trace:
[] dump_trace+0x68/0xf0
[] x86_backtrace+0xb2/0xc0
[] oprofile_add_sample+0xa2/0xc0
[] ? do_softirq+0x6f/0xa0
[] ppro_check_ctrs+0x79/0x100
[] ? ppro_shutdown+0x60/0x60
[] profile_exceptions_notify+0x8f/0xb0
[] nmi_handle.isra.0+0x48/0x70
[] do_nmi+0xd3/0x3c0
[] ? __local_bh_enable+0x29/0x70
[] ? ftrace_define_fields_irq_handler_entry+0x80/0x80
[] nmi_stack_correct+0x28/0x2d
[] ? ftrace_define_fields_irq_handler_entry+0x80/0x80
[] ? do_softirq+0x6f/0xa0

[] irq_exit+0x65/0x70
[] smp_apic_timer_interrupt+0x59/0x89
[] apic_timer_interrupt+0x2a/0x30
[] ? acpi_idle_enter_bm+0x245/0x273
[] cpuidle_enter+0x15/0x20
[] cpuidle_idle_call+0xa0/0x320
[] cpu_idle+0x55/0xb0
[] rest_init+0x6c/0x74
[] start_kernel+0x2ec/0x2f3
[] ? repair_env_string+0x51/0x51
[] i386_start_kernel+0x78/0x7d
Code: e0 ff ff 89 7d ec 74 5a 8d b4 26 00 00 00 00 8d bc 27 00 00
00 00 39 f3 72 0c 8b 45 f0 8d 64 24 18 5b 5e 5f 5d c3 3b 5d ec 72
ef <8b> 3b 89 f8 89 7d dc e8 ef 40 04 00 85 c0 74 20 8b 40
EIP: [] print_context_stack+0x55/0x110 SS:ESP 0068:f600de88
CR2: 656d6153
---[ end trace 751c9b47c6ff5e29 ]---

Let's assume a scenario that do_softirq() switches the stack to a soft irq
stack, and the soft irq stack is totally empty. At this moment, a nmi interrupt
occurs, subsequently, CPU does not automatically save SS and SP registers
and switch any stack, but instead only stores EFLAGS, CS and IP to the soft irq
stack. since the CPU is in kernel mode when the NMI exception occurs.
the layout of the current soft irq stack is this:

  +--+<-the top of soft irq
  |   EFLAGS |
  +--+
  |CS|
  +--+
  |IP|
  +--+
  |   SAVE_ALL   |
  +--+

but the return value of the function kernel_stack_pointer() is'>sp'
(for x86_32 CPU), which is invoked by the x86_backtrace function. Since
the type of regs pointer is a pt_regs structure, the return value is not
in the range of the soft irq stack, as the SP register is not save in the
soft irq stack. Therefore, we need to check if the return value of the function
resides in valid range. Additionally, the changes has no impact on the normal
NMI exception.

Signed-off-by: Yang Wei 
---
 arch/x86/oprofile/backtrace.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index d6aa6e8..a5fca0b 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -17,6 +17,11 @@
 #include 
 #include 
 
+static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
+{
+   void *t = tinfo;
+   return p > t + sizeof(struct thread_info) && p < t + THREAD_SIZE;
+}
 static int backtrace_stack(void *data, char *name)
 {
/* Yes, we want all stacks */
@@ -110,9 +115,14 @@ void
 x86_backtrace(struct pt_regs * const regs, unsigned int depth)
 {
struct stack_frame *head = (struct stack_frame *)frame_pointer(regs);
+   struct thread_info *context;
 
if (!user_mode_vm(regs)) {
unsigned long stack = kernel_stack_pointer(regs);
+   context = (struct thread_info *)
+   (stack & (~(THREAD_SIZE - 1)));
+   if (!valid_stack_ptr(context, (void *)stack))
+   return;
if (depth)
dump_trace(NULL, regs, (unsigned long *)stack, 0,
   _ops, );
-- 
1.7.0.2

--
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] OMAP GPIO - don't wake from suspend unless requested.

2012-08-26 Thread Shilimkar, Santosh
On Sun, Aug 26, 2012 at 3:53 PM, NeilBrown  wrote:
>
> On Sun, 26 Aug 2012 09:47:50 +0530 "Shilimkar, Santosh"
>  wrote:
>
> > + Jon,
> >
> > On Sat, Aug 25, 2012 at 5:14 PM, NeilBrown  wrote:
> > >
> > >
> > >
> > > Current kernel will wake from suspend on an event on any active
> > > GPIO even if enable_irq_wake() wasn't called.
> > >
> > > There are two reasons that the hardware wake-enable bit should be set:
> > >
> > > 1/ while non-suspended the CPU might go into a deep sleep (off_mode)
> > >   in which the wake-enable bit is needed for an interrupt to be
> > >   recognised.
> > > 2/ while suspended the GPIO interrupt should wake from suspend if and
> > >only if irq_wake as been enabled.
> > >
> > > The code currently doesn't keep these two reasons separate so they get
> > > confused and sometimes the wakeup flags is set incorrectly.
> > >
> > > This patch reverts:
> > >  commit 9c4ed9e6c01e7a8bd9079da8267e1f03cb4761fc
> > > gpio/omap: remove suspend/resume callbacks
> > > and
> > >  commit 0aa2727399c0b78225021413022c164cb99fbc5e
> > > gpio/omap: remove suspend_wakeup field from struct gpio_bank
> > >
> > > and makes some minor changes so that we have separate flags for "GPIO
> > > should wake from deep idle" and "GPIO should wake from suspend".
> > >
> > > With this patch, the GPIO from my touch screen doesn't wake my device
> > > any more, which is what I want.
> > >
> > > Cc: Kevin Hilman 
> > > Cc: Tony Lindgren 
> > > Cc: Santosh Shilimkar 
> > > Cc: Cousson, Benoit 
> > > Cc: Grant Likely 
> > > Cc: Tarun Kanti DebBarma 
> > > Cc: Felipe Balbi 
> > > Cc: Govindraj.R 
> > >
> > > Signed-off-by: NeilBrown 
> > >
> > The patch doesn't seems to be correct. At least the 2/ gets
> > fixed with a proper IRQCHIP flag. Can you try the patch at
> > end of the email and see if it helps ? Am attaching it in case
> > mailer damages it.
> >
> > Regards
> > Santosh
> >
> > >From b8a38fc75e046f6462610e26c47c620cad850c24 Mon Sep 17 00:00:00 2001
> > From: Santosh Shilimkar 
> > Date: Sun, 26 Aug 2012 09:39:51 +0530
> > Subject: [PATCH] gpio: omap: Set IRQCHIP_MASK_ON_SUSPEND to mask all
> >  non-wakeup gpio wakeups.
> >
> > Set the irq chip flag IRQCHIP_MASK_ON_SUSPEND to cause the irq pm code
> > to mask all non-wake gpios in suspend, which will ensure the wakeup
> > enable
> > bit is not set on non-wake gpios.
> >
> > Signed-off-by: Santosh Shilimkar 
> > ---
> >  drivers/gpio/gpio-omap.c |1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > index e6efd77..50b4c18 100644
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -779,6 +779,7 @@ static struct irq_chip gpio_irq_chip = {
> >   .irq_unmask = gpio_unmask_irq,
> >   .irq_set_type   = gpio_irq_type,
> >   .irq_set_wake   = gpio_wake_enable,
> > + .flags  = IRQCHIP_MASK_ON_SUSPEND;
> >  };
> >
> >
> > /*-*/
>
>
> No obvious damage, unless the mailer is responsible or the ';' at the end
> of
> the line, rather than ',' :-)
>
:-) That was typo.

> The approach makes sense, but does actually work.  Should be fixable
> though.
>
> When I try this I get:
>
>
>
> [  158.114440] Checking wakeup interrupts
> [  158.118408] Unhandled fault: external abort on non-linefetch (0x1028)
> at 0xfb054040
> [  158.126403] Internal error: : 1028 [#1] PREEMPT ARM
> [  158.131500] Modules linked in: ipv6 g_ether hso libertas_sdio libertas
> cfg80211
> [  158.139190] CPU: 0Not tainted  (3.5.0-gta04-debug+ #2)
> [  158.144927] PC is at _set_gpio_triggering+0x38/0x258
> [  158.150115] LR is at gpio_mask_irq+0xac/0xc0
> [  158.154602] pc : []lr : []psr: 6193
> [  158.154602] sp : db521e90  ip : 0011  fp : beeecc2c
> [  158.166595] r10: c05c8ebc  r9 : daa5a858  r8 : 0003
> [  158.172027] r7 : a193  r6 :   r5 : fb054000  r4 : ded44e18
> [  158.178863] r3 : 0001  r2 :   r1 : ded30340  r0 : 0040
> [  158.185668] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
> Segment use
>
> so it looks like runtime PM has turned off the iclk to the GPIO module so
> that
> when we try to tell it to change settings, it is no longer listening to
> us.
>From the crash logs it appears like that.

> The "Checking wakeup interrupts" function happens very late in the suspend
> cycle, after all the suspend_late and suspend_noirq functions have run.
> Maybe it needs to be moved earlier...
>
No it shouldn't be moved and it is that point for lot many good
reasons. Ofcourse
this omap gpio driver crash needs to be addressed. Need to think bit
more on this
issue.

Regards
Santosh
--
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] fat : no need to reset EOF in ent_put for FAT32

2012-08-26 Thread Namjae Jeon
2012/8/26, OGAWA Hirofumi :
> Namjae Jeon  writes:
>
>> #define FAT_ENT_EOF(EOF_FAT32)
>>
>> there is no need to reset value of 'new' for FAT32 as the values is
>> already correct
>>
>> Signed-off-by: Namjae Jeon 
>> Signed-off-by: Amit Sahrawat 
>> ---
>>  fs/fat/fatent.c |2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
>> index 31f08ab..af53815 100644
>> --- a/fs/fat/fatent.c
>> +++ b/fs/fat/fatent.c
>> @@ -186,8 +186,6 @@ static void fat16_ent_put(struct fat_entry *fatent,
>> int new)
>>
>>  static void fat32_ent_put(struct fat_entry *fatent, int new)
>>  {
>> -if (new == FAT_ENT_EOF)
>> -new = EOF_FAT32;
Hi OGAWA..
Okay, I will resend v2 patch after removing line.
Thanks.
>>
>
> Please remove this new line too. If it was removed,
>
> Acked-by: OGAWA Hirofumi 
>
>>  WARN_ON(new & 0xf000);
>>  new |= le32_to_cpu(*fatent->u.ent32_p) & ~0x0fff;
>
> --
> OGAWA Hirofumi 
>
--
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 1/2] fat: kill unused macros

2012-08-26 Thread Namjae Jeon
2012/8/26, OGAWA Hirofumi :
> Namjae Jeon  writes:
>
>> Remove unused macros.
>
> Those are for userland. Are you sure userland doesn't use those anymore?
Hi. OGAWA.
I missed this point. I will repost if I can be sure.
Thanks a lot.
>
>> Signed-off-by: Namjae Jeon 
>> Signed-off-by: Amit Sahrawat 
>> ---
>>  include/linux/msdos_fs.h |   12 
>>  1 file changed, 12 deletions(-)
>>
>> diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
>> index 11cc2ac..be3dc72 100644
>> --- a/include/linux/msdos_fs.h
>> +++ b/include/linux/msdos_fs.h
>> @@ -9,18 +9,6 @@
>>   * The MS-DOS filesystem constants/structures
>>   */
>>
>> -#define SECTOR_SIZE 512 /* sector size (bytes) */
>> -#define SECTOR_BITS 9   /* log2(SECTOR_SIZE) */
>> -#define MSDOS_DPB   (MSDOS_DPS) /* dir entries per block */
>> -#define MSDOS_DPB_BITS  4   /* log2(MSDOS_DPB) */
>> -#define MSDOS_DPS   (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
>> -#define MSDOS_DPS_BITS  4   /* log2(MSDOS_DPS) */
>> -#define MSDOS_LONGNAME  256 /* maximum name length */
>> -#define CF_LE_W(v)  le16_to_cpu(v)
>> -#define CF_LE_L(v)  le32_to_cpu(v)
>> -#define CT_LE_W(v)  cpu_to_le16(v)
>> -#define CT_LE_L(v)  cpu_to_le32(v)
>> -
>>  #define MSDOS_ROOT_INO   1  /* The root inode number */
>>  #define MSDOS_FSINFO_INO 2  /* Used for managing the FSINFO block */
>
> --
> OGAWA Hirofumi 
>
--
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: [RESEND BUGFIX PATCH 1/3] PCI/AER: fix pci_ops return NULL when hotplug a pci bus which was doing aer error inject

2012-08-26 Thread Huang Ying
On Sat, 2012-08-25 at 17:59 +0800, Yijing Wang wrote:
> When we inject aer errors to the target pci device by aer_inject module, the 
> pci_ops of pci
> bus which the target device is on will be assign to pci_ops_aer.So if the 
> target pci device
> is a bridge, once we hotplug the pci bus(child bus) which the target device 
> bridges to, child
> bus's pci_ops will be assigned to pci_ops_aer too.Now every access to the 
> child bus's device
> will result to system panic, because it return NULL pci_ops in pci_read_aer.
> This patch fix this.
> 
> CallTrace:
> bash[5908]: NaT consumption 17179869216 [1]
> Modules linked in: aer_inject cpufreq_conservative cpufreq_userspace 
> cpufreq_pow
> ersave acpi_cpufreq binfmt_misc fuse nls_iso8859_1 loop ipmi_si(+) 
> ipmi_devintf
> ipmi_msghandler dm_mod ppdev iTCO_wdt iTCO_vendor_support sg igb parport_pc 
> i2c_
> i801 mptctl i2c_core serio_raw hid_generic lpc_ich mfd_core parport button 
> conta
> iner usbhid hid uhci_hcd ehci_hcd usbcore usb_common sd_mod crc_t10dif ext3 
> mbca
> che jbd fan processor ide_pci_generic ide_core ata_piix libata mptsas 
> mptscsih m
> ptbase scsi_transport_sas scsi_mod thermal thermal_sys hwmon
> 
> Pid: 5908, CPU 9, comm: bash
> psr : 1010085a2010 ifs : 848e ip  : []
> Not
> tainted (3.5.0-rc6yijing-repo)
> ip is at pci_read_aer+0x330/0x460 [aer_inject]
> unat:  pfs : 048e rsc : 0003
> rnat:  bsps:  pr  : 65519aa6a6969aa5
> ldrs:  ccv : 0001 fpsr: 0009804c8a70033f
> csd :  ssd : 
> b0  : a00220b815b0 b6  : a00220b81280 b7  : a001006d56a0
> f6  : 1003e0005 f7  : 1003e0028
> f8  : 1003e00c8 f9  : 1003e0005
> f10 : 1003e627ec1e2f4c0d8a7 f11 : 1003e0011
> r1  : a001014e63c0 r2  : 0738 r3  : fffe
> r8  : 0736 r9  : 0042 r10 : e01f08f4c898
> r11 :  r12 : e00f3dfcfdc0 r13 : e00f3dfc
> r14 : 0738 r15 : 4000 r16 : a00220b827c8
> r17 : a00220b827b8 r18 : ff00 r19 : e00f073b0110
> r20 : 0042 r21 : e00f073b0114 r22 : 
> r23 : e00f073b0118 r24 : a001009e0e49 r25 : 0001
> r26 : 7041 r27 : e00f3dfcfde0 r28 : 
> r29 : e00f3dfcfc08 r30 : a00220b827c8 r31 : e01f074d6000
> 
> Call Trace:
>  [] show_stack+0x80/0xa0
> sp=e00f3dfcf800 bsp=e00f3dfc1758
>  [] show_regs+0x640/0x920
> sp=e00f3dfcf9d0 bsp=e00f3dfc1700
>  [] die+0x190/0x2c0
> sp=e00f3dfcf9e0 bsp=e00f3dfc16c0
>  [] die_if_kernel+0x50/0x80
> sp=e00f3dfcf9e0 bsp=e00f3dfc1690
>  [] ia64_fault+0xf0/0x15e0
> sp=e00f3dfcf9e0 bsp=e00f3dfc1640
>  [] ia64_native_leave_kernel+0x0/0x270
> sp=e00f3dfcfbf0 bsp=e00f3dfc1640
>  [] pci_read_aer+0x330/0x460 [aer_inject]
> sp=e00f3dfcfdc0 bsp=e00f3dfc15c8
>  [] pci_bus_read_config_dword+0xe0/0x140
> sp=e00f3dfcfdc0 bsp=e00f3dfc1580
>  [] pci_bus_read_dev_vendor_id+0x50/0x200
> sp=e00f3dfcfdd0 bsp=e00f3dfc1530
>  [] pci_scan_single_device+0x90/0x200
> sp=e00f3dfcfdd0 bsp=e00f3dfc14f8
>  [] pci_scan_slot+0xb0/0x320
> sp=e00f3dfcfde0 bsp=e00f3dfc14a8
>  [] pci_scan_child_bus+0x90/0x2e0
> sp=e00f3dfcfde0 bsp=e00f3dfc1468
>  [] pci_scan_bridge+0x540/0xdc0
> sp=e00f3dfcfde0 bsp=e00f3dfc13d0
>  [] pci_scan_child_bus+0x2b0/0x2e0
> sp=e00f3dfcfe00 bsp=e00f3dfc1390
>  [] pci_rescan_bus+0x50/0x220
> sp=e00f3dfcfe00 bsp=e00f3dfc1358
>  [] bus_rescan_store+0xf0/0x160
> sp=e00f3dfcfe10 bsp=e00f3dfc1328
>  [] bus_attr_store+0x70/0xa0
> sp=e00f3dfcfe20 bsp=e00f3dfc12f0
>  [] sysfs_write_file+0x240/0x340
> sp=e00f3dfcfe20 bsp=e00f3dfc1298
>  [] vfs_write+0x1b0/0x3a0
> sp=e00f3dfcfe20 bsp=e00f3dfc1250
>  [] sys_write+0x80/0x100
> sp=e00f3dfcfe20 bsp=e00f3dfc11d0
>  [] ia64_ret_from_syscall+0x0/0x20
> sp=e00f3dfcfe30 bsp=e00f3dfc11d0
>  [] __kernel_syscall_via_break+0x0/0x20
> sp=e00f3dfd bsp=e00f3dfc11d0
> Disabling lock debugging due to kernel taint
> 

Re: [PATCH V5 0/5] clk: mmp: add clock framework for mmp

2012-08-26 Thread Chao Xie
On Sat, Aug 25, 2012 at 8:21 AM, Mike Turquette  wrote:
> Quoting Chao Xie (2012-08-19 19:55:10)
>> From: Chao Xie 
>>  arch/arm/mach-mmp/Kconfig|3 +
>>  drivers/clk/Makefile |3 +
>>  drivers/clk/mmp/Makefile |9 +
>>  drivers/clk/mmp/clk-apbc.c   |  152 ++
>>  drivers/clk/mmp/clk-apmu.c   |   97 +
>>  drivers/clk/mmp/clk-frac.c   |  153 ++
>>  drivers/clk/mmp/clk-mmp2.c   |  449 
>> ++
>>  drivers/clk/mmp/clk-pxa168.c |  346 
>>  drivers/clk/mmp/clk-pxa910.c |  320 ++
>>  drivers/clk/mmp/clk.h|   35 
>
> Looks like you are not removing your arch/arm/mach-mmp/clock.c.  Is that
> intentional?
>
> When I apply your series against v3.6-rc3 I find that compilation breaks
> with mmp2_defconfig due to conflicting definitions for the clk api
> (clk_enable, clk_set_rate, etc).  This is not surprising since your
> legacy clock code is neither deleted nor removed from compilation
> conditionally by checking for CONFIG_COMMON_CLK.
>
> Did I somehow manage to misapply your patches or should your patches
> have removed the arch-specific clock framework as well?
>
hi, Mike
Yes. There are some patches for seperate the original clock code in arch.
I had sent these patches before, but it seems that too many patches
sent, and haojian missed it.
I will sent out the patches for arch today. Thanks.

> Regards,
> Mike
>
>>  10 files changed, 1567 insertions(+), 0 deletions(-)
>>  create mode 100644 drivers/clk/mmp/Makefile
>>  create mode 100644 drivers/clk/mmp/clk-apbc.c
>>  create mode 100644 drivers/clk/mmp/clk-apmu.c
>>  create mode 100644 drivers/clk/mmp/clk-frac.c
>>  create mode 100644 drivers/clk/mmp/clk-mmp2.c
>>  create mode 100644 drivers/clk/mmp/clk-pxa168.c
>>  create mode 100644 drivers/clk/mmp/clk-pxa910.c
>>  create mode 100644 drivers/clk/mmp/clk.h
--
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: linux-next: build failure after merge of the gpio-lw tree

2012-08-26 Thread Kuninori Morimoto

Hi Linus W

> > Now, these fixup patches were accepted.
> >   http://git.kernel.org/tip/17d83127d4c2b322dd8f217e0ac08c66eb403779
> >   http://git.kernel.org/tip/b3ae66f209e8929db62b5a5f874ab2cdcf5ef1d4
> >
> > Could you please re-check this dropped patch ?
> 
> Yes! I've applied it. Check that it lands nicely in -next.

Thank you !
It works on my board.

Best regards
---
Kuninori Morimoto
--
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] kdump: remove unused including

2012-08-26 Thread Simon Horman
On Sat, Aug 25, 2012 at 10:18:20AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun 
> 
> 
> Remove including  that don't need it.
> 
> Signed-off-by: Wei Yongjun 

Reviewed-by: Simon Horman  ---
>  kernel/kexec.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/kexec.c b/kernel/kexec.c
> index 0668d58..5e4bd78 100644
> --- a/kernel/kexec.c
> +++ b/kernel/kexec.c
> @@ -21,7 +21,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> 
> 
> 
> ___
> kexec mailing list
> ke...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 
--
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] extcon: arizona: Free MICDET IRQ on error during probe

2012-08-26 Thread Chanwoo Choi
On 08/27/2012 05:58 AM, Mark Brown wrote:

> Signed-off-by: Mark Brown 
> ---
>  drivers/extcon/extcon-arizona.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index fa2114f..13eafcb 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -488,11 +488,13 @@ static int __devinit arizona_extcon_probe(struct 
> platform_device *pdev)
>   ret = input_register_device(info->input);
>   if (ret) {
>   dev_err(>dev, "Can't register input device: %d\n", ret);
> - goto err_fall_wake;
> + goto err_micdet;
>   }
>  
>   return 0;
>  
> +err_micdet:
> + arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info);
>  err_fall_wake:
>   arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_FALL, 0);
>  err_fall:


Thanks much,

Signed-off-by: Chanwoo Choi 

I will apply this patch to
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next
and you can check it after some hours.
--
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 -next] extcon: extcon-arizona depends on INPUT

2012-08-26 Thread Chanwoo Choi
On 08/25/2012 02:04 AM, Randy Dunlap wrote:

> From: Randy Dunlap 
> 
> extcon-arizona uses input_*() functions so it should depend
> on INPUT.
> 
> ERROR: "input_event" [drivers/extcon/extcon-arizona.ko] undefined!
> ERROR: "input_free_device" [drivers/extcon/extcon-arizona.ko] undefined!
> ERROR: "input_register_device" [drivers/extcon/extcon-arizona.ko] undefined!
> ERROR: "input_set_capability" [drivers/extcon/extcon-arizona.ko] undefined!
> ERROR: "input_allocate_device" [drivers/extcon/extcon-arizona.ko] undefined!
> ERROR: "input_unregister_device" [drivers/extcon/extcon-arizona.ko] undefined!
> 
> Signed-off-by: Randy Dunlap 
> Cc: MyungJoo Ham 
> Cc: Chanwoo Choi 
> Cc: Mark Brown 
> ---

Thanks much,

Signed-off-by: Chanwoo Choi 

I will apply this patch to
http://10.90.51.51/cgi-bin/gitweb.cgi?p=linux-samsung;a=shortlog;h=refs/heads/extcon-for-next
and you can check it after some hours.
--
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 3.4.10

2012-08-26 Thread Greg KH
I'm announcing the release of the 3.4.10 kernel.

All users of the 3.4 kernel series must upgrade.

Note, there is a reported problem with the Intel graphics driver in this
release that might affect you, or not, please test.

The updated 3.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.4.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 
 arch/s390/kernel/compat_linux.c |2 
 arch/s390/kernel/compat_wrapper.S   |4 
 arch/x86/xen/p2m.c  |   36 +++
 drivers/dma/imx-dma.c   |   36 ++-
 drivers/gpu/drm/i915/intel_display.c|   11 -
 drivers/gpu/drm/i915/intel_dp.c |   18 -
 drivers/gpu/drm/i915/intel_ringbuffer.c |7 
 drivers/gpu/drm/nouveau/nvd0_display.c  |2 
 drivers/gpu/drm/radeon/atombios_crtc.c  |   14 +
 drivers/gpu/drm/radeon/evergreen.c  |   71 +--
 drivers/gpu/drm/radeon/ni.c |   14 +
 drivers/gpu/drm/radeon/radeon_asic.h|8 
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |4 
 drivers/gpu/drm/radeon/radeon_mode.h|1 
 drivers/gpu/drm/radeon/rv515.c  |   13 -
 drivers/infiniband/ulp/srp/ib_srp.c |   87 ++--
 drivers/net/wireless/rt2x00/rt2800usb.c |1 
 drivers/tty/serial/pmac_zilog.c |   12 -
 drivers/usb/gadget/u_ether.c|6 
 drivers/usb/host/pci-quirks.c   |7 
 drivers/usb/host/pci-quirks.h   |1 
 drivers/usb/host/xhci-pci.c |   10 
 drivers/usb/host/xhci-ring.c|   36 ++-
 drivers/usb/host/xhci.c |8 
 drivers/usb/host/xhci.h |1 
 drivers/usb/serial/ftdi_sio.c   |1 
 drivers/usb/serial/ftdi_sio_ids.h   |7 
 drivers/usb/serial/mos7840.c|9 
 drivers/usb/serial/option.c |  281 +++-
 fs/ext4/extents.c   |1 
 fs/ext4/super.c |6 
 fs/fuse/file.c  |2 
 fs/jbd2/journal.c   |3 
 include/drm/drm_pciids.h|3 
 include/linux/jbd2.h|1 
 include/linux/usb.h |   21 ++
 37 files changed, 408 insertions(+), 339 deletions(-)

Alex Deucher (4):
  drm/radeon: properly handle crtc powergating
  drm/radeon: add some new SI pci ids
  drm/radeon: fix bank tiling parameters on cayman
  drm/radeon: fix bank tiling parameters on evergreen

Bart Van Assche (1):
  IB/srp: Fix a race condition

Bjørn Mork (1):
  USB: option: add ZTE K5006-Z

Christoph Bumiller (1):
  drm/nvd0/disp: mask off high 16 bit of negative cursor x-coordinate

Daniel Vetter (3):
  drm/i915: correctly order the ring init sequence
  drm/i915: ignore eDP bpc settings from vbt
  drm/i915: reorder edp disabling to fix ivb MacBook Air

Fabio Estevam (1):
  dma: imx-dma: Fix kernel crash due to missing clock conversion

Greg Kroah-Hartman (1):
  Linux 3.4.10

Gustavo Padovan (1):
  USB: add USB_VENDOR_AND_INTERFACE_INFO() macro

Heiko Carstens (2):
  s390/compat: fix compat wrappers for process_vm system calls
  s390/compat: fix mmap compat system calls

Jason Wessel (1):
  pmac_zilog,kdb: Fix console poll hook to return instead of loop

Jeongdo Son (1):
  rt2x00: Add support for BUFFALO WLI-UC-GNM2 to rt2800usb.

Jerome Glisse (1):
  drm/radeon: do not reenable crtc after moving vram start address

Jesse Barnes (1):
  drm/i915: prefer wide & slow to fast & narrow in DP configs

Mark Ferrell (1):
  usb: serial: mos7840: Fixup mos7840_chars_in_buffer()

Michael Grzeschik (1):
  usb: gadget: u_ether: fix kworker 100% CPU issue with still used 
interfaces in eth_stop

Ozan Çağlayan (1):
  USB: ftdi_sio: Add VID/PID for Kondo Serial USB

Sarah Sharp (4):
  xhci: Add Etron XHCI_TRUST_TX_LENGTH quirk.
  xhci: Increase reset timeout for Renesas 720201 host.
  xhci: Switch PPT ports to EHCI on shutdown.
  xhci: Fix bug after deq ptr set to link TRB.

Stefano Stabellini (1):
  xen: mark local pages as FOREIGN in the m2p_override

Theodore Ts'o (4):
  ext4: make sure the journal sb is written in ext4_clear_journal_err()
  ext4: avoid kmemcheck complaint from reading uninitialized memory
  ext4: fix long mount times on very big file systems
  ext4: fix kernel BUG on large-scale rm -rf commands

Zach Brown (1):
  fuse: verify all ioctl retry iov elements

fangxiaozhi (1):
  USB: support the new interfaces of Huawei Data Card devices in option 
driver



pgp52CdtutlbN.pgp
Description: 

Re: Linux 3.0.42

2012-08-26 Thread Greg KH
diff --git a/Makefile b/Makefile
index 2cbfd97..d863aa0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 0
-SUBLEVEL = 41
+SUBLEVEL = 42
 EXTRAVERSION =
 NAME = Sneaky Weasel
 
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 53acaa8..f98af03 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -631,7 +631,6 @@ asmlinkage unsigned long old32_mmap(struct 
mmap_arg_struct_emu31 __user *arg)
return -EFAULT;
if (a.offset & ~PAGE_MASK)
return -EINVAL;
-   a.addr = (unsigned long) compat_ptr(a.addr);
return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
  a.offset >> PAGE_SHIFT);
 }
@@ -642,7 +641,6 @@ asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 
__user *arg)
 
if (copy_from_user(, arg, sizeof(a)))
return -EFAULT;
-   a.addr = (unsigned long) compat_ptr(a.addr);
return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
 }
 
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 58efeb9..2f7847d 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -683,6 +683,7 @@ int m2p_add_override(unsigned long mfn, struct page *page, 
bool clear_pte)
unsigned long uninitialized_var(address);
unsigned level;
pte_t *ptep = NULL;
+   int ret = 0;
 
pfn = page_to_pfn(page);
if (!PageHighMem(page)) {
@@ -706,6 +707,24 @@ int m2p_add_override(unsigned long mfn, struct page *page, 
bool clear_pte)
list_add(>lru,  _overrides[mfn_hash(mfn)]);
spin_unlock_irqrestore(_override_lock, flags);
 
+   /* p2m(m2p(mfn)) == mfn: the mfn is already present somewhere in
+* this domain. Set the FOREIGN_FRAME_BIT in the p2m for the other
+* pfn so that the following mfn_to_pfn(mfn) calls will return the
+* pfn from the m2p_override (the backend pfn) instead.
+* We need to do this because the pages shared by the frontend
+* (xen-blkfront) can be already locked (lock_page, called by
+* do_read_cache_page); when the userspace backend tries to use them
+* with direct_IO, mfn_to_pfn returns the pfn of the frontend, so
+* do_blockdev_direct_IO is going to try to lock the same pages
+* again resulting in a deadlock.
+* As a side effect get_user_pages_fast might not be safe on the
+* frontend pages while they are being shared with the backend,
+* because mfn_to_pfn (that ends up being called by GUPF) will
+* return the backend pfn rather than the frontend pfn. */
+   ret = __get_user(pfn, _to_phys_mapping[mfn]);
+   if (ret == 0 && get_phys_to_machine(pfn) == mfn)
+   set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));
+
return 0;
 }
 EXPORT_SYMBOL_GPL(m2p_add_override);
@@ -717,6 +736,7 @@ int m2p_remove_override(struct page *page, bool clear_pte)
unsigned long uninitialized_var(address);
unsigned level;
pte_t *ptep = NULL;
+   int ret = 0;
 
pfn = page_to_pfn(page);
mfn = get_phys_to_machine(pfn);
@@ -743,6 +763,22 @@ int m2p_remove_override(struct page *page, bool clear_pte)
/* No tlb flush necessary because the caller already
 * left the pte unmapped. */
 
+   /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present
+* somewhere in this domain, even before being added to the
+* m2p_override (see comment above in m2p_add_override).
+* If there are no other entries in the m2p_override corresponding
+* to this mfn, then remove the FOREIGN_FRAME_BIT from the p2m for
+* the original pfn (the one shared by the frontend): the backend
+* cannot do any IO on this page anymore because it has been
+* unshared. Removing the FOREIGN_FRAME_BIT from the p2m entry of
+* the original pfn causes mfn_to_pfn(mfn) to return the frontend
+* pfn again. */
+   mfn &= ~FOREIGN_FRAME_BIT;
+   ret = __get_user(pfn, _to_phys_mapping[mfn]);
+   if (ret == 0 && get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) &&
+   m2p_find_override(mfn) == NULL)
+   set_phys_to_machine(pfn, mfn);
+
return 0;
 }
 EXPORT_SYMBOL_GPL(m2p_remove_override);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2d6039b..3bd85f7 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -150,8 +150,6 @@ static int init_ring_common(struct intel_ring_buffer *ring)
I915_WRITE_HEAD(ring, 0);
ring->write_tail(ring, 0);
 
-   /* Initialize the ring. */
-   I915_WRITE_START(ring, obj->gtt_offset);
head = I915_READ_HEAD(ring) & HEAD_ADDR;
 
/* G45 ring initialization fails to reset head to zero */
@@ -177,6 +175,11 @@ static int 

Linux 3.0.42

2012-08-26 Thread Greg KH
I'm announcing the release of the 3.0.42 kernel.

All users of the 3.0 kernel series must upgrade.

Note, there is a reported problem with the Intel graphics driver in this
release, a follow-on release might happen quite quickly to resolve this
issue after it has been tested out.

The updated 3.0.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.0.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 
 arch/s390/kernel/compat_linux.c |2 
 arch/x86/xen/p2m.c  |   36 
 drivers/gpu/drm/i915/intel_ringbuffer.c |7 
 drivers/gpu/drm/radeon/evergreen.c  |   57 --
 drivers/gpu/drm/radeon/radeon_asic.h|8 
 drivers/gpu/drm/radeon/rv515.c  |   13 -
 drivers/infiniband/ulp/srp/ib_srp.c |   87 +++--
 drivers/net/wireless/rt2x00/rt2800usb.c |1 
 drivers/usb/host/pci-quirks.c   |7 
 drivers/usb/host/pci-quirks.h   |1 
 drivers/usb/host/xhci-pci.c |   10 +
 drivers/usb/host/xhci.c |8 
 drivers/usb/host/xhci.h |1 
 drivers/usb/serial/ftdi_sio.c   |1 
 drivers/usb/serial/ftdi_sio_ids.h   |7 
 drivers/usb/serial/mos7840.c|9 -
 drivers/usb/serial/option.c |  281 
 fs/ext4/super.c |1 
 fs/fuse/file.c  |2 
 include/linux/usb.h |   21 ++
 21 files changed, 283 insertions(+), 279 deletions(-)

Bart Van Assche (1):
  IB/srp: Fix a race condition

Bjørn Mork (1):
  USB: option: add ZTE K5006-Z

Daniel Vetter (1):
  drm/i915: correctly order the ring init sequence

Greg Kroah-Hartman (1):
  Linux 3.0.42

Gustavo Padovan (1):
  USB: add USB_VENDOR_AND_INTERFACE_INFO() macro

Heiko Carstens (1):
  s390/compat: fix mmap compat system calls

Jeongdo Son (1):
  rt2x00: Add support for BUFFALO WLI-UC-GNM2 to rt2800usb.

Jerome Glisse (1):
  drm/radeon: do not reenable crtc after moving vram start address

Mark Ferrell (1):
  usb: serial: mos7840: Fixup mos7840_chars_in_buffer()

Ozan Çağlayan (1):
  USB: ftdi_sio: Add VID/PID for Kondo Serial USB

Sarah Sharp (3):
  xhci: Add Etron XHCI_TRUST_TX_LENGTH quirk.
  xhci: Increase reset timeout for Renesas 720201 host.
  xhci: Switch PPT ports to EHCI on shutdown.

Stefano Stabellini (1):
  xen: mark local pages as FOREIGN in the m2p_override

Theodore Ts'o (1):
  ext4: avoid kmemcheck complaint from reading uninitialized memory

Zach Brown (1):
  fuse: verify all ioctl retry iov elements

fangxiaozhi (1):
  USB: support the new interfaces of Huawei Data Card devices in option 
driver



pgpW11lCSArOK.pgp
Description: PGP signature


Re: [PATCH] OMAP GPIO - don't wake from suspend unless requested.

2012-08-26 Thread NeilBrown
On Sun, 26 Aug 2012 09:47:50 +0530 "Shilimkar, Santosh"
 wrote:

> + Jon,
> 
> On Sat, Aug 25, 2012 at 5:14 PM, NeilBrown  wrote:
> >
> >
> >
> > Current kernel will wake from suspend on an event on any active
> > GPIO even if enable_irq_wake() wasn't called.
> >
> > There are two reasons that the hardware wake-enable bit should be set:
> >
> > 1/ while non-suspended the CPU might go into a deep sleep (off_mode)
> >   in which the wake-enable bit is needed for an interrupt to be
> >   recognised.
> > 2/ while suspended the GPIO interrupt should wake from suspend if and
> >only if irq_wake as been enabled.
> >
> > The code currently doesn't keep these two reasons separate so they get
> > confused and sometimes the wakeup flags is set incorrectly.
> >
> > This patch reverts:
> >  commit 9c4ed9e6c01e7a8bd9079da8267e1f03cb4761fc
> > gpio/omap: remove suspend/resume callbacks
> > and
> >  commit 0aa2727399c0b78225021413022c164cb99fbc5e
> > gpio/omap: remove suspend_wakeup field from struct gpio_bank
> >
> > and makes some minor changes so that we have separate flags for "GPIO
> > should wake from deep idle" and "GPIO should wake from suspend".
> >
> > With this patch, the GPIO from my touch screen doesn't wake my device
> > any more, which is what I want.
> >
> > Cc: Kevin Hilman 
> > Cc: Tony Lindgren 
> > Cc: Santosh Shilimkar 
> > Cc: Cousson, Benoit 
> > Cc: Grant Likely 
> > Cc: Tarun Kanti DebBarma 
> > Cc: Felipe Balbi 
> > Cc: Govindraj.R 
> >
> > Signed-off-by: NeilBrown 
> >
> The patch doesn't seems to be correct. At least the 2/ gets
> fixed with a proper IRQCHIP flag. Can you try the patch at
> end of the email and see if it helps ? Am attaching it in case
> mailer damages it.
> 
> Regards
> Santosh
> 
> >From b8a38fc75e046f6462610e26c47c620cad850c24 Mon Sep 17 00:00:00 2001
> From: Santosh Shilimkar 
> Date: Sun, 26 Aug 2012 09:39:51 +0530
> Subject: [PATCH] gpio: omap: Set IRQCHIP_MASK_ON_SUSPEND to mask all
>  non-wakeup gpio wakeups.
> 
> Set the irq chip flag IRQCHIP_MASK_ON_SUSPEND to cause the irq pm code
> to mask all non-wake gpios in suspend, which will ensure the wakeup enable
> bit is not set on non-wake gpios.
> 
> Signed-off-by: Santosh Shilimkar 
> ---
>  drivers/gpio/gpio-omap.c |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index e6efd77..50b4c18 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -779,6 +779,7 @@ static struct irq_chip gpio_irq_chip = {
>   .irq_unmask = gpio_unmask_irq,
>   .irq_set_type   = gpio_irq_type,
>   .irq_set_wake   = gpio_wake_enable,
> + .flags  = IRQCHIP_MASK_ON_SUSPEND;
>  };
> 
>  /*-*/


No obvious damage, unless the mailer is responsible or the ';' at the end of
the line, rather than ',' :-)

The approach makes sense, but does actually work.  Should be fixable though.

When I try this I get:



[  158.114440] Checking wakeup interrupts
[  158.118408] Unhandled fault: external abort on non-linefetch (0x1028) at 
0xfb054040
[  158.126403] Internal error: : 1028 [#1] PREEMPT ARM
[  158.131500] Modules linked in: ipv6 g_ether hso libertas_sdio libertas 
cfg80211
[  158.139190] CPU: 0Not tainted  (3.5.0-gta04-debug+ #2)
[  158.144927] PC is at _set_gpio_triggering+0x38/0x258
[  158.150115] LR is at gpio_mask_irq+0xac/0xc0
[  158.154602] pc : []lr : []psr: 6193
[  158.154602] sp : db521e90  ip : 0011  fp : beeecc2c
[  158.166595] r10: c05c8ebc  r9 : daa5a858  r8 : 0003
[  158.172027] r7 : a193  r6 :   r5 : fb054000  r4 : ded44e18
[  158.178863] r3 : 0001  r2 :   r1 : ded30340  r0 : 0040
[  158.185668] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment use

so it looks like runtime PM has turned off the iclk to the GPIO module so that
when we try to tell it to change settings, it is no longer listening to us.
The "Checking wakeup interrupts" function happens very late in the suspend
cycle, after all the suspend_late and suspend_noirq functions have run.
Maybe it needs to be moved earlier...

Thanks,
NeilBrown


signature.asc
Description: PGP signature


[PATCH] printk: Move to separate directory for easier modification

2012-08-26 Thread Joe Perches
Make it easier to break up printk into bite-sized chunks.

Remove printk path/filename from comment.

Signed-off-by: Joe Perches 
---
 kernel/Makefile  |3 ++-
 kernel/printk/Makefile   |1 +
 kernel/{ => printk}/printk.c |2 --
 3 files changed, 3 insertions(+), 3 deletions(-)
 create mode 100644 kernel/printk/Makefile
 rename kernel/{ => printk}/printk.c (99%)

diff --git a/kernel/Makefile b/kernel/Makefile
index c0cc67a..12cad6e 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y = fork.o exec_domain.o panic.o printk.o \
+obj-y = fork.o exec_domain.o panic.o \
cpu.o exit.o itimer.o time.o softirq.o resource.o \
sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \
signal.o sys.o kmod.o workqueue.o pid.o task_work.o \
@@ -24,6 +24,7 @@ endif
 
 obj-y += sched/
 obj-y += power/
+obj-y += printk/
 
 ifeq ($(CONFIG_CHECKPOINT_RESTORE),y)
 obj-$(CONFIG_X86) += kcmp.o
diff --git a/kernel/printk/Makefile b/kernel/printk/Makefile
new file mode 100644
index 000..36d306d
--- /dev/null
+++ b/kernel/printk/Makefile
@@ -0,0 +1 @@
+obj-y  = printk.o
diff --git a/kernel/printk.c b/kernel/printk/printk.c
similarity index 99%
rename from kernel/printk.c
rename to kernel/printk/printk.c
index 66a2ea3..5ee48b5 100644
--- a/kernel/printk.c
+++ b/kernel/printk/printk.c
@@ -1,6 +1,4 @@
 /*
- *  linux/kernel/printk.c
- *
  *  Copyright (C) 1991, 1992  Linus Torvalds
  *
  * Modified to make sys_syslog() more flexible: added commands to
-- 
1.7.6.rc3

--
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] dw_dmac: make driver endianness configurable

2012-08-26 Thread Hein Tibosch
The dw_dmac was originally developed for avr32 to be used with the
Synopsys DesignWare AHB DMA controller. After 2.6.38, device access was done
with the little-endian readl/writel functions. This didn't work on the
avr32 platform, because it needs native-endian (i.e. big-endian) accessors.
This patch makes the endianness configurable using 'DW_DMAC_BE',
which will default be true for AVR32


Signed-off-by: Hein Tibosch 
---
 drivers/dma/Kconfig|8 
 drivers/dma/dw_dmac_regs.h |   23 +++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index aadeb5b..3635daf 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -89,6 +89,14 @@ config DW_DMAC
  Support the Synopsys DesignWare AHB DMA controller.  This
  can be integrated in chips such as the Atmel AT32ap7000.
 
+config DW_DMAC_BE
+   bool "Synopsys DesignWare AHB DMA needs big endian access"
+   default y if AVR32
+   depends on DW_DMAC
+   help
+ Say yes if access to the Synopsys DesignWare AHB DMA controller
+ should be big endian, such as for Atmel AT32ap7000
+
 config AT_HDMAC
tristate "Atmel AHB DMA support"
depends on ARCH_AT91
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index f298f69..cf048c3 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -175,11 +175,22 @@ __dwc_regs(struct dw_dma_chan *dwc)
return dwc->ch_regs;
 }
 
+#ifdef CONFIG_DW_DMAC_BE
+
+#define channel_readl(dwc, name) \
+   ioread32be(&(__dwc_regs(dwc)->name))
+#define channel_writel(dwc, name, val) \
+   iowrite32be((val), &(__dwc_regs(dwc)->name))
+
+#else
+
 #define channel_readl(dwc, name) \
readl(&(__dwc_regs(dwc)->name))
 #define channel_writel(dwc, name, val) \
writel((val), &(__dwc_regs(dwc)->name))
 
+#endif
+
 static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
 {
return container_of(chan, struct dw_dma_chan, chan);
@@ -201,11 +212,23 @@ static inline struct dw_dma_regs __iomem 
*__dw_regs(struct dw_dma *dw)
return dw->regs;
 }
 
+#ifdef CONFIG_DW_DMAC_BE
+
+#define dma_readl(dwc, name) \
+   ioread32be(&(__dw_regs(dw)->name))
+#define dma_writel(dwc, name, val) \
+   iowrite32be((val), &(__dw_regs(dw)->name))
+
+#else
+
 #define dma_readl(dw, name) \
readl(&(__dw_regs(dw)->name))
 #define dma_writel(dw, name, val) \
writel((val), &(__dw_regs(dw)->name))
 
+#endif
+
 #define channel_set_bit(dw, reg, mask) \
dma_writel(dw, reg, ((mask) << 8) | (mask))
 #define channel_clear_bit(dw, reg, mask) \
-- 
1.7.8.0

--
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] avr32-linux: at32ap700x: set DMA slave properties for MCI dw_dmac

2012-08-26 Thread Hein Tibosch
@Andrew: could you please push the patch below? Hans-Christian
doesn't have a GIT tree on kernel.org

Thanks, Hein

The MCI makes use of the dw_dmac driver when DMA is being used.
Due to recent changes the driver was broken because:
- the SMS field in the CTLL register received the wrong value 0
- a patch in dw_dmac allowed for 64-bit transfers on the
memory side, giving an illegal value of 3 in the SRC/DST_TR_WIDTH
register.
This patch sets the SMS to 1 and limits the maximum transfer
width to 2 (32 bits)

Note: this can only be applied after my patch:
[PATCH 2/2] dw_dmac: max_mem_width limits value for
SRC/DST_TR_WID register

Signed-off-by: Hein Tibosch 
---
 arch/avr32/mach-at32ap/at32ap700x.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)
 diff --git a/arch/avr32/mach-at32ap/at32ap700x.c 
b/arch/avr32/mach-at32ap/at32ap700x.c
index 0445c4f..e7202af 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1355,6 +1355,10 @@ at32_add_device_mci(unsigned int id, struct 
mci_platform_data *data)
| DWC_CFGH_DST_PER(1));
slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL
| DWC_CFGL_HS_SRC_POL);
+   /* Give CTLL SMS value 1 */
+   slave->sdata.src_master = 1;
+   /* SRC/DST_TR_WIDTH register only accepts 0,1,2 */
+   slave->sdata.max_mem_width = 2;
 
data->dma_slave = slave;
 
-- 
1.7.8.0

--
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] dw_dmac: max_mem_width limits value for SRC/DST_TR_WID register

2012-08-26 Thread Hein Tibosch
The dw_dmac driver was earlier adapted to do 64-bit transfers
on the memory side (https://lkml.org/lkml/2012/1/18/52)
This works on ARM platforms but for AVR32 (AP700x) the maximum
allowed transfer size is 32-bits.
This patch allows the arch to set a new slave property
max_mem_width to limit the size.
Allowable values for dw_dma_slave::max_mem_width are:

0 : leave it up to dw_dmac (64 bits)
1 : 16-bits
2 : 32-bits

Signed-off-by: Hein Tibosch 

---
 drivers/dma/dw_dmac.c   |8 
 include/linux/dw_dmac.h |3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 7212961..a4bdf1d 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -754,6 +754,10 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct 
scatterlist *sgl,
mem_width = 1;
else
mem_width = 0;
+   /* Some controllers don't support 64-bits mem access */
+   if (dws->max_mem_width &&
+   mem_width > dws->max_mem_width)
+   mem_width = dws->max_mem_width;
 
 slave_sg_todev_fill_desc:
desc = dwc_desc_get(dwc);
@@ -821,6 +825,10 @@ slave_sg_todev_fill_desc:
mem_width = 1;
else
mem_width = 0;
+   /* Some controllers don't support 64-bits mem access */
+   if (dws->max_mem_width &&
+   mem_width > dws->max_mem_width)
+   mem_width = dws->max_mem_width;
 
 slave_sg_fromdev_fill_desc:
desc = dwc_desc_get(dwc);
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 2412e02..60b01c3 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -51,6 +51,8 @@ enum dw_dma_msize {
  * @cfg_lo: Platform-specific initializer for the CFG_LO register
  * @src_master: src master for transfers on allocated channel.
  * @dst_master: dest master for transfers on allocated channel.
+ * @max_mem_width: max value for SRC/DST_TR_WIDTH register
+ * default 0 means: leave it up to driver
  */
 struct dw_dma_slave {
struct device   *dma_dev;
@@ -58,6 +60,7 @@ struct dw_dma_slave {
u32 cfg_lo;
u8  src_master;
u8  dst_master;
+   u8  max_mem_width;
 };
 
 /* Platform-configurable bits in CFG_HI */
-- 
1.7.8.0

--
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 3/3] HWPOISON: prevent inode cache removal to keep AS_HWPOISON sticky

2012-08-26 Thread Dave Chinner
On Fri, Aug 24, 2012 at 01:24:16PM -0400, Naoya Horiguchi wrote:
> On Fri, Aug 24, 2012 at 02:39:17PM +1000, Dave Chinner wrote:
> > On Thu, Aug 23, 2012 at 10:39:32PM -0400, Naoya Horiguchi wrote:
> > > On Fri, Aug 24, 2012 at 11:31:18AM +1000, Dave Chinner wrote:
> > > > On Wed, Aug 22, 2012 at 11:17:35AM -0400, Naoya Horiguchi wrote:
> > > > > "HWPOISON: report sticky EIO for poisoned file" still has a corner 
> > > > > case
> > > > > where we have possibilities of data lost. This is because in this fix
> > > > > AS_HWPOISON is cleared when the inode cache is dropped.
> > 
> > > > > --- v3.6-rc1.orig/mm/truncate.c
> > > > > +++ v3.6-rc1/mm/truncate.c
> > > > > @@ -574,6 +574,8 @@ void truncate_setsize(struct inode *inode, loff_t 
> > > > > newsize)
> > > > >  
> > > > >   oldsize = inode->i_size;
> > > > >   i_size_write(inode, newsize);
> > > > > + if (unlikely(mapping_hwpoison(inode->i_mapping) && !newsize))
> > > > > + mapping_clear_hwpoison(inode->i_mapping);
> > > > 
> > > > So only a truncate to zero size will clear the poison flag?
> > > 
> > > Yes, this is because we only know if the file is affected by hwpoison,
> > > but not where the hwpoisoned page is in the file. We could remember it,
> > > but I did not do it for simplicity.
> > 
> > Surely the page has flags on it to say it is poisoned? That is,
> > after truncating the page cache, if the address space is poisoned,
> > then you can do a pass across the mapping tree checking if there are
> > any poisoned pages left? Or perhaps adding a new mapping tree tag so
> > that the poisoned status is automatically determined by the presence
> > of the poisoned page in the mapping tree?
> 
> The answer for the first question is yes. And for the second question,
> I don't think it's easy because the mapping tree has no reference to
> the error page (I explain more about this below, please see also it,)
> and it can cost too much to search poisoned pages over page cache in
> each request.

Which is my point about a radix tree tag - that's very efficient.

> And for the third question, I think we could do this, but to do it
> we need an additional space (8 bytes) in struct radix_tree_node.
> Considering that this new tag is not used so frequently, so I'm not
> sure that it's worth the cost.

A radix tree node is currently 560 bytes on x86_64, packed 7 to a
page. i.e. using 3920 bytes. We can add another 8 bytes to it
without increasing memory usage at all. So, no cost at all.

> > > > What happens if it is the last page in the mapping that is poisoned,
> > > > and we truncate that away? Shouldn't that clear the poisoned bit?
> > > 
> > > When we handle the hwpoisoned inode, the error page should already
> > > be removed from pagecache, so the remaining pages are not related
> > > to the error and we need not care about them when we consider bit
> > > clearing.
> > 
> > Sorry, I don't follow. What removed the page from the page cache?
> > The truncate_page_cache() call that follows the above code hunk is
> > what does that, so I don't see how it can already be removed from
> > the page cache
> 
> Memory error handler (memory_failure() in mm/memory-failure.c) has
> removed the error page from the page cache.
> And truncate_page_cache() that follows this hunk removes all pages
> belonging to the page cache of the poisoned file (where the error
> page itself is not included in them.)
> 
> Let me explain more to clarify my whole scenario. If a memory error
> hits on a dirty pagecache, kernel works like below:
> 
>   1. handles a MCE interrupt (logging MCE events,)
>   2. calls memory error handler (doing 3 to 6,)
>   3. sets PageHWPoison flag on the error page,
>   4. unmaps all mappings to processes' virtual addresses,

So nothing in userspace sees the bad page after this.

>   5. sets AS_HWPOISON on mappings to which the error page belongs
>   6. invalidates the error page (unlinks it from LRU list and removes
>  it from pagecache,)
>   (memory error handler finished)

Ok, so the moment a memory error is handled, the page has been
removed from the inode's mapping, and it will never be seen by
aplications again. It's a transient error

>   7. later accesses to the file returns -EIO,
>   8. AS_HWPOISON is cleared when the file is removed or completely
>  truncated.

 so why do we have to keep an EIO on the inode forever?

If the page is not dirty, then just tossing it from the cache (as
is already done) and rereading it from disk next time it is accessed
removes the need for any error to be reported at all. It's
effectively a transient error at this point, and as such no errors
should be visible from userspace.

If the page is dirty, then it needs to be treated just like any
other failed page write - the page is invalidated and the address
space is marked with AS_EIO, and that is reported to the next
operation that waits on IO on that file (i.e. fsync)

If you have a second application that reads the files 

[PATCH 0/2] dw_dmac: repair driver for use with AVR32 (AP7000)

2012-08-26 Thread Hein Tibosch
After some recent changes to dw_dmac, the driver got broken
for the AVR32 platform for two reasons:

The accessors to i/o memory had become little-endian.
The maximum transfer width on the memory side was increased
from 32 to 64 bits.

These patches repair the driver by:
1. making the endianness configurable through Kconfig,
for AVR32 it will become big-endian
2. making the maximum memory transfer width configurable
It can be set in the code within arch

For non-avr32 (ARM) platforms, nothing has to be changed.

Thanks to Viresh and Arnd for reviewing

Hein Tibosch (2):

  dw_dmac: make driver endianness configurable
  dw_dmac: max_mem_width limits value for SRC/DST_TR_WID register

 drivers/dma/Kconfig|8 
 drivers/dma/dw_dmac.c  |8 
 drivers/dma/dw_dmac_regs.h |   23 +++
 include/linux/dw_dmac.h|3 +++
 4 files changed, 42 insertions(+), 0 deletions(-)

-- 

--
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,STAGING] speakup: lower default software speech rate

2012-08-26 Thread Samuel Thibault
Speech synthesis beginners need a low speech rate, and trained people
want a high speech rate.  A medium speech rate is thus actually not a
good default for neither.  Since trained people will typically know how
to change the rate, better default for a low speech rate, which
beginners can grasp and learn how to increase it afterwards

Signed-off-by: Samuel Thibault 
---

This was agreed with users on the speakup mailing list.

diff --git a/drivers/staging/speakup/speakup_soft.c 
b/drivers/staging/speakup/speakup_soft.c
index 42cdafe..2a67610 100644
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -46,7 +46,7 @@ static int misc_registered;
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"\x01+3p" } },
{ CAPS_STOP, .u.s = {"\x01-3p" } },
-   { RATE, .u.n = {"\x01%ds", 5, 0, 9, 0, 0, NULL } },
+   { RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } },
{ PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } },
{ VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
{ TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } },
--
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] extcon: arizona: Free MICDET IRQ on error during probe

2012-08-26 Thread Mark Brown
Signed-off-by: Mark Brown 
---
 drivers/extcon/extcon-arizona.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index fa2114f..13eafcb 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -488,11 +488,13 @@ static int __devinit arizona_extcon_probe(struct 
platform_device *pdev)
ret = input_register_device(info->input);
if (ret) {
dev_err(>dev, "Can't register input device: %d\n", ret);
-   goto err_fall_wake;
+   goto err_micdet;
}
 
return 0;
 
+err_micdet:
+   arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info);
 err_fall_wake:
arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_FALL, 0);
 err_fall:
-- 
1.7.10.4

--
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/


[BUG]: fsnotify oops on 3.5.2

2012-08-26 Thread Andrew Watts
Hi.

Last night I had a kernel oops in fsnotify (see attached). It happened
when I clicked a hyperlink to a text file in Firefox (which normally
opens an open-with/save-file dialog).

I've not found a way to reproduce.

The system runs kernel 3.5.2 with ext3. (note: kernel is patched with
overlayfs-v13).

Many thanks for your assistance.

~ Andy

==
BUG: unable to handle kernel NULL pointer dereference at 0064
IP: [] fsnotify+0x8b/0x270
*pde = 
Oops:  [#1]
Pid: 14083, comm: firefox Tainted: G O 3.5.2
EIP: 0060:[] EFLAGS: 00210246 CPU: 0
EIP is at fsnotify+0x8b/0x270
EAX:  EBX: fff0 ECX: f5988910 EDX: f5988910
ESI: 0010 EDI:  EBP: dea1de5c ESP: dea1de14
DS: 007b ES: 007b FS:  GS: 00e0 SS: 0068
CR0: 80050033 CR2: 0064 CR3: 34c52000 CR4: 07d0
DR0:  DR1:  DR2:  DR3: 
DR6: 0ff0 DR7: 0400
Process firefox (pid: 14083, ti=dea1c000 task=ed2d1880 task.ti=dea1c000)
Stack:
dea1de34 c10ee498  dea1deec dea1df78 8000 0001 c10f21c3
eeb43688 f5988910 0010 dea1de48    eeb43680
0010 f6003600 dea1de8c c10de255 0001   
Call Trace:
[] ? dput+0x156/0x1c5
[] ? mntput+0x19/0x28
[] fput+0x196/0x1ed
[] release_open_intent+0x1d/0x29
[] path_openat+0xc5/0x33f
[] do_filp_open+0x2a/0x79
[] ? alloc_fd+0x5c/0xcb
[] ? getname_flags+0x31/0xb1
[] do_sys_open+0xef/0x1da
[] sys_open+0x27/0x2f
[] sysenter_do_call+0x12/0x22
[] ? netlbl_mgmt_add_common+0x1ec/0x306
Code: 02 00 00 b8 20 82 93 c1 e8 41 35 f4 ff 89 45 d0 8b 4d dc 85 b1 24 01 00 
00 0f 85 2b 01 00 00 85 db 0f 84 37 01 00 00 85 ff 75 09 <85> 73 74 0f 84 2a 01 
00 00 8b 43 70 89 45 ec 8b 4d dc 8b 91 28
EIP: [] fsnotify+0x8b/0x270 SS:ESP 0068:dea1de14
CR2: 0064
---[ end trace b9a1d764aab1963e ]---


Re: [Ksummit-2012-discuss] Pubring and instructions for the KS 2012 keysigning

2012-08-26 Thread Konstantin Ryabitsev
On 26/08/12 09:42 AM, Ben Hutchings wrote:
> You seem to have missed step 0:
> 
> Verify your own key fingerprint in ks2012-pubring.gpg by comparing:
> 
> gpg --fingerprint $KEY_ID
> gpg --no-default-keyring --keyring ./ks2012-pubring.gpg --fingerprint 
> $REAL_NAME

Yes, you are correct. I'll send a mass mailing to all people who
submitted their keys to remember to do that step -- I meant to do that,
but got busy doing all the datacentre stuff.

Thanks for the reminder.

Best,
-- 
Konstantin Ryabitsev
Systems Administrator
Linux Foundation, kernel.org
Montréal, Québec



signature.asc
Description: OpenPGP digital signature


Re: [PATCH drm-next 2/3] drm/i915: Remove reference to drm_display_info raw_edid field

2012-08-26 Thread Sedat Dilek
On Sun, Aug 26, 2012 at 8:39 PM, Daniel Vetter  wrote:
> On Sat, Aug 25, 2012 at 12:16:23AM +0200, Sedat Dilek wrote:
>> Reported-By: Stephen Rothwell 
>> Acked-by: Jani Nikula 
>> Acked-by: Dave Airlie 
>> Signed-off-by: Sedat Dilek 
>
> This doesn't apply to my drm-intel-next tree any more - we've moved around
> the assignement a bit.

Error still exists but is in intel_ddc_get_modes() now.

- Sedat -

http://cgit.freedesktop.org/~danvet/drm-intel/tree/drivers/gpu/drm/i915/intel_modes.c?h=drm-intel-next#n53

> -Daniel
>
>> ---
>>  drivers/gpu/drm/i915/intel_modes.c |1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_modes.c 
>> b/drivers/gpu/drm/i915/intel_modes.c
>> index 29b7259..4bc1c0f 100644
>> --- a/drivers/gpu/drm/i915/intel_modes.c
>> +++ b/drivers/gpu/drm/i915/intel_modes.c
>> @@ -45,7 +45,6 @@ int intel_connector_update_modes(struct drm_connector 
>> *connector,
>>   drm_mode_connector_update_edid_property(connector, edid);
>>   ret = drm_add_edid_modes(connector, edid);
>>   drm_edid_to_eld(connector, edid);
>> - connector->display_info.raw_edid = NULL;
>>   kfree(edid);
>>
>>   return ret;
>> --
>> 1.7.9.5
>>
>> ___
>> dri-devel mailing list
>> dri-de...@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Mail: dan...@ffwll.ch
> Mobile: +41 (0)79 365 57 48
--
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 00/19 v2] Improve IRQ remapping abstraction in x86 core code

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:55:46PM +0200, Joerg Roedel wrote:
> Please review.

Finally. Usually you don't add/change code but you just move common
irq remapping pieces out of geric io-apic code and put them in once place. I
think it would be good, if you would note this in the description of your
patch.
Altogether it makes a good impression.

After browsing through the new functions in irq_remapping_modify_x86_ops() I
see that some of them test for "remap_ops" which is pointless because you don't
call irq_remapping_modify_x86_ops() if it is not the case. This also goes mostly
for irq_remapping_enabled.
The only reason when you can disable (or say irq_remapping_disable() is
called) is in the suspend path. And the remap is enabled again in via
irq_remapping_reenable() in resume. Now if this goes wrong what is next? You
don't even return an error if the callback is missing. The variable
irq_remapping_enabled does not save your ass here because some function
behave now different.

But back to the realisitic world: If something goes wrong in resume and you
can't re-enable irq remapping, the system is not really useable or is it (even
before your series)?

> Thanks,
> 
>   Joerg
> 

Sebastian
--
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 drm-next 3/3] drm/i915/contexts: Fixup merge with commit b6c7488df68a

2012-08-26 Thread Sedat Dilek
On Sun, Aug 26, 2012 at 8:42 PM, Daniel Vetter  wrote:
> On Sat, Aug 25, 2012 at 12:16:24AM +0200, Sedat Dilek wrote:
>> This is a fixup patch for the merge of drm-next into linux-next caused
>> by commit b6c7488df68a ("drm/i915/contexts: fix list corruption").
>>
>> Reported-By: Stephen Rothwell 
>> Signed-off-by: Sedat Dilek 
>
> This is wrong, switch_context _must_ happen before ring_idle, otherwise
> all hell can break loose on resume.

I followed what's in drm-intel-next not what was in Linus-tree.

- Sedat -

http://cgit.freedesktop.org/~danvet/drm-intel/tree/drivers/gpu/drm/i915/i915_gem.c?h=drm-intel-next#n2432

> -Daniel
>
>> ---
>>  drivers/gpu/drm/i915/i915_gem.c |4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem.c 
>> b/drivers/gpu/drm/i915/i915_gem.c
>> index 4f6841d..e8a5cb2 100644
>> --- a/drivers/gpu/drm/i915/i915_gem.c
>> +++ b/drivers/gpu/drm/i915/i915_gem.c
>> @@ -2273,11 +2273,11 @@ int i915_gpu_idle(struct drm_device *dev)
>>
>>   /* Flush everything onto the inactive list. */
>>   for_each_ring(ring, dev_priv, i) {
>> - ret = i915_switch_context(ring, NULL, DEFAULT_CONTEXT_ID);
>> + ret = i915_ring_idle(ring);
>>   if (ret)
>>   return ret;
>>
>> - ret = i915_ring_idle(ring);
>> + ret = i915_switch_context(ring, NULL, DEFAULT_CONTEXT_ID);
>>   if (ret)
>>   return ret;
>>
>> --
>> 1.7.9.5
>>
>> ___
>> dri-devel mailing list
>> dri-de...@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Mail: dan...@ffwll.ch
> Mobile: +41 (0)79 365 57 48
--
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 3/4] task_work: revert d35abdb2 "hold task_lock around checks in keyctl"

2012-08-26 Thread Oleg Nesterov
This reverts commit d35abdb28824cf74f0a106a0f9c6f3ff700a35bf.

task_lock() was added to ensure exit_mm() and thus exit_task_work() is
not possible before task_work_add().

This is wrong, task_lock() must not be nested with write_lock(tasklist).
And this is no longer needed, task_work_add() fails if it is called
after exit_task_work().

Reported-by: Dave Jones 
Signed-off-by: Oleg Nesterov 
---
 security/keys/keyctl.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 3364fbf..6cfc647 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1486,7 +1486,6 @@ long keyctl_session_to_parent(void)
oldwork = NULL;
parent = me->real_parent;
 
-   task_lock(parent);
/* the parent mustn't be init and mustn't be a kernel thread */
if (parent->pid <= 1 || !parent->mm)
goto unlock;
@@ -1530,7 +1529,6 @@ long keyctl_session_to_parent(void)
if (!ret)
newwork = NULL;
 unlock:
-   task_unlock(parent);
write_unlock_irq(_lock);
rcu_read_unlock();
if (oldwork)
-- 
1.5.5.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/4] task_work: task_work_add() should not succeed after exit_task_work()

2012-08-26 Thread Oleg Nesterov
ed3e694d "move exit_task_work() past exit_files() et.al" destroyed
the add/exit synchronization we had, the caller itself should ensure
task_work_add() can't race with the exiting task.

However, this is not convenient/simple, and the only user which tries
to do this is buggy (see the next patch). Unless the task is current,
there is simply no way to do this in general.

Change exit_task_work()->task_work_run() to use the dummy "work_exited"
entry to let task_work_add() know it should fail.

Signed-off-by: Oleg Nesterov 
---
 include/linux/task_work.h |3 +--
 kernel/task_work.c|   22 --
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/include/linux/task_work.h b/include/linux/task_work.h
index fb46b03..ca5a1cf 100644
--- a/include/linux/task_work.h
+++ b/include/linux/task_work.h
@@ -18,8 +18,7 @@ void task_work_run(void);
 
 static inline void exit_task_work(struct task_struct *task)
 {
-   if (unlikely(task->task_works))
-   task_work_run();
+   task_work_run();
 }
 
 #endif /* _LINUX_TASK_WORK_H */
diff --git a/kernel/task_work.c b/kernel/task_work.c
index f13ec0b..65bd3c9 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
@@ -2,16 +2,17 @@
 #include 
 #include 
 
+static struct callback_head work_exited; /* all we need is ->next == NULL */
+
 int
 task_work_add(struct task_struct *task, struct callback_head *work, bool 
notify)
 {
struct callback_head *head;
-   /*
-* Not inserting the new work if the task has already passed
-* exit_task_work() is the responisbility of callers.
-*/
+
do {
head = ACCESS_ONCE(task->task_works);
+   if (unlikely(head == _exited))
+   return -ESRCH;
work->next = head;
} while (cmpxchg(>task_works, head, work) != head);
 
@@ -30,7 +31,7 @@ task_work_cancel(struct task_struct *task, task_work_func_t 
func)
 * If cmpxchg() fails we continue without updating pprev.
 * Either we raced with task_work_add() which added the
 * new entry before this work, we will find it again. Or
-* we raced with task_work_run(), *pprev == NULL.
+* we raced with task_work_run(), *pprev == NULL/exited.
 */
raw_spin_lock_irqsave(>pi_lock, flags);
while ((work = ACCESS_ONCE(*pprev))) {
@@ -51,7 +52,16 @@ void task_work_run(void)
struct callback_head *work, *head, *next;
 
for (;;) {
-   work = xchg(>task_works, NULL);
+   /*
+* work->func() can do task_work_add(), do not set
+* work_exited unless the list is empty.
+*/
+   do {
+   work = ACCESS_ONCE(task->task_works);
+   head = !work && (task->flags & PF_EXITING) ?
+   _exited : NULL;
+   } while (cmpxchg(>task_works, work, head) != work);
+
if (!work)
break;
/*
-- 
1.5.5.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 4/4] task_work: simplify the usage in ptrace_notify() and get_signal_to_deliver()

2012-08-26 Thread Oleg Nesterov
ptrace_notify() and get_signal_to_deliver() do unnecessary things
before task_work_run().

1. smp_mb__after_clear_bit() is not needed, test_and_clear_bit()
   implies mb().

2. And we do not need the barrier at all, in this case we only
   care about the "synchronous" works added by the task itself.

3. No need to clear TIF_NOTIFY_RESUME, and we should not assume
   task_works is the only user of this flag.

Signed-off-by: Oleg Nesterov 
---
 kernel/signal.c |   18 --
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index be4f856..2c681f1 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1971,13 +1971,8 @@ static void ptrace_do_notify(int signr, int exit_code, 
int why)
 void ptrace_notify(int exit_code)
 {
BUG_ON((exit_code & (0x7f | ~0x)) != SIGTRAP);
-   if (unlikely(current->task_works)) {
-   if (test_and_clear_ti_thread_flag(current_thread_info(),
-  TIF_NOTIFY_RESUME)) {
-   smp_mb__after_clear_bit();
-   task_work_run();
-   }
-   }
+   if (unlikely(current->task_works))
+   task_work_run();
 
spin_lock_irq(>sighand->siglock);
ptrace_do_notify(SIGTRAP, exit_code, CLD_TRAPPED);
@@ -2198,13 +2193,8 @@ int get_signal_to_deliver(siginfo_t *info, struct 
k_sigaction *return_ka,
struct signal_struct *signal = current->signal;
int signr;
 
-   if (unlikely(current->task_works)) {
-   if (test_and_clear_ti_thread_flag(current_thread_info(),
-  TIF_NOTIFY_RESUME)) {
-   smp_mb__after_clear_bit();
-   task_work_run();
-   }
-   }
+   if (unlikely(current->task_works))
+   task_work_run();
 
if (unlikely(uprobe_deny_signal()))
return 0;
-- 
1.5.5.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/4] task_work: make task_work_add() lockless

2012-08-26 Thread Oleg Nesterov
Change task_works to use llist-like code to avoid pi_lock
in task_work_add(), this makes it useable under rq->lock.

task_work_cancel() and task_work_run() still use pi_lock
to synchronize with each other.

Suggested-by: Peter Zijlstra 
Signed-off-by: Oleg Nesterov 
---
 kernel/task_work.c |   95 ++-
 1 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/kernel/task_work.c b/kernel/task_work.c
index d320d44..f13ec0b 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
@@ -3,25 +3,18 @@
 #include 
 
 int
-task_work_add(struct task_struct *task, struct callback_head *twork, bool 
notify)
+task_work_add(struct task_struct *task, struct callback_head *work, bool 
notify)
 {
-   struct callback_head *last, *first;
-   unsigned long flags;
-
+   struct callback_head *head;
/*
 * Not inserting the new work if the task has already passed
 * exit_task_work() is the responisbility of callers.
 */
-   raw_spin_lock_irqsave(>pi_lock, flags);
-   last = task->task_works;
-   first = last ? last->next : twork;
-   twork->next = first;
-   if (last)
-   last->next = twork;
-   task->task_works = twork;
-   raw_spin_unlock_irqrestore(>pi_lock, flags);
+   do {
+   head = ACCESS_ONCE(task->task_works);
+   work->next = head;
+   } while (cmpxchg(>task_works, head, work) != head);
 
-   /* test_and_set_bit() implies mb(), see tracehook_notify_resume(). */
if (notify)
set_notify_resume(task);
return 0;
@@ -30,52 +23,60 @@ task_work_add(struct task_struct *task, struct 
callback_head *twork, bool notify
 struct callback_head *
 task_work_cancel(struct task_struct *task, task_work_func_t func)
 {
+   struct callback_head **pprev = >task_works;
+   struct callback_head *work = NULL;
unsigned long flags;
-   struct callback_head *last, *res = NULL;
-
+   /*
+* If cmpxchg() fails we continue without updating pprev.
+* Either we raced with task_work_add() which added the
+* new entry before this work, we will find it again. Or
+* we raced with task_work_run(), *pprev == NULL.
+*/
raw_spin_lock_irqsave(>pi_lock, flags);
-   last = task->task_works;
-   if (last) {
-   struct callback_head *q = last, *p = q->next;
-   while (1) {
-   if (p->func == func) {
-   q->next = p->next;
-   if (p == last)
-   task->task_works = q == p ? NULL : q;
-   res = p;
-   break;
-   }
-   if (p == last)
-   break;
-   q = p;
-   p = q->next;
-   }
+   while ((work = ACCESS_ONCE(*pprev))) {
+   read_barrier_depends();
+   if (work->func != func)
+   pprev = >next;
+   else if (cmpxchg(pprev, work, work->next) == work)
+   break;
}
raw_spin_unlock_irqrestore(>pi_lock, flags);
-   return res;
+
+   return work;
 }
 
 void task_work_run(void)
 {
struct task_struct *task = current;
-   struct callback_head *p, *q;
+   struct callback_head *work, *head, *next;
 
-   while (1) {
-   raw_spin_lock_irq(>pi_lock);
-   p = task->task_works;
-   task->task_works = NULL;
-   raw_spin_unlock_irq(>pi_lock);
+   for (;;) {
+   work = xchg(>task_works, NULL);
+   if (!work)
+   break;
+   /*
+* Synchronize with task_work_cancel(). It can't remove
+* the first entry == work, cmpxchg(task_works) should
+* fail, but it can play with *work and other entries.
+*/
+   raw_spin_unlock_wait(>pi_lock);
+   smp_mb();
 
-   if (unlikely(!p))
-   return;
+   /* Reverse the list to run the works in fifo order */
+   head = NULL;
+   do {
+   next = work->next;
+   work->next = head;
+   head = work;
+   work = next;
+   } while (work);
 
-   q = p->next; /* head */
-   p->next = NULL; /* cut it */
-   while (q) {
-   p = q->next;
-   q->func(q);
-   q = p;
+   work = head;
+   do {
+   next = work->next;
+   work->func(work);
+   work = next;
cond_resched();
-   }
+   } while (work);
 

[PATCH 0/4] (Was: lockdep trace from posix timers)

2012-08-26 Thread Oleg Nesterov
On 08/24, Oleg Nesterov wrote:
>
> Peter, if you think it can work for you and if you agree with
> the implementation I will be happy to send the patch.

I think I should try anyway ;)

To simplify the review, I attached the resulting code below.

Changes:

- Comments.

- Not sure this is really better, but task_work_run()
  does not need to actually take pi_lock, unlock_wait
  is enough.

  However, in this case the dummy entry is better than
  the fake pointer.

Oleg.

#include 
#include 
#include 

static struct callback_head work_exited; /* all we need is ->next == NULL */

int
task_work_add(struct task_struct *task, struct callback_head *work, bool notify)
{
struct callback_head *head;

do {
head = ACCESS_ONCE(task->task_works);
if (unlikely(head == _exited))
return -ESRCH;
work->next = head;
} while (cmpxchg(>task_works, head, work) != head);

if (notify)
set_notify_resume(task);
return 0;
}

struct callback_head *
task_work_cancel(struct task_struct *task, task_work_func_t func)
{
struct callback_head **pprev = >task_works;
struct callback_head *work = NULL;
unsigned long flags;
/*
 * If cmpxchg() fails we continue without updating pprev.
 * Either we raced with task_work_add() which added the
 * new entry before this work, we will find it again. Or
 * we raced with task_work_run(), *pprev == NULL/exited.
 */
raw_spin_lock_irqsave(>pi_lock, flags);
while ((work = ACCESS_ONCE(*pprev))) {
read_barrier_depends();
if (work->func != func)
pprev = >next;
else if (cmpxchg(pprev, work, work->next) == work)
break;
}
raw_spin_unlock_irqrestore(>pi_lock, flags);

return work;
}

void task_work_run(void)
{
struct task_struct *task = current;
struct callback_head *work, *head, *next;

for (;;) {
/*
 * work->func() can do task_work_add(), do not set
 * work_exited unless the list is empty.
 */
do {
work = ACCESS_ONCE(task->task_works);
head = !work && (task->flags & PF_EXITING) ?
_exited : NULL;
} while (cmpxchg(>task_works, work, head) != work);

if (!work)
break;
/*
 * Synchronize with task_work_cancel(). It can't remove
 * the first entry == work, cmpxchg(task_works) should
 * fail, but it can play with *work and other entries.
 */
raw_spin_unlock_wait(>pi_lock);
smp_mb();

/* Reverse the list to run the works in fifo order */
head = NULL;
do {
next = work->next;
work->next = head;
head = work;
work = next;
} while (work);

work = head;
do {
next = work->next;
work->func(work);
work = next;
cond_resched();
} while (work);
}
}

--
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 18/19] x86, io_apic: Introduce eoi_ioapic_pin call-back

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:56:04PM +0200, Joerg Roedel wrote:
> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> index aac3f62..d4db390 100644
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -557,19 +557,10 @@ static void unmask_ioapic_irq(struct irq_data *data)
>   * Otherwise, we simulate the EOI message manually by changing the trigger
>   * mode to edge and then back to level, with RTE being masked during this.
>   */
> -static void __eoi_ioapic_pin(int apic, int pin, int vector, struct irq_cfg 
> *cfg)
> +void native_eoi_ioapic_pin(int apic, int pin, int vector)
>  {
>   if (mpc_ioapic_ver(apic) >= 0x20) {
> - /*
> -  * Intr-remapping uses pin number as the virtual vector
> -  * in the RTE. Actual vector is programmed in
> -  * intr-remapping table entry. Hence for the io-apic
> -  * EOI we use the pin number.
> -  */
> - if (cfg && irq_remapped(cfg))
> - io_apic_eoi(apic, pin);
> - else
> - io_apic_eoi(apic, vector);
> + io_apic_eoi(apic, vector);
>   } else {
>   struct IO_APIC_route_entry entry, entry1;
>  
> diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
> index e61a174..d62e757 100644
> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -94,12 +94,24 @@ static void __init irq_remapping_setup_timer_pin(unsigned 
> int ioapic_idx,
>   /* Not needed with interrupt remapping */
>  }
>  
> +void eoi_ioapic_pin_remapped(int apic, int pin, int vector)
> +{
> + /*
> +  * Intr-remapping uses pin number as the virtual vector
> +  * in the RTE. Actual vector is programmed in
> +  * intr-remapping table entry. Hence for the io-apic
> +  * EOI we use the pin number.
> +  */
> + io_apic_eoi(apic, pin);
> +}
> +

Basically you shuffle the code from up there, down there and call from behind
a function pointer. There are two things different this time:
- no version check >= 0x20
  I belive this is obsolete since this runs only on x86-64 with x(2)apic
  support and assumes more or less version 0x20+ or we wouldn't be here at
  all.
- the irq_remapped(cfg) check is gone. The cfg thing is per-interrupt basis
  created so you _now_ you act like the interrupt is remapped even if it is
  not. Or am I wrong here?

> @@ -316,3 +328,4 @@ bool setup_remapped_irq(int irq, struct irq_cfg *cfg, 
> struct irq_chip *chip)
>   return false;
>   }
>  }
> +
New line and the end? Why would that be?

Sebastian
--
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 drm-next 2/3] drm/i915: Remove reference to drm_display_info raw_edid field

2012-08-26 Thread Daniel Vetter
On Sat, Aug 25, 2012 at 12:16:23AM +0200, Sedat Dilek wrote:
> Reported-By: Stephen Rothwell 
> Acked-by: Jani Nikula 
> Acked-by: Dave Airlie 
> Signed-off-by: Sedat Dilek 

This doesn't apply to my drm-intel-next tree any more - we've moved around
the assignement a bit.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_modes.c |1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_modes.c 
> b/drivers/gpu/drm/i915/intel_modes.c
> index 29b7259..4bc1c0f 100644
> --- a/drivers/gpu/drm/i915/intel_modes.c
> +++ b/drivers/gpu/drm/i915/intel_modes.c
> @@ -45,7 +45,6 @@ int intel_connector_update_modes(struct drm_connector 
> *connector,
>   drm_mode_connector_update_edid_property(connector, edid);
>   ret = drm_add_edid_modes(connector, edid);
>   drm_edid_to_eld(connector, edid);
> - connector->display_info.raw_edid = NULL;
>   kfree(edid);
>  
>   return ret;
> -- 
> 1.7.9.5
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
--
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 drm-next 3/3] drm/i915/contexts: Fixup merge with commit b6c7488df68a

2012-08-26 Thread Daniel Vetter
On Sat, Aug 25, 2012 at 12:16:24AM +0200, Sedat Dilek wrote:
> This is a fixup patch for the merge of drm-next into linux-next caused
> by commit b6c7488df68a ("drm/i915/contexts: fix list corruption").
> 
> Reported-By: Stephen Rothwell 
> Signed-off-by: Sedat Dilek 

This is wrong, switch_context _must_ happen before ring_idle, otherwise
all hell can break loose on resume.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 4f6841d..e8a5cb2 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2273,11 +2273,11 @@ int i915_gpu_idle(struct drm_device *dev)
>  
>   /* Flush everything onto the inactive list. */
>   for_each_ring(ring, dev_priv, i) {
> - ret = i915_switch_context(ring, NULL, DEFAULT_CONTEXT_ID);
> + ret = i915_ring_idle(ring);
>   if (ret)
>   return ret;
>  
> - ret = i915_ring_idle(ring);
> + ret = i915_switch_context(ring, NULL, DEFAULT_CONTEXT_ID);
>   if (ret)
>   return ret;
>  
> -- 
> 1.7.9.5
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
--
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 17/19] x86, msi: Introduce x86_msi.compose_msi_msg call-back

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:56:03PM +0200, Joerg Roedel wrote:
> This call-back points to the right function for initializing
> the msi_msg structure.

So you pull out the compose_remapped_msi_msg() out of msi_compose_msg() and
put this in a callback. Such information is good since you don't see this in
diff and even --patience does not help here.

> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -242,10 +243,12 @@ void compose_remapped_msi_msg(struct pci_dev *pdev,
> unsigned int irq, unsigned int dest,
> struct msi_msg *msg, u8 hpet_id)
>  {
> - if (!remap_ops || !remap_ops->compose_msi_msg)
> - return;
> + struct irq_cfg *cfg = irq_get_chip_data(irq);
>  
> - remap_ops->compose_msi_msg(pdev, irq, dest, msg, hpet_id);
> + if (cfg && !irq_remapped(cfg))
> + native_compose_msi_msg(pdev, irq, dest, msg, hpet_id);
> + else if (remap_ops && remap_ops->compose_msi_msg)
> + remap_ops->compose_msi_msg(pdev, irq, dest, msg, hpet_id);

cfg _has_ to be valid here and if it is not than you shouldn't assume that
this irq is remapped.
Also remap_ops has to be set here. And ->compose_msi_msg() should be set
here as well. Would it make sense if it is not set?

>  }
>  
>  static int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)

Sebastian
--
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 16/19] x86, irq: Introduce setup_remapped_irq()

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:56:02PM +0200, Joerg Roedel wrote:
> --- a/arch/x86/include/asm/irq_remapping.h
> +++ b/arch/x86/include/asm/irq_remapping.h
> @@ -44,6 +44,9 @@ extern void compose_remapped_msi_msg(struct pci_dev *pdev,
>struct msi_msg *msg, u8 hpet_id);
>  extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
>  extern void panic_if_irq_remap(const char *msg);
> +extern bool setup_remapped_irq(int irq,
> +struct irq_cfg *cfg,
> +struct irq_chip *chip);
here and in the next definition, is it possible to fit it in one line or
alteast in two?

>  
>  static inline bool irq_remapped(struct irq_cfg *cfg)
>  {
> @@ -93,6 +96,12 @@ static inline void irq_remap_modify_chip_defaults(struct 
> irq_chip *chip)

> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -302,3 +302,14 @@ void irq_remap_modify_chip_defaults(struct irq_chip 
> *chip)
>   chip->irq_eoi = ir_ack_apic_level;
>   chip->irq_set_affinity = x86_io_apic_ops.set_affinity;
>  }
> +
> +bool setup_remapped_irq(int irq, struct irq_cfg *cfg, struct irq_chip *chip)
> +{
> + if (irq_remapped(cfg)) {
> + irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
> + irq_remap_modify_chip_defaults(chip);
> + return true;
> + } else {
> + return false;
> + }
> +}

What about

bool setup_remapped_irq(int irq, struct irq_cfg *cfg, struct irq_chip *chip)
{
if (!irq_remapped(cfg))
return false;
irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
irq_remap_modify_chip_defaults(chip);
return true;
}

Sebastian
--
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 15/19] x86, irq: Move irq_remapped() check into free_remapped_irq

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:56:01PM +0200, Joerg Roedel wrote:
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -2981,8 +2981,8 @@ void destroy_irq(unsigned int irq)
>  
>   irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE);
>  
> - if (irq_remapped(cfg))
> - free_remapped_irq(irq);
> + free_remapped_irq(irq);
> +
>   raw_spin_lock_irqsave(_lock, flags);
>   __clear_irq_vector(irq, cfg);
>   raw_spin_unlock_irqrestore(_lock, flags);
> diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
> index 3957fb2..f2affc7 100644
> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -229,10 +229,13 @@ int set_remapped_irq_affinity(struct irq_data *data, 
> const struct cpumask *mask,
>  
>  void free_remapped_irq(int irq)
>  {
> + struct irq_cfg *cfg = irq_get_chip_data(irq);
> +
>   if (!remap_ops || !remap_ops->free_irq)
>   return;
>  
> - remap_ops->free_irq(irq);
> + if (cfg && irq_remapped(cfg))

You shuffle code with the exception that you now check for cfg. Why?

> + remap_ops->free_irq(irq);
>  }
>  
>  void compose_remapped_msi_msg(struct pci_dev *pdev,

Sebastian
--
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/7] perf tool: handle errors in synthesized event functions

2012-08-26 Thread David Ahern
Handle error from process callback and propogate back to caller.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/util/event.c |   35 ++-
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 3a0f1a5..84ff6f16 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -120,7 +120,9 @@ static pid_t perf_event__synthesize_comm(struct perf_tool 
*tool,
if (!full) {
event->comm.tid = pid;
 
-   process(tool, event, _sample, machine);
+   if (process(tool, event, _sample, machine) != 0)
+   return -1;
+
goto out;
}
 
@@ -151,7 +153,10 @@ static pid_t perf_event__synthesize_comm(struct perf_tool 
*tool,
 
event->comm.tid = pid;
 
-   process(tool, event, _sample, machine);
+   if (process(tool, event, _sample, machine) != 0) {
+   tgid = -1;
+   break;
+   }
}
 
closedir(tasks);
@@ -167,6 +172,7 @@ static int perf_event__synthesize_mmap_events(struct 
perf_tool *tool,
 {
char filename[PATH_MAX];
FILE *fp;
+   int rc = 0;
 
snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);
 
@@ -231,18 +237,22 @@ static int perf_event__synthesize_mmap_events(struct 
perf_tool *tool,
event->mmap.pid = tgid;
event->mmap.tid = pid;
 
-   process(tool, event, _sample, machine);
+   if (process(tool, event, _sample, machine) != 0) {
+   rc = -1;
+   break;
+   }
}
}
 
fclose(fp);
-   return 0;
+   return rc;
 }
 
 int perf_event__synthesize_modules(struct perf_tool *tool,
   perf_event__handler_t process,
   struct machine *machine)
 {
+   int rc = 0;
struct rb_node *nd;
struct map_groups *kmaps = >kmaps;
union perf_event *event = zalloc((sizeof(event->mmap) +
@@ -284,11 +294,14 @@ int perf_event__synthesize_modules(struct perf_tool *tool,
 
memcpy(event->mmap.filename, pos->dso->long_name,
   pos->dso->long_name_len + 1);
-   process(tool, event, _sample, machine);
+   if (process(tool, event, _sample, machine) != 0) {
+   rc = -1;
+   break;
+   }
}
 
free(event);
-   return 0;
+   return rc;
 }
 
 static int __event__synthesize_thread(union perf_event *comm_event,
@@ -392,12 +405,16 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
if (*end) /* only interested in proper numerical dirents */
continue;
 
-   __event__synthesize_thread(comm_event, mmap_event, pid, 1,
-  process, tool, machine);
+   if (__event__synthesize_thread(comm_event, mmap_event, pid, 1,
+  process, tool, machine) != 0) {
+   err = -1;
+   goto out_closedir;
+   }
}
 
-   closedir(proc);
err = 0;
+out_closedir:
+   closedir(proc);
 out_free_mmap:
free(mmap_event);
 out_free_comm:
-- 
1.7.10.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 4/7] perf stat: remove use of die/exit and handle errors

2012-08-26 Thread David Ahern
Allows perf to clean up properly on program termination.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/builtin-stat.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index d53d8ab..02f49eb 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -428,7 +428,7 @@ static int run_perf_stat(int argc __used, const char **argv)
 
if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
perror("failed to create pipes");
-   exit(1);
+   return -1;
}
 
if (forks) {
@@ -510,7 +510,8 @@ static int run_perf_stat(int argc __used, const char **argv)
}
if (child_pid != -1)
kill(child_pid, SIGTERM);
-   die("Not all events could be opened.\n");
+
+   pr_err("Not all events could be opened.\n");
return -1;
}
counter->supported = true;
@@ -1189,7 +1190,7 @@ int cmd_stat(int argc, const char **argv, const char 
*prefix __used)
output = fopen(output_name, mode);
if (!output) {
perror("failed to create output file");
-   exit(-1);
+   return -1;
}
clock_gettime(CLOCK_REALTIME, );
fprintf(output, "# started on %s\n", ctime(_sec));
-- 
1.7.10.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 14/19] x86, io-apic: Remove !irq_remapped() check from __target_IO_APIC_irq()

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:56:00PM +0200, Joerg Roedel wrote:
> This function is only called from default_ioapic_set_affinity()
> which is only used when interrupt remapping is disabled. So
> the check will always evaluate as true and can be removed.

Since commit ("x86, io_apic: Introduce set_affinity function pointer") I
believe and this information would helpfull.

Sebastian
--
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 5/7] perf help: remove remove use of die and handle errors

2012-08-26 Thread David Ahern
Allows perf to clean up properly on exit.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/builtin-help.c |   48 -
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 6d5a8a7..f9daae5 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -24,13 +24,14 @@ static struct man_viewer_info_list {
 } *man_viewer_info_list;
 
 enum help_format {
+   HELP_FORMAT_NONE,
HELP_FORMAT_MAN,
HELP_FORMAT_INFO,
HELP_FORMAT_WEB,
 };
 
 static bool show_all = false;
-static enum help_format help_format = HELP_FORMAT_MAN;
+static enum help_format help_format = HELP_FORMAT_NONE;
 static struct option builtin_help_options[] = {
OPT_BOOLEAN('a', "all", _all, "print all available commands"),
OPT_SET_UINT('m', "man", _format, "show man page", 
HELP_FORMAT_MAN),
@@ -54,7 +55,9 @@ static enum help_format parse_help_format(const char *format)
return HELP_FORMAT_INFO;
if (!strcmp(format, "web") || !strcmp(format, "html"))
return HELP_FORMAT_WEB;
-   die("unrecognized help format '%s'", format);
+
+   pr_err("unrecognized help format '%s'", format);
+   return HELP_FORMAT_NONE;
 }
 
 static const char *get_man_viewer_info(const char *name)
@@ -259,6 +262,8 @@ static int perf_help_config(const char *var, const char 
*value, void *cb)
if (!value)
return config_error_nonbool(var);
help_format = parse_help_format(value);
+   if (help_format == HELP_FORMAT_NONE)
+   return -1;
return 0;
}
if (!strcmp(var, "man.viewer")) {
@@ -352,7 +357,7 @@ static void exec_viewer(const char *name, const char *page)
warning("'%s': unknown man viewer.", name);
 }
 
-static void show_man_page(const char *perf_cmd)
+static int show_man_page(const char *perf_cmd)
 {
struct man_viewer_list *viewer;
const char *page = cmd_to_page(perf_cmd);
@@ -365,28 +370,35 @@ static void show_man_page(const char *perf_cmd)
if (fallback)
exec_viewer(fallback, page);
exec_viewer("man", page);
-   die("no man viewer handled the request");
+
+   pr_err("no man viewer handled the request");
+   return -1;
 }
 
-static void show_info_page(const char *perf_cmd)
+static int show_info_page(const char *perf_cmd)
 {
const char *page = cmd_to_page(perf_cmd);
setenv("INFOPATH", system_path(PERF_INFO_PATH), 1);
execlp("info", "info", "perfman", page, NULL);
+   return -1;
 }
 
-static void get_html_page_path(struct strbuf *page_path, const char *page)
+static int get_html_page_path(struct strbuf *page_path, const char *page)
 {
struct stat st;
const char *html_path = system_path(PERF_HTML_PATH);
 
/* Check that we have a perf documentation directory. */
if (stat(mkpath("%s/perf.html", html_path), )
-   || !S_ISREG(st.st_mode))
-   die("'%s': not a documentation directory.", html_path);
+   || !S_ISREG(st.st_mode)) {
+   pr_err("'%s': not a documentation directory.", html_path);
+   return -1;
+   }
 
strbuf_init(page_path, 0);
strbuf_addf(page_path, "%s/%s.html", html_path, page);
+
+   return 0;
 }
 
 /*
@@ -401,19 +413,23 @@ static void open_html(const char *path)
 }
 #endif
 
-static void show_html_page(const char *perf_cmd)
+static int show_html_page(const char *perf_cmd)
 {
const char *page = cmd_to_page(perf_cmd);
struct strbuf page_path; /* it leaks but we exec bellow */
 
-   get_html_page_path(_path, page);
+   if (get_html_page_path(_path, page) != 0)
+   return -1;
 
open_html(page_path.buf);
+
+   return 0;
 }
 
 int cmd_help(int argc, const char **argv, const char *prefix __used)
 {
const char *alias;
+   int rc = 0;
 
load_command_list("perf-", _cmds, _cmds);
 
@@ -444,16 +460,20 @@ int cmd_help(int argc, const char **argv, const char 
*prefix __used)
 
switch (help_format) {
case HELP_FORMAT_MAN:
-   show_man_page(argv[0]);
+   rc = show_man_page(argv[0]);
break;
case HELP_FORMAT_INFO:
-   show_info_page(argv[0]);
+   rc = show_info_page(argv[0]);
break;
case HELP_FORMAT_WEB:
-   show_html_page(argv[0]);
+   rc = show_html_page(argv[0]);
+   break;
+   case HELP_FORMAT_NONE:
+   /* fall-through */
default:
+   rc = -1;
break;
}
 
-   return 0;
+   return rc;
 }
-- 
1.7.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 

[PATCH 3/7] perf lock: remove use of die and handle errors

2012-08-26 Thread David Ahern
Allows perf to clean up properly on exit.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/builtin-lock.c |  181 +++--
 1 file changed, 124 insertions(+), 57 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 585aae2..75153c8 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -161,8 +161,10 @@ static struct thread_stat 
*thread_stat_findnew_after_first(u32 tid)
return st;
 
st = zalloc(sizeof(struct thread_stat));
-   if (!st)
-   die("memory allocation failed\n");
+   if (!st) {
+   pr_err("memory allocation failed\n");
+   return NULL;
+   }
 
st->tid = tid;
INIT_LIST_HEAD(>seq_list);
@@ -181,8 +183,10 @@ static struct thread_stat *thread_stat_findnew_first(u32 
tid)
struct thread_stat *st;
 
st = zalloc(sizeof(struct thread_stat));
-   if (!st)
-   die("memory allocation failed\n");
+   if (!st) {
+   pr_err("memory allocation failed\n");
+   return NULL;
+   }
st->tid = tid;
INIT_LIST_HEAD(>seq_list);
 
@@ -248,18 +252,20 @@ struct lock_key keys[] = {
{ NULL, NULL }
 };
 
-static void select_key(void)
+static int select_key(void)
 {
int i;
 
for (i = 0; keys[i].name; i++) {
if (!strcmp(keys[i].name, sort_key)) {
compare = keys[i].key;
-   return;
+   return 0;
}
}
 
-   die("Unknown compare key:%s\n", sort_key);
+   pr_err("Unknown compare key: %s\n", sort_key);
+
+   return -1;
 }
 
 static void insert_to_result(struct lock_stat *st,
@@ -324,7 +330,8 @@ static struct lock_stat *lock_stat_findnew(void *addr, 
const char *name)
return new;
 
 alloc_failed:
-   die("memory allocation failed\n");
+   pr_err("memory allocation failed\n");
+   return NULL;
 }
 
 static const char *input_name;
@@ -356,16 +363,16 @@ struct trace_release_event {
 };
 
 struct trace_lock_handler {
-   void (*acquire_event)(struct trace_acquire_event *,
+   int (*acquire_event)(struct trace_acquire_event *,
  const struct perf_sample *sample);
 
-   void (*acquired_event)(struct trace_acquired_event *,
+   int (*acquired_event)(struct trace_acquired_event *,
   const struct perf_sample *sample);
 
-   void (*contended_event)(struct trace_contended_event *,
+   int (*contended_event)(struct trace_contended_event *,
const struct perf_sample *sample);
 
-   void (*release_event)(struct trace_release_event *,
+   int (*release_event)(struct trace_release_event *,
  const struct perf_sample *sample);
 };
 
@@ -379,8 +386,10 @@ static struct lock_seq_stat *get_seq(struct thread_stat 
*ts, void *addr)
}
 
seq = zalloc(sizeof(struct lock_seq_stat));
-   if (!seq)
-   die("Not enough memory\n");
+   if (!seq) {
+   pr_err("memory allocation failed\n");
+   return NULL;
+   }
seq->state = SEQ_STATE_UNINITIALIZED;
seq->addr = addr;
 
@@ -403,7 +412,7 @@ enum acquire_flags {
READ_LOCK = 2,
 };
 
-static void
+static int
 report_lock_acquire_event(struct trace_acquire_event *acquire_event,
  const struct perf_sample *sample)
 {
@@ -412,11 +421,18 @@ report_lock_acquire_event(struct trace_acquire_event 
*acquire_event,
struct lock_seq_stat *seq;
 
ls = lock_stat_findnew(acquire_event->addr, acquire_event->name);
+   if (!ls)
+   return -1;
if (ls->discard)
-   return;
+   return 0;
 
ts = thread_stat_findnew(sample->tid);
+   if (!ts)
+   return -1;
+
seq = get_seq(ts, acquire_event->addr);
+   if (!seq)
+   return -1;
 
switch (seq->state) {
case SEQ_STATE_UNINITIALIZED:
@@ -461,10 +477,10 @@ broken:
ls->nr_acquire++;
seq->prev_event_time = sample->time;
 end:
-   return;
+   return 0;
 }
 
-static void
+static int
 report_lock_acquired_event(struct trace_acquired_event *acquired_event,
   const struct perf_sample *sample)
 {
@@ -475,16 +491,23 @@ report_lock_acquired_event(struct trace_acquired_event 
*acquired_event,
u64 contended_term;
 
ls = lock_stat_findnew(acquired_event->addr, acquired_event->name);
+   if (!ls)
+   return -1;
if (ls->discard)
-   return;
+   return 0;
 
ts = thread_stat_findnew(sample->tid);
+   if (!ts)
+   return -1;
+
seq = get_seq(ts, acquired_event->addr);
+   if (!seq)
+   return -1;
 

[PATCH 1/7] perf tool: flush_sample_queue needs to handle errors from handlers

2012-08-26 Thread David Ahern
Allows errors to propogate through event processing code and back
to commands.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/util/session.c |   24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f7bb7ae..9453758 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -692,7 +692,7 @@ static int perf_session_deliver_event(struct perf_session 
*session,
  struct perf_tool *tool,
  u64 file_offset);
 
-static void flush_sample_queue(struct perf_session *s,
+static int flush_sample_queue(struct perf_session *s,
   struct perf_tool *tool)
 {
struct ordered_samples *os = >ordered_samples;
@@ -705,7 +705,7 @@ static void flush_sample_queue(struct perf_session *s,
int ret;
 
if (!tool->ordered_samples || !limit)
-   return;
+   return 0;
 
list_for_each_entry_safe(iter, tmp, head, list) {
if (iter->timestamp > limit)
@@ -715,9 +715,12 @@ static void flush_sample_queue(struct perf_session *s,
s->header.needs_swap);
if (ret)
pr_err("Can't parse sample, err = %d\n", ret);
-   else
-   perf_session_deliver_event(s, iter->event, , 
tool,
-  iter->file_offset);
+   else {
+   ret = perf_session_deliver_event(s, iter->event, 
, tool,
+iter->file_offset);
+   if (ret)
+   return ret;
+   }
 
os->last_flush = iter->timestamp;
list_del(>list);
@@ -737,6 +740,8 @@ static void flush_sample_queue(struct perf_session *s,
}
 
os->nr_samples = 0;
+
+   return 0;
 }
 
 /*
@@ -782,10 +787,11 @@ static int process_finished_round(struct perf_tool *tool,
  union perf_event *event __used,
  struct perf_session *session)
 {
-   flush_sample_queue(session, tool);
-   session->ordered_samples.next_flush = 
session->ordered_samples.max_timestamp;
+   int ret = flush_sample_queue(session, tool);
+   if (!ret)
+   session->ordered_samples.next_flush = 
session->ordered_samples.max_timestamp;
 
-   return 0;
+   return ret;
 }
 
 /* The queue is ordered by time */
@@ -1443,7 +1449,7 @@ more:
err = 0;
/* do the final flush for ordered samples */
session->ordered_samples.next_flush = ULLONG_MAX;
-   flush_sample_queue(session, tool);
+   err = flush_sample_queue(session, tool);
 out_err:
perf_session__warn_about_errors(session, tool);
perf_session_free_sample_buffers(session);
-- 
1.7.10.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 7/7] perf record: remove use of die/exit

2012-08-26 Thread David Ahern
Allows perf to clean up properly on exit. If perf-record is exiting
due to failure, the on_exit should not run as the session has been
deleted.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/builtin-record.c |  158 +--
 1 file changed, 109 insertions(+), 49 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 479ff2a..7b8b891 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -71,19 +71,23 @@ static void advance_output(struct perf_record *rec, size_t 
size)
rec->bytes_written += size;
 }
 
-static void write_output(struct perf_record *rec, void *buf, size_t size)
+static int write_output(struct perf_record *rec, void *buf, size_t size)
 {
while (size) {
int ret = write(rec->output, buf, size);
 
-   if (ret < 0)
-   die("failed to write");
+   if (ret < 0) {
+   pr_err("failed to write\n");
+   return -1;
+   }
 
size -= ret;
buf += ret;
 
rec->bytes_written += ret;
}
+
+   return 0;
 }
 
 static int process_synthesized_event(struct perf_tool *tool,
@@ -92,11 +96,13 @@ static int process_synthesized_event(struct perf_tool *tool,
 struct machine *machine __used)
 {
struct perf_record *rec = container_of(tool, struct perf_record, tool);
-   write_output(rec, event, event->header.size);
+   if (write_output(rec, event, event->header.size) < 0)
+   return -1;
+
return 0;
 }
 
-static void perf_record__mmap_read(struct perf_record *rec,
+static int perf_record__mmap_read(struct perf_record *rec,
   struct perf_mmap *md)
 {
unsigned int head = perf_mmap__read_head(md);
@@ -104,9 +110,10 @@ static void perf_record__mmap_read(struct perf_record *rec,
unsigned char *data = md->base + rec->page_size;
unsigned long size;
void *buf;
+   int rc = 0;
 
if (old == head)
-   return;
+   return 0;
 
rec->samples++;
 
@@ -117,17 +124,26 @@ static void perf_record__mmap_read(struct perf_record 
*rec,
size = md->mask + 1 - (old & md->mask);
old += size;
 
-   write_output(rec, buf, size);
+   if (write_output(rec, buf, size) < 0) {
+   rc = -1;
+   goto out;
+   }
}
 
buf = [old & md->mask];
size = head - old;
old += size;
 
-   write_output(rec, buf, size);
+   if (write_output(rec, buf, size) < 0) {
+   rc = -1;
+   goto out;
+   }
 
md->prev = old;
perf_mmap__write_tail(md, old);
+
+out:
+   return rc;
 }
 
 static volatile int done = 0;
@@ -183,12 +199,13 @@ static bool perf_evlist__equal(struct perf_evlist *evlist,
return true;
 }
 
-static void perf_record__open(struct perf_record *rec)
+static int perf_record__open(struct perf_record *rec)
 {
struct perf_evsel *pos;
struct perf_evlist *evlist = rec->evlist;
struct perf_session *session = rec->session;
struct perf_record_opts *opts = >opts;
+   int rc = 0;
 
perf_evlist__config_attrs(evlist, opts);
 
@@ -222,10 +239,13 @@ try_again:
 
if (err == EPERM || err == EACCES) {
ui__error_paranoid();
-   exit(EXIT_FAILURE);
+   rc = -err;
+   goto out;
} else if (err ==  ENODEV && opts->target.cpu_list) {
-   die("No such device - did you specify"
-   " an out-of-range profile CPU?\n");
+   pr_err("No such device - did you specify"
+  " an out-of-range profile CPU?\n");
+   rc = -err;
+   goto out;
} else if (err == EINVAL) {
if (!opts->exclude_guest_missing &&
(attr->exclude_guest || 
attr->exclude_host)) {
@@ -272,7 +292,8 @@ try_again:
if (err == ENOENT) {
ui__error("The %s event is not supported.\n",
  perf_evsel__name(pos));
-   exit(EXIT_FAILURE);
+   rc = -err;
+   goto out;
}
 
printf("\n");
@@ -280,34 +301,46 @@ try_again:
  err, strerror(err));
 
 #if defined(__i386__) || defined(__x86_64__)
-   if 

[PATCH 6/7] perf script: remove use of die/exit

2012-08-26 Thread David Ahern
Allows perf to clean up properly on exit. Only exits left are exec
failures which are appropriate and usage callbacks that list available
options.

Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
---
 tools/perf/builtin-script.c |   60 +--
 1 file changed, 41 insertions(+), 19 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 2d6e3b2..c350cfe 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1153,18 +1153,23 @@ static const struct option options[] = {
OPT_END()
 };
 
-static bool have_cmd(int argc, const char **argv)
+static int have_cmd(int argc, const char **argv)
 {
char **__argv = malloc(sizeof(const char *) * argc);
 
-   if (!__argv)
-   die("malloc");
+   if (!__argv) {
+   pr_err("malloc failed\n");
+   return -1;
+   }
+
memcpy(__argv, argv, sizeof(const char *) * argc);
argc = parse_options(argc, (const char **)__argv, record_options,
 NULL, PARSE_OPT_STOP_AT_NON_OPTION);
free(__argv);
 
-   return argc != 0;
+   system_wide = (argc == 0);
+
+   return 0;
 }
 
 int cmd_script(int argc, const char **argv, const char *prefix __used)
@@ -1231,13 +1236,13 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __used)
 
if (pipe(live_pipe) < 0) {
perror("failed to create pipe");
-   exit(-1);
+   return -1;
}
 
pid = fork();
if (pid < 0) {
perror("failed to fork");
-   exit(-1);
+   return -1;
}
 
if (!pid) {
@@ -1249,13 +1254,18 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __used)
if (is_top_script(argv[0])) {
system_wide = true;
} else if (!system_wide) {
-   system_wide = !have_cmd(argc - rep_args,
-   [rep_args]);
+   if (have_cmd(argc - rep_args, [rep_args]) 
!= 0) {
+   err = -1;
+   goto out;
+   }
}
 
__argv = malloc((argc + 6) * sizeof(const char *));
-   if (!__argv)
-   die("malloc");
+   if (!__argv) {
+   pr_err("malloc failed\n");
+   err = -ENOMEM;
+   goto out;
+   }
 
__argv[j++] = "/bin/sh";
__argv[j++] = rec_script_path;
@@ -1277,8 +1287,12 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __used)
close(live_pipe[1]);
 
__argv = malloc((argc + 4) * sizeof(const char *));
-   if (!__argv)
-   die("malloc");
+   if (!__argv) {
+   pr_err("malloc failed\n");
+   err = -ENOMEM;
+   goto out;
+   }
+
j = 0;
__argv[j++] = "/bin/sh";
__argv[j++] = rep_script_path;
@@ -1303,12 +1317,20 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __used)
 
if (!rec_script_path)
system_wide = false;
-   else if (!system_wide)
-   system_wide = !have_cmd(argc - 1, [1]);
+   else if (!system_wide) {
+   if (have_cmd(argc - 1, [1]) != 0) {
+   err = -1;
+   goto out;
+   }
+   }
 
__argv = malloc((argc + 2) * sizeof(const char *));
-   if (!__argv)
-   die("malloc");
+   if (!__argv) {
+   pr_err("malloc failed\n");
+   err = -ENOMEM;
+   goto out;
+   }
+
__argv[j++] = "/bin/sh";
__argv[j++] = script_path;
if (system_wide)
@@ -1357,18 +1379,18 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __used)
input = open(session->filename, O_RDONLY);  /* input_name */
if (input < 0) {
perror("failed to open file");
-   exit(-1);
+   return -1;
}
 
err = fstat(input, _stat);
if (err < 0) {
perror("failed to stat file");
-   exit(-1);
+   

[PATCH 0/7] perf: cleanups related to die/exit and error handling

2012-08-26 Thread David Ahern
Round 1 removing the use of die() and exit(). It's rather slow and tedious
to check all the error paths and make sure error propogation is properly
done and handled, so submitting patches in phases as I have time to work
on it.

David Ahern (7):
  perf tool: flush_sample_queue needs to handle errors from handlers
  perf tool: handle errors in synthesized event functions
  perf lock: remove use of die and handle errors
  perf stat: remove use of die/exit and handle errors
  perf help: remove remove use of die and handle errors
  perf script: remove use of die/exit
  perf record: remove use of die/exit

 tools/perf/builtin-help.c   |   48 
 tools/perf/builtin-lock.c   |  181 +--
 tools/perf/builtin-record.c |  158 +
 tools/perf/builtin-script.c |   60 +-
 tools/perf/builtin-stat.c   |7 +-
 tools/perf/util/event.c |   35 ++---
 tools/perf/util/session.c   |   24 +++---
 7 files changed, 353 insertions(+), 160 deletions(-)

-- 
1.7.10.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 13/19] x86, io-apic: Move CONFIG_IRQ_REMAP code out of x86 core

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:55:59PM +0200, Joerg Roedel wrote:
> index fc89a2a..c84403e 100644
> --- a/arch/x86/include/asm/hw_irq.h
> +++ b/arch/x86/include/asm/hw_irq.h
> @@ -127,6 +127,7 @@ struct irq_cfg {
>   u8  vector;
>   u8  move_in_progress : 1;
>  #ifdef CONFIG_IRQ_REMAP
> + boolremapped;
u8  remapped : 1;
?

>   union {
>   struct irq_2_iommu irq_2_iommu;
>   struct irq_2_irte  irq_2_irte;

Sebastian
--
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 12/19] x86, irq: Add data structure to keep AMD specific irq remapping information

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:55:58PM +0200, Joerg Roedel wrote:
> --- a/arch/x86/include/asm/hw_irq.h
> +++ b/arch/x86/include/asm/hw_irq.h
> @@ -101,6 +101,7 @@ static inline void set_io_apic_irq_attr(struct 
> io_apic_irq_attr *irq_attr,
>   irq_attr->polarity  = polarity;
>  }
>  
> +/* Intel specific interrupt remapping information */
>  struct irq_2_iommu {
>   struct intel_iommu *iommu;
>   u16 irte_index;
> @@ -108,6 +109,12 @@ struct irq_2_iommu {
>   u8  irte_mask;
>  };
>  
> +/* AMD specific interrupt remapping information */
> +struct irq_2_irte {
> + u16 devid; /* Device ID for IRTE table */
> + u16 index; /* Index into IRTE table*/
> +};
so irte_index like in iommu case would make the comment superfluous. However
the struct is already named _irte...
However, the "{Intel|AMD} specific..." is helpfull since irte and such are
present in both.

Sebastian
--
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 10/19] x86, io_apic: Introduce function pointer for setup_timer_IRQ0_pin

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:55:56PM +0200, Joerg Roedel wrote:
> diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
> index 827f8a1..71824fc 100644
> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -87,11 +87,18 @@ error:
>   return ret;
>  }
>  
> +static void __init irq_remapping_setup_timer_pin(unsigned int ioapic_idx,
> +  unsigned int pin, int vector)
> +{
> + /* Not needed with interrupt remapping */

I see that this is not needed because it is empty. But *why* isn't it needed?
That comment would make sense here. So please drop this or explain :)

> +}
> +

Sebastian
--
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 06/19] x86, msi: Use IRQ remapping specific setup_msi_irqs routine

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:55:52PM +0200, Joerg Roedel wrote:
> diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
> index f439151..984104b 100644
> --- a/drivers/iommu/irq_remapping.c
> +++ b/drivers/iommu/irq_remapping.c
> @@ -181,7 +232,7 @@ void compose_remapped_msi_msg(struct pci_dev *pdev,
>   remap_ops->compose_msi_msg(pdev, irq, dest, msg, hpet_id);
>  }
>  
> -int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)
> +static int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)
>  {
>   if (!remap_ops || !remap_ops->msi_alloc_irq)
>   return -ENODEV;
> @@ -189,8 +240,8 @@ int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, 
> int nvec)
>   return remap_ops->msi_alloc_irq(pdev, irq, nvec);
>  }
>  
> -int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
> -int index, int sub_handle)
> +static int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
> +   int index, int sub_handle)
>  {
>   if (!remap_ops || !remap_ops->msi_setup_irq)
>   return -ENODEV;

Both functions, that is msi_alloc_remapped_irq() and msi_setup_remapped_irq()
and are now called only from irq_remapping_setup_msi_irqs() which can only be
called once remap_ops are set.

Sebastian
--
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 04/19] x86, io_apic: Introduce x86_io_apic_ops.print_entries for debugging

2012-08-26 Thread Sebastian Andrzej Siewior
On Mon, Aug 20, 2012 at 03:55:50PM +0200, Joerg Roedel wrote:
> This call-back is used to dump IO-APIC entries for debugging
> purposes into the kernel log. VT-d needs a special routine
> for this and will overwrite the default.

Okay, again: code basically does what it did, it has been shifted around and
is now called directly.

> Signed-off-by: Joerg Roedel 
> diff --git a/drivers/iommu/intel_irq_remapping.c 
> b/drivers/iommu/intel_irq_remapping.c
> index e0b18f3..321db1a 100644
> --- a/drivers/iommu/intel_irq_remapping.c
> +++ b/drivers/iommu/intel_irq_remapping.c
> @@ -617,6 +617,10 @@ static int __init intel_enable_irq_remapping(void)
>   goto error;
>  
>   irq_remapping_enabled = 1;
> +
> + /* VT-d needs a special routine to print IO-APIC entries */
Seriously? That that's why you overwrite it with a different function :)

> + x86_io_apic_ops.print_entries = intel_ir_io_apic_print_entries;
> +
>   pr_info("Enabled IRQ remapping in %s mode\n", eim ? "x2apic" : "xapic");
>  
>   return eim ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;

Sebastian
--
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: perf backtraces off-by-1

2012-08-26 Thread Arun Sharma


On 8/26/12 9:10 AM, Peter Zijlstra wrote:

On Fri, 2012-08-24 at 15:13 -0700, Arun Sharma wrote:


  One option is to support
this for user mode only, with code to detect signal frames. Any other
ideas?


I guess we'd need to see what that patch would look like... :-)



It used to look like this:

http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=commitdiff;h=92cc7fd78a5a79c4bb5f85bfb7d7fb025df9cd5a

These days we just look at dwarf augmentation string:

http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob;f=src/dwarf/Gfde.c;h=8659624b0320c514057861a259b6efe1b605bbf3;hb=HEAD#l189

 -Arun
--
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] hwmon/lm70: adding support for NS LM74 chip

2012-08-26 Thread Guenter Roeck
On Thu, Aug 23, 2012 at 11:13:17AM -0700, Guenter Roeck wrote:
> On Thu, Aug 23, 2012 at 05:32:12PM +0200, Christophe Leroy wrote:
> > Hello,
> > 
> Hi Christophe,
> 
Hi again,

[ ... ]

> >  
> > -   /* 3-wire link (shared SI/SO) for LM70 */
> > -   if (chip == LM70_CHIP_LM70 && !(spi->mode & SPI_3WIRE))
> > +   /* 3-wire link (shared SI/SO) for LM70 and LM74 */
> > +   if ((chip == LM70_CHIP_LM70 || chip == LM70_CHIP_LM74)
> > +   && !(spi->mode & SPI_3WIRE))
> 
> Ok for now, but I'll have to check this. The driver does not really write
> anything to the chip, so it should be irrelevant which mode the SPI master
> controller supports (MOSI does not have to be connected). Besides, from the
> chip specification it looks like it is possible to connect the chip to a
> standard SPI interface by adding a 10k resistor between MOSI and MISO.
> 
After looking into the above, the proper change or fix is really to remove the
above check for SPI_3WIRE entirely. The driver works perfectly fine if a LM70 is
connected to a controller which does not explicitly support SPI_3WIRE; all that
needs to be done is to connect MOSI through a resistor or not at all. This is,
however, a board design decision, not a SPI master chip limitation.

With that, we don't need to explicitly add any LM74 specific code to the driver,
since the TMP121 code does the trick. All we need to do is to update the
documentation, adding a note that LM74 is supported as well, and that it can be
selected with 'tmp121'.

Thanks,
Guenter
--
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/


[GIT PULL] hwmon fixes for 3.6-rc4

2012-08-26 Thread Guenter Roeck
Hi Linus,

Please pull hwmon fixes for Linux 3.6-rc4 from signed tag:

git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git 
hwmon-for-linus

Thanks,
Guenter
--

The following changes since commit fea7a08acb13524b47711625eebea40a0ede69a0:

  Linux 3.6-rc3 (2012-08-22 13:29:06 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git 
tags/hwmon-for-linus

for you to fetch changes up to 43ca6cb28c871f2fbad10117b0648e5ae3b0f638:

  hwmon: (asus_atk0110) Add quirk for Asus M5A78L (2012-08-22 22:33:31 -0700)


Fix sensor readings for Asus M5A78L in asus_atk0110 driver.


Luca Tettamanti (1):
  hwmon: (asus_atk0110) Add quirk for Asus M5A78L

 drivers/hwmon/asus_atk0110.c |6 ++
 1 file changed, 6 insertions(+)


signature.asc
Description: Digital signature


Re: [GIT PULL] logfs: some important bug fixes

2012-08-26 Thread Prasad Joshi
On Sun, Aug 26, 2012 at 4:56 PM, Prasad Joshi
 wrote:
> Hello Linus,
>
> Could you please pull the following changes since commit
> dd775ae2549217d3ae09363e3edb305d0fa19928:
>
>   Linux 3.4-rc1 (2012-03-31 16:24:09 -0700)
>
> are available in the git repository at:
>   git://github.com/prasad-joshi/logfs_upstream.git master
>
> Prasad Joshi (5):
>   logfs: destroy the reserved inodes while unmounting
>   logfs: initialize the number of iovecs in bio
>   logfs: create a pagecache page if it is not present
>   logfs: maintain the ordering of meta-inode destruction
>   logfs: query block device for number of pages to send with bio
>

Please pardon my ignorance, here is a short description of above patches

9f0bbd8 logfs: query block device for number of pages to send with bio
This BUG was found when LogFS was used on KVM. The patch fixes
the problem by asking for underlaying block device the number
of pages to send with each BIO.

41b93bc logfs: maintain the ordering of meta-inode destruction
LogFS maintains file system meta-data in special inodes. These
inodes are releated to each other, therefore they must be
destroyed in a proper order.

ddb24bb logfs: create a pagecache page if it is not present

cd8bfa9 logfs: initialize the number of iovecs in bio
LogFS used to panic when it was created on an encrypted LVM
volume. The patch fixes the problem by properly initializing
the BIO.

d2dcd90 logfs: destroy the reserved inodes while unmounting

Sorry for multiple mails and inconvenience it might have caused.

Thanks and Regards,
Prasad

>  fs/logfs/dev_bdev.c  |   15 +++
>  fs/logfs/inode.c |   18 +-
>  fs/logfs/journal.c   |2 +-
>  fs/logfs/readwrite.c |1 -
>  fs/logfs/segment.c   |2 +-
>  5 files changed, 26 insertions(+), 12 deletions(-)
>
> Please note that the signed tag (for-linus) is applied and the same is
> pushed. The repository is also added in the 'linux-next' and there no
> conflicts in the 'linux-next: Tree for Aug 24'.
>
> Thanks and Warm Regards,
> Prasad
--
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] Bluetooth: Add support for Apple vendor-specific devices

2012-08-26 Thread Marcel Holtmann
Hi Henrik,

> As pointed out by Gustavo and Marcel, all Apple-specific Broadcom
> devices seen so far have the same interface class, subclass and
> protocol numbers. This patch adds an entry which matches all of them,
> using the new USB_VENDOR_AND_INTERFACE_INFO() macro.
> 
> In particular, this patch adds support for the MacBook Pro Retina
> (05ac:8286), which is not in the present list.
> 
> Signed-off-by: Henrik Rydberg 
> ---
> Hi Gustavo,
> 
> here is a patch for the Apple devices, utilizing commit d81a5d19, for
> 3.6. Tested on the MacBookPro10,1 (Retina). If you want, I can
> follow-up with a patch for 3.7 which removes the specific entries. I
> have verified the lsusb output of all of them, except MacMini5,1.
> 
> Thanks,
> Henrik
> 
>  drivers/bluetooth/btusb.c | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Marcel Holtmann 

Regards

Marcel


--
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: [Ksummit-2012-discuss] Pubring and instructions for the KS 2012 keysigning

2012-08-26 Thread Ben Hutchings
On Fri, 2012-08-24 at 23:39 -0700, Konstantin Ryabitsev wrote:
> Hello, all:
> 
> I collected 46 keys from 40 people interested in keysigning at the
> Kernel Summit. I have uploaded the fingerprints and the pubring to the
> following locations:
> 
> https://www.kernel.org/ks2012-fingerprints.txt
> https://www.kernel.org/ks2012-pubring.gpg
> 
> This is the sha256sum of the pubring:
> bbb816d955c3939c72985175b0ea4f8781662f70d8a0fa9b0985391403a0fe79
> 
> You can import the pubring using "gpg --import" command.
> 
> WARNING: just in case someone jumps the gun -- these fingerprints were
> taken at "face value". I DID NO VERIFICATION WHATSOEVER whether these
> keys belong to the actual people. DO NOT sign any of these keys
> without the verification procedure at the Kernel Summit. My GPG
> signature on this email is in no way an endorsement of these keys.
> 
> Here's how the procedure will play out:
[...]

You seem to have missed step 0:

Verify your own key fingerprint in ks2012-pubring.gpg by comparing:

gpg --fingerprint $KEY_ID
gpg --no-default-keyring --keyring ./ks2012-pubring.gpg --fingerprint $REAL_NAME

(Normally, people would verify their key fingerprints in
ks2012-fingerprints.txt, but unless we also agree the sha256sum of that
then no-one can rely on the contents of that file as more than a
checklist.)

Ben.

-- 
Ben Hutchings
Experience is what causes a person to make new mistakes instead of old ones.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] drivers/media/dvb-frontends/rtl2830.c: correct double assignment

2012-08-26 Thread Antti Palosaari

On 08/26/2012 07:15 PM, Julia Lawall wrote:

From: Julia Lawall 

The double assignment is meant to be a bit-or to combine two values.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@@
expression i;
@@

*i = ...;
  i = ...;
// 

Signed-off-by: Julia Lawall 

---
  drivers/media/dvb-frontends/rtl2830.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/rtl2830.c 
b/drivers/media/dvb-frontends/rtl2830.c
index 8fa8b08..b6ab858 100644
--- a/drivers/media/dvb-frontends/rtl2830.c
+++ b/drivers/media/dvb-frontends/rtl2830.c
@@ -254,7 +254,7 @@ static int rtl2830_init(struct dvb_frontend *fe)
goto err;

buf[0] = tmp << 6;
-   buf[0] = (if_ctl >> 16) & 0x3f;
+   buf[0] |= (if_ctl >> 16) & 0x3f;
buf[1] = (if_ctl >>  8) & 0xff;
buf[2] = (if_ctl >>  0) & 0xff;



Thank you!

Acked-by: Antti Palosaari 
Reviewed-by: Antti Palosaari 


Antti
--
http://palosaari.fi/
--
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] drivers/media/dvb-frontends/rtl2830.c: correct double assignment

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

The double assignment is meant to be a bit-or to combine two values.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@@
expression i;
@@

*i = ...;
 i = ...;
// 

Signed-off-by: Julia Lawall 

---
 drivers/media/dvb-frontends/rtl2830.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/rtl2830.c 
b/drivers/media/dvb-frontends/rtl2830.c
index 8fa8b08..b6ab858 100644
--- a/drivers/media/dvb-frontends/rtl2830.c
+++ b/drivers/media/dvb-frontends/rtl2830.c
@@ -254,7 +254,7 @@ static int rtl2830_init(struct dvb_frontend *fe)
goto err;
 
buf[0] = tmp << 6;
-   buf[0] = (if_ctl >> 16) & 0x3f;
+   buf[0] |= (if_ctl >> 16) & 0x3f;
buf[1] = (if_ctl >>  8) & 0xff;
buf[2] = (if_ctl >>  0) & 0xff;
 

--
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: perf backtraces off-by-1

2012-08-26 Thread Peter Zijlstra
On Fri, 2012-08-24 at 15:13 -0700, Arun Sharma wrote:
> 
> Wondering if this has been discussed before.

Not that I can recall.

>  One option is to support 
> this for user mode only, with code to detect signal frames. Any other
> ideas?
> 
I guess we'd need to see what that patch would look like... :-)

--
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/1] Document:add Chinese translation of basic_profiling.txt

2012-08-26 Thread liang xie
This is a Chinese translated version of Documentation/basic_profiling.txt

Signed-off-by: Liang Xie 
---
 Documentation/zh_CN/basic_profiling.txt |   71 +++
 1 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100755 Documentation/zh_CN/basic_profiling.txt

diff --git a/Documentation/zh_CN/basic_profiling.txt
b/Documentation/zh_CN/basic_profiling.txt
new file mode 100755
index 000..3105eaf
--- /dev/null
+++ b/Documentation/zh_CN/basic_profiling.txt
@@ -0,0 +1,71 @@
+Chinese translated version of Documentation/basic_profiling
+
+If you have any comment or update to the content, please post to LKML directly.
+However, if you have problem communicating in English you can also ask the
+Chinese maintainer for help.  Contact the Chinese maintainer, if this
+translation is outdated or there is problem with translation.
+
+Chinese maintainer: Liang Xie 
+-
+Documentation/basic_profiling的中文翻译
+
+如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可
+以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。
+
+中文版维护者: 谢良 Liang Xie 
+中文版翻译者: 谢良 Liang Xie 
+中文版校译者:
+以下为正文
+-
+
+下面这些说明指令都是非常基础的,如果你想进一步了解请阅读相关专业文档:)
+请不要再在本文档增加新的内容,但可以修复文档中的错误:)(mbl...@aracnet.com)
+感谢John Levon,Dave Hansen等在撰写时的帮助
+
+ 用于表示要测量的目标
+请先确保您已经有正确的System.map / vmlinux配置!
+
+对于linux系统来说,配置vmlinuz最容易的方法可能就是使用“make install”,然后修改
+/sbin/installkernel将vmlinux拷贝到/boot目录,而System.map通常是默认安装好的
+
+Readprofile
+---
+2.6系列内核需要版本相对较新的readprofile,比如util-linux 2.12a中包含的,可以从:
+
+http://www.kernel.org/pub/linux/utils/util-linux/ 下载
+
+大部分linux发行版已经包含了.
+
+启用readprofile需要在kernel启动命令行增加”profile=2“
+
+clear  readprofile -r
+   
+dump outputreadprofile -m /boot/System.map > captured_profile
+
+Oprofile
+
+
+从http://oprofile.sourceforge.net/获取源代码(请参考Changes以获取匹配的版本)
+在kernel启动命令行增加“idle=poll”
+
+配置CONFIG_PROFILING=y和CONFIG_OPROFILE=y然后重启进入新kernel
+
+./configure --with-kernel-support
+make install
+
+想得到好的测量结果,请确保启用了本地APIC特性。如果opreport显示有0Hz CPU,
+说明APIC特性没有开启。另外注意idle=poll选项可能有损性能。
+
+One time setup:
+   opcontrol --setup --vmlinux=/boot/vmlinux
+
+clear  opcontrol --reset
+start  opcontrol --start
+   
+stop   opcontrol --stop
+dump outputopreport >  output_file
+
+如果只看kernel相关的报告结果,请运行命令 opreport -l /boot/vmlinux > output_file
+
+通过reset选项可以清理过期统计数据,相当于重启的效果。
+
-- 
1.7.9.6 (Apple Git-31.1)


Re: udev 182: response timeout for request_firmware in module_probe path

2012-08-26 Thread Benjamin Herrenschmidt
On Thu, 2012-08-23 at 17:46 +0100, Alan Cox wrote:
> > IMO, the driver probing path is allowed to sleep, so looks request
> firmware
> > should be allowed inside .probe().
> 
> I'm not convinced about that. It can sleep but its holding various
> locks
> in most cases, and it looks like that can end up in a complete heap.
> 
> By all means *request* the firmware asynchronously in the probe, but
> there needs to be a seperate method somewhere after the probe to
> finish
> the job once the firmware appears. 

Not necessarily enough in the general case, for example some stacks will
cause a driver open to be call back from somewhere within the
register_foo() the driver did to register itself with it's subsystem
inside probe. For example register_framebuffer(), register_netdev(), ...

This is clearly a udev bug :-)

Cheers,
Ben.


--
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/13] drivers/staging/iio/adc/spear_adc.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/staging/iio/adc/spear_adc.c |   25 -
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/iio/adc/spear_adc.c 
b/drivers/staging/iio/adc/spear_adc.c
index 675c427..0b83e2e 100644
--- a/drivers/staging/iio/adc/spear_adc.c
+++ b/drivers/staging/iio/adc/spear_adc.c
@@ -330,36 +330,30 @@ static int __devinit spear_adc_probe(struct 
platform_device *pdev)
goto errout3;
}
 
-   ret = clk_prepare(info->clk);
-   if (ret) {
-   dev_err(dev, "failed preparing clock\n");
-   goto errout4;
-   }
-
-   ret = clk_enable(info->clk);
+   ret = clk_prepare_enable(info->clk);
if (ret) {
dev_err(dev, "failed enabling clock\n");
-   goto errout5;
+   goto errout4;
}
 
irq = platform_get_irq(pdev, 0);
if ((irq < 0) || (irq >= NR_IRQS)) {
dev_err(dev, "failed getting interrupt resource\n");
ret = -EINVAL;
-   goto errout6;
+   goto errout5;
}
 
ret = devm_request_irq(dev, irq, spear_adc_isr, 0, MOD_NAME, info);
if (ret < 0) {
dev_err(dev, "failed requesting interrupt\n");
-   goto errout6;
+   goto errout5;
}
 
if (of_property_read_u32(np, "sampling-frequency",
 >sampling_freq)) {
dev_err(dev, "sampling-frequency missing in DT\n");
ret = -EINVAL;
-   goto errout6;
+   goto errout5;
}
 
/*
@@ -389,16 +383,14 @@ static int __devinit spear_adc_probe(struct 
platform_device *pdev)
 
ret = iio_device_register(iodev);
if (ret)
-   goto errout6;
+   goto errout5;
 
dev_info(dev, "SPEAR ADC driver loaded, IRQ %d\n", irq);
 
return 0;
 
-errout6:
-   clk_disable(info->clk);
 errout5:
-   clk_unprepare(info->clk);
+   clk_disable_unprepare(info->clk);
 errout4:
clk_put(info->clk);
 errout3:
@@ -416,8 +408,7 @@ static int __devexit spear_adc_remove(struct 
platform_device *pdev)
 
iio_device_unregister(iodev);
platform_set_drvdata(pdev, NULL);
-   clk_disable(info->clk);
-   clk_unprepare(info->clk);
+   clk_disable_unprepare(info->clk);
clk_put(info->clk);
iounmap(info->adc_base_spear6xx);
iio_device_free(iodev);

--
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/13] drivers/spi/spi-{orion,pl022}.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/spi/spi-orion.c |3 +--
 drivers/spi/spi-pl022.c |   17 -
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index b17c09c..b2a7199 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -416,8 +416,7 @@ static int __init orion_spi_probe(struct platform_device 
*pdev)
goto out;
}
 
-   clk_prepare(spi->clk);
-   clk_enable(spi->clk);
+   clk_prepare_enable(spi->clk);
tclk_hz = clk_get_rate(spi->clk);
spi->max_speed = DIV_ROUND_UP(tclk_hz, 4);
spi->min_speed = DIV_ROUND_UP(tclk_hz, 30);
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index b0fec03..0d235d4 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -2142,16 +2142,10 @@ pl022_probe(struct amba_device *adev, const struct 
amba_id *id)
goto err_no_clk;
}
 
-   status = clk_prepare(pl022->clk);
-   if (status) {
-   dev_err(>dev, "could not prepare SSP/SPI bus clock\n");
-   goto  err_clk_prep;
-   }
-
-   status = clk_enable(pl022->clk);
+   status = clk_prepare_enable(pl022->clk);
if (status) {
dev_err(>dev, "could not enable SSP/SPI bus clock\n");
-   goto err_no_clk_en;
+   goto err_clk_prep;
}
 
/* Initialize transfer pump */
@@ -2207,9 +2201,7 @@ pl022_probe(struct amba_device *adev, const struct 
amba_id *id)
 
free_irq(adev->irq[0], pl022);
  err_no_irq:
-   clk_disable(pl022->clk);
- err_no_clk_en:
-   clk_unprepare(pl022->clk);
+   clk_disable_unprepare(pl022->clk);
  err_clk_prep:
clk_put(pl022->clk);
  err_no_clk:
@@ -2243,8 +2235,7 @@ pl022_remove(struct amba_device *adev)
pl022_dma_remove(pl022);
 
free_irq(adev->irq[0], pl022);
-   clk_disable(pl022->clk);
-   clk_unprepare(pl022->clk);
+   clk_disable_unprepare(pl022->clk);
clk_put(pl022->clk);
pm_runtime_disable(>dev);
iounmap(pl022->virtbase);

--
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 5/13] arch/arm: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 arch/arm/common/sa.c   |3 +--
 arch/arm/common/timer-sp.c |   16 
 arch/arm/kernel/smp_twd.c  |   13 +++--
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/arch/arm/common/sa.c b/arch/arm/common/sa.c
index 9173d11..bd58414 100644
--- a/arch/arm/common/sa.c
+++ b/arch/arm/common/sa.c
@@ -834,8 +834,7 @@ static void __sa_remove(struct sa *sachip)
sa_writel(0, irqbase + SA_WAKEEN0);
sa_writel(0, irqbase + SA_WAKEEN1);
 
-   clk_disable(sachip->clk);
-   clk_unprepare(sachip->clk);
+   clk_disable_unprepare(sachip->clk);
 
if (sachip->irq != NO_IRQ) {
irq_set_chained_handler(sachip->irq, NULL);
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index df13a3f..af1a4ab 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -42,17 +42,10 @@ static long __init sp804_get_clock_rate(const char *name)
return PTR_ERR(clk);
}
 
-   err = clk_prepare(clk);
+   err = clk_prepare_enable(clk);
if (err) {
-   pr_err("sp804: %s clock failed to prepare: %d\n", name, err);
-   clk_put(clk);
-   return err;
-   }
-
-   err = clk_enable(clk);
-   if (err) {
-   pr_err("sp804: %s clock failed to enable: %d\n", name, err);
-   clk_unprepare(clk);
+   pr_err("sp804: %s clock failed to prepare or to enable: %d\n",
+  name, err);
clk_put(clk);
return err;
}
@@ -60,8 +53,7 @@ static long __init sp804_get_clock_rate(const char *name)
rate = clk_get_rate(clk);
if (rate < 0) {
pr_err("sp804: %s clock failed to get rate: %ld\n", name, rate);
-   clk_disable(clk);
-   clk_unprepare(clk);
+   clk_disable_unprepare(clk);
clk_put(clk);
}
 
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index fef42b2..8c94b8b 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -204,17 +204,10 @@ static struct clk *twd_get_clock(void)
return clk;
}
 
-   err = clk_prepare(clk);
+   err = clk_prepare_enable(clk);
if (err) {
-   pr_err("smp_twd: clock failed to prepare: %d\n", err);
-   clk_put(clk);
-   return ERR_PTR(err);
-   }
-
-   err = clk_enable(clk);
-   if (err) {
-   pr_err("smp_twd: clock failed to enable: %d\n", err);
-   clk_unprepare(clk);
+   pr_err("smp_twd: clock failed to prepare or to enable: %d\n",
+  err);
clk_put(clk);
return ERR_PTR(err);
}

--
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 8/13] i2c: mv64xxx: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/i2c/busses/i2c-mv64xxx.c |   18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 2e9d567..046c4b5 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -633,10 +633,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
drv_data->clk = clk_get(>dev, NULL);
-   if (!IS_ERR(drv_data->clk)) {
-   clk_prepare(drv_data->clk);
-   clk_enable(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_prepare_enable(drv_data->clk);
 #endif
if (pdata) {
drv_data->freq_m = pdata->freq_m;
@@ -686,10 +684,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
exit_unmap_regs:
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
-   if (!IS_ERR(drv_data->clk)) {
-   clk_disable(drv_data->clk);
-   clk_unprepare(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_disable_unprepare(drv_data->clk);
 #endif
mv64xxx_i2c_unmap_regs(drv_data);
exit_kfree:
@@ -708,10 +704,8 @@ mv64xxx_i2c_remove(struct platform_device *dev)
mv64xxx_i2c_unmap_regs(drv_data);
 #if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
-   if (!IS_ERR(drv_data->clk)) {
-   clk_disable(drv_data->clk);
-   clk_unprepare(drv_data->clk);
-   }
+   if (!IS_ERR(drv_data->clk))
+   clk_disable_unprepare(drv_data->clk);
 #endif
kfree(drv_data);
 

--
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 7/13] drivers/mmc/host/mmci.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/mmc/host/mmci.c |   13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 50ff19a..edc3e9b 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1309,14 +1309,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
goto host_free;
}
 
-   ret = clk_prepare(host->clk);
+   ret = clk_prepare_enable(host->clk);
if (ret)
goto clk_free;
 
-   ret = clk_enable(host->clk);
-   if (ret)
-   goto clk_unprep;
-
host->plat = plat;
host->variant = variant;
host->mclk = clk_get_rate(host->clk);
@@ -1515,9 +1511,7 @@ static int __devinit mmci_probe(struct amba_device *dev,
  err_gpio_cd:
iounmap(host->base);
  clk_disable:
-   clk_disable(host->clk);
- clk_unprep:
-   clk_unprepare(host->clk);
+   clk_disable_unprepare(host->clk);
  clk_free:
clk_put(host->clk);
  host_free:
@@ -1564,8 +1558,7 @@ static int __devexit mmci_remove(struct amba_device *dev)
gpio_free(host->gpio_cd);
 
iounmap(host->base);
-   clk_disable(host->clk);
-   clk_unprepare(host->clk);
+   clk_disable_unprepare(host->clk);
clk_put(host->clk);
 
if (host->vcc)

--
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/13] use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

The transformation is made using the following semantic patch
(http://coccinelle.lip6.fr/).  This semantic patch is not really safe, in
that it doesn't check for clk_disable's that are relying on the removed
clk_unprepare's.  These cases have been adjusted by hand.

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
identifier r;
statement S;
@@

- r = clk_prepare(e); if (r) S
- clk_enable(e);
+ r = clk_prepare_enable(e); if (r) S

@@
expression e;
expression r;
@@

- clk_prepare(e);
  r =
- clk_enable
+ clk_prepare_enable
  (e);
  if (r) { ...
- clk_unprepare(e); // unsafe!
  ...
  return ...;
  }

@@
expression e;
expression r;
@@

- clk_prepare(e);
  r =
- clk_enable
+ clk_prepare_enable
  (e);

@@
expression e;
statement S;
@@

- if (clk_prepare(e)) S
- clk_enable(e);
+ if (clk_prepare_enable(e)) S

@@
expression e;
@@

- clk_prepare(e);
  if (
- clk_enable(e)
+ clk_prepare_enable(e)
  ) { ...
- clk_unprepare(e); // unsafe!
  ...
  return ...;
  }

@@
expression e;
statement S;
@@

- clk_prepare(e);
  if (
- clk_enable(e)
+ clk_prepare_enable(e)
  ) S

@@
expression e,r2;
identifier r1;
statement S;
@@

- r1 = clk_prepare(e); if (r1) S
  r2 =
-  clk_enable
+  clk_prepare_enable
   (e);
  if (r2) { ...
- clk_unprepare(e); // unsafe!
  ...
  return ...;
  }

@@
expression e,r2;
identifier r1;
statement S;
@@

- r1 = clk_prepare(e); if (r1) S
  r2 =
-  clk_enable
+  clk_prepare_enable
   (e);

@@
expression e;
statement S1;
@@

- if (clk_prepare(e)) S1
  if (
-  clk_enable
+  clk_prepare_enable
 (e)) { ...
- clk_unprepare(e); // unsafe!
  ...
  return ...;
  }

@@
expression e;
statement S1,S2;
@@

- if (clk_prepare(e)) S1
  if (
-  clk_enable
+  clk_prepare_enable
 (e)) S2

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

--
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 6/13] drivers/iio/adc/at91_adc.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/iio/adc/at91_adc.c |   33 +
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 98c96f9..c1e4690 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -589,18 +589,13 @@ static int __devinit at91_adc_probe(struct 
platform_device *pdev)
goto error_free_irq;
}
 
-   ret = clk_prepare(st->clk);
+   ret = clk_prepare_enable(st->clk);
if (ret) {
-   dev_err(>dev, "Could not prepare the clock.\n");
+   dev_err(>dev,
+   "Could not prepare or enable the clock.\n");
goto error_free_irq;
}
 
-   ret = clk_enable(st->clk);
-   if (ret) {
-   dev_err(>dev, "Could not enable the clock.\n");
-   goto error_unprepare_clk;
-   }
-
st->adc_clk = devm_clk_get(>dev, "adc_op_clk");
if (IS_ERR(st->adc_clk)) {
dev_err(>dev, "Failed to get the ADC clock.\n");
@@ -608,18 +603,13 @@ static int __devinit at91_adc_probe(struct 
platform_device *pdev)
goto error_disable_clk;
}
 
-   ret = clk_prepare(st->adc_clk);
+   ret = clk_prepare_enable(st->adc_clk);
if (ret) {
-   dev_err(>dev, "Could not prepare the ADC clock.\n");
+   dev_err(>dev,
+   "Could not prepare or enable the ADC clock.\n");
goto error_disable_clk;
}
 
-   ret = clk_enable(st->adc_clk);
-   if (ret) {
-   dev_err(>dev, "Could not enable the ADC clock.\n");
-   goto error_unprepare_adc_clk;
-   }
-
/*
 * Prescaler rate computation using the formula from the Atmel's
 * datasheet : ADC Clock = MCK / ((Prescaler + 1) * 2), ADC Clock being
@@ -681,13 +671,9 @@ error_remove_triggers:
 error_unregister_buffer:
at91_adc_buffer_remove(idev);
 error_disable_adc_clk:
-   clk_disable(st->adc_clk);
-error_unprepare_adc_clk:
-   clk_unprepare(st->adc_clk);
+   clk_disable_unprepare(st->adc_clk);
 error_disable_clk:
-   clk_disable(st->clk);
-error_unprepare_clk:
-   clk_unprepare(st->clk);
+   clk_disable_unprepare(st->clk);
 error_free_irq:
free_irq(st->irq, idev);
 error_free_device:
@@ -705,8 +691,7 @@ static int __devexit at91_adc_remove(struct platform_device 
*pdev)
at91_adc_trigger_remove(idev);
at91_adc_buffer_remove(idev);
clk_disable_unprepare(st->adc_clk);
-   clk_disable(st->clk);
-   clk_unprepare(st->clk);
+   clk_disable_unprepare(st->clk);
free_irq(st->irq, idev);
iio_device_free(idev);
 

--
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 10/13] drivers/watchdog/sp805_wdt.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/watchdog/sp805_wdt.c |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index e4841c3..cabb040 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -130,16 +130,10 @@ static int wdt_config(struct watchdog_device *wdd, bool 
ping)
int ret;
 
if (!ping) {
-   ret = clk_prepare(wdt->clk);
-   if (ret) {
-   dev_err(>adev->dev, "clock prepare fail");
-   return ret;
-   }
 
-   ret = clk_enable(wdt->clk);
+   ret = clk_prepare_enable(wdt->clk);
if (ret) {
dev_err(>adev->dev, "clock enable fail");
-   clk_unprepare(wdt->clk);
return ret;
}
}
@@ -190,8 +184,7 @@ static int wdt_disable(struct watchdog_device *wdd)
readl_relaxed(wdt->base + WDTLOCK);
spin_unlock(>lock);
 
-   clk_disable(wdt->clk);
-   clk_unprepare(wdt->clk);
+   clk_disable_unprepare(wdt->clk);
 
return 0;
 }

--
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 11/13] arch/arm/mach-at91/gpio.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 arch/arm/mach-at91/gpio.c |9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index be42cf0..7760f35 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -956,19 +956,14 @@ static int __init at91_gpio_setup_clk(int idx)
goto err;
}
 
-   if (clk_prepare(at91_gpio->clock))
-   goto clk_prep_err;
-
/* enable PIO controller's clock */
-   if (clk_enable(at91_gpio->clock)) {
+   if (clk_prepare_enable(at91_gpio->clock)) {
pr_err("at91_gpio.%d, failed to enable clock, ignoring.\n", 
idx);
-   goto clk_err;
+   goto clk_prep_err;
}
 
return 0;
 
-clk_err:
-   clk_unprepare(at91_gpio->clock);
 clk_prep_err:
clk_put(at91_gpio->clock);
 err:

--
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 13/13] drivers/rtc/rtc-coh901331.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
I'm not sure about this.  Maybe it would be better to leave the disable and
unprepare separated, since there is no matching nearby clk_prepare.

 drivers/rtc/rtc-coh901331.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index 76b2156..c8115b8 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -276,8 +276,7 @@ static void coh901331_shutdown(struct platform_device *pdev)
 
clk_enable(rtap->clk);
writel(0, rtap->virtbase + COH901331_IRQ_MASK);
-   clk_disable(rtap->clk);
-   clk_unprepare(rtap->clk);
+   clk_disable_unprepare(rtap->clk);
 }
 
 static struct platform_driver coh901331_driver = {

--
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 3/13] drivers/gpio/gpio-pxa.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/gpio/gpio-pxa.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 9528779..bd8fb66 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -589,19 +589,12 @@ static int __devinit pxa_gpio_probe(struct 
platform_device *pdev)
iounmap(gpio_reg_base);
return PTR_ERR(clk);
}
-   ret = clk_prepare(clk);
+   ret = clk_prepare_enable(clk);
if (ret) {
clk_put(clk);
iounmap(gpio_reg_base);
return ret;
}
-   ret = clk_enable(clk);
-   if (ret) {
-   clk_unprepare(clk);
-   clk_put(clk);
-   iounmap(gpio_reg_base);
-   return ret;
-   }
 
/* Initialize GPIO chips */
info = dev_get_platdata(>dev);

--
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 12/13] drivers/amba/bus.c: use clk_prepare_enable and clk_disable_unprepare

2012-08-26 Thread Julia Lawall
From: Julia Lawall 

Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare.  They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

A simplified version of the semantic patch that introduces calls to these
functions is as follows: (http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/amba/bus.c |   15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index e8eb91b..6374ee6 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -329,17 +329,9 @@ static int amba_get_enable_pclk(struct amba_device *pcdev)
if (IS_ERR(pclk))
return PTR_ERR(pclk);
 
-   ret = clk_prepare(pclk);
-   if (ret) {
-   clk_put(pclk);
-   return ret;
-   }
-
-   ret = clk_enable(pclk);
-   if (ret) {
-   clk_unprepare(pclk);
+   ret = clk_prepare_enable(pclk);
+   if (ret)
clk_put(pclk);
-   }
 
return ret;
 }
@@ -348,8 +340,7 @@ static void amba_put_disable_pclk(struct amba_device *pcdev)
 {
struct clk *pclk = pcdev->pclk;
 
-   clk_disable(pclk);
-   clk_unprepare(pclk);
+   clk_disable_unprepare(pclk);
clk_put(pclk);
 }
 

--
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/


  1   2   3   4   >