Re: PROBLEM: New Kernel Patch

2012-08-06 Thread Belisko Marek
On Mon, Aug 6, 2012 at 2:27 AM, Christopher Sacchi
chris.sac...@gmail.com wrote:
 Here is a new patch that should be tested that fixes a function issue
 in the description for the Mac80211 driver in tar.bz2 format.
Please don't send patches as attachment (send in email body). More can
be found in
kernel source: Documentation/SubmittingPatches (paragraph 7)

 Let me know if it works.
 Thanks,

 --
 Christopher

mbe

-- 
as simple and primitive as possible
-
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.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 v4 0/6] Port Tegra to generic clk framework

2012-08-06 Thread Prashant Gaikwad
This patch set ports Tegra clock code to generic clock framework.

Depends on:
b2f4774 ARM: tegra: fix U16 divider range check
e1a8a4d ARM: tegra: turn on UART A clock at boot

Tested on Ventana and Cardhu.

v4:
 - Rebased on Tegra's for-3.7/common-clk

v3:
 - Fix Tegra20 pll clk round rate.
 - Fix Tegra30 periph clk ref count check.

v2:
 - Rebased on Tegra's for-3.6/common-clk.

Prashant Gaikwad (6):
  ARM: tegra30: Separate out clk ops and clk data
  ARM: tegra20: Separate out clk ops and clk data
  ARM: tegra: Rename tegra20 clock file
  ARM: tegra: Add clk_tegra structure and helper functions
  ARM: tegra: Port tegra to generic clock framework
  ARM: tegra: Remove duplicate code

 arch/arm/Kconfig  |1 +
 arch/arm/mach-tegra/Makefile  |4 +-
 arch/arm/mach-tegra/clock.c   |  570 +--
 arch/arm/mach-tegra/clock.h   |   40 +-
 arch/arm/mach-tegra/common.c  |1 -
 arch/arm/mach-tegra/include/mach/clk.h|3 +
 arch/arm/mach-tegra/tegra20_clocks.c  | 1526 +
 arch/arm/mach-tegra/tegra20_clocks.h  |   41 +
 arch/arm/mach-tegra/tegra20_clocks_data.c | 1113 +
 arch/arm/mach-tegra/tegra2_clocks.c   | 2484 
 arch/arm/mach-tegra/tegra30_clocks.c  | 2559 ++---
 arch/arm/mach-tegra/tegra30_clocks.h  |   53 +
 arch/arm/mach-tegra/tegra30_clocks_data.c | 1370 +++
 13 files changed, 4991 insertions(+), 4774 deletions(-)
 create mode 100644 arch/arm/mach-tegra/tegra20_clocks.c
 create mode 100644 arch/arm/mach-tegra/tegra20_clocks.h
 create mode 100644 arch/arm/mach-tegra/tegra20_clocks_data.c
 delete mode 100644 arch/arm/mach-tegra/tegra2_clocks.c
 create mode 100644 arch/arm/mach-tegra/tegra30_clocks.h
 create mode 100644 arch/arm/mach-tegra/tegra30_clocks_data.c

-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 3/6] ARM: tegra: Rename tegra20 clock file

2012-08-06 Thread Prashant Gaikwad
Make the name consistent with other files.
s/tegra2/tegra20

Signed-off-by: Prashant Gaikwad pgaik...@nvidia.com
---
 arch/arm/mach-tegra/Makefile   |2 +-
 .../{tegra2_clocks.c = tegra20_clocks.c}  |0
 2 files changed, 1 insertions(+), 1 deletions(-)
 rename arch/arm/mach-tegra/{tegra2_clocks.c = tegra20_clocks.c} (100%)

diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 655fcfc..f07f994 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -12,7 +12,7 @@ obj-y += powergate.o
 obj-y  += apbio.o
 obj-$(CONFIG_CPU_IDLE) += cpuidle.o
 obj-$(CONFIG_CPU_IDLE) += sleep.o
-obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o
+obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_clocks.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_clocks_data.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= tegra30_clocks.o
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c 
b/arch/arm/mach-tegra/tegra20_clocks.c
similarity index 100%
rename from arch/arm/mach-tegra/tegra2_clocks.c
rename to arch/arm/mach-tegra/tegra20_clocks.c
-- 
1.7.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 4/6] ARM: tegra: Add clk_tegra structure and helper functions

2012-08-06 Thread Prashant Gaikwad
Add Tegra platform specific clock structure clk_tegra and
some helper functions for generic clock framework.

struct clk_tegra is the single strcture used for all types of
clocks. reset and cfg_ex ops moved to clk_tegra from clk_ops.

Signed-off-by: Prashant Gaikwad pgaik...@nvidia.com
---
 arch/arm/mach-tegra/clock.c|  126 +++-
 arch/arm/mach-tegra/clock.h|   90 ---
 arch/arm/mach-tegra/common.c   |2 +
 arch/arm/mach-tegra/include/mach/clk.h |3 +
 4 files changed, 210 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 58f981c..ef9b494 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -1,6 +1,7 @@
 /*
  *
  * Copyright (C) 2010 Google, Inc.
+ * Copyright (c) 2012 NVIDIA CORPORATION.  All rights reserved.
  *
  * Author:
  * Colin Cross ccr...@google.com
@@ -62,6 +63,7 @@
 static DEFINE_MUTEX(clock_list_lock);
 static LIST_HEAD(clocks);
 
+#ifndef CONFIG_COMMON_CLK
 struct clk *tegra_get_clock_by_name(const char *name)
 {
struct clk *c;
@@ -668,5 +670,127 @@ err_out:
debugfs_remove_recursive(clk_debugfs_root);
return err;
 }
-
 #endif
+#else
+
+void tegra_clk_add(struct clk *clk)
+{
+   struct clk_tegra *c = to_clk_tegra(__clk_get_hw(clk));
+
+   mutex_lock(clock_list_lock);
+   list_add(c-node, clocks);
+   mutex_unlock(clock_list_lock);
+}
+
+struct clk *tegra_get_clock_by_name(const char *name)
+{
+   struct clk_tegra *c;
+   struct clk *ret = NULL;
+   mutex_lock(clock_list_lock);
+   list_for_each_entry(c, clocks, node) {
+   if (strcmp(__clk_get_name(c-hw.clk), name) == 0) {
+   ret = c-hw.clk;
+   break;
+   }
+   }
+   mutex_unlock(clock_list_lock);
+   return ret;
+}
+
+static int tegra_clk_init_one_from_table(struct tegra_clk_init_table *table)
+{
+   struct clk *c;
+   struct clk *p;
+   struct clk *parent;
+
+   int ret = 0;
+
+   c = tegra_get_clock_by_name(table-name);
+
+   if (!c) {
+   pr_warn(Unable to initialize clock %s\n,
+   table-name);
+   return -ENODEV;
+   }
+
+   parent = clk_get_parent(c);
+
+   if (table-parent) {
+   p = tegra_get_clock_by_name(table-parent);
+   if (!p) {
+   pr_warn(Unable to find parent %s of clock %s\n,
+   table-parent, table-name);
+   return -ENODEV;
+   }
+
+   if (parent != p) {
+   ret = clk_set_parent(c, p);
+   if (ret) {
+   pr_warn(Unable to set parent %s of clock %s: 
%d\n,
+   table-parent, table-name, ret);
+   return -EINVAL;
+   }
+   }
+   }
+
+   if (table-rate  table-rate != clk_get_rate(c)) {
+   ret = clk_set_rate(c, table-rate);
+   if (ret) {
+   pr_warn(Unable to set clock %s to rate %lu: %d\n,
+   table-name, table-rate, ret);
+   return -EINVAL;
+   }
+   }
+
+   if (table-enabled) {
+   ret = clk_prepare_enable(c);
+   if (ret) {
+   pr_warn(Unable to enable clock %s: %d\n,
+   table-name, ret);
+   return -EINVAL;
+   }
+   }
+
+   return 0;
+}
+
+void tegra_clk_init_from_table(struct tegra_clk_init_table *table)
+{
+   for (; table-name; table++)
+   tegra_clk_init_one_from_table(table);
+}
+
+void tegra_periph_reset_deassert(struct clk *c)
+{
+   struct clk_tegra *clk = to_clk_tegra(__clk_get_hw(c));
+   BUG_ON(!clk-reset);
+   clk-reset(__clk_get_hw(c), false);
+}
+EXPORT_SYMBOL(tegra_periph_reset_deassert);
+
+void tegra_periph_reset_assert(struct clk *c)
+{
+   struct clk_tegra *clk = to_clk_tegra(__clk_get_hw(c));
+   BUG_ON(!clk-reset);
+   clk-reset(__clk_get_hw(c), true);
+}
+EXPORT_SYMBOL(tegra_periph_reset_assert);
+
+/* Several extended clock configuration bits (e.g., clock routing, clock
+ * phase control) are included in PLL and peripheral clock source
+ * registers. */
+int tegra_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting)
+{
+   int ret = 0;
+   struct clk_tegra *clk = to_clk_tegra(__clk_get_hw(c));
+
+   if (!clk-clk_cfg_ex) {
+   ret = -ENOSYS;
+   goto out;
+   }
+   ret = clk-clk_cfg_ex(__clk_get_hw(c), p, setting);
+
+out:
+   return ret;
+}
+#endif /* !CONFIG_COMMON_CLK */
diff --git a/arch/arm/mach-tegra/clock.h b/arch/arm/mach-tegra/clock.h
index bc30065..f4d32ba 100644
--- a/arch/arm/mach-tegra/clock.h
+++ 

[PATCH v4 6/6] ARM: tegra: Remove duplicate code

2012-08-06 Thread Prashant Gaikwad
Remove Tegra legacy clock framework code.

Signed-off-by: Prashant Gaikwad pgaik...@nvidia.com
---
 arch/arm/mach-tegra/clock.c  |  632 --
 arch/arm/mach-tegra/clock.h  |   89 --
 arch/arm/mach-tegra/common.c |3 -
 3 files changed, 0 insertions(+), 724 deletions(-)

diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index ef9b494..632133f 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -20,8 +20,6 @@
 #include linux/kernel.h
 #include linux/clk.h
 #include linux/clkdev.h
-#include linux/debugfs.h
-#include linux/delay.h
 #include linux/init.h
 #include linux/list.h
 #include linux/module.h
@@ -37,642 +35,13 @@
 /*
  * Locking:
  *
- * Each struct clk has a spinlock.
- *
- * To avoid AB-BA locking problems, locks must always be traversed from child
- * clock to parent clock.  For example, when enabling a clock, the clock's lock
- * is taken, and then clk_enable is called on the parent, which take's the
- * parent clock's lock.  There is one exceptions to this ordering: When dumping
- * the clock tree through debugfs.  In this case, clk_lock_all is called,
- * which attemps to iterate through the entire list of clocks and take every
- * clock lock.  If any call to spin_trylock fails, all locked clocks are
- * unlocked, and the process is retried.  When all the locks are held,
- * the only clock operation that can be called is clk_get_rate_all_locked.
- *
- * Within a single clock, no clock operation can call another clock operation
- * on itself, except for clk_get_rate_locked and clk_set_rate_locked.  Any
- * clock operation can call any other clock operation on any of it's possible
- * parents.
- *
  * An additional mutex, clock_list_lock, is used to protect the list of all
  * clocks.
  *
- * The clock operations must lock internally to protect against
- * read-modify-write on registers that are shared by multiple clocks
  */
 static DEFINE_MUTEX(clock_list_lock);
 static LIST_HEAD(clocks);
 
-#ifndef CONFIG_COMMON_CLK
-struct clk *tegra_get_clock_by_name(const char *name)
-{
-   struct clk *c;
-   struct clk *ret = NULL;
-   mutex_lock(clock_list_lock);
-   list_for_each_entry(c, clocks, node) {
-   if (strcmp(c-name, name) == 0) {
-   ret = c;
-   break;
-   }
-   }
-   mutex_unlock(clock_list_lock);
-   return ret;
-}
-
-/* Must be called with c-spinlock held */
-static unsigned long clk_predict_rate_from_parent(struct clk *c, struct clk *p)
-{
-   u64 rate;
-
-   rate = clk_get_rate(p);
-
-   if (c-mul != 0  c-div != 0) {
-   rate *= c-mul;
-   rate += c-div - 1; /* round up */
-   do_div(rate, c-div);
-   }
-
-   return rate;
-}
-
-/* Must be called with c-spinlock held */
-unsigned long clk_get_rate_locked(struct clk *c)
-{
-   unsigned long rate;
-
-   if (c-parent)
-   rate = clk_predict_rate_from_parent(c, c-parent);
-   else
-   rate = c-rate;
-
-   return rate;
-}
-
-unsigned long clk_get_rate(struct clk *c)
-{
-   unsigned long flags;
-   unsigned long rate;
-
-   spin_lock_irqsave(c-spinlock, flags);
-
-   rate = clk_get_rate_locked(c);
-
-   spin_unlock_irqrestore(c-spinlock, flags);
-
-   return rate;
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-int clk_reparent(struct clk *c, struct clk *parent)
-{
-   c-parent = parent;
-   return 0;
-}
-
-void clk_init(struct clk *c)
-{
-   spin_lock_init(c-spinlock);
-
-   if (c-ops  c-ops-init)
-   c-ops-init(c);
-
-   if (!c-ops || !c-ops-enable) {
-   c-refcnt++;
-   c-set = true;
-   if (c-parent)
-   c-state = c-parent-state;
-   else
-   c-state = ON;
-   }
-
-   mutex_lock(clock_list_lock);
-   list_add(c-node, clocks);
-   mutex_unlock(clock_list_lock);
-}
-
-int clk_enable(struct clk *c)
-{
-   int ret = 0;
-   unsigned long flags;
-
-   spin_lock_irqsave(c-spinlock, flags);
-
-   if (c-refcnt == 0) {
-   if (c-parent) {
-   ret = clk_enable(c-parent);
-   if (ret)
-   goto out;
-   }
-
-   if (c-ops  c-ops-enable) {
-   ret = c-ops-enable(c);
-   if (ret) {
-   if (c-parent)
-   clk_disable(c-parent);
-   goto out;
-   }
-   c-state = ON;
-   c-set = true;
-   }
-   }
-   c-refcnt++;
-out:
-   spin_unlock_irqrestore(c-spinlock, flags);
-   return ret;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *c)
-{
-   unsigned long flags;
-
-   

Re: mq: INFO: possible circular locking dependency detected

2012-08-06 Thread Al Viro
On Sat, Aug 04, 2012 at 12:59:31PM +0200, Sasha Levin wrote:
 Hi all,
 
 While fuzzing with trinity inside a KVM tools guest, using latest -next 
 kernel, I've stumbled on the dump below.
 
 I think this is the result of commit 765927b2 (switch dentry_open() to 
 struct path, make it grab references itself).

Not quite, actually - back then the order didn't matter;
unfortunately, I'd missed that place when porting Jan's series,
which made these ordered.

Anyway, see today's vfs.git#for-linus; that should be dealt with
there.
--
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: DT GPIO numbering?

2012-08-06 Thread Linus Walleij
On Mon, Aug 6, 2012 at 4:18 AM, Stephen Warren swar...@wwwdotorg.org wrote:

 I can't comment on the sysfs-vs-dev interface location, but I don't
 think it addresses Johannes' issue; finding out which GPIO IDs are
 provided by which devices.

 Perhaps in each device's sysfs node, there should be some information
 re: which GPIO range it provides. Right now, perhaps a text file with
 the GPIO base it it.

Yes that could work ...

 With the new /dev interface you mention above,
 perhaps a symlink to the /dev file, or a file containing the /dev file's
 major/minor number. Or, is there such a thing already (other than
 debugfs's gpio file).

Nothing I know of, but yes the day we come up with something,
it needs to be backward-compatible some way.

The problem is that there is really no reference userspace
like lsgpio or so. Maybe the first step could be to create that.

Yours,
Linus Walleij
--
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] dma-buf: add helpers for attacher dma-parms

2012-08-06 Thread Semwal, Sumit
On Fri, Jul 20, 2012 at 10:09 PM, Rob Clark rob.cl...@linaro.org wrote:
 Fyi, Daniel Vetter had suggested on IRC that it would be cleaner to
 have a single helper fxn that most-restrictive union of all attached
 device's dma_parms.  Really this should include dma_mask and
 coherent_dma_mask, I think.  But that touches a lot of other places in
 the code.  If no one objects to the cleanup of moving
 dma_mask/coherent_dma_mask into dma_parms, I'll do this first.

 So anyways, don't consider this patch yet for inclusion, I'll make an
 updated one based on dma_parms..
Hi Rob,
Any news on this patch-set?

 BR,
 -R
BR,
~Sumit.

 On Thu, Jul 19, 2012 at 11:23 AM, Rob Clark rob.cl...@linaro.org wrote:
 From: Rob Clark r...@ti.com

 Add some helpers to iterate through all attachers and get the most
 restrictive segment size/count/boundary.

 Signed-off-by: Rob Clark r...@ti.com
 ---
  drivers/base/dma-buf.c  |   63 
 +++
  include/linux/dma-buf.h |   19 ++
  2 files changed, 82 insertions(+)

 diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
 index 24e88fe..757ee20 100644
 --- a/drivers/base/dma-buf.c
 +++ b/drivers/base/dma-buf.c
 @@ -192,6 +192,69 @@ void dma_buf_put(struct dma_buf *dmabuf)
  EXPORT_SYMBOL_GPL(dma_buf_put);

  /**
 + * dma_buf_max_seg_size - helper for exporters to get the minimum of
 + * all attached device's max segment size
 + */
 +unsigned int dma_buf_max_seg_size(struct dma_buf *dmabuf)
 +{
 +   struct dma_buf_attachment *attach;
 +   unsigned int max = (unsigned int)-1;
 +
 +   if (WARN_ON(!dmabuf))
 +   return 0;
 +
 +   mutex_lock(dmabuf-lock);
 +   list_for_each_entry(attach, dmabuf-attachments, node)
 +   max = min(max, dma_get_max_seg_size(attach-dev));
 +   mutex_unlock(dmabuf-lock);
 +
 +   return max;
 +}
 +EXPORT_SYMBOL_GPL(dma_buf_max_seg_size);
 +
 +/**
 + * dma_buf_max_seg_count - helper for exporters to get the minimum of
 + * all attached device's max segment count
 + */
 +unsigned int dma_buf_max_seg_count(struct dma_buf *dmabuf)
 +{
 +   struct dma_buf_attachment *attach;
 +   unsigned int max = (unsigned int)-1;
 +
 +   if (WARN_ON(!dmabuf))
 +   return 0;
 +
 +   mutex_lock(dmabuf-lock);
 +   list_for_each_entry(attach, dmabuf-attachments, node)
 +   max = min(max, dma_get_max_seg_count(attach-dev));
 +   mutex_unlock(dmabuf-lock);
 +
 +   return max;
 +}
 +EXPORT_SYMBOL_GPL(dma_buf_max_seg_count);
 +
 +/**
 + * dma_buf_get_seg_boundary - helper for exporters to get the most
 + * restrictive segment alignment of all the attached devices
 + */
 +unsigned int dma_buf_get_seg_boundary(struct dma_buf *dmabuf)
 +{
 +   struct dma_buf_attachment *attach;
 +   unsigned int mask = (unsigned int)-1;
 +
 +   if (WARN_ON(!dmabuf))
 +   return 0;
 +
 +   mutex_lock(dmabuf-lock);
 +   list_for_each_entry(attach, dmabuf-attachments, node)
 +   mask = dma_get_seg_boundary(attach-dev);
 +   mutex_unlock(dmabuf-lock);
 +
 +   return mask;
 +}
 +EXPORT_SYMBOL_GPL(dma_buf_get_seg_boundary);
 +
 +/**
   * dma_buf_attach - Add the device to dma_buf's attachments list; 
 optionally,
   * calls attach() of dma_buf_ops to allow device-specific attach 
 functionality
   * @dmabuf:[in]buffer to attach device to.
 diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
 index eb48f38..9533b9b 100644
 --- a/include/linux/dma-buf.h
 +++ b/include/linux/dma-buf.h
 @@ -167,6 +167,10 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags);
  struct dma_buf *dma_buf_get(int fd);
  void dma_buf_put(struct dma_buf *dmabuf);

 +unsigned int dma_buf_max_seg_size(struct dma_buf *dmabuf);
 +unsigned int dma_buf_max_seg_count(struct dma_buf *dmabuf);
 +unsigned int dma_buf_get_seg_boundary(struct dma_buf *dmabuf);
 +
  struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
 enum dma_data_direction);
  void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table 
 *,
 @@ -220,6 +224,21 @@ static inline void dma_buf_put(struct dma_buf *dmabuf)
 return;
  }

 +static inline unsigned int dma_buf_max_seg_size(struct dma_buf *dmabuf)
 +{
 +   return 0;
 +}
 +
 +static inline unsigned int dma_buf_max_seg_count(struct dma_buf *dmabuf)
 +{
 +   return 0;
 +}
 +
 +static inline unsigned int dma_buf_get_seg_boundary(struct dma_buf *dmabuf)
 +{
 +   return 0;
 +}
 +
  static inline struct sg_table *dma_buf_map_attachment(
 struct dma_buf_attachment *attach, enum dma_data_direction write)
  {
 --
 1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: linux-next: Tree for July 17 (mfd/tps65217.c)

2012-08-06 Thread AnilKumar, Chimata
On Fri, Aug 03, 2012 at 22:58:01, Randy Dunlap wrote:
 On 07/17/2012 02:48 PM, Randy Dunlap wrote:
 
  On 07/16/2012 10:41 PM, Stephen Rothwell wrote:
  
  Hi all,
 
  Changes since 20120716:
 
  
  
  on i386:
  
  drivers/built-in.o: In function `tps65217_probe':
  tps65217.c:(.devinit.text+0x13e37): undefined reference to 
  `of_regulator_match'
  
  
  Full randconfig file is attached.
  CONFIG_REGULATOR is not enabled.
  
 
 
 This build error is still present in linux-next of 20120803.
 

This will be fixed with this patch
https://patchwork.kernel.org/patch/1220151/

Today, I will submit v2 for this

Regards
AnilKumar
--
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] gpio: Add Avionic Design N-bit GPIO expander support

2012-08-06 Thread Linus Walleij
On Mon, Aug 6, 2012 at 7:11 AM, Thierry Reding
thierry.red...@avionic-design.de wrote:
 On Sun, Aug 05, 2012 at 12:50:54PM +0200, Linus Walleij wrote:

 We're working on a goal of a single zImage (one unified ARM
 kernel) which means your platform must be able to handle the
 case where this is turned on anyway, so I would suggest you
 drop the optional compile-time IRQ support, just make it
 optional at runtime instead.

 I don't quite understand. Do you want me to add a module parameter to
 make it optional at runtime? Since the driver is now OF only I suppose I
 could make it optional on the interrupt-controller property as well.

No, no module parameter. Just don't register the IRQ domain if there
are not IRQ resources in the device tree, if the interrupt-controller
property is not present I guess?

 OK but atleast find a way to move this to the probe() function,
 what happens if the debugfs file is browsed and you run out
 of memory? Not nice, and you were using this to debug as
 well...

 Alright, I can do that. Alternatively I could probably drop the
 allocations altogether and use local variables within the second loop to
 store the variables:

 for (i = 0; i  num_regs; i++) {
 u8 ddr, plr, ier, isr, ptr;

 err = adnp_read(gpio, GPIO_DDR(gpio) + i, ddr);
 if (err  0)
 goto out;

 ...
 }

 With the proper locking this shouldn't be a problem. The reason why I
 used the block-wise approach in the first place was that the register
 accesses were more atomic. Of course without locking this is non-
 sense.

Either approach works, the above seems more elegant though!

Yours,
Linus Walleij
--
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: [RFC PATCH 1/3] dma-fence: dma-buf synchronization (v5)

2012-08-06 Thread Sumit Semwal
Hi Maarten,
On 27 July 2012 19:09, Maarten Lankhorst
maarten.lankho...@canonical.com wrote:
 A dma-fence can be attached to a buffer which is being filled or consumed
 by hw, to allow userspace to pass the buffer without waiting to another
 device.  For example, userspace can call page_flip ioctl to display the
 next frame of graphics after kicking the GPU but while the GPU is still
 rendering.  The display device sharing the buffer with the GPU would
 attach a callback to get notified when the GPU's rendering-complete IRQ
 fires, to update the scan-out address of the display, without having to
 wake up userspace.
Since Rob is the original author of this (and I the next?), may I
request you to re-submit with his From: bit?

Rob / Daniel: comments on this series will help me line it up in
for-next, and maybe even for 3.7-rc.

Best regards,
~Sumit.
snip
--
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] power_supply: Added support for power supply attribute sources

2012-08-06 Thread Pallala, Ramakrishna
Hi Anton,

  On Thu, Jul 26, 2012 at 08:47:24PM +0530, Ramakrishna Pallala wrote:
   On some platforms one driver(or HW chip) may not be able to provide
   all the necessary attributes of the power supply connected to the
   platform or may provide very limited info which can be used by
   core/primary
  drivers.
  
   For example a temperature sensor chip placed near the battery can be
   used to report battery ambient temperature but it does not makes
   sense to register sensor driver with power supply class. Or even a
   ADC driver or platform driver may report power supply properties
   like voltage/current or charging status but registering all those
   driver with power supply class is not a practical or ideal approach.
  
   This patch adds the generic support to register the drivers as power
   supply attribute(properties) sources and adds an interface to read
   these attributes from power supply class drivers.
  
   If there are multiple attribute sources of the same type then caller
   has to do source selection by passing the source string in the query 
   struct.
  
   Signed-off-by: Ramakrishna Pallala ramakrishna.pall...@intel.com
   ---
  [...]
   +extern int power_supply_attributes_register(struct device *parent,
   + struct power_supply_attr_source *psy_attr);
 
  Can you please show some user of the new calls? If I understand
  correctly, you're going to call these from sensing (ADC, or some
  other) drivers, which would be very very wrong thing to do.
 
 I have submitted two patches, one on smb347_charger driver and one on
 max17042_battery driver to demonstrate the use of these API's.
 
 [PATCH] smb347_charger: Add support for battery power supply attributes
 registration [PATCH] max17042_battery: add support for battery STATUS and
 CHARGE_TYPE
 
 Please review and let me know your comments.

I haven't received any inputs from you yet.
Can I assume these changes going to be merged?

Thanks,
Ram


Re: [PATCH] Extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices

2012-08-06 Thread Lars-Peter Clausen
On 08/06/2012 06:54 AM, anish kumar wrote:
 From: anish kumar anish198519851...@gmail.com
 
 External connector devices that decides connection information based on
 ADC values may use adc-jack device driver. The user simply needs to
 provide a table of adc range and connection states. Then, extcon
 framework will automatically notify others.

Hi,

some comments inline.

 
 Signed-off-by: anish kumar anish.si...@samsung.com
 ---
  drivers/extcon/Kconfig  |5 +
  drivers/extcon/Makefile |1 +
  drivers/extcon/adc_jack.c   |  183 
 +++
  include/linux/extcon/adc_jack.h |  108 +++
  4 files changed, 297 insertions(+), 0 deletions(-)
  create mode 100644 drivers/extcon/adc_jack.c
  create mode 100644 include/linux/extcon/adc_jack.h
 
[...]
 diff --git a/drivers/extcon/adc_jack.c b/drivers/extcon/adc_jack.c
 new file mode 100644
 index 000..fef8334
 --- /dev/null
 +++ b/drivers/extcon/adc_jack.c
 @@ -0,0 +1,183 @@
[...]
 +static irqreturn_t adc_jack_irq_thread(int irq, void *_data)
 +{
 + struct adc_jack_data *data = _data;
 +
 + schedule_delayed_work(data-handler, data-handling_delay);

If you are just going to schedule a delayed work in the interrupt handler you
don't necessarily need a threaded interrupt handler. I'd use
request_any_context_irq to request the IRQ.

 +
 + return IRQ_HANDLED;
 +}
 +
 +static int adc_jack_probe(struct platform_device *pdev)
 +{
 + struct adc_jack_data *data;
 + struct adc_jack_pdata *pdata = pdev-dev.platform_data;
 + int i, err = 0;
 +
 + data = kzalloc(sizeof(struct adc_jack_data), GFP_KERNEL);

It makes sense to use devm_kzalloc here.

 + if (!data)
 + return -ENOMEM;
 +
 + data-edev.name = pdata-name;
 +
 + if (pdata-cable_names)
 + data-edev.supported_cable = pdata-cable_names;
 + else
 + data-edev.supported_cable = extcon_cable_name;
 +
 + /* Check the length of array and set num_cables */
 + for (i = 0; data-edev.supported_cable[i]; i++)
 + ;
 + if (i == 0 || i  SUPPORTED_CABLE_MAX) {
 + err = -EINVAL;
 + dev_err(pdev-dev, error: pdata-cable_names size = %d\n,
 + i - 1);
 + goto err_alloc;
 + }
 + data-num_cables = i;
 +
 + if (!pdata-adc_condition ||
 + !pdata-adc_condition[0].state) {
 + err = -EINVAL;
 + dev_err(pdev-dev, error: adc_condition not defined.\n);
 + goto err_alloc;
 + }
 + data-adc_condition = pdata-adc_condition;
 +
 + /* Check the length of array and set num_conditions */
 + for (i = 0; data-adc_condition[i].state; i++)
 + ;
 + data-num_conditions = i;
 +
 + data-chan = iio_channel_get(dev_name(pdev-dev),
 + pdata-consumer_channel);

You should check the result of iio_channel_get.

 + data-handling_delay = msecs_to_jiffies(pdata-handling_delay_ms);
 +
 + INIT_DELAYED_WORK_DEFERRABLE(data-handler, adc_jack_handler);
 +
 + platform_set_drvdata(pdev, data);
 +
 + if (pdata-irq) {

Is the driver actually useful without a interrupt? I mean it wouldn't do much
expect always reporting a unconnected cable.

 + data-irq = pdata-irq;

Usually you'd use platform device resources to set the IRQ and not platform
data. E.g. data-irq = platform_get_irq(pdev, 0);

 +
 + err = request_threaded_irq(data-irq, NULL,
 +adc_jack_irq_thread,
 +pdata-irq_flags, pdata-name,
 +data);
 +
 + if (err) {
 + dev_err(pdev-dev, error: irq %d\n, data-irq);
 + err = -EINVAL;
 + goto err_initwork;
 + }
 + }
 + err = extcon_dev_register(data-edev, pdev-dev);
 + if (err)
 + goto err_irq;
 +
 + data-ready = true;

If you request the irq after you registered the extcon_dev you don't need ready.

 +
 + goto out;
 +
 +err_irq:
 + if (data-irq)
 + free_irq(data-irq, data);
 +err_initwork:
 + cancel_delayed_work_sync(data-handler);
 +err_alloc:
 + kfree(data);
 +out:
 + return err;
 +}
 +
 +static int __devexit adc_jack_remove(struct platform_device *pdev)
 +{
 + struct adc_jack_data *data = platform_get_drvdata(pdev);
 +
 + extcon_dev_unregister(data-edev);
 + if (data-irq)
 + free_irq(data-irq, data);
 + platform_set_drvdata(pdev, NULL);

Setting the drvdata to NULL is not necessary.

 + kfree(data);
 +
 + return 0;
 +}
 +
 +static struct platform_driver adc_jack_driver = {
 + .probe  = adc_jack_probe,
 + .remove = __devexit_p(adc_jack_remove),
 + .driver = {
 + .name   = adc-jack,
 + .owner  = THIS_MODULE,
 + },
 +};
 +
 

Re: [Regression] x86-64/efi: Use EFI to deal with platform wall clock prevents my machine from booting

2012-08-06 Thread Jan Beulich
 On 06.08.12 at 00:28, H. Peter Anvin h...@zytor.com wrote:
 On 08/05/2012 02:29 PM, Jérôme Carretero wrote:
 Hi,

 My PC (AMD Bulldozer + Asus SABERTOOTH 990FX) booted fine from UEFI
 and it broke between v3.5 and v3.6-rc1.
 Other machines with old BIOSes booted fine so I looked into EFI-related
 patches trying to revert them, because I didn't know what else to do.

 Bingo, bacef661: x86-64/efi: Use EFI to deal with platform wall clock.

 At the moment I reverted this commit after v3.6-rc1-133-g42a579a,
 and it boots fine.

 This really not my domain so tell me if I can help testing.

 
 Thank you... we were aware of the problem but had not been able to 
 reproduce it, so we had hoped someone would bisect or otherwise identify 
 the faulty patch.

Faulty? Without technical detail I'd be careful with this, as there's
too many broken EFI implementation around.

The only change that has a (very low) potential for causing
problems by itself is the earlier calling of efi_enter_virtual_mode(),
which was requested/recommended by Matthew.

I am e.g. (meanwhile) aware of (Intel) systems that use floating
point instructions in the UEFI runtime code, which is clearly a
violation of the spec; having the kernel continue to be not spec
compliant is a questionable tradeoff.

In any case, without having seen _how_ things break I don't
think a decision should be taken if/how to address this
(apparent) regression.

Jan
--
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] media: mx3_camera: Improve data bus width check code for probe

2012-08-06 Thread Liu Ying
This patch contains code change only to use the present macro-
MX3_CAMERA_DATAWIDTH_MASK to check valid camera platform data
bus width instead of enumerating every possible data bus width.

Signed-off-by: Liu Ying ying@freescale.com
---
 drivers/media/video/mx3_camera.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c
index f96f92f..346e2cd 100644
--- a/drivers/media/video/mx3_camera.c
+++ b/drivers/media/video/mx3_camera.c
@@ -1173,9 +1173,7 @@ static int __devinit mx3_camera_probe(struct 
platform_device *pdev)
 
mx3_cam-pdata = pdev-dev.platform_data;
mx3_cam-platform_flags = mx3_cam-pdata-flags;
-   if (!(mx3_cam-platform_flags  (MX3_CAMERA_DATAWIDTH_4 |
-   MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10 |
-   MX3_CAMERA_DATAWIDTH_15))) {
+   if (!(mx3_cam-platform_flags  MX3_CAMERA_DATAWIDTH_MASK)) {
/*
 * Platform hasn't set available data widths. This is bad.
 * Warn and use a default.
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


No 3.5 version on www.kernel.org

2012-08-06 Thread Tino Keitel
Hi,

when looking at http://www.kernel.org/, kernel 3.4.7 is shown as the
latest stable kernel, and 3.6-rc1 as the latest mainline kernel. The
3.5 version is not mentioned. Why is the latest stable kernel something
older than 3.5?

Regards,
Tino
--
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] module: Fix compile error for ref_module when CONFIG_MODULES is not set

2012-08-06 Thread Rusty Russell
On Wed, 1 Aug 2012 20:57:07 +0300, Barbaros Tokaoğlu barbar...@gmail.com 
wrote:
 ref_module function is not defined when CONFIG_MODULES is not set thus
 it causes compile error when a module which is set to be built-in uses it.
 This patch defines a dummy ref_module function when CONFIG_MODULES
 is not set.
 
 Signed-off-by: Barbaros Tokaoğlu barbar...@gmail.com

Hi Barbaros,

It's usually a good idea to paste the error message into the
commit message for compile fixes: it helps people googling the problem.

In this case, it's particularly important, because I can't find any
users of ref_module() outside module.c itself: it's only exported for
ksplice to use.

Cheers,
Rusty.
--
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: Update VIP to videobuf2 and control framework

2012-08-06 Thread Hans Verkuil
On Sun August 5 2012 19:11:19 Federico Vaga wrote:
 Hi Hans,
  
  Did you run the latest v4l2-compliance tool from the v4l-utils.git
  repository over your driver? I'm sure you didn't since VIP is missing
  support for control events and v4l2-compliance would certainly
  complain about that.
  
  Always check with v4l2-compliance whenever you make changes! It's
  continuously improved as well, so a periodic check wouldn't hurt.
 
 I applied all your suggestions, and some extra simplification; now I'm 
 running v4l2-compliance but I have this error:
 
 
 Allow for multiple opens:
 test second video open: OK
 test VIDIOC_QUERYCAP: OK
 fail: v4l2-compliance.cpp(322): doioctl(node, 
 VIDIOC_G_PRIORITY, prio)
 test VIDIOC_G/S_PRIORITY: FAIL
 
 
 which I don't undestand. I don't have vidio_{g|s}_priority functions in 
 my implementation. And I'm using the V4L2_FL_USE_FH_PRIO flag as 
 suggested in the documentation:
 
 ---
 - flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the 
 framework handle the VIDIOC_G/S_PRIORITY ioctls. This requires that you 
 use struct v4l2_fh.

  ^^

Are you using struct v4l2_fh? The version you posted didn't. You need this
anyway to implement control events.

Regards,

Hans

 Eventually this flag will disappear once all drivers 
 use the core priority handling. But for now it has to be set explicitly.
 --
 
 
--
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] hugetlb: update hugetlbpage.txt

2012-08-06 Thread Zhouping Liu
commit f0f57b2b1(mm: move hugepage test examples to tools/testing/selftests/vm)
moved map_hugetlb.c, hugepage-shm.c and hugepage-mmap.c tests into
tools/testing/selftests/vm/ directory, but it didn't update hugetlbpage.txt

Signed-off-by: Zhouping Liu sanweiday...@gmail.com
---
 Documentation/vm/hugetlbpage.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index f8551b3..4ac359b 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -299,11 +299,17 @@ map_hugetlb.c.
 ***
 
 /*
- * hugepage-shm:  see Documentation/vm/hugepage-shm.c
+ * map_hugetlb: see tools/testing/selftests/vm/map_hugetlb.c
  */
 
 ***
 
 /*
- * hugepage-mmap:  see Documentation/vm/hugepage-mmap.c
+ * hugepage-shm:  see tools/testing/selftests/vm/hugepage-shm.c
+ */
+
+***
+
+/*
+ * hugepage-mmap:  see tools/testing/selftests/vm/hugepage-mmap.c
  */
-- 
1.7.11.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: Update VIP to videobuf2 and control framework

2012-08-06 Thread Federico Vaga

  I applied all your suggestions, and some extra simplification;
  [...]

  ---
  - flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the
  framework handle the VIDIOC_G/S_PRIORITY ioctls. This requires that
  you use struct v4l2_fh.
 
   ^^
 
 Are you using struct v4l2_fh? The version you posted didn't. You need
 this anyway to implement control events.

Yes I'm using it now, it is part of the extra simplification that I did.

-- 
Federico Vaga
--
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: tmp102: Add device tree support

2012-08-06 Thread Poddar, Sourav
Hi Benoit,

On Fri, Aug 3, 2012 at 8:26 PM, Benoit Cousson b-cous...@ti.com wrote:
 Hi Sourav,

 On 08/03/2012 02:35 PM, Sourav Poddar wrote:
 update tmp102 temperature sensor to also use device tree.

 Cc: Benoit Cousson b-cous...@ti.com
 Cc: Felipe Balbi ba...@ti.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Acked-by: Felipe Balbi ba...@ti.com
 Signed-off-by: Sourav Poddar sourav.pod...@ti.com
 ---
  drivers/hwmon/tmp102.c |   14 +-
  1 files changed, 13 insertions(+), 1 deletions(-)

 diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
 index 0d466b9..a8a9060 100644
 --- a/drivers/hwmon/tmp102.c
 +++ b/drivers/hwmon/tmp102.c
 @@ -26,6 +26,7 @@
  #include linux/err.h
  #include linux/mutex.h
  #include linux/device.h
 +#include linux/of.h

  #define  DRIVER_NAME tmp102

 @@ -284,8 +285,19 @@ static const struct i2c_device_id tmp102_id[] = {
  };
  MODULE_DEVICE_TABLE(i2c, tmp102_id);

 +#ifdef CONFIG_OF
 +static const struct of_device_id temperature_dt_match[] = {
 + { .compatible = ti,tmp102 },

 Are you sure this is needed for this device?

 There is an automatic binding done for I2C devices in the of_i2c core
 code. So in theory, DT will be able to bind to any I2C device using the
 already existing table: MODULE_DEVICE_TABLE(i2c, tmp102_id).

 So I think this patch should not be needed.

Indeed. Checked it just now, this patch is not required and the already
existing table is enough for the device to work fine.

Thanks for the information.

This patch is abandoned.
~Sourav
 Regards,
 Benoit

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


[RFC PATCH] perf/x86: Add cpumask for uncore PMU.

2012-08-06 Thread Yan, Zheng
From: Yan, Zheng zheng.z@intel.com

This RFC patch adds a cpumask file to the uncore pmu sysfs directory.
If user doesn't explicitly specify CPU list, perf-stat only collects
uncore events on CPUs listed in the cpumask file.

Signed-off-by: Yan, Zheng zheng.z@intel.com
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 28 ++---
 arch/x86/kernel/cpu/perf_event_intel_uncore.h |  6 --
 tools/perf/builtin-stat.c | 30 ++-
 tools/perf/util/cpumap.c  | 22 +---
 tools/perf/util/cpumap.h  |  2 +-
 tools/perf/util/evsel.h   |  1 +
 tools/perf/util/parse-events.c| 14 +++--
 tools/perf/util/pmu.c | 30 +++
 tools/perf/util/pmu.h |  1 +
 9 files changed, 105 insertions(+), 29 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 0a55710..62ec3e6 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2341,6 +2341,27 @@ int uncore_pmu_event_init(struct perf_event *event)
return ret;
 }
 
+static ssize_t uncore_get_attr_cpumask(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int n = cpulist_scnprintf(buf, PAGE_SIZE - 2, uncore_cpu_mask);
+
+   buf[n++] = '\n';
+   buf[n] = '\0';
+   return n;
+}
+
+static DEVICE_ATTR(cpumask, S_IRUGO, uncore_get_attr_cpumask, NULL);
+
+static struct attribute *uncore_pmu_attrs[] = {
+   dev_attr_cpumask.attr,
+   NULL,
+};
+
+static struct attribute_group uncore_pmu_attr_group = {
+   .attrs = uncore_pmu_attrs,
+};
+
 static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu)
 {
int ret;
@@ -2378,8 +2399,8 @@ static void __init uncore_type_exit(struct 
intel_uncore_type *type)
free_percpu(type-pmus[i].box);
kfree(type-pmus);
type-pmus = NULL;
-   kfree(type-attr_groups[1]);
-   type-attr_groups[1] = NULL;
+   kfree(type-events_group);
+   type-events_group = NULL;
 }
 
 static void __init uncore_types_exit(struct intel_uncore_type **types)
@@ -2431,9 +2452,10 @@ static int __init uncore_type_init(struct 
intel_uncore_type *type)
for (j = 0; j  i; j++)
attrs[j] = type-event_descs[j].attr.attr;
 
-   type-attr_groups[1] = events_group;
+   type-events_group = events_group;
}
 
+   type-pmu_group = uncore_pmu_attr_group;
type-pmus = pmus;
return 0;
 fail:
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h 
b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index 5b81c18..e68a455 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -369,10 +369,12 @@ struct intel_uncore_type {
struct intel_uncore_pmu *pmus;
struct intel_uncore_ops *ops;
struct uncore_event_desc *event_descs;
-   const struct attribute_group *attr_groups[3];
+   const struct attribute_group *attr_groups[4];
 };
 
-#define format_group attr_groups[0]
+#define pmu_group attr_groups[0]
+#define format_group attr_groups[1]
+#define events_group attr_groups[2]
 
 struct intel_uncore_ops {
void (*init_box)(struct intel_uncore_box *);
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 861f0ae..8b4275c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -220,6 +220,16 @@ static void perf_evsel__free_stat_priv(struct perf_evsel 
*evsel)
evsel-priv = NULL;
 }
 
+static inline struct cpu_map *perf_evsel__cpus(struct perf_evsel *evsel)
+{
+   return (evsel-cpus  !target.cpu_list) ? evsel-cpus : 
evsel_list-cpus;
+}
+
+static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
+{
+   return perf_evsel__cpus(evsel)-nr;
+}
+
 static void update_stats(struct stats *stats, u64 val)
 {
double delta;
@@ -299,7 +309,7 @@ retry:
evsel-attr.exclude_guest = evsel-attr.exclude_host = 0;
 
if (perf_target__has_cpu(target)) {
-   ret = perf_evsel__open_per_cpu(evsel, evsel_list-cpus,
+   ret = perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel),
   group, group_fd);
if (ret)
goto check_ret;
@@ -382,7 +392,7 @@ static int read_counter_aggr(struct perf_evsel *counter)
u64 *count = counter-counts-aggr.values;
int i;
 
-   if (__perf_evsel__read(counter, evsel_list-cpus-nr,
+   if (__perf_evsel__read(counter, perf_evsel__nr_cpus(counter),
   evsel_list-threads-nr, scale)  0)
return -1;
 
@@ -411,7 +421,7 @@ static int read_counter(struct perf_evsel *counter)
 

[NEW DRIVER V2 0/7] DA9058 PMIC - please comment on this new driver

2012-08-06 Thread Anthony Olech
This is submission attempt number 2 to have this driver included in
the linux kernel source tree. This is the driver for the Dialog DA9058.

The DA9058 is a low power Power Management Integrated Circuit with extra
functionality. It is a Multi Function Device controlled only from an I2C
bus whose components can raise an interrupt request on a single IRQ line.

The driver for the DA9058 consists of a core (i2c) device driver that
instantiates the individual component device drivers for:

hwmon - 5 ADC channels
gpio - 2 available pins
onkey - 1 device
regulator - 4 BUCKS, 19 LDO and 3 fixed
rtc - low power clock
power - battery information

All the above six component device drivers depend on the 'core' driver,
which is number one in the patch series.

This driver has been tested on a Samsung SMDK6410 connected to a Dialog
DA9058 Evaluation Board via one GPIO and a 3-wire I2C connection.

All the components can be builtin to the kernel or compiled as modules.
As far as I can tell, all the latest APIs both for the core driver and
all the component drivers have been adhered to, but if I have missed
something please let me know.

Many thanks,
Anthony Olech, Dialog Semiconductor Ltd.

Anthony Olech (Drivers Team) (7):
  DA9058 MFD core and ADC driver
  DA9058 ONKEY driver
  DA9058 POWER driver
  DA9058 RTC driver
  DA9058 GPIO driver
  DA9058 HWMON driver
  DA9058 REGULATOR driver

 drivers/gpio/Kconfig |   12 +
 drivers/gpio/Makefile|1 +
 drivers/gpio/gpio-da9058.c   |  376 ++
 drivers/hwmon/Kconfig|   10 +
 drivers/hwmon/Makefile   |1 +
 drivers/hwmon/da9058-hwmon.c |  390 +++
 drivers/input/misc/Kconfig   |   10 +
 drivers/input/misc/Makefile  |1 +
 drivers/input/misc/da9058_onkey.c|  171 
 drivers/mfd/Kconfig  |   18 ++
 drivers/mfd/Makefile |3 +
 drivers/mfd/da9058-core.c|  268 +++
 drivers/mfd/da9058-i2c.c |  102 +++
 drivers/mfd/da9058-irq.c |   57 
 drivers/power/Kconfig|   10 +
 drivers/power/Makefile   |1 +
 drivers/power/da9058_power.c |  404 
 drivers/regulator/Kconfig|   11 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9058-regulator.c |  239 +
 drivers/rtc/Kconfig  |   10 +
 drivers/rtc/Makefile |1 +
 drivers/rtc/rtc-da9058.c |  446 +++
 include/linux/mfd/da9058/bat.h   |   33 +++
 include/linux/mfd/da9058/codec.h |   21 ++
 include/linux/mfd/da9058/core.h  |   58 
 include/linux/mfd/da9058/gpio.h  |   19 ++
 include/linux/mfd/da9058/hwmon.h |   20 ++
 include/linux/mfd/da9058/irq.h   |   50 
 include/linux/mfd/da9058/onkey.h |   17 ++
 include/linux/mfd/da9058/pdata.h |   28 ++
 include/linux/mfd/da9058/registers.h |  480 ++
 include/linux/mfd/da9058/regulator.h |   33 +++
 include/linux/mfd/da9058/rtc.h   |   17 ++
 34 files changed, 3319 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/gpio-da9058.c
 create mode 100644 drivers/hwmon/da9058-hwmon.c
 create mode 100644 drivers/input/misc/da9058_onkey.c
 create mode 100644 drivers/mfd/da9058-core.c
 create mode 100644 drivers/mfd/da9058-i2c.c
 create mode 100644 drivers/mfd/da9058-irq.c
 create mode 100644 drivers/power/da9058_power.c
 create mode 100644 drivers/regulator/da9058-regulator.c
 create mode 100644 drivers/rtc/rtc-da9058.c
 create mode 100644 include/linux/mfd/da9058/bat.h
 create mode 100644 include/linux/mfd/da9058/codec.h
 create mode 100644 include/linux/mfd/da9058/core.h
 create mode 100644 include/linux/mfd/da9058/gpio.h
 create mode 100644 include/linux/mfd/da9058/hwmon.h
 create mode 100644 include/linux/mfd/da9058/irq.h
 create mode 100644 include/linux/mfd/da9058/onkey.h
 create mode 100644 include/linux/mfd/da9058/pdata.h
 create mode 100644 include/linux/mfd/da9058/registers.h
 create mode 100644 include/linux/mfd/da9058/regulator.h
 create mode 100644 include/linux/mfd/da9058/rtc.h

-- 
end-of-patch for NEW DRIVER V2

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


[NEW DRIVER V2 7/7] DA9058 REGULATOR driver

2012-08-06 Thread Anthony Olech
This is the REGULATOR component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the core DA9058 MFD driver.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/regulator/Kconfig|   11 ++
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9058-regulator.c |  239 ++
 3 files changed, 251 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/da9058-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index c86b886..1fc04f9 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -64,6 +64,17 @@ config REGULATOR_USERSPACE_CONSUMER
 
   If unsure, say no.
 
+config REGULATOR_DA9058
+   tristate Support regulators on Dialog Semiconductor DA9058 PMIC
+   depends on MFD_DA9058
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9058 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9058-regulator.
+
+
 config REGULATOR_GPIO
tristate GPIO regulator support
depends on GENERIC_GPIO
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 977fd46..f4d0bff 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
+obj-$(CONFIG_REGULATOR_DA9058) += da9058-regulator.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
 obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
diff --git a/drivers/regulator/da9058-regulator.c 
b/drivers/regulator/da9058-regulator.c
new file mode 100644
index 000..33c3a22
--- /dev/null
+++ b/drivers/regulator/da9058-regulator.c
@@ -0,0 +1,239 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/module.h
+#include linux/err.h
+#include linux/slab.h
+#include linux/regulator/machine.h
+#include linux/regulator/driver.h
+#include linux/regmap.h
+#include linux/mfd/core.h
+
+#include linux/mfd/da9058/version.h
+#include linux/mfd/da9058/registers.h
+#include linux/mfd/da9058/core.h
+#include linux/mfd/da9058/regulator.h
+
+struct da9058_regulator {
+   struct da9058 *da9058;
+   int ramp_register;
+   int ramp_enable_mask;
+   int fixed_voltage;
+   struct platform_device *pdev;
+   struct regulator_dev *reg_dev;
+   struct regulator_desc desc;
+   struct regulator_init_data init;
+};
+
+static int da9058_buck_ramp_voltage(struct regulator_dev *rdev,
+   unsigned int old_selector,
+   unsigned int new_selector)
+{
+   struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
+   struct da9058 *da9058 = regulator-da9058;
+   int ret;
+
+   if (regulator-ramp_register == 0)
+   return -EINVAL;
+
+   if (regulator-ramp_enable_mask == 0)
+   return -EINVAL;
+
+   ret = da9058_set_bits(da9058, regulator-ramp_register,
+   regulator-ramp_enable_mask);
+
+   if (ret)
+   return ret;
+
+   return 2200; /* micro Seconds needed to ramp to new voltage*/
+}
+
+static int da9058_get_fixed_regulator_voltage(struct regulator_dev *rdev)
+{
+   struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
+
+   if (regulator_is_enabled_regmap(rdev))
+   return regulator-fixed_voltage;
+   else
+   return 0;
+}
+
+static struct regulator_ops da9058_buck_regulator_ops = {
+   .map_voltage = regulator_map_voltage_linear,
+   .list_voltage = regulator_list_voltage_linear,
+   .set_voltage_time_sel = da9058_buck_ramp_voltage,
+   .get_voltage_sel = regulator_get_voltage_sel_regmap,
+   .set_voltage_sel = regulator_set_voltage_sel_regmap,
+   .enable = regulator_enable_regmap,
+   .disable = regulator_disable_regmap,
+   .is_enabled = regulator_is_enabled_regmap,
+};
+
+static struct regulator_ops da9058_ldo_regulator_ops = {
+   .map_voltage = regulator_map_voltage_linear,
+   .list_voltage = regulator_list_voltage_linear,
+   .get_voltage_sel = regulator_get_voltage_sel_regmap,
+   .set_voltage_sel = regulator_set_voltage_sel_regmap,
+   .enable = regulator_enable_regmap,
+   .disable = regulator_disable_regmap,
+   

[PATCH] x86/dt: use linear irq domain for ioapic(s).

2012-08-06 Thread Sebastian Andrzej Siewior
The former conversion to irq_domain_add_legacy() did not fully work
since we miss the irq decs for NR_IRQS_LEGACY+.
Ideally we could use irq_domain_add_simple() or the no-map variant (and
program the virq - line mapping directly into ioapic) but this would
require a different irq lookup in do_IRQ() and won't work with ACPI
without changes. So this is probably easiest for everyone.

Signed-off-by: Sebastian Andrzej Siewior sebast...@breakpoint.cc
---
 arch/x86/kernel/devicetree.c |   52 ++
 1 file changed, 43 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 3ae2ced..df225fc 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -342,6 +342,48 @@ const struct irq_domain_ops ioapic_irq_domain_ops = {
.xlate = ioapic_xlate,
 };
 
+static void dt_add_ioapic_domain(unsigned int ioapic_num,
+   struct device_node *np)
+{
+   struct irq_domain *id;
+   struct mp_ioapic_gsi *gsi_cfg;
+   int ret;
+   int num;
+
+   gsi_cfg = mp_ioapic_gsi_routing(ioapic_num);
+   num = gsi_cfg-gsi_end - gsi_cfg-gsi_base + 1;
+
+   id = irq_domain_add_linear(np, num,
+   ioapic_irq_domain_ops,
+   (void *)ioapic_num);
+   BUG_ON(!id);
+   if (gsi_cfg-gsi_base == 0) {
+   /*
+* The first NR_IRQS_LEGACY irq descs are allocated in
+* early_irq_init() and need just a mapping. The
+* remaining irqs need both. All of them are preallocated
+* and assigned so we can keep the 1:1 mapping which the ioapic
+* is having.
+*/
+   ret = irq_domain_associate_many(id, 0, 0, NR_IRQS_LEGACY);
+   if (ret)
+   pr_err(Error mapping legacy irqs: %d\n, ret);
+
+   if (num  NR_IRQS_LEGACY) {
+   ret = irq_create_strict_mappings(id, NR_IRQS_LEGACY,
+   NR_IRQS_LEGACY, num - NR_IRQS_LEGACY);
+   if (ret)
+   pr_err(Error creating mapping for the 
+   remaining  irqs: %d\n, ret);
+   }
+   irq_set_default_host(id);
+   } else {
+   ret = irq_create_strict_mappings(id, gsi_cfg-gsi_base, 0, num);
+   if (ret)
+   pr_err(Error creating irq mapping: %d\n, ret);
+   }
+}
+
 static void __init ioapic_add_ofnode(struct device_node *np)
 {
struct resource r;
@@ -356,15 +398,7 @@ static void __init ioapic_add_ofnode(struct device_node 
*np)
 
for (i = 0; i  nr_ioapics; i++) {
if (r.start == mpc_ioapic_addr(i)) {
-   struct irq_domain *id;
-   struct mp_ioapic_gsi *gsi_cfg;
-
-   gsi_cfg = mp_ioapic_gsi_routing(i);
-
-   id = irq_domain_add_legacy(np, 32, gsi_cfg-gsi_base, 0,
-  ioapic_irq_domain_ops,
-  (void*)i);
-   BUG_ON(!id);
+   dt_add_ioapic_domain(i, np);
return;
}
}
-- 
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/


Re: Update VIP to videobuf2 and control framework

2012-08-06 Thread Hans Verkuil
On Mon August 6 2012 09:38:10 Federico Vaga wrote:
 
   I applied all your suggestions, and some extra simplification;
   [...]
 
   ---
   - flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the
   framework handle the VIDIOC_G/S_PRIORITY ioctls. This requires that
   you use struct v4l2_fh.
  
^^
  
  Are you using struct v4l2_fh? The version you posted didn't. You need
  this anyway to implement control events.
 
 Yes I'm using it now, it is part of the extra simplification that I did.

In that case I need to see your latest version of the source code to see
why it doesn't work.

Regards,

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


[PULL] Last-minute module patches

2012-08-06 Thread Rusty Russell
The following changes since commit 42a579a0f960081cd16fc945036e4780c3ad3202:

  Merge branches 'timers-urgent-for-linus' and 'perf-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2012-08-05 22:28:49 
+0300)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus.git 
tags/module-for-linus

for you to fetch changes up to 26ab1397b6e51ffc72fb00ad012598eb2e135726:

  Make most arch asm/module.h files use asm-generic/module.h (2012-08-06 
16:57:33 +0930)


Left to (past?) the last minute for two reasons:
1) There were minor conflicts in linux-next; I like a clean merge, so wanted
   the other stuff (aka real work) in first.
2) I was hoping we could discard the lve license check, but Greg tells me
   it's still not 100% resolved, so I've left it in.

Thanks!
Rusty.


David Howells (1):
  Make most arch asm/module.h files use asm-generic/module.h

Matthew Garrett (1):
  module: taint kernel when lve module is loaded

 arch/Kconfig   |   19 +
 arch/alpha/Kconfig |2 ++
 arch/alpha/include/asm/module.h|   10 ++---
 arch/arm/Kconfig   |2 ++
 arch/arm/include/asm/module.h  |8 ++--
 arch/avr32/Kconfig |2 ++
 arch/avr32/include/asm/module.h|6 ++
 arch/blackfin/Kconfig  |2 ++
 arch/blackfin/include/asm/module.h |4 +---
 arch/c6x/Kconfig   |1 +
 arch/c6x/include/asm/module.h  |   12 +--
 arch/cris/Kconfig  |1 +
 arch/cris/include/asm/Kbuild   |2 ++
 arch/cris/include/asm/module.h |9 
 arch/frv/include/asm/module.h  |8 +---
 arch/h8300/Kconfig |1 +
 arch/h8300/include/asm/Kbuild  |2 ++
 arch/h8300/include/asm/module.h|   11 --
 arch/hexagon/Kconfig   |1 +
 arch/ia64/Kconfig  |2 ++
 arch/ia64/include/asm/module.h |6 ++
 arch/m32r/Kconfig  |1 +
 arch/m32r/include/asm/Kbuild   |2 ++
 arch/m32r/include/asm/module.h |   10 -
 arch/m32r/kernel/module.c  |   15 --
 arch/m68k/Kconfig  |3 +++
 arch/m68k/include/asm/module.h |6 ++
 arch/microblaze/Kconfig|1 +
 arch/mips/Kconfig  |3 +++
 arch/mips/include/asm/module.h |   10 +++--
 arch/mips/kernel/module.c  |2 ++
 arch/mn10300/Kconfig   |1 +
 arch/mn10300/include/asm/module.h  |7 +--
 arch/openrisc/Kconfig  |1 +
 arch/parisc/Kconfig|2 ++
 arch/parisc/include/asm/module.h   |   16 +++
 arch/powerpc/Kconfig   |2 ++
 arch/powerpc/include/asm/module.h  |7 +--
 arch/s390/Kconfig  |2 ++
 arch/s390/include/asm/module.h |   18 +++-
 arch/score/Kconfig |2 ++
 arch/score/include/asm/module.h|6 +-
 arch/score/kernel/module.c |   10 -
 arch/sh/Kconfig|2 ++
 arch/sh/include/asm/module.h   |   14 +++--
 arch/sparc/Kconfig |1 +
 arch/sparc/include/asm/Kbuild  |1 +
 arch/sparc/include/asm/module.h|   24 --
 arch/tile/Kconfig  |1 +
 arch/unicore32/Kconfig |1 +
 arch/x86/Kconfig   |2 ++
 arch/xtensa/Kconfig|1 +
 arch/xtensa/include/asm/module.h   |9 +---
 include/asm-generic/module.h   |   40 +---
 include/linux/moduleloader.h   |   36 
 kernel/module.c|   24 --
 56 files changed, 171 insertions(+), 223 deletions(-)
 delete mode 100644 arch/cris/include/asm/module.h
 delete mode 100644 arch/h8300/include/asm/module.h
 delete mode 100644 arch/m32r/include/asm/module.h
 delete mode 100644 arch/sparc/include/asm/module.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/


[NEW DRIVER V2 6/7] DA9058 HWMON driver

2012-08-06 Thread Anthony Olech
This is the HWMON component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the core DA9058 MFD driver.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/hwmon/Kconfig|   10 +
 drivers/hwmon/Makefile   |1 +
 drivers/hwmon/da9058-hwmon.c |  390 ++
 3 files changed, 401 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hwmon/da9058-hwmon.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 6f1d167..0986f43 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -294,6 +294,16 @@ config SENSORS_ATXP1
  This driver can also be built as a module.  If so, the module
  will be called atxp1.
 
+config SENSORS_DA9058
+   tristate Dialog Semiconductor DA9058 ADC
+   depends on I2C
+   help
+ If you say yes here you get support for ADC on the Dialog
+ Semiconductor DA9058 PMIC.
+
+ This driver can also be built as a module.  If so, the module
+ will be called da9058-hwmon.
+
 config SENSORS_DS620
tristate Dallas Semiconductor DS620
depends on I2C
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index e1eeac1..be99572 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o
 obj-$(CONFIG_SENSORS_ATXP1)+= atxp1.o
 obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o
 obj-$(CONFIG_SENSORS_DME1737)  += dme1737.o
+obj-$(CONFIG_SENSORS_DA9058)   += da9058-hwmon.o
 obj-$(CONFIG_SENSORS_DS620)+= ds620.o
 obj-$(CONFIG_SENSORS_DS1621)   += ds1621.o
 obj-$(CONFIG_SENSORS_EMC1403)  += emc1403.o
diff --git a/drivers/hwmon/da9058-hwmon.c b/drivers/hwmon/da9058-hwmon.c
new file mode 100644
index 000..a1475e4
--- /dev/null
+++ b/drivers/hwmon/da9058-hwmon.c
@@ -0,0 +1,390 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/delay.h
+#include linux/err.h
+#include linux/hwmon.h
+#include linux/hwmon-sysfs.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/mfd/core.h
+
+#include linux/mfd/da9058/version.h
+#include linux/mfd/da9058/registers.h
+#include linux/mfd/da9058/core.h
+#include linux/mfd/da9058/hwmon.h
+
+struct da9058_hwmon {
+   struct da9058   *da9058;
+   struct platform_device *pdev;
+
+   struct device   *class_device;
+   struct mutexhwmon_lock;
+   int use_automatic_adc;
+   int temp_adc_resistance;
+   int vf_adc_resistance;
+};
+
+static ssize_t da9058_read_tbat(struct device *dev,
+   struct device_attribute *devattr, char *buf)
+{
+   struct da9058_hwmon *hwmon = dev_get_drvdata(dev);
+   int voltage; /* x000 .. xFFF = 0 .. 2500 mV */
+   int ret;
+
+   ret = da9058_adc_read(hwmon-da9058, DA9058_ADCMAN_MUXSEL_TEMP,
+   hwmon-use_automatic_adc, voltage);
+   if (ret)
+   return ret;
+
+   return sprintf(buf, %d\n, voltage * 2500 / 0xFFF);
+}
+
+static ssize_t da9058_read_vbat(struct device *dev,
+   struct device_attribute *devattr, char *buf)
+{
+   struct da9058_hwmon *hwmon = dev_get_drvdata(dev);
+   int voltage; /* x000 .. xFFF = 2500 .. 4500 mV */
+   int ret;
+
+   ret = da9058_adc_read(hwmon-da9058, DA9058_ADCMAN_MUXSEL_VBAT,
+   hwmon-use_automatic_adc, voltage);
+   if (ret)
+   return ret;
+
+   return sprintf(buf, %d\n, 2500 + voltage * 2000 / 0xFFF);
+}
+
+static ssize_t da9058_read_misc_channel(struct device *dev,
+   struct device_attribute *devattr,
+   char *buf)
+{
+   struct da9058_hwmon *hwmon = dev_get_drvdata(dev);
+   int channel = to_sensor_dev_attr(devattr)-index;
+   int voltage; /* xFFF .. x800 = 0 .. 2500 mV */
+   int ret;
+
+   ret = da9058_adc_read(hwmon-da9058, channel,
+   hwmon-use_automatic_adc, voltage);
+   if (ret)
+   return ret;
+
+   return sprintf(buf, %d\n, (0xFFF - voltage) * 2500 / 0x7FF);
+}
+
+/*
+ *  The algorithm for converting the value is
+ *  Degrees celsius = 1.708 * (TJUNC_RES - T_OFFSET) - 108.8
+ *  T_OFFSET is a trim value used to improve accuracy of the result
+ */
+static ssize_t da9058_read_tjunc(struct device *dev,
+   struct device_attribute *devattr, char 

[NEW DRIVER V2 5/7] DA9058 GPIO driver

2012-08-06 Thread Anthony Olech
This is the GPIO component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the core DA9058 MFD driver.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/gpio/Kconfig   |   12 ++
 drivers/gpio/Makefile  |1 +
 drivers/gpio/gpio-da9058.c |  376 
 3 files changed, 389 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/gpio-da9058.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 542f0c0..63b574a 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -86,6 +86,18 @@ config GPIO_DA9052
help
  Say yes here to enable the GPIO driver for the DA9052 chip.
 
+config GPIO_DA9058
+   tristate Dialog DA9058 GPIO
+   depends on MFD_DA9058
+   help
+ Say yes here to enable the GPIO driver for the DA9058 chip.
+
+ The Dialog DA9058 PMIC chip has 2 GPIO pins that can be
+ be controller by this driver.
+
+ If driver is built as a module it will be called da9058-gpio.
+
+
 config GPIO_MAX730X
tristate
 
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 0f55662..209224a 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_GPIO_ADP5520)+= gpio-adp5520.o
 obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o
 obj-$(CONFIG_GPIO_BT8XX)   += gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CS5535)  += gpio-cs5535.o
+obj-$(CONFIG_GPIO_DA9058)  += gpio-da9058.o
 obj-$(CONFIG_GPIO_DA9052)  += gpio-da9052.o
 obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o
 obj-$(CONFIG_GPIO_EM)  += gpio-em.o
diff --git a/drivers/gpio/gpio-da9058.c b/drivers/gpio/gpio-da9058.c
new file mode 100644
index 000..ed464ff
--- /dev/null
+++ b/drivers/gpio/gpio-da9058.c
@@ -0,0 +1,376 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/module.h
+#include linux/fs.h
+#include linux/uaccess.h
+#include linux/platform_device.h
+#include linux/gpio.h
+#include linux/syscalls.h
+#include linux/seq_file.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/mfd/core.h
+#include linux/regmap.h
+
+#include linux/mfd/da9058/version.h
+#include linux/mfd/da9058/registers.h
+#include linux/mfd/da9058/core.h
+#include linux/mfd/da9058/gpio.h
+#include linux/mfd/da9058/irq.h
+#include linux/mfd/da9058/pdata.h
+
+/*
+ *  There are only 2 available GPIO pins on the DA9058 PMIC
+ *
+ *  Thus this driver distinguishes them by the offset number
+ *  being zero or non-zero for simplicity
+ */
+
+struct da9058_gpio {
+   struct da9058 *da9058;
+   struct platform_device *pdev;
+   struct gpio_chip gp;
+   struct mutex lock;
+   u8 inp_config;
+   u8 out_config;
+};
+
+static struct da9058_gpio *gpio_chip_to_da9058_gpio(struct gpio_chip *chip)
+{
+   return container_of(chip, struct da9058_gpio, gp);
+}
+
+static int da9058_gpio_get(struct gpio_chip *gc, unsigned offset)
+{
+   struct da9058_gpio *gpio = gpio_chip_to_da9058_gpio(gc);
+   struct da9058 *da9058 = gpio-da9058;
+   unsigned int gpio_level;
+   int ret;
+
+   if (offset  1)
+   return -EINVAL;
+
+   mutex_lock(gpio-lock);
+   ret = da9058_reg_read(da9058, DA9058_STATUSC_REG, gpio_level);
+   mutex_unlock(gpio-lock);
+   if (ret  0)
+   return ret;
+
+   if (offset) {
+   if (gpio_level  DA9058_STATUSC_GPI1)
+   return 1;
+   else
+   return 0;
+   } else {
+   if (gpio_level  DA9058_STATUSC_GPI0)
+   return 1;
+   else
+   return 0;
+   }
+}
+
+static void da9058_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
+{
+   struct da9058_gpio *gpio = gpio_chip_to_da9058_gpio(gc);
+   struct da9058 *da9058 = gpio-da9058;
+   unsigned int gpio_cntrl;
+   int ret;
+
+   if (offset  1) {
+   dev_err(da9058-dev,
+   Failed to set GPIO%d output=%d because illegal GPIO\n,
+   offset, value);
+   return;
+   }
+
+   mutex_lock(gpio-lock);
+
+   ret = da9058_reg_read(da9058, DA9058_GPIO0001_REG, gpio_cntrl);
+   if (ret)
+   goto exit;
+
+   if (offset) {
+   u8 value_bits = value ? 0x80 : 0x00;
+
+   gpio-out_config = ~0x80;
+   gpio-out_config |= value_bits;
+
+   if (!(gpio_cntrl  0x20))
+   goto exit;
+
+   gpio_cntrl = ~0xF0;

[NEW DRIVER V2 4/7] DA9058 RTC driver

2012-08-06 Thread Anthony Olech
This is the RTC component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the core DA9058 MFD driver.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/rtc/Kconfig  |   10 +
 drivers/rtc/Makefile |1 +
 drivers/rtc/rtc-da9058.c |  446 ++
 3 files changed, 457 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-da9058.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 08cbdb9..21f5630 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -135,6 +135,16 @@ config RTC_DRV_88PM860X
  This driver can also be built as a module. If so, the module
  will be called rtc-88pm860x.
 
+config RTC_DRV_DA9058
+   tristate Dialog DA9058
+   depends on MFD_DA9058
+   help
+ If you say yes here you will get support for the
+ RTC of the Dialog DA9058 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-da9058.
+
 config RTC_DRV_DS1307
tristate Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025
help
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 2973921..b772f05 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_CMOS)+= rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_COH901331)+= rtc-coh901331.o
 obj-$(CONFIG_RTC_DRV_DA9052)   += rtc-da9052.o
 obj-$(CONFIG_RTC_DRV_DAVINCI)  += rtc-davinci.o
+obj-$(CONFIG_RTC_DRV_DA9058)   += rtc-da9058.o
 obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o
 obj-$(CONFIG_RTC_DRV_DS1216)   += rtc-ds1216.o
diff --git a/drivers/rtc/rtc-da9058.c b/drivers/rtc/rtc-da9058.c
new file mode 100644
index 000..c981900
--- /dev/null
+++ b/drivers/rtc/rtc-da9058.c
@@ -0,0 +1,446 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/rtc.h
+#include linux/slab.h
+#include linux/irq.h
+#include linux/regmap.h
+#include linux/mfd/core.h
+
+#include linux/mfd/da9058/version.h
+#include linux/mfd/da9058/registers.h
+#include linux/mfd/da9058/core.h
+#include linux/mfd/da9058/irq.h
+#include linux/mfd/da9058/rtc.h
+
+/*
+ * Limit values
+ */
+#define DA9058_RTC_SECONDS_LIMIT   59
+#define DA9058_RTC_MINUTES_LIMIT   59
+#define DA9058_RTC_HOURS_LIMIT 23
+#define DA9058_RTC_DAYS_LIMIT  31
+#define DA9058_RTC_MONTHS_LIMIT12
+#define DA9058_RTC_YEARS_LIMIT 63
+
+struct da9058_rtc {
+   struct da9058 *da9058;
+   struct platform_device *pdev;
+   struct rtc_device *rtc_dev;
+   int alarm_irq;
+   int tick_irq;
+   int alarm_enabled;  /* used over suspend/resume */
+};
+
+static int da9058_rtc_check_param(struct rtc_time *rtc_tm)
+{
+   if ((rtc_tm-tm_sec  DA9058_RTC_SECONDS_LIMIT) || (rtc_tm-tm_sec  0))
+   return -EIO;
+
+   if ((rtc_tm-tm_min  DA9058_RTC_MINUTES_LIMIT) || (rtc_tm-tm_min  0))
+   return -EIO;
+
+   if ((rtc_tm-tm_hour  DA9058_RTC_HOURS_LIMIT) || (rtc_tm-tm_hour  0))
+   return -EIO;
+
+   if (rtc_tm-tm_mday == 0)
+   return -EIO;
+
+   if ((rtc_tm-tm_mon  DA9058_RTC_MONTHS_LIMIT) || (rtc_tm-tm_mon = 0))
+   return -EIO;
+
+   if ((rtc_tm-tm_year  DA9058_RTC_YEARS_LIMIT) || (rtc_tm-tm_year  0))
+   return -EIO;
+
+   return 0;
+}
+
+static int da9058_rtc_readtime(struct device *dev, struct rtc_time *tm)
+{
+   struct da9058_rtc *rtc = dev_get_drvdata(dev);
+   struct da9058 *da9058 = rtc-da9058;
+   unsigned int rtc_time[6];
+   int ret;
+
+   ret = da9058_bulk_read(da9058, DA9058_COUNTS_REG, rtc_time, 6);
+   if (ret)
+   return ret;
+
+   tm-tm_sec = rtc_time[0]  DA9058_RTC_SECS_MASK;
+
+   tm-tm_min = rtc_time[1]  DA9058_RTC_MINS_MASK;
+
+   tm-tm_hour = rtc_time[2]  DA9058_RTC_HRS_MASK;
+
+   tm-tm_mday = (rtc_time[3]  DA9058_RTC_DAY_MASK);
+
+   tm-tm_mon = (rtc_time[4]  DA9058_RTC_MTH_MASK);
+
+   tm-tm_year = (rtc_time[5]  DA9058_RTC_YRS_MASK);
+
+   ret = da9058_rtc_check_param(tm);
+
+   if (ret)
+   return ret;
+
+   tm-tm_yday = rtc_year_days(tm-tm_mday, tm-tm_mon,
+   tm-tm_year);
+   tm-tm_year += 100;
+   tm-tm_mon -= 1;
+
+   return 0;
+}
+
+static int da9058_rtc_settime(struct device *dev, struct rtc_time *tm)
+{
+   

[NEW DRIVER V2 3/7] DA9058 POWER driver

2012-08-06 Thread Anthony Olech
This is the POWER component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the core DA9058 MFD driver.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/power/Kconfig|   10 +
 drivers/power/Makefile   |1 +
 drivers/power/da9058_power.c |  404 ++
 3 files changed, 415 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/da9058_power.c

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index e3a3b49..e0b4d34 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -8,6 +8,16 @@ menuconfig POWER_SUPPLY
 
 if POWER_SUPPLY
 
+config BATTERY_DA9058
+   tristate DA9058 battery charger support
+   depends on MFD_DA9058
+   help
+ Say Y here to enable support for the battery charger in the Dialog
+ DA9058 PMIC.
+
+ To compile this driver as a module, choose M here: the module
+ will be called da9058_power.
+
 config POWER_SUPPLY_DEBUG
bool Power supply debug
help
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index b6b2434..8a4a049 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_WM831X_POWER)+= wm831x_power.o
 obj-$(CONFIG_WM8350_POWER) += wm8350_power.o
 obj-$(CONFIG_TEST_POWER)   += test_power.o
 
+obj-$(CONFIG_BATTERY_DA9058)   += da9058_power.o
 obj-$(CONFIG_BATTERY_DS2760)   += ds2760_battery.o
 obj-$(CONFIG_BATTERY_DS2780)   += ds2780_battery.o
 obj-$(CONFIG_BATTERY_DS2781)   += ds2781_battery.o
diff --git a/drivers/power/da9058_power.c b/drivers/power/da9058_power.c
new file mode 100644
index 000..08907c1
--- /dev/null
+++ b/drivers/power/da9058_power.c
@@ -0,0 +1,404 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/module.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/power_supply.h
+#include linux/slab.h
+#include linux/regmap.h
+#include linux/mfd/core.h
+
+#include linux/mfd/da9058/version.h
+#include linux/mfd/da9058/registers.h
+#include linux/mfd/da9058/core.h
+#include linux/mfd/da9058/irq.h
+#include linux/mfd/da9058/bat.h
+
+struct da9058_power {
+   struct da9058 *da9058;
+   struct platform_device *pdev;
+   struct power_supply battery;
+
+   int battery_type;
+   u8 illegalbattery;
+   u8 health;
+   u16 bat_temp;
+   u16 bat_voltage;
+   u8 cal_capacity;
+   int bat_low_limit;
+   int use_automatic_adc;
+   int temperature_points;
+   struct da9058_temp_capacity (*temp_tables)[];
+};
+
+static inline u8 bat_temp_reg_to_C(u16 value)
+{
+   return 55 - value;
+}
+
+static inline u8 bat_mV_to_reg(u16 value)
+{
+   return ((value - 4100) / 100)  4;
+}
+
+static inline u8 bat_drop_mV_to_reg(u16 value)
+{
+   return ((value - 100) / 100)  6;
+}
+
+static inline u16 bat_reg_to_mV(u8 value)
+{
+   return (value * 100) + 4100;
+}
+
+static inline u16 bat_drop_reg_to_mV(u8 value)
+{
+   return (value * 100) + 100;
+}
+
+static inline u8 vbat_thr_mV_to_reg(u16 value)
+{
+   return (value - 2500) / 8;
+}
+
+static inline u16 vddout_reg_to_mV(u8 value)
+{
+   return (value * 8) + 2500;
+}
+
+static inline u16 volt_bit_reg_to_mV(u16 value)
+{
+   return (value * 2) + 2500;
+}
+
+static inline u16 volt_reg_to_mV(u16 value)
+{
+   return (((value * 610 * 100) / 115) + 240) / 1000;
+}
+
+static inline u16 volt_10bit_reg_to_mV(u16 value)
+{
+   return (((value * 1510 * 100) / 75) + 240) / 1000;
+}
+
+static inline u8 bit8_mV_to_reg(u16 value)
+{
+   return (value * 2500) / 256000;
+}
+
+/*
+ *  to convert the ADC reading to milliVolts:
+ *  LL00 for automatic conversion
+ *   for manual conversion
+ *  2.5Volts == 0x -- 2500
+ *  4.5Volts == 0x0FFF -- 4500
+ */
+static int da9058_read_battery_millivolts(struct da9058_power *power)
+{
+   struct da9058 *da9058 = power-da9058;
+   int vbat;
+   int ret;
+
+   ret = da9058_adc_read(da9058, DA9058_ADCMAN_MUXSEL_VBAT,
+   power-use_automatic_adc, vbat);
+
+   if (ret)
+   return ret;
+
+   power-bat_voltage = (2500*0x0FFF + vbat*2000)/0x0FFF;
+
+   return 0;
+}
+
+static int da9058_battery_temperature_tbat(struct da9058_power *power)
+{
+   struct da9058 *da9058 = power-da9058;
+   int temp;
+   int ret;
+
+   ret = da9058_adc_read(da9058, DA9058_ADCMAN_MUXSEL_TEMP,
+   power-use_automatic_adc, temp);
+
+   if (ret)
+   

[NEW DRIVER V2 2/7] DA9058 ONKEY driver

2012-08-06 Thread Anthony Olech
This is the ONKEY component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the core DA9058 MFD driver.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/input/misc/Kconfig|   10 ++
 drivers/input/misc/Makefile   |1 +
 drivers/input/misc/da9058_onkey.c |  171 +
 3 files changed, 182 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/da9058_onkey.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7faf4a7..697b703 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -73,6 +73,16 @@ config INPUT_BMA150
  To compile this driver as a module, choose M here: the
  module will be called bma150.
 
+config INPUT_DA9058_ONKEY
+   tristate DA9058 ONKEY support
+   depends on MFD_DA9058
+   help
+ Support the ONKEY of DA9058 PMICs as an input device
+ reporting power button status.
+
+ To compile this driver as a module, choose M here: the module
+ will be called da9058_onkey.
+
 config INPUT_PCSPKR
tristate PC Speaker support
depends on PCSPKR_PLATFORM
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index f55cdf4..048d50e 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_INPUT_PCF8574)   += pcf8574_keypad.o
 obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
 obj-$(CONFIG_INPUT_PM8XXX_VIBRATOR)+= pm8xxx-vibrator.o
 obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)+= pmic8xxx-pwrkey.o
+obj-$(CONFIG_INPUT_DA9058_ONKEY)   += da9058_onkey.o
 obj-$(CONFIG_INPUT_POWERMATE)  += powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)   += rb532_button.o
diff --git a/drivers/input/misc/da9058_onkey.c 
b/drivers/input/misc/da9058_onkey.c
new file mode 100644
index 000..fb29c14
--- /dev/null
+++ b/drivers/input/misc/da9058_onkey.c
@@ -0,0 +1,171 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/module.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/mfd/core.h
+#include linux/regmap.h
+
+#include linux/mfd/da9058/version.h
+#include linux/mfd/da9058/registers.h
+#include linux/mfd/da9058/core.h
+#include linux/mfd/da9058/irq.h
+#include linux/mfd/da9058/onkey.h
+
+struct da9058_onkey {
+   struct da9058 *da9058;
+   struct platform_device *pdev;
+   struct input_dev *input;
+   struct delayed_work work;
+   int irq;
+};
+
+static void da9058_onkey_poll(struct work_struct *work)
+{
+   struct da9058_onkey *onkey = container_of(work, struct da9058_onkey,
+   work.work);
+   struct da9058 *da9058 = onkey-da9058;
+   int poll, ret;
+   unsigned int sa;
+
+   ret = da9058_reg_read(da9058, DA9058_STATUSA_REG, sa);
+   if (ret) {
+   dev_dbg(onkey-pdev-dev, Failed to read ONKEY: %d\n, ret);
+   poll = 1;
+   } else if (sa  DA9058_STATUSA_NONKEY) {
+   poll = 0;
+   } else {
+   poll = 1;
+   }
+
+   input_report_key(onkey-input, KEY_POWER, poll);
+   input_sync(onkey-input);
+
+   if (poll)
+   schedule_delayed_work(onkey-work, msecs_to_jiffies(50));
+}
+
+static irqreturn_t da9058_onkey_event_handler(int irq, void *data)
+{
+   struct da9058_onkey *onkey = data;
+
+   schedule_delayed_work(onkey-work, 0);
+
+   return IRQ_HANDLED;
+}
+
+static int __devinit da9058_onkey_probe(struct platform_device *pdev)
+{
+   struct da9058 *da9058 = dev_get_drvdata(pdev-dev.parent);
+   const struct mfd_cell *cell = mfd_get_cell(pdev);
+   struct da9058_onkey_pdata *onkey_pdata;
+   struct da9058_onkey *onkey;
+   int ret;
+
+   if (cell == NULL) {
+   ret = -ENODEV;
+   goto exit;
+   }
+
+   onkey_pdata = cell-platform_data;
+
+   if (onkey_pdata == NULL) {
+   ret = -EINVAL;
+   goto exit;
+   }
+
+   dev_info(pdev-dev, Starting ONKEY\n);
+
+   onkey = devm_kzalloc(pdev-dev, sizeof(struct da9058_onkey),
+   GFP_KERNEL);
+   if (!onkey) {
+   ret = -ENOMEM;
+   goto exit;
+   }
+
+   platform_set_drvdata(pdev, onkey);
+
+   onkey-da9058 = da9058;
+   onkey-pdev = pdev;
+
+   INIT_DELAYED_WORK(onkey-work, da9058_onkey_poll);
+
+   

[NEW DRIVER V2 1/7] DA9058 MFD core and ADC driver

2012-08-06 Thread Anthony Olech
This is the MFD core driver for the Dialog DA9058 PMIC.
This driver, via MFD CELLs, causes all the component drivers to be
loaded, if it is a module, and initialized via their probe methods.
It also provides access to the ADC functions on the PMIC.
All the other component drivers depend on this one.

This core driver supplies all of the MFD cell platform data used
by the other DA9058 component drivers for initialization. This core
driver recieves the actual platform data from the machine driver,
but that config data has the nature of overides from sensible default
values. Thus it is not essential to provide any real platform data at
all.

Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
Signed-off-by: David Dajun Chen david.c...@diasemi.com
---
 drivers/mfd/Kconfig  |   18 ++
 drivers/mfd/Makefile |3 +
 drivers/mfd/da9058-core.c|  268 +++
 drivers/mfd/da9058-i2c.c |  102 +++
 drivers/mfd/da9058-irq.c |   57 
 include/linux/mfd/da9058/bat.h   |   33 +++
 include/linux/mfd/da9058/codec.h |   21 ++
 include/linux/mfd/da9058/core.h  |   58 
 include/linux/mfd/da9058/gpio.h  |   19 ++
 include/linux/mfd/da9058/hwmon.h |   20 ++
 include/linux/mfd/da9058/irq.h   |   50 
 include/linux/mfd/da9058/onkey.h |   17 ++
 include/linux/mfd/da9058/pdata.h |   28 ++
 include/linux/mfd/da9058/registers.h |  480 ++
 include/linux/mfd/da9058/regulator.h |   33 +++
 include/linux/mfd/da9058/rtc.h   |   17 ++
 16 files changed, 1224 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/da9058-core.c
 create mode 100644 drivers/mfd/da9058-i2c.c
 create mode 100644 drivers/mfd/da9058-irq.c
 create mode 100644 include/linux/mfd/da9058/bat.h
 create mode 100644 include/linux/mfd/da9058/codec.h
 create mode 100644 include/linux/mfd/da9058/core.h
 create mode 100644 include/linux/mfd/da9058/gpio.h
 create mode 100644 include/linux/mfd/da9058/hwmon.h
 create mode 100644 include/linux/mfd/da9058/irq.h
 create mode 100644 include/linux/mfd/da9058/onkey.h
 create mode 100644 include/linux/mfd/da9058/pdata.h
 create mode 100644 include/linux/mfd/da9058/registers.h
 create mode 100644 include/linux/mfd/da9058/regulator.h
 create mode 100644 include/linux/mfd/da9058/rtc.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 92144ed..3fa1a75 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -3,6 +3,7 @@
 #
 
 if HAS_IOMEM
+
 menu Multifunction device drivers
 
 config MFD_CORE
@@ -20,6 +21,23 @@ config MFD_88PM860X
  select individual components like voltage regulators, RTC and
  battery-charger under the corresponding menus.
 
+config MFD_DA9058
+   tristate Dialog Semiconductor DA9058 PMIC Support
+   depends on I2C
+   select REGMAP_I2C
+   select REGMAP_IRQ
+   select MFD_CORE
+   help
+ Say yes here for support of Dialog Semiconductor DA9058. This is
+ a Power Management IC. This driver provides common support for
+ accessing the device as well as the I2C interface to the chip itself.
+ Additional drivers must be enabled in order to use the functionality
+ of the device.
+
+ This driver can be built as a module, but since the functionality
+ of the device includes regulators it probably should be built into
+ the kernel. If built as a module it will be called da9058
+
 config MFD_SM501
tristate Support for Silicon Motion SM501
 ---help---
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..1853278 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -86,6 +86,9 @@ obj-$(CONFIG_MFD_MAX8998) += max8998.o max8998-irq.o
 
 pcf50633-objs  := pcf50633-core.o pcf50633-irq.o
 obj-$(CONFIG_MFD_PCF50633) += pcf50633.o
+da9058-objs= da9058-irq.o da9058-i2c.o da9058-core.o 
da9058-info.o
+obj-$(CONFIG_MFD_DA9058)   += da9058.o
+
 obj-$(CONFIG_PCF50633_ADC) += pcf50633-adc.o
 obj-$(CONFIG_PCF50633_GPIO)+= pcf50633-gpio.o
 obj-$(CONFIG_ABX500_CORE)  += abx500-core.o
diff --git a/drivers/mfd/da9058-core.c b/drivers/mfd/da9058-core.c
new file mode 100644
index 000..efe01f6
--- /dev/null
+++ b/drivers/mfd/da9058-core.c
@@ -0,0 +1,268 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include linux/version.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/init.h
+#include linux/bug.h
+#include linux/device.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/irq.h
+#include linux/ioport.h
+#include 

Re: how to implement platform specific per process parameter?

2012-08-06 Thread Anshuman Khandual
 There are 4 options:

 1. [not a kernel interface] use ptrace to execute the register changing
 command inside the specified pid. The next context switch saves the new
 value in the thread_struct. Dirty hack.
 
 2. Add a new syscall which would receive pid + register value and do the
 job. A bit too much.
 
 3. Add some hook in /proc filesystem but so far there were no platform
 specific bits, right?
 
 4. Implement a static node /sys/devices/system/cpu/dscr_control.
 write() would parse the input stream, call scanf(%d %x, pid, dscr)
 and do the job.
 


/sys/ interface would be appropriate I believe. But in this way we can take a 
new
(pid, dscr) and update thread_struct. But there should be a way to enlist all
(pid, dscr) values which are explicitly set by the user and different than that
of /sys/devices/system/cpu/dscr_default. So that we can know which process is 
holding
to what value of DSCR at any point of time.

 

 What is the correct approach? Thanks.
 
 


Regards
Anshuman

--
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] char/tpm: Use struct dev_pm_ops for power management.

2012-08-06 Thread Peter Huewe
Make the tpm_i2c_infineon driver define its PM callbacks trough a
struct dev_pm_ops by using SIMPLE_DEV_PM_OPS instead of coding it
explicitly.

This simplifies the code and allows the driver to use tpm_pm_suspend()
and tpm_pm_resume() as its PM callbacks directly, without defining its
own PM callback routines.

Signed-off-by: Peter Huewe peter.hu...@infineon.com
---
Thanks Kent and Rafael - much better this way ;)

 drivers/char/tpm/tpm_i2c_infineon.c |   30 +-
 1 files changed, 1 insertions(+), 29 deletions(-)

diff --git a/drivers/char/tpm/tpm_i2c_infineon.c 
b/drivers/char/tpm/tpm_i2c_infineon.c
index 1794a09..65761b6 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -655,35 +655,7 @@ static const struct i2c_device_id tpm_tis_i2c_table[] = {
 };
 
 MODULE_DEVICE_TABLE(i2c, tpm_tis_i2c_table);
-
-#ifdef CONFIG_PM
-/* NOTE:
- * Suspend does currently not work Nvidias Tegra2 Platform
- * but works fine on Beagleboard (arm omap).
- *
- * This function will block System Suspend if TPM is not initialized,
- * however the TPM is usually initialized by BIOS/u-boot or by sending
- * a TPM_Startup command.
- */
-static int tpm_tis_i2c_suspend(struct device *dev)
-{
-   return tpm_pm_suspend(dev, dev-power.power_state);
-}
-
-static int tpm_tis_i2c_resume(struct device *dev)
-{
-   return tpm_pm_resume(dev);
-}
-
-static const struct dev_pm_ops tpm_tis_i2c_ops = {
-   .suspend = tpm_tis_i2c_suspend,
-   .resume = tpm_tis_i2c_resume,
-};
-#else
-#define tpm_tis_i2c_suspend NULL
-#define tpm_tis_i2c_resume NULL
-#define tpm_tis_i2c_ops NULL
-#endif
+static SIMPLE_DEV_PM_OPS(tpm_tis_i2c_ops, tpm_pm_suspend, tpm_pm_resume);
 
 static int __devinit tpm_tis_i2c_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
-- 
1.7.6.msysgit.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 fixed for !SMP] x86: don't ever patch back to UP if we unplug cpus

2012-08-06 Thread Rusty Russell
We still patch SMP instructions to UP variants if we boot with a
single CPU, but not at any other time.  In particular, not if we
unplug CPUs to return to a single cpu.

Paul McKenney points out:

 mean offline overhead is 6251/48=130.2 milliseconds.

 If I remove the alternatives_smp_switch() from the offline
 path [...] the mean offline overhead is 550/42=13.1 milliseconds

Basically, we're never going to get those 120ms back, and the code is
pretty messy.

We get rid of:
1) The smp-alt-once boot option.  It's actually smp-alt-boot, the
   documentation is wrong.  It's now the default.
2) The skip_smp_alternatives flag used by suspend.
3) arch_disable_nonboot_cpus_begin() and arch_disable_nonboot_cpus_end()
   which were only used to set this one flag.

Signed-off-by: Rusty Russell ru...@rustcorp.com.au
---
 Documentation/kernel-parameters.txt |3 
 arch/x86/include/asm/alternative.h  |4 -
 arch/x86/kernel/alternative.c   |  109 
 arch/x86/kernel/smpboot.c   |   20 --
 kernel/cpu.c|   11 ---
 5 files changed, 31 insertions(+), 116 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2638,9 +2638,6 @@ bytes respectively. Such letter suffixes
smart2= [HW]
Format: io1[,io2[,...,io8]]
 
-   smp-alt-once[X86-32,SMP] On a hotplug CPU system, only
-   attempt to substitute SMP alternatives once at boot.
-
smsc-ircc2.nopnp[HW] Don't use PNP to discover SMC devices
smsc-ircc2.ircc_cfg=[HW] Device configuration I/O port
smsc-ircc2.ircc_sir=[HW] SIR base I/O port
diff --git a/arch/x86/include/asm/alternative.h 
b/arch/x86/include/asm/alternative.h
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -60,7 +60,7 @@ extern void alternatives_smp_module_add(
void *locks, void *locks_end,
void *text, void *text_end);
 extern void alternatives_smp_module_del(struct module *mod);
-extern void alternatives_smp_switch(int smp);
+extern void alternatives_enable_smp(void);
 extern int alternatives_text_reserved(void *start, void *end);
 extern bool skip_smp_alternatives;
 #else
@@ -68,7 +68,7 @@ static inline void alternatives_smp_modu
   void *locks, void *locks_end,
   void *text, void *text_end) {}
 static inline void alternatives_smp_module_del(struct module *mod) {}
-static inline void alternatives_smp_switch(int smp) {}
+static inline void alternatives_enable_smp(void) {}
 static inline int alternatives_text_reserved(void *start, void *end)
 {
return 0;
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -23,19 +23,6 @@
 
 #define MAX_PATCH_LEN (255-1)
 
-#ifdef CONFIG_HOTPLUG_CPU
-static int smp_alt_once;
-
-static int __init bootonly(char *str)
-{
-   smp_alt_once = 1;
-   return 1;
-}
-__setup(smp-alt-boot, bootonly);
-#else
-#define smp_alt_once 1
-#endif
-
 static int __initdata_or_module debug_alternative;
 
 static int __init debug_alt(char *str)
@@ -326,9 +313,6 @@ static void alternatives_smp_unlock(cons
 {
const s32 *poff;
 
-   if (noreplace_smp)
-   return;
-
mutex_lock(text_mutex);
for (poff = start; poff  end; poff++) {
u8 *ptr = (u8 *)poff + *poff;
@@ -359,7 +343,7 @@ struct smp_alt_module {
 };
 static LIST_HEAD(smp_alt_modules);
 static DEFINE_MUTEX(smp_alt);
-static int smp_mode = 1;   /* protected by smp_alt */
+static bool uniproc_patched = false;   /* protected by smp_alt */
 
 void __init_or_module alternatives_smp_module_add(struct module *mod,
  char *name,
@@ -368,19 +352,18 @@ void __init_or_module alternatives_smp_m
 {
struct smp_alt_module *smp;
 
-   if (noreplace_smp)
-   return;
+   mutex_lock(smp_alt);
+   if (!uniproc_patched)
+   goto unlock;
 
-   if (smp_alt_once) {
-   if (boot_cpu_has(X86_FEATURE_UP))
-   alternatives_smp_unlock(locks, locks_end,
-   text, text_end);
-   return;
-   }
+   if (num_possible_cpus() == 1)
+   /* Don't bother remembering, we'll never have to undo it. */
+   goto smp_unlock;
 
smp = kzalloc(sizeof(*smp), GFP_KERNEL);
if (NULL == smp)
-   return; /* we'll run the (safe but slow) SMP code then ... */
+   /* we'll run the (safe but slow) SMP code then ... */
+   goto unlock;
 
smp-mod= mod;

Re: [PATCH] hugetlb: update hugetlbpage.txt

2012-08-06 Thread Dave Young
On 08/06/2012 03:26 PM, Zhouping Liu wrote:

 commit f0f57b2b1(mm: move hugepage test examples to 
 tools/testing/selftests/vm)
 moved map_hugetlb.c, hugepage-shm.c and hugepage-mmap.c tests into
 tools/testing/selftests/vm/ directory, but it didn't update hugetlbpage.txt
 
 Signed-off-by: Zhouping Liu sanweiday...@gmail.com


Ack

 ---
  Documentation/vm/hugetlbpage.txt | 10 --
  1 file changed, 8 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/vm/hugetlbpage.txt 
 b/Documentation/vm/hugetlbpage.txt
 index f8551b3..4ac359b 100644
 --- a/Documentation/vm/hugetlbpage.txt
 +++ b/Documentation/vm/hugetlbpage.txt
 @@ -299,11 +299,17 @@ map_hugetlb.c.
  ***
  
  /*
 - * hugepage-shm:  see Documentation/vm/hugepage-shm.c
 + * map_hugetlb: see tools/testing/selftests/vm/map_hugetlb.c
   */
  
  ***
  
  /*
 - * hugepage-mmap:  see Documentation/vm/hugepage-mmap.c
 + * hugepage-shm:  see tools/testing/selftests/vm/hugepage-shm.c
 + */
 +
 +***
 +
 +/*
 + * hugepage-mmap:  see tools/testing/selftests/vm/hugepage-mmap.c
   */



-- 
Thanks
Dave
--
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: [RFC PATCH 1/3] dma-fence: dma-buf synchronization (v5)

2012-08-06 Thread Maarten Lankhorst
Hey Sumit,

Op 06-08-12 08:41, Sumit Semwal schreef:
 Hi Maarten,
 On 27 July 2012 19:09, Maarten Lankhorst
 maarten.lankho...@canonical.com wrote:
 A dma-fence can be attached to a buffer which is being filled or consumed
 by hw, to allow userspace to pass the buffer without waiting to another
 device.  For example, userspace can call page_flip ioctl to display the
 next frame of graphics after kicking the GPU but while the GPU is still
 rendering.  The display device sharing the buffer with the GPU would
 attach a callback to get notified when the GPU's rendering-complete IRQ
 fires, to update the scan-out address of the display, without having to
 wake up userspace.
 Since Rob is the original author of this (and I the next?), may I
 request you to re-submit with his From: bit?

 Rob / Daniel: comments on this series will help me line it up in
 for-next, and maybe even for 3.7-rc.

It's a bit of a collaboration actually, I have done a few minor tweaks
on top of the version I sent out for RFC, making it v6. I will send it
somewhere this week, but I wanted to be sure that it worked with the
Xorg server first, instead of just my minor testsuit:

v6: [ Maarten Lankhorst ] I removed dma_fence_cancel_callback and some comments
about checking if fence fired or not. This is broken by design.
waitqueue_active during destruction is now fatal, since the signaller
should be holding a reference in enable_signalling until it signalled
the fence. Pass the original dma_fence_cb along, and call __remove_wait
in the dma_fence_callback handler, so that no cleanup needs to be
performed.

I have created a few minor testcases that seemed to have shown that the i915 
parts
work. It also shows that a race-free remove wait early is hard, and should
preferably not be done unless a fatal hardware error occurred.

Tree is currently at:
http://cgit.freedesktop.org/~mlankhorst/linux/log/

And is based on drm-next + some fixes from nouveau. The reason why is that I
need some patches from drm-intel-next for flushing list removal.

It will likely also interact with the deferred fput if it's still in the -next
tree, however it should hopefully not be a problem, since the best thing about
it is that deferred fput will fix a few deadlocks. :)

I want to test it some more first to see that no deadlocks occur, but the
final version for the nouveau series will have to be rewritten, since the
maintainer dropped a massive 'rewrite everything' patch series. However,
when I finish testing later this week against real Xorg instead of my,
smaller testcases, I'll be more confident that nothing major will break
and that the base and intel parts are ready for -next.
 
Cheers,
~Maarten

--
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/3 v2] [media] sta2x11_vip: convert to videobuf2 and control framework

2012-08-06 Thread Federico Vaga
Signed-off-by: Federico Vaga federico.v...@gmail.com
Acked-by: Giancarlo Asnaghi giancarlo.asna...@st.com

---
 drivers/media/video/sta2x11_vip.c | 1239 +
 1 file modificato, 414 inserzioni(+), 825 rimozioni(-)

diff --git a/drivers/media/video/sta2x11_vip.c 
b/drivers/media/video/sta2x11_vip.c
index 4c10205..ffd9f0a 100644
--- a/drivers/media/video/sta2x11_vip.c
+++ b/drivers/media/video/sta2x11_vip.c
@@ -1,6 +1,7 @@
 /*
  * This is the driver for the STA2x11 Video Input Port.
  *
+ * Copyright (C) 2012   ST Microelectronics
  * Copyright (C) 2010   WindRiver Systems, Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -19,36 +20,30 @@
  * The full GNU General Public License is included in this distribution in
  * the file called COPYING.
  *
- * Author: Andreas Kies andreas.k...@windriver.com
- * Vlad Lungu vlad.lu...@windriver.com
- *
  */
 
 #include linux/types.h
 #include linux/kernel.h
 #include linux/module.h
 #include linux/init.h
-#include linux/vmalloc.h
-
 #include linux/videodev2.h
-
 #include linux/kmod.h
-
 #include linux/pci.h
 #include linux/interrupt.h
-#include linux/mutex.h
 #include linux/io.h
 #include linux/gpio.h
 #include linux/i2c.h
 #include linux/delay.h
 #include media/v4l2-common.h
 #include media/v4l2-device.h
+#include media/v4l2-ctrls.h
 #include media/v4l2-ioctl.h
-#include media/videobuf-dma-contig.h
+#include media/v4l2-fh.h
+#include media/v4l2-event.h
+#include media/videobuf2-dma-streaming.h
 
 #include sta2x11_vip.h
 
-#define DRV_NAME sta2x11_vip
 #define DRV_VERSION 1.3
 
 #ifndef PCI_DEVICE_ID_STMICRO_VIP
@@ -63,8 +58,8 @@
 #define DVP_TFS0x08
 #define DVP_BFO0x0C
 #define DVP_BFS0x10
-#define DVP_VTP 0x14
-#define DVP_VBP 0x18
+#define DVP_VTP0x14
+#define DVP_VBP0x18
 #define DVP_VMP0x1C
 #define DVP_ITM0x98
 #define DVP_ITS0x9C
@@ -84,44 +79,24 @@
 
 #define DVP_HLFLN_SD   0x0001
 
-#define REG_WRITE(vip, reg, value) iowrite32((value), (vip-iomem)+(reg))
-#define REG_READ(vip, reg) ioread32((vip-iomem)+(reg))
-
 #define SAVE_COUNT 8
 #define AUX_COUNT 3
 #define IRQ_COUNT 1
 
-/**
- * struct sta2x11_vip - All internal data for one instance of device
- * @v4l2_dev: device registered in v4l layer
- * @video_dev: properties of our device
- * @pdev: PCI device
- * @adapter: contains I2C adapter information
- * @register_save_area: All relevant register are saved here during suspend
- * @decoder: contains information about video DAC
- * @format: pixel format, fixed UYVY
- * @std: video standard (e.g. PAL/NTSC)
- * @input: input line for video signal ( 0 or 1 )
- * @users: Number of open of device ( max. 1 )
- * @disabled: Device is in power down state
- * @mutex: ensures exclusive opening of device
- * @slock: for excluse acces of registers
- * @vb_vidq: queue maintained by videobuf layer
- * @capture: linked list of capture buffer
- * @active: struct videobuf_buffer currently beingg filled
- * @started: device is ready to capture frame
- * @closing: device will be shut down
- * @tcount: Number of top frames
- * @bcount: Number of bottom frames
- * @overflow: Number of FIFO overflows
- * @mem_spare: small buffer of unused frame
- * @dma_spare: dma addres of mem_spare
- * @iomem: hardware base address
- * @config: I2C and gpio config from platform
- *
- * All non-local data is accessed via this structure.
- */
 
+struct vip_buffer {
+   struct vb2_buffer   vb;
+   struct list_headlist;
+   dma_addr_t  dma;
+};
+static inline struct vip_buffer *to_vip_buffer(struct vb2_buffer *vb2)
+{
+   return container_of(vb2, struct vip_buffer, vb);
+}
+
+struct sta2x11_vip_fh {
+   struct v4l2_fh fh;
+};
 struct sta2x11_vip {
struct v4l2_device v4l2_dev;
struct video_device *video_dev;
@@ -129,21 +104,27 @@ struct sta2x11_vip {
struct i2c_adapter *adapter;
unsigned int register_save_area[IRQ_COUNT + SAVE_COUNT + AUX_COUNT];
struct v4l2_subdev *decoder;
-   struct v4l2_pix_format format;
-   v4l2_std_id std;
-   unsigned int input;
-   int users;
-   int disabled;
-   struct mutex mutex; /* exclusive access during open */
-   spinlock_t slock;   /* spin lock for hardware and queue access */
-   struct videobuf_queue vb_vidq;
-   struct list_head capture;
-   struct videobuf_buffer *active;
-   int started, closing, tcount, bcount;
+   struct v4l2_ctrl_handler ctrl_hdl;
+
+
+   struct v4l2_pix_format format;  /* pixel format, fixed UYVY */
+   v4l2_std_id std;/* Video standard (PAL/NTSC)*/
+   unsigned int input; /* Input line (0 or 1) */
+   int disabled; /* 1 disabled 0 enabled */
+   spinlock_t slock; /* spin lock for hardware */
+
+   struct vb2_alloc_ctx *alloc_ctx;
+ 

Re: Service http://patchwork.kernel.org/ not available!

2012-08-06 Thread Sedat Dilek
On Sun, May 6, 2012 at 1:32 AM, John 'Warthog9' Hawley
warth...@kernel.org wrote:
 That service is still being brought back up, we don't have an eta but it
 is expected to be restored.


Hi,

it would be wonderful to get a feedback when services are available again.

I just saw today a reference on linux-next ML to [1] otherwise I would
not have known.

- Sedat -

[1] https://patchwork.kernel.org/patch/1220151/

 - John 'Warthog9' Hawley
 Chief Kernel.org Administrator

 On 05/05/2012 02:40 PM, Sedat Dilek wrote:
 Hi,

 why is patchwork.k.o no more available?

 This is/was a nice service to see what's going on in the Linux-kernel
 world (patch and patchsets) and was a nice reference (patchwork-id-no)
 service for single patches.
 For me this is/was a very useful help.
 Hope for others, too.

 Is this known?
 If yes, do you have any plans to revive the service?

 Regards,
 - Sedat -
--
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: Update VIP to videobuf2 and control framework

2012-08-06 Thread Federico Vaga
 In that case I need to see your latest version of the source code to
 see why it doesn't work.

I send it as patch v2 of the previous one

-- 
Federico Vaga
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/8] acpi-cpufreq: Move modern AMD cpufreq support to acpi-cpufreq

2012-08-06 Thread Borislav Petkov
On Sun, Aug 05, 2012 at 04:39:14PM -0700, H. Peter Anvin wrote:
 On 08/05/2012 02:20 PM, Rafael J. Wysocki wrote:
 On Thursday, July 26, 2012, Andre Przywara wrote:
 The programming model for cpufreq on current AMD CPUs is almost identical
 to the one used on Intel and VIA hardware. This patchset merges support
 into acpi-cpufreq and removes it from powernow-k8.
 
 This patchset is heavily based on Matthew Garrett's V4 from last July.
 The boosting part has been mostly reworked and documentation for it
 has been added. Also there was a need for (yet another) BIOS quirk
 on AMD desktop boards.
 
 Signed-off-by: Andre Przywara andre.przyw...@amd.com
 
 Peter, any objection to this series?
 
 No.  It might be good for Borislav  Co to look it over, though, if
 they haven't already.

Yep, already done so.

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
--
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: KVM segfaults with 3.5 while installing ubuntu 12.04

2012-08-06 Thread Avi Kivity
On 08/05/2012 10:00 PM, Stefan Priebe wrote:
 Am 05.08.2012 17:52, schrieb Stefan Priebe:
 Am 05.08.2012 12:29, schrieb Avi Kivity:
 On 08/05/2012 01:08 PM, Stefan Priebe wrote:
 Am 01.08.2012 11:53, schrieb Avi Kivity:
 On 08/01/2012 12:42 PM, Stefan Priebe - Profihost AG wrote:
 Am 01.08.2012 11:33, schrieb Avi Kivity:
 So here are 3 backtraces from booting the rescue system:
 http://pastebin.com/raw.php?i=xCy2pEcP

 To me they all look the same.

 They are.  What version of qemu are you using?

 latest stable-1.1 branch (1.1.1) - which works fine with latest RHEL6
 kernel.

 This could be due to a kernel bug, or due to a different code path
 taken
 in qemu because of differing features exposed to kvm.

 Please try qemu-kvm.git master and report.
 
 OK got it running it's just awfully slow and i was too impatient. It
 crashes at the part as 1.1.1 stable.
 

Slow?  what does 'info kvm' say?

I got master running and it wasn't particularly slow.  I'll try 1.1.1 too.


-- 
error compiling committee.c: too many arguments to function
--
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: [NEW DRIVER V2 1/7] DA9058 MFD core and ADC driver

2012-08-06 Thread Venu Byravarasu
 -Original Message-
 From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
 ow...@vger.kernel.org] On Behalf Of Anthony Olech
 Sent: Monday, August 06, 2012 2:14 AM
 To: Samuel Ortiz
 Cc: Mark Brown; Arnd Bergmann; Mauro Carvalho Chehab; Steven Toth;
 Michael Krufky; LKML; David Dajun Chen
 Subject: [NEW DRIVER V2 1/7] DA9058 MFD core and ADC driver
 
 This is the MFD core driver for the Dialog DA9058 PMIC.
 This driver, via MFD CELLs, causes all the component drivers to be
 loaded, if it is a module, and initialized via their probe methods.
 It also provides access to the ADC functions on the PMIC.
 All the other component drivers depend on this one.
 
 +#endif /* __DA9058_PDATA_H */
 diff --git a/include/linux/mfd/da9058/registers.h
 b/include/linux/mfd/da9058/registers.h
 new file mode 100644
 index 000..0fd6aef
 --- /dev/null
 +++ b/include/linux/mfd/da9058/registers.h
 @@ -0,0 +1,480 @@
 +/*
 + *  Copyright (C) 2012 Dialog Semiconductor Ltd.
 + *
 + *  This program is free software; you can redistribute it and/or modify
 + *  it under the terms of the GNU General Public License as published by
 + *  the Free Software Foundation; either version 2 of the License, or
 + *  (at your option) any later version.
 + *
 + */
 +
 +#ifndef __DA9058_REGISTERS_H
 +#define __DA9058_REGISTERS_H
 +
 +#define DA9058_PAGECON0_REG  0

You can remove _REG after each register name.

 +#define DA9058_STATUSA_REG   1
 +#define DA9058_STATUSB_REG   2
 +#define DA9058_STATUSC_REG   3
 +#define DA9058_STATUSD_REG   4

 

 +/* RTC fields */
 +#define DA9058_RTC_SECS_MASK 0x3F

Usually most of the PMIC RTCs provide RTC time registers in BCD
Format. Plz make sure that is not the case with your device, 
otherwise these masks may not be valid.
 
 +#define DA9058_RTC_MINS_MASK 0x3F
 +#define DA9058_RTC_HRS_MASK  0x1F
 +#define DA9058_RTC_DAY_MASK  0x1F
 +#define DA9058_RTC_MTH_MASK  0x0F
 +#define DA9058_RTC_YRS_MASK  0x3F
 +#define DA9058_RTC_ALMSECS_MASK  0x3F
 +#define DA9058_RTC_ALMMINS_MASK  0x3F
 +#define DA9058_RTC_ALMHRS_MASK   0x1F
 +#define DA9058_RTC_ALMDAY_MASK   0x1F
 +#define DA9058_RTC_ALMMTH_MASK   0x0F
 +#define DA9058_RTC_ALMYRS_MASK   0x3F
 +/* RTC TIMER SECONDS REGISTER */
 +#define DA9058_COUNTS_COUNTSEC   (630)
 +/* RTC TIMER MINUTES REGISTER */
 +#define DA9058_COUNTMI_COUNTMIN  (630)
 +/* RTC TIMER HOUR REGISTER */
 +#define DA9058_COUNTH_COUNTHOUR  (310)
 +/* RTC TIMER DAYS REGISTER */
 +#define DA9058_COUNTD_COUNTDAY   (310)
 +/* RTC TIMER MONTHS REGISTER */
 +#define DA9058_COUNTMO_COUNTMONTH(150)
 +/* RTC TIMER YEARS REGISTER */
 +#define DA9058_COUNTY_MONITOR(16)
 +#define DA9058_COUNTY_COUNTYEAR  (630)
 +/* RTC ALARM SECONDS REGISTER */
 +#define DA9058_ALARMMI_COUNTSEC  (630)
 +/* RTC ALARM MINUTES REGISTER */
 +#define DA9058_ALARMMI_TICKTYPE  (17)
 +#define DA9058_ALARMMI_ALARMMIN  (630)
 +/* RTC ALARM HOURS REGISTER */
 +#define DA9058_ALARMH_ALARMHOUR  (310)
 +/* RTC ALARM DAYS REGISTER */
 +#define DA9058_ALARMD_ALARMDAY   (310)
 +/* RTC ALARM MONTHS REGISTER */
 +#define DA9058_ALARMMO_ALARMMONTH(150)
 +/* RTC ALARM YEARS REGISTER */
 +#define DA9058_ALARMY_TICKON (17)
 +#define DA9058_ALARMY_ALARMON(16)
 +#define DA9058_ALARMY_ALARMYEAR  (630)
 +/* CHIP IDENTIFICATION REGISTER */
 +#define DA9058_CHIPID_MRC(154)
 +#define DA9058_CHIPID_TRC(150)
 +/* CONFIGURATION IDENTIFICATION REGISTER */
 +#define DA9058_CONFIGID_CONFID   (70)
 +/* OTP CONTROL REGISTER */
 +#define DA9058_OTPCONT_GPWRITEDIS(17)
 +#define DA9058_OTPCONT_OTPCONFLOCK   (16)
 +#define DA9058_OTPCONT_OTPGPLOCK (15)
 +#define DA9058_OTPCONT_OTPCONFG  (13)
 +#define DA9058_OTPCONT_OTPGP (12)
 +#define DA9058_OTPCONT_OTPRP (11)
 +#define DA9058_OTPCONT_OTPTRANSFER   (10)
 +/* RTC OSCILLATOR TRIM REGISTER */
 +#define DA9058_OSCTRIM_TRIM32K   (2550)
 +/* GP ID REGISTERs 0 - 9 */
 +#define DA9058_GPID0_GP0 (2550)
 +#define DA9058_GPID1_GP1 (2550)
 +#define DA9058_GPID2_GP2 (2550)
 +#define DA9058_GPID3_GP3 (2550)
 +#define DA9058_GPID4_GP4 (2550)
 +#define DA9058_GPID5_GP5 (2550)
 +#define DA9058_GPID6_GP6 (2550)
 

RE: [NEW DRIVER V2 4/7] DA9058 RTC driver

2012-08-06 Thread Venu Byravarasu

 -Original Message-
 From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
 ow...@vger.kernel.org] On Behalf Of Anthony Olech
 Sent: Monday, August 06, 2012 2:14 AM
 To: Andrew Morton
 Cc: Mark Brown; Paul Gortmaker; Samuel Ortiz; Alessandro Zummo; rtc-
 li...@googlegroups.com; LKML; David Dajun Chen
 Subject: [NEW DRIVER V2 4/7] DA9058 RTC driver
 
 This is the RTC component driver of the Dialog DA9058 PMIC.
 This driver is just one component of the whole DA9058 PMIC driver.
 It depends on the core DA9058 MFD driver.
 
 Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
 Signed-off-by: David Dajun Chen david.c...@diasemi.com
 ---
 +
 +static int da9058_rtc_check_param(struct rtc_time *rtc_tm)
 +{
 + if ((rtc_tm-tm_sec  DA9058_RTC_SECONDS_LIMIT) || (rtc_tm-
 tm_sec  0))
 + return -EIO;
 +
 + if ((rtc_tm-tm_min  DA9058_RTC_MINUTES_LIMIT) || (rtc_tm-
 tm_min  0))
 + return -EIO;
 +
 + if ((rtc_tm-tm_hour  DA9058_RTC_HOURS_LIMIT) || (rtc_tm-
 tm_hour  0))
 + return -EIO;
 +
 + if (rtc_tm-tm_mday == 0)
 + return -EIO;

Why limit check is not done for mday, like it is done for other params? 

 +
 + if ((rtc_tm-tm_mon  DA9058_RTC_MONTHS_LIMIT) || (rtc_tm-
 tm_mon = 0))
 + return -EIO;
 +
 + if ((rtc_tm-tm_year  DA9058_RTC_YEARS_LIMIT) || (rtc_tm-
 tm_year  0))
 + return -EIO;
 +
 + return 0;
 +}
 +
 +static int da9058_rtc_readtime(struct device *dev, struct rtc_time *tm)
 +{
 + struct da9058_rtc *rtc = dev_get_drvdata(dev);
 + struct da9058 *da9058 = rtc-da9058;
 + unsigned int rtc_time[6];
 + int ret;
 +
 + ret = da9058_bulk_read(da9058, DA9058_COUNTS_REG, rtc_time, 6);
 + if (ret)
 + return ret;
 +
 + tm-tm_sec = rtc_time[0]  DA9058_RTC_SECS_MASK;

Usually most of the PMIC RTCs provide RTC time registers in BCD
Format. Plz make sure that is not the case with your device, 
otherwise these masks may not be valid.

 + tm-tm_min = rtc_time[1]  DA9058_RTC_MINS_MASK;
 +
 + tm-tm_hour = rtc_time[2]  DA9058_RTC_HRS_MASK;

 

 +
 + tm-tm_yday = rtc_year_days(tm-tm_mday, tm-tm_mon,
 + tm-tm_year);
 + tm-tm_year += 100;
 + tm-tm_mon -= 1;
 +
 + return 0;
 +}
 +
 +static int da9058_rtc_settime(struct device *dev, struct rtc_time *tm)
 +{
 + struct da9058_rtc *rtc = dev_get_drvdata(dev);
 + struct da9058 *da9058 = rtc-da9058;
 + unsigned int rtc_ctrl, val, rtc_time[6];
 + int ret;
 +
 + tm-tm_year -= 111;

Why 111 is subtracted here and only 100 is added in read_time()
above? If this is what you really wanted to have, it would be
better to add few comments justifying these magic numbers. 

 + tm-tm_mon += 1;


 +static irqreturn_t da9058_rtc_timer_alarm_handler(int irq, void *data)
 +{
 + struct da9058_rtc *rtc = data;
 +
 + da9058_rtc_stop_alarm(rtc);
 + rtc_update_irq(rtc-rtc_dev, 1, RTC_IRQF | RTC_AF);
 +

Whether start RTC is not needed here explicitly?

 + return IRQ_HANDLED;
 +}
 +


 + rtc-tick_irq = DA9058_IRQ_ETICK;
 + ret = request_threaded_irq(da9058_to_virt_irq_num(da9058,
 + rtc-tick_irq),
 + NULL, da9058_rtc_tick_alarm_handler,
 + IRQF_TRIGGER_RISING | IRQF_ONESHOT,
 + DA9058 RTC Tick Alarm, rtc);
 + if (ret) {
 + dev_err(pdev-dev,
 + Failed to get rtc timer alarm IRQ %d: %d\n,
 + DA9058_IRQ_ETICK, ret);
 + goto err4;
 + }
 +
 + ret = 0;
 + goto exit;

You can have return 0 here, instead of above two statements.
 
 +
 +err4:
 + free_irq(da9058_to_virt_irq_num(da9058, rtc-alarm_irq), rtc);
 +err3:
 +err2:
 + rtc_device_unregister(rtc-rtc_dev);
 +err1:
 +err0:
 + platform_set_drvdata(pdev, NULL);
 +exit:
 + return ret;
 +}
 +
 +static int __devexit da9058_rtc_remove(struct platform_device *pdev)
 +{
 + struct da9058_rtc *rtc = platform_get_drvdata(pdev);
 + struct da9058 *da9058 = rtc-da9058;
 +
 + free_irq(da9058_to_virt_irq_num(da9058, rtc-alarm_irq), rtc);
 + free_irq(da9058_to_virt_irq_num(da9058, rtc-tick_irq), rtc);
 +
 + rtc_device_unregister(rtc-rtc_dev);
 +
 + return 0;
 +}
 +
 +static struct platform_driver da9058_rtc_driver = {
 + .probe = da9058_rtc_probe,
 + .remove = __devexit_p(da9058_rtc_remove),
 + .driver = {
 + .name = da9058-rtc,

Some of the rtc drivers had name as rtc-deviceName and others have 
deviceName-rtc.
Can some experts comment which one is correct practice?


 + .owner = THIS_MODULE,
 + },
 +};
 +
 +module_platform_driver(da9058_rtc_driver);
 +
 +MODULE_DESCRIPTION(Dialog DA9058 PMIC Real Time Clock Driver);
 +MODULE_AUTHOR(Anthony Olech anthony.ol...@diasemi.com);
 +MODULE_LICENSE(GPL v2);
 

[PATCH] sched: using dst_rq instead of this_rq during load balance

2012-08-06 Thread Michael Wang
From: Michael Wang wang...@linux.vnet.ibm.com

As we already have dst_rq in lb_env, using or changing this_rq do not
make sense.

This patch will replace this_rq with dst_rq in load_balance, and we
don't need to change this_rq while process LBF_SOME_PINNED any more.

Signed-off-by: Michael Wang wang...@linux.vnet.ibm.com
---
 kernel/sched/fair.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d0cc03b..f03b99c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4275,7 +4275,7 @@ redo:
goto out_balanced;
}
 
-   BUG_ON(busiest == this_rq);
+   BUG_ON(busiest == env.dst_rq);
 
schedstat_add(sd, lb_imbalance[idle], env.imbalance);
 
@@ -4295,7 +4295,7 @@ redo:
 
 more_balance:
local_irq_save(flags);
-   double_rq_lock(this_rq, busiest);
+   double_rq_lock(env.dst_rq, busiest);
if (!env.loop)
update_h_load(env.src_cpu);
 
@@ -4305,7 +4305,7 @@ more_balance:
 */
cur_ld_moved = move_tasks(env);
ld_moved += cur_ld_moved;
-   double_rq_unlock(this_rq, busiest);
+   double_rq_unlock(env.dst_rq, busiest);
local_irq_restore(flags);
 
if (env.flags  LBF_NEED_BREAK) {
@@ -4341,8 +4341,7 @@ more_balance:
if ((env.flags  LBF_SOME_PINNED)  env.imbalance  0 
lb_iterations++  max_lb_iterations) {
 
-   this_rq  = cpu_rq(env.new_dst_cpu);
-   env.dst_rq   = this_rq;
+   env.dst_rq   = cpu_rq(env.new_dst_cpu);
env.dst_cpu  = env.new_dst_cpu;
env.flags   = ~LBF_SOME_PINNED;
env.loop = 0;
-- 
1.7.4.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 1/4] arm/dts: omap5-evm: Add I2C support

2012-08-06 Thread Felipe Balbi
Hi,

On Fri, Aug 03, 2012 at 09:22:19PM +0400, Sergei Shtylyov wrote:
 Hello.
 
 On 08/03/2012 04:38 PM, Sourav Poddar wrote:
 
  Add I2C data node in omap5 device tree file.
 
  Tested on omap5430 sdp.
 
  Cc: Benoit Cousson b-cous...@ti.com
  Cc: Felipe Balbi ba...@ti.com
  Cc: Santosh Shilimkar santosh.shilim...@ti.com
  Acked-by: Felipe Balbi ba...@ti.com
  Signed-off-by: Sourav Poddar sourav.pod...@ti.com
  ---
   arch/arm/boot/dts/omap5.dtsi |   35 +++
   1 files changed, 35 insertions(+), 0 deletions(-)
 
  diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
  index 57e5270..6b68dfe 100644
  --- a/arch/arm/boot/dts/omap5.dtsi
  +++ b/arch/arm/boot/dts/omap5.dtsi
  @@ -145,6 +145,41 @@
  #interrupt-cells = 1;
  };
   
  +   i2c1: i2c@4807 {
  +   compatible = ti,omap4-i2c;
  +   #address-cells = 1;
  +   #size-cells = 0;
  +   ti,hwmods = i2c1;
 
Address postfix in the node name and no reg property?

that's because of the ti,hwmods attribute. OMAP is still not entirely
converted to DT and there's this weird ti,hwmods attribute. OMAP's hwmod
framework will fill up register addresses, irqs, etc when the device is
created. Oh well...

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/3 v2] [media] sta2x11_vip: convert to videobuf2 and control framework

2012-08-06 Thread Hans Verkuil
On Mon August 6 2012 10:17:39 Federico Vaga wrote:
 Signed-off-by: Federico Vaga federico.v...@gmail.com
 Acked-by: Giancarlo Asnaghi giancarlo.asna...@st.com
 
 ---
  drivers/media/video/sta2x11_vip.c | 1239 
 +
  1 file modificato, 414 inserzioni(+), 825 rimozioni(-)
 
 diff --git a/drivers/media/video/sta2x11_vip.c 
 b/drivers/media/video/sta2x11_vip.c
 index 4c10205..ffd9f0a 100644
 --- a/drivers/media/video/sta2x11_vip.c
 +++ b/drivers/media/video/sta2x11_vip.c
 @@ -1186,25 +798,6 @@ static void vip_gpio_release(struct device *dev, int 
 pin, const char *name)
   }
  }
  
 -/**
 - * sta2x11_vip_init_one - init one instance of video device
 - * @pdev: PCI device
 - * @ent: (not used)
 - *
 - * allocate reset pins for DAC.
 - * Reset video DAC, this is done via reset line.
 - * allocate memory for managing device
 - * request interrupt
 - * map IO region
 - * register device
 - * find and initialize video DAC
 - *
 - * return value: 0, no error
 - *
 - * -ENOMEM, no memory
 - *
 - * -ENODEV, device could not be detected or registered
 - */
  static int __devinit sta2x11_vip_init_one(struct pci_dev *pdev,
 const struct pci_device_id *ent)
  {
 @@ -1212,10 +805,17 @@ static int __devinit sta2x11_vip_init_one(struct 
 pci_dev *pdev,
   struct sta2x11_vip *vip;
   struct vip_config *config;
  
 + /* Check if hardware support 26-bit DMA */
 + if (dma_set_mask(pdev-dev, DMA_BIT_MASK(26))) {
 + dev_err(pdev-dev, 26-bit DMA addressing not available\n);
 + return -EINVAL;
 + }
 + /* Enable PCI */
   ret = pci_enable_device(pdev);
   if (ret)
   return ret;
  
 + /* Get VIP platform data */
   config = dev_get_platdata(pdev-dev);
   if (!config) {
   dev_info(pdev-dev, VIP slot disabled\n);
 @@ -1223,6 +823,7 @@ static int __devinit sta2x11_vip_init_one(struct pci_dev 
 *pdev,
   goto disable;
   }
  
 + /* Power configuration */
   ret = vip_gpio_reserve(pdev-dev, config-pwr_pin, 0,
  config-pwr_name);
   if (ret)
 @@ -1237,7 +838,6 @@ static int __devinit sta2x11_vip_init_one(struct pci_dev 
 *pdev,
   goto disable;
   }
   }
 -
   if (config-pwr_pin != -1) {
   /* Datasheet says 5ms between PWR and RST */
   usleep_range(5000, 25000);
 @@ -1251,17 +851,20 @@ static int __devinit sta2x11_vip_init_one(struct 
 pci_dev *pdev,
   }
   usleep_range(5000, 25000);
  
 + /* Allocate a new VIP instance */
   vip = kzalloc(sizeof(struct sta2x11_vip), GFP_KERNEL);
   if (!vip) {
   ret = -ENOMEM;
   goto release_gpios;
   }
 -
   vip-pdev = pdev;
   vip-std = V4L2_STD_PAL;
   vip-format = formats_50[0];
   vip-config = config;
  
 + ret = sta2x11_vip_init_controls(vip);
 + if (ret)
 + goto free_mem;
   if (v4l2_device_register(pdev-dev, vip-v4l2_dev))
   goto free_mem;
  
 @@ -1271,46 +874,52 @@ static int __devinit sta2x11_vip_init_one(struct 
 pci_dev *pdev,
  
   pci_set_master(pdev);
  
 - ret = pci_request_regions(pdev, DRV_NAME);
 + ret = pci_request_regions(pdev, KBUILD_MODNAME);
   if (ret)
   goto unreg;
  
   vip-iomem = pci_iomap(pdev, 0, 0x100);
   if (!vip-iomem) {
 - ret = -ENOMEM; /* FIXME */
 + ret = -ENOMEM;
   goto release;
   }
  
   pci_enable_msi(pdev);
  
 - INIT_LIST_HEAD(vip-capture);
 + /* Initialize buffer */
 + ret = sta2x11_vip_init_buffer(vip);
 + if (ret)
 + goto unmap;
 +
   spin_lock_init(vip-slock);
 - mutex_init(vip-mutex);
 - vip-started = 0;
 - vip-disabled = 0;
  
   ret = request_irq(pdev-irq,
 (irq_handler_t) vip_irq,
 -   IRQF_SHARED, DRV_NAME, vip);
 +   IRQF_SHARED, KBUILD_MODNAME, vip);
   if (ret) {
   dev_err(pdev-dev, request_irq failed\n);
   ret = -ENODEV;
 - goto unmap;
 + goto release_buf;
   }
  
 + /* Alloc, initialize and register video device */
   vip-video_dev = video_device_alloc();
   if (!vip-video_dev) {
   ret = -ENOMEM;
   goto release_irq;
   }
  
 - *(vip-video_dev) = video_dev_template;
 + vip-video_dev = video_dev_template;
 + vip-video_dev-v4l2_dev = vip-v4l2_dev;
 + vip-video_dev-queue = vip-vb_vidq;
 + vip-video_dev-flags |= V4L2_FL_USES_V4L2_FH | V4L2_FL_USE_FH_PRIO;

Been there, done that :-)

V4L2_FL_USE_FH_PRIO is a bit number, not a bit mask. Use set_bit instead:

set_bit(V4L2_FL_USE_FH_PRIO, vip-video_dev-flags);

No need to set V4L2_FL_USES_V4L2_FH, BTW. That will be set automatically as soon
as v4l2_fh_open is called.

Regards,

Hans
--
To 

Re: Gethering power management/policy hw drivers under drivers/power/? (Re: [RFC][PATCH v3 1/3] runtime interpreted power sequences)

2012-08-06 Thread Pihet-XID, Jean
Hi Anton,

Sorry for the late reply. I was away and back now.

On Mon, Jul 30, 2012 at 4:40 AM, Anton Vorontsov cbouatmai...@gmail.com wrote:
 On Mon, Jul 30, 2012 at 10:51:42AM +0900, Alex Courbot wrote:
 [...]
 On the other hand I have just noticed that the apparently unrelated
 Adaptive Voltage Scaling driver just appeared in drivers/power/avs.
 So if Anton and David are ok with this, maybe I could put the power
 sequences code in its own subdirectory within drivers/power.

 Well, currently drivers/power/ is indeed just for power supply class
 subsystem and drivers. But if the trend is to gather power management
 (policy) stuff under one directory, i.e.

 drivers/
   power/
 supplies/- former power supply class and drivers
 regulators/
 idle/
 cpuidle/
 cpufreq/
 devfreq/
 avs/
 ...

 That would probably make sense, we could easily see the big picture.
 But if we're not going to do this long-term, I would suggest to stick
 to just a new directory under drivers (and move drivers/power/avs/ to
 drivers/avs).

 Cc'ing some more people...

 Thanks,

 p.s. Jean, why am I the last person who discovers drivers/power/avs/?
 Would be nice to Cc me on such patches; by moving AVS under
 drivers/power/ you effectively nominated me as its maintainer. :-)
Oops, I am really sorry about that ;-( . I wrongly assumed Rafael and
Greg KH were the contact persons for drivers/power and so I contacted
them before moving the code.

Thanks for letting me know. Are you ok with the changes? Let me know
if some more changes are needed.

Regards,
Jean


 --
 Anton Vorontsov
 Email: cbouatmai...@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: KVM segfaults with 3.5 while installing ubuntu 12.04

2012-08-06 Thread Stefan Priebe - Profihost AG

Am 06.08.2012 10:36, schrieb Avi Kivity:

On 08/05/2012 10:00 PM, Stefan Priebe wrote:

So here are 3 backtraces from booting the rescue system:
http://pastebin.com/raw.php?i=xCy2pEcP

To me they all look the same.


They are.  What version of qemu are you using?


latest stable-1.1 branch (1.1.1) - which works fine with latest RHEL6
kernel.


This could be due to a kernel bug, or due to a different code path
taken
in qemu because of differing features exposed to kvm.

Please try qemu-kvm.git master and report.


OK got it running it's just awfully slow and i was too impatient. It
crashes at the part as 1.1.1 stable.



Slow?  what does 'info kvm' say?


Will recheck right now i'm running 1.1.1 again.


I got master running and it wasn't particularly slow.  I'll try 1.1.1 too.


But still i got the segfault and core dump - this is my main problem? I 
mean qemu-kvm master isn't declared as stable. So i don't care about the 
slowness here.


What can we do about the core dump and crash?

Stefan
--
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 v2] [media] sta2x11_vip: convert to videobuf2 and control framework

2012-08-06 Thread Federico Vaga
  +   vip-video_dev-flags |= V4L2_FL_USES_V4L2_FH |
  V4L2_FL_USE_FH_PRIO;
 Been there, done that :-)
 
 V4L2_FL_USE_FH_PRIO is a bit number, not a bit mask. Use set_bit
 instead:
 
   set_bit(V4L2_FL_USE_FH_PRIO, vip-video_dev-flags);
 
 No need to set V4L2_FL_USES_V4L2_FH, BTW. That will be set
 automatically as soon as v4l2_fh_open is called.

I saw unsigned long flags; in the header but without reading the 
comment :) Thank you. I will test it in these days but I think it's all 
done.

-- 
Federico Vaga
--
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 v6 01/11] drivers: usb: otg: add a new driver for omap usb2 phy

2012-08-06 Thread Felipe Balbi
Hi,

On Fri, Aug 03, 2012 at 08:01:44PM +0530, ABRAHAM, KISHON VIJAY wrote:
  + return 0;
  +}
  +
  +#ifdef CONFIG_PM_RUNTIME
  +
  +static int omap_usb2_runtime_suspend(struct device *dev)
  +{
  + struct platform_device  *pdev = to_platform_device(dev);
  + struct omap_usb *phy = platform_get_drvdata(pdev);
  +
  + clk_disable(phy-wkupclk);
 
  weird. I would expect the wakeup clock to be enabled on suspend and
  disabled on resume. Isn't this causing any unbalanced disable warnings ?
 
 Even I was expecting the wakeup clock to be enabled on suspend but if
 we have this enabled coreaon domain is never
 gated and core does not hit low power state. btw Why do think this is
 unbalanced?

because you never do a clk_enable() on probe(), so on your first
suspend, you will disable the clock without having enabled it before,
no? Unless pm_runtime forces a runtime_resume() when you call
pm_runtime_enable()...

  +static int omap_usb2_runtime_resume(struct device *dev)
  +{
  + u32 ret = 0;
  + struct platform_device  *pdev = to_platform_device(dev);
  + struct omap_usb *phy = platform_get_drvdata(pdev);
  +
  + ret = clk_enable(phy-wkupclk);
  + if (ret  0)
  + dev_err(phy-dev, Failed to enable wkupclk %d\n, ret);
  +
  + return ret;
  +}
  +
  +static const struct dev_pm_ops omap_usb2_pm_ops = {
  + SET_RUNTIME_PM_OPS(omap_usb2_runtime_suspend, 
  omap_usb2_runtime_resume,
  + NULL)
 
  only runtime ? What about static suspend ? We need this to work also
  after a traditional echo mem  /sys/power/state ;-)
 
 The static suspend case is handled by users of this phy using
 set_suspend hooks.

I'm not sure if that's too wise, what if your user enabled USB, but
for whatever reason loaded only the phy driver and not musb or dwc3. It
will fail, right ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v6 00/11] omap: musb: Add device tree support

2012-08-06 Thread Felipe Balbi
Hi,

On Mon, Jul 30, 2012 at 02:39:49PM +0530, Kishon Vijay Abraham I wrote:
 This patch series adds device tree support for MUSB and device
 tree support for all the related modules to get MUSB working in
 OMAP platform.
 
 A new omap-usb2 phy driver has been added (with only dt suppport)
 to perform phy configurations. Previously this configuration was
 performed by twl6030, using pdata function pointers.
 
 With the addition of omap-usb2 to perform phy configurations,
 twl6030 is made as a comparator driver to detect VBUS and ID events
 and notify it to the glue layer.
 
 musb core is _NOT_ yet converted to support device tree support as it
 would need lot of driver re-design because of its enormous use of
 function pointers. That will be in _TO DO_ list.
 
 Changes from v5:
 minor cleanups like checking for return value in get_sync and few changes
 in the documentation has been done.
 
 Changes from v4:
 duplicate getting of 'mode' property is removed in omap-musb glue.
 
 Changes from v3:
 remove the address in the node name of usb_otg_hs since the usb_otg_hs
 node doesn't have a reg property. Thanks Ajay Gupta for finding this.
 
 Changes from v2:
 Fixed Sergei's comment to remove *0x* prefix in usb2phy@0x4a0ad080
 
 Changes from v1:
 * Fixed Rajendra Nayak comments (regulator naming, compatible naming of
 musb and other minor cleanups.)
 * It's agreed to have ocp2scp in drivers/bus and usb2 phy is a child of
 ocp2scp, the documentation is updated accordingly.
 
 Changes from RFC:
 Removed the dependency on [RFC PATCH 00/11] OMAP System Control Module.
 Writing to control module register is now handled in otg driver itself.
 Once the system control module driver get upstreamed, I'll send a patch
 to make use of API's in control module driver to write to control
 module register.
 
 This series was developed on
 git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv
 
 This patch series depends on
 [PATCH 0/2] omap: add ocp2scp as a bus driver
 
 Performed MUSB device mode testing on OMAP4 panda, OMAP4 SDP
 and OMAP3 beagle.
 
 Kishon Vijay Abraham I (11):
   drivers: usb: otg: add a new driver for omap usb2 phy
   arm/dts: omap: Add omap-usb2 dt data
   drivers: usb: otg: make twl6030_usb as a comparator driver to
 omap_usb2
   arm: omap: hwmod: add a new addr space in otg for writing to control
 module
   drivers: usb: twl6030: Add dt support for twl6030 usb
   arm/dts: Add twl6030-usb data
   drivers: usb: twl4030: Add device tree support for twl4030 usb
   arm/dts: Add twl4030-usb data
   drivers: usb: musb: Add device tree support for omap musb glue
   arm/dts: omap: Add usb_otg and glue data
   arm: omap: phy: remove unused functions from omap-phy-internal.c

When you send your next series, can you please split the stuff based on
their dependencies or at least note here what depends on what ? I mean,
I cannot take the DT patches without an Acked-by Grant and Tony, but the
drivers themselves I could take queue them since they're already in good
shape ;-)

Maybe just start the series with patches without dependencies on one
another, and the rest of the series would be ones that need to go
together, or something. That'll help me ;-)

-- 
balbi


signature.asc
Description: Digital signature


Re: i915 regression on 3.6-rc1: lid blanks screen

2012-08-06 Thread Daniel Vetter
On Mon, Aug 6, 2012 at 6:21 AM, Hugh Dickins hu...@google.com wrote:
 On Sun, 5 Aug 2012, Takashi Iwai wrote:
 At Sat, 4 Aug 2012 10:01:13 -0700 (PDT),
 Hugh Dickins wrote:
 
  Sorry to report that with 3.6-rc1, closing and opening the lid on
  this ThinkPad T420s leaves the screen blank, and I have to reboot.
 
  I understand there's also an nVidia graphics device in here,
  but I have that configured out, preferring to use the i915:
 
  00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core 
  Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA 
  controller])
  Subsystem: Lenovo Device 21d3
  Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
  Stepping- SERR- FastB2B- DisINTx+
  Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast TAbort- 
  TAbort- MAbort- SERR- PERR- INTx-
  Latency: 0
  Interrupt: pin A routed to IRQ 41
  Region 0: Memory at f140 (64-bit, non-prefetchable) [size=4M]
  Region 2: Memory at e000 (64-bit, prefetchable) [size=256M]
  Region 4: I/O ports at 5000 [size=64]
  Expansion ROM at unassigned [disabled]
  Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
  Address: fee0100c  Data: 41c2
  Capabilities: [d0] Power Management version 2
  Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA 
  PME(D0-,D1-,D2-,D3hot-,D3cold-)
  Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
  Capabilities: [a4] PCI Advanced Features
  AFCap: TP+ FLR+
  AFCtrl: FLR-
  AFStatus: TP-
  Kernel driver in use: i915
 
  Bisection led to this commit, and reverting indeed gets my screen back:
 
  commit 520c41cf2fa029d1e8b923ac2026f96664f17c4b
  Author: Daniel Vetter daniel.vet...@ffwll.ch
  Date:   Wed Jul 11 16:27:52 2012 +0200
 
  drm/i915/lvds: ditch -prepare special case
 ...

 Hm, it's surprising.

 Could you check whether the counter-part intel_lvds_enable() is
 called?  If the prepare callback affects, it must be from the mode
 setting (drm_crtc_helper_set_mode()).

 Yes, I put a dump_stack() in both, and intel_lvds_enable() gets called
 about 0.28 seconds after the intel_lvds_disable() when I lift the lid;
 but with no video display until I revert that commit.

Can you please boot with drm.debug=0xe added to your kernel cmdline,
reproduce the issue (with the two dump_stack calls added) and then
attach the full dmesg?

Also a few other things to try: What happens if you do a modeset on
the LVDS while it's still working, e.g.

xrandr --outpu LVDS1 --auto --crtc 1

then switch back to crtc 0 with

xrandr --outpu LVDS1 --auto --crtc 0

Would also be interesting to know whether this can resurrect your machine.

Also, how blank is the screen? I.e. is only the backlight off, but you
can (dimly) see some screen contents, or is it completely off?

Thanks, Daniel
-- 
Daniel Vetter
daniel.vet...@ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
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/7] perf hists: Cleanup hist printing code (v2)

2012-08-06 Thread Namhyung Kim
Hi,

This is a cleanup and refactoring patchset for the hist printing code
by adding hist_period_print functions and hpp_context. I believe it
makes the code easy to maintain and to add new functionalities like
upcoming group viewing and callchain accumulation.

Any comments are welcome, thanks.
Namhyung


Namhyung Kim (7):
  perf hists: Separate out hist print functions
  perf hists: Refactor some functions
  perf hists: Introduce hist_period_print functions
  perf hists: Handle field separator properly
  perf hists: Use hpp_functions-width to calculate the column widths
  perf ui/browser: Use hist_period_print functions
  perf gtk/browser: Use hist_period_print functions

 tools/perf/Makefile|   4 +-
 tools/perf/builtin-diff.c  |   1 +
 tools/perf/ui/browsers/hists.c |  96 +++--
 tools/perf/ui/gtk/browser.c| 101 -
 tools/perf/ui/gtk/gtk.h|   2 +
 tools/perf/ui/gtk/setup.c  |   1 +
 tools/perf/ui/hist.c   | 885 +
 tools/perf/ui/setup.c  |   8 +-
 tools/perf/ui/tui/setup.c  |   4 +
 tools/perf/util/hist.c | 710 +
 tools/perf/util/hist.h |  41 +-
 11 files changed, 1115 insertions(+), 738 deletions(-)
 create mode 100644 tools/perf/ui/hist.c

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


[PATCH 2/7] perf hists: Refactor some functions

2012-08-06 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Rename functions for consistency and move callchain print function
into hist_entry__fprintf().

Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/ui/browsers/hists.c |  4 ++--
 tools/perf/ui/hist.c   | 51 +++---
 tools/perf/util/hist.h |  4 ++--
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 413bd62eedb1..a5b5ba6d4e77 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -576,7 +576,7 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
}
 
if (row_offset == 0) {
-   hist_entry__snprintf(entry, s, sizeof(s), browser-hists);
+   hist_entry__sort_snprintf(entry, s, sizeof(s), browser-hists);
percent = (entry-period * 100.0) / 
browser-hists-stats.total_period;
 
ui_browser__set_percent_color(browser-b, percent, 
current_entry);
@@ -920,7 +920,7 @@ static int hist_browser__fprintf_entry(struct hist_browser 
*browser,
if (symbol_conf.use_callchain)
folded_sign = hist_entry__folded(he);
 
-   hist_entry__snprintf(he, s, sizeof(s), browser-hists);
+   hist_entry__sort_snprintf(he, s, sizeof(s), browser-hists);
percent = (he-period * 100.0) / browser-hists-stats.total_period;
 
if (symbol_conf.use_callchain)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index b7936dc6271f..5075e9e5a0fd 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -291,7 +291,7 @@ static size_t hist_entry_callchain__fprintf(struct 
hist_entry *he,
return 0;
 }
 
-static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s,
+static int hist_entry__period_snprintf(struct hist_entry *he, char *s,
 size_t size, struct hists *pair_hists,
 bool show_displacement, long displacement,
 bool color, u64 total_period)
@@ -404,8 +404,8 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, 
char *s,
return ret;
 }
 
-int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size,
-struct hists *hists)
+int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
+ struct hists *hists)
 {
const char *sep = symbol_conf.field_sep;
struct sort_entry *se;
@@ -423,6 +423,22 @@ int hist_entry__snprintf(struct hist_entry *he, char *s, 
size_t size,
return ret;
 }
 
+static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
+   struct hists *hists,
+   u64 total_period, FILE *fp)
+{
+   int left_margin = 0;
+
+   if (sort__first_dimension == SORT_COMM) {
+   struct sort_entry *se = list_first_entry(hist_entry__sort_list,
+typeof(*se), list);
+   left_margin = hists__col_len(hists, se-se_width_idx);
+   left_margin -= thread__comm_len(he-thread);
+   }
+
+   return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
+}
+
 static int hist_entry__fprintf(struct hist_entry *he, size_t size,
   struct hists *hists, struct hists *pair_hists,
   bool show_displacement, long displacement,
@@ -434,27 +450,18 @@ static int hist_entry__fprintf(struct hist_entry *he, 
size_t size,
if (size == 0 || size  sizeof(bf))
size = sizeof(bf);
 
-   ret = hist_entry__pcnt_snprintf(he, bf, size, pair_hists,
-   show_displacement, displacement,
-   true, total_period);
-   hist_entry__snprintf(he, bf + ret, size - ret, hists);
-   return fprintf(fp, %s\n, bf);
-}
+   ret = hist_entry__period_snprintf(he, bf, size, pair_hists,
+ show_displacement, displacement,
+ true, total_period);
+   hist_entry__sort_snprintf(he, bf + ret, size - ret, hists);
 
-static size_t hist_entry__fprintf_callchain(struct hist_entry *he,
-   struct hists *hists,
-   u64 total_period, FILE *fp)
-{
-   int left_margin = 0;
+   ret = fprintf(fp, %s\n, bf);
 
-   if (sort__first_dimension == SORT_COMM) {
-   struct sort_entry *se = list_first_entry(hist_entry__sort_list,
-typeof(*se), list);
-   left_margin = hists__col_len(hists, se-se_width_idx);
-   left_margin -= thread__comm_len(he-thread);
-   }
+   if (symbol_conf.use_callchain)
+   ret += 

[PATCH 1/7] perf hists: Separate out hist print functions

2012-08-06 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Separate out those functions into ui/hist.c. This is required for
upcoming changes.

Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/Makefile|   4 +-
 tools/perf/ui/hist.c   | 648 ++
 tools/perf/util/hist.c | 677 ++---
 tools/perf/util/hist.h |   2 +
 4 files changed, 670 insertions(+), 661 deletions(-)
 create mode 100644 tools/perf/ui/hist.c

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 35655c3a7b7a..49cff288ac24 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -388,10 +388,10 @@ LIB_OBJS += $(OUTPUT)util/target.o
 LIB_OBJS += $(OUTPUT)util/rblist.o
 LIB_OBJS += $(OUTPUT)util/intlist.o
 
-BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
+LIB_OBJS += $(OUTPUT)ui/hist.o
 
+BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
-
 # Benchmark modules
 BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
 BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
new file mode 100644
index ..b7936dc6271f
--- /dev/null
+++ b/tools/perf/ui/hist.c
@@ -0,0 +1,648 @@
+#include stdio.h
+#include math.h
+
+#include ../util/util.h
+#include ../util/hist.h
+#include ../util/sort.h
+
+
+static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
+{
+   int i;
+   int ret = fprintf(fp, );
+
+   for (i = 0; i  left_margin; i++)
+   ret += fprintf(fp,  );
+
+   return ret;
+}
+
+static size_t ipchain__fprintf_graph_line(FILE *fp, int depth, int depth_mask,
+ int left_margin)
+{
+   int i;
+   size_t ret = callchain__fprintf_left_margin(fp, left_margin);
+
+   for (i = 0; i  depth; i++)
+   if (depth_mask  (1  i))
+   ret += fprintf(fp, |  );
+   else
+   ret += fprintf(fp,);
+
+   ret += fprintf(fp, \n);
+
+   return ret;
+}
+
+static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain,
+int depth, int depth_mask, int period,
+u64 total_samples, u64 hits,
+int left_margin)
+{
+   int i;
+   size_t ret = 0;
+
+   ret += callchain__fprintf_left_margin(fp, left_margin);
+   for (i = 0; i  depth; i++) {
+   if (depth_mask  (1  i))
+   ret += fprintf(fp, |);
+   else
+   ret += fprintf(fp,  );
+   if (!period  i == depth - 1) {
+   double percent;
+
+   percent = hits * 100.0 / total_samples;
+   ret += percent_color_fprintf(fp, --%2.2f%%-- , 
percent);
+   } else
+   ret += fprintf(fp, %s,   );
+   }
+   if (chain-ms.sym)
+   ret += fprintf(fp, %s\n, chain-ms.sym-name);
+   else
+   ret += fprintf(fp, 0x%0 PRIx64 \n, chain-ip);
+
+   return ret;
+}
+
+static struct symbol *rem_sq_bracket;
+static struct callchain_list rem_hits;
+
+static void init_rem_hits(void)
+{
+   rem_sq_bracket = malloc(sizeof(*rem_sq_bracket) + 6);
+   if (!rem_sq_bracket) {
+   fprintf(stderr, Not enough memory to display remaining 
hits\n);
+   return;
+   }
+
+   strcpy(rem_sq_bracket-name, [...]);
+   rem_hits.ms.sym = rem_sq_bracket;
+}
+
+static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
+u64 total_samples, int depth,
+int depth_mask, int left_margin)
+{
+   struct rb_node *node, *next;
+   struct callchain_node *child;
+   struct callchain_list *chain;
+   int new_depth_mask = depth_mask;
+   u64 remaining;
+   size_t ret = 0;
+   int i;
+   uint entries_printed = 0;
+
+   remaining = total_samples;
+
+   node = rb_first(root);
+   while (node) {
+   u64 new_total;
+   u64 cumul;
+
+   child = rb_entry(node, struct callchain_node, rb_node);
+   cumul = callchain_cumul_hits(child);
+   remaining -= cumul;
+
+   /*
+* The depth mask manages the output of pipes that show
+* the depth. We don't want to keep the pipes of the current
+* level for the last child of this depth.
+* Except if we have remaining filtered hits. They will
+* supersede the last child
+*/
+   next = rb_next(node);
+   if (!next  (callchain_param.mode != CHAIN_GRAPH_REL || 
!remaining))
+   new_depth_mask = ~(1  (depth - 1));
+
+   /*
+* But we keep the older 

[PATCH 6/7] perf ui/browser: Use hist_period_print functions

2012-08-06 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Override hpp-color functions for TUI. Because line coloring is done
outside of the function, it just sets the percent value and pass it.

Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/ui/browsers/hists.c | 94 --
 tools/perf/ui/tui/setup.c  |  4 ++
 2 files changed, 76 insertions(+), 22 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a5b5ba6d4e77..67cf297de588 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -27,6 +27,8 @@ struct hist_browser {
bool has_symbols;
 };
 
+extern void hist_browser__init_hpp(void);
+
 static int hists__browser_title(struct hists *hists, char *bf, size_t size,
const char *ev_name);
 
@@ -553,14 +555,47 @@ static int hist_browser__show_callchain(struct 
hist_browser *browser,
return row - first_row;
 }
 
+#define HPP_COLOR_FN(_name, _field)\
+static int hist_browser__hpp_color_ ## _name(struct hpp_context *ctx,  \
+struct hist_entry *he) \
+{  \
+   double percent = 100.0 * he-_field / ctx-total_period;\
+   *(double *)ctx-ptr = percent;  \
+   return scnprintf(ctx-s, ctx-size, %5.2f%%, percent);\
+}
+
+HPP_COLOR_FN(overhead, period)
+HPP_COLOR_FN(overhead_sys, period_sys)
+HPP_COLOR_FN(overhead_us, period_us)
+HPP_COLOR_FN(overhead_guest_sys, period_guest_sys)
+HPP_COLOR_FN(overhead_guest_us, period_guest_us)
+
+#undef HPP_COLOR_FN
+
+void hist_browser__init_hpp(void)
+{
+   perf_hpp__init(false, false);
+
+   hpp_functions[PERF_HPP__OVERHEAD].color =
+   hist_browser__hpp_color_overhead;
+   hpp_functions[PERF_HPP__OVERHEAD_SYS].color =
+   hist_browser__hpp_color_overhead_sys;
+   hpp_functions[PERF_HPP__OVERHEAD_US].color =
+   hist_browser__hpp_color_overhead_us;
+   hpp_functions[PERF_HPP__OVERHEAD_GUEST_SYS].color =
+   hist_browser__hpp_color_overhead_guest_sys;
+   hpp_functions[PERF_HPP__OVERHEAD_GUEST_US].color =
+   hist_browser__hpp_color_overhead_guest_us;
+}
+
 static int hist_browser__show_entry(struct hist_browser *browser,
struct hist_entry *entry,
unsigned short row)
 {
char s[256];
double percent;
-   int printed = 0;
-   int width = browser-b.width - 6; /* The percentage */
+   int i, printed = 0;
+   int width = browser-b.width;
char folded_sign = ' ';
bool current_entry = ui_browser__is_current_entry(browser-b, row);
off_t row_offset = entry-row_offset;
@@ -576,35 +611,50 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
}
 
if (row_offset == 0) {
-   hist_entry__sort_snprintf(entry, s, sizeof(s), browser-hists);
-   percent = (entry-period * 100.0) / 
browser-hists-stats.total_period;
+   struct hpp_context ctx = {
+   .s  = s,
+   .size   = sizeof(s),
+   .total_period   = browser-hists-stats.total_period,
+   };
 
-   ui_browser__set_percent_color(browser-b, percent, 
current_entry);
ui_browser__gotorc(browser-b, row, 0);
-   if (symbol_conf.use_callchain) {
-   slsmg_printf(%c , folded_sign);
-   width -= 2;
-   }
 
-   slsmg_printf( %5.2f%%, percent);
+   for (i = 0; i  PERF_HPP__MAX_INDEX; i++) {
+   if (!hpp_functions[i].cond)
+   continue;
 
-   /* The scroll bar isn't being used */
-   if (!browser-b.navkeypressed)
-   width += 1;
+   if (i) {
+   slsmg_printf(  );
+   width -= 2;
+   }
 
-   if (!current_entry || !browser-b.navkeypressed)
-   ui_browser__set_color(browser-b, HE_COLORSET_NORMAL);
+   if (hpp_functions[i].color) {
+   ctx.ptr = percent;
+   /* It will set percent for us. See HPP_COLOR_FN 
above. */
+   width -= hpp_functions[i].color(ctx, entry);
 
-   if (symbol_conf.show_nr_samples) {
-   slsmg_printf( %11u, entry-nr_events);
-   width -= 12;
-   }
+   ui_browser__set_percent_color(browser-b, 
percent, 

[PATCH 7/7] perf gtk/browser: Use hist_period_print functions

2012-08-06 Thread Namhyung Kim
Now we can support color using pango markup with this change.

Cc: Pekka Enberg penb...@kernel.org
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/ui/gtk/browser.c | 101 +---
 tools/perf/ui/gtk/gtk.h |   2 +
 tools/perf/ui/gtk/setup.c   |   1 +
 3 files changed, 88 insertions(+), 16 deletions(-)

diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index ec12e0b4ded6..acedfa982ff7 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -35,6 +35,57 @@ static void perf_gtk__resize_window(GtkWidget *window)
gtk_window_resize(GTK_WINDOW(window), width, height);
 }
 
+static const char *perf_gtk__get_percent_color(double percent)
+{
+   if (percent = MIN_RED)
+   return span fgcolor='red';
+   if (percent = MIN_GREEN)
+   return span fgcolor='dark green';
+   return NULL;
+}
+
+#define HPP_COLOR_FN(_name, _field)
\
+static int perf_gtk__hpp_color_ ## _name(struct hpp_context *ctx,  
\
+struct hist_entry *he) 
\
+{  
\
+   double percent = 100.0 * he-_field / ctx-total_period;
\
+   const char *markup; 
\
+   int ret = 0;
\
+   
\
+   markup = perf_gtk__get_percent_color(percent);  
\
+   if (markup) 
\
+   ret += scnprintf(ctx-s, ctx-size, %s, markup);  
\
+   ret += scnprintf(ctx-s + ret, ctx-size - ret, %5.2f%%, percent);
\
+   if (markup) 
\
+   ret += scnprintf(ctx-s + ret, ctx-size - ret, /span); 
\
+   
\
+   return ret; 
\
+}
+
+HPP_COLOR_FN(overhead, period)
+HPP_COLOR_FN(overhead_sys, period_sys)
+HPP_COLOR_FN(overhead_us, period_us)
+HPP_COLOR_FN(overhead_guest_sys, period_guest_sys)
+HPP_COLOR_FN(overhead_guest_us, period_guest_us)
+
+#undef HPP_COLOR_FN
+
+void perf_gtk__init_hpp(void)
+{
+   perf_hpp__init(false, false);
+
+   hpp_functions[PERF_HPP__OVERHEAD].color =
+   perf_gtk__hpp_color_overhead;
+   hpp_functions[PERF_HPP__OVERHEAD_SYS].color =
+   perf_gtk__hpp_color_overhead_sys;
+   hpp_functions[PERF_HPP__OVERHEAD_US].color =
+   perf_gtk__hpp_color_overhead_us;
+   hpp_functions[PERF_HPP__OVERHEAD_GUEST_SYS].color =
+   perf_gtk__hpp_color_overhead_guest_sys;
+   hpp_functions[PERF_HPP__OVERHEAD_GUEST_US].color =
+   perf_gtk__hpp_color_overhead_guest_us;
+}
+
 static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
 {
GType col_types[MAX_COLUMNS];
@@ -42,15 +93,25 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists)
struct sort_entry *se;
GtkListStore *store;
struct rb_node *nd;
-   u64 total_period;
GtkWidget *view;
-   int col_idx;
+   int i, col_idx;
int nr_cols;
+   char s[512];
+
+   struct hpp_context ctx = {
+   .s  = s,
+   .size   = sizeof(s),
+   .total_period   = hists-stats.total_period,
+   };
 
nr_cols = 0;
 
-   /* The percentage column */
-   col_types[nr_cols++] = G_TYPE_STRING;
+   for (i = 0; i  PERF_HPP__MAX_INDEX; i++) {
+   if (!hpp_functions[i].cond)
+   continue;
+
+   col_types[nr_cols++] = G_TYPE_STRING;
+   }
 
list_for_each_entry(se, hist_entry__sort_list, list) {
if (se-elide)
@@ -67,11 +128,17 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists)
 
col_idx = 0;
 
-   /* The percentage column */
-   gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
-   -1, Overhead (%),
-   renderer, text,
-   col_idx++, NULL);
+   for (i = 0; i  PERF_HPP__MAX_INDEX; i++) {
+   if (!hpp_functions[i].cond)
+   continue;
+
+   hpp_functions[i].header(ctx);
+
+   gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
+   -1, s,
+   

[PATCH 5/7] perf hists: Use hpp_functions-width to calculate the column widths

2012-08-06 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/ui/hist.c   | 27 +++
 tools/perf/util/hist.c | 33 -
 2 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 01724a9905c0..1293546cf7f2 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -835,6 +835,33 @@ out:
return ret;
 }
 
+/*
+ * See hists__fprintf to match the column widths
+ */
+unsigned int hists__sort_list_width(struct hists *hists)
+{
+   struct sort_entry *se;
+   int i, ret = 0;
+
+   for (i = 0; i  PERF_HPP__MAX_INDEX; i++) {
+   if (!hpp_functions[i].cond)
+   continue;
+   if (i)
+   ret += 2;
+
+   ret += hpp_functions[i].width(NULL);
+   }
+
+   list_for_each_entry(se, hist_entry__sort_list, list)
+   if (!se-elide)
+   ret += 2 + hists__col_len(hists, se-se_width_idx);
+
+   if (verbose) /* Addr + origin */
+   ret += 3 + BITS_PER_LONG / 4;
+
+   return ret;
+}
+
 size_t hists__fprintf_nr_events(struct hists *hists, FILE *fp)
 {
int i;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b1817f15bb87..0ba65ad07cd1 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -563,39 +563,6 @@ void hists__output_resort_threaded(struct hists *hists)
return __hists__output_resort(hists, true);
 }
 
-/*
- * See hists__fprintf to match the column widths
- */
-unsigned int hists__sort_list_width(struct hists *hists)
-{
-   struct sort_entry *se;
-   int ret = 9; /* total % */
-
-   if (symbol_conf.show_cpu_utilization) {
-   ret += 7; /* count_sys % */
-   ret += 6; /* count_us % */
-   if (perf_guest) {
-   ret += 13; /* count_guest_sys % */
-   ret += 12; /* count_guest_us % */
-   }
-   }
-
-   if (symbol_conf.show_nr_samples)
-   ret += 11;
-
-   if (symbol_conf.show_total_period)
-   ret += 13;
-
-   list_for_each_entry(se, hist_entry__sort_list, list)
-   if (!se-elide)
-   ret += 2 + hists__col_len(hists, se-se_width_idx);
-
-   if (verbose) /* Addr + origin */
-   ret += 3 + BITS_PER_LONG / 4;
-
-   return ret;
-}
-
 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry 
*h,
   enum hist_filter filter)
 {
-- 
1.7.11.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/


[PATCH 3/7] perf hists: Introduce hist_period_print functions

2012-08-06 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Current hist print functions are messy. Refactor them using the hpp
callbacks. This will make it easy to add new features.

Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/builtin-diff.c |   1 +
 tools/perf/ui/hist.c  | 490 +++---
 tools/perf/ui/setup.c |   8 +-
 tools/perf/util/hist.h|  35 
 4 files changed, 369 insertions(+), 165 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index d29d350fb2b7..3fc53f8b098e 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -235,6 +235,7 @@ int cmd_diff(int argc, const char **argv, const char 
*prefix __used)
if (symbol__init()  0)
return -1;
 
+   perf_hpp__init(true, show_displacement);
setup_sorting(diff_usage, options);
setup_pager();
 
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 5075e9e5a0fd..6817fcb0b303 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -6,6 +6,272 @@
 #include ../util/sort.h
 
 
+/* hist period print (hpp) functions */
+static int hpp_header_overhead(struct hpp_context *ctx)
+{
+   if (ctx-ptr)
+   return scnprintf(ctx-s, ctx-size, Baseline);
+   else
+   return scnprintf(ctx-s, ctx-size, Overhead);
+}
+
+static int hpp_width_overhead(struct hpp_context *ctx __used)
+{
+   return 8;
+}
+
+static int hpp_color_overhead(struct hpp_context *ctx,
+ struct hist_entry *he)
+{
+   double percent = 100.0 * he-period / ctx-total_period;
+   return percent_color_snprintf(ctx-s, ctx-size,   %5.2f%%, percent);
+}
+
+static int hpp_entry_overhead(struct hpp_context *ctx,
+ struct hist_entry *he)
+{
+   double percent = 100.0 * he-period / ctx-total_period;
+   return scnprintf(ctx-s, ctx-size,   %5.2f%%, percent);
+}
+
+static int hpp_header_overhead_sys(struct hpp_context *ctx)
+{
+   return scnprintf(ctx-s, ctx-size,  sys  );
+}
+
+static int hpp_width_overhead_sys(struct hpp_context *ctx __used)
+{
+   return 6;
+}
+
+static int hpp_color_overhead_sys(struct hpp_context *ctx,
+ struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_sys / ctx-total_period;
+   return percent_color_snprintf(ctx-s, ctx-size, %5.2f%%, percent);
+}
+
+static int hpp_entry_overhead_sys(struct hpp_context *ctx,
+ struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_sys / ctx-total_period;
+   return scnprintf(ctx-s, ctx-size, %5.2f%%, percent);
+}
+
+static int hpp_header_overhead_us(struct hpp_context *ctx)
+{
+   return scnprintf(ctx-s, ctx-size,  user );
+}
+
+static int hpp_width_overhead_us(struct hpp_context *ctx __used)
+{
+   return 6;
+}
+
+static int hpp_color_overhead_us(struct hpp_context *ctx,
+struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_us / ctx-total_period;
+   return percent_color_snprintf(ctx-s, ctx-size, %5.2f%%, percent);
+}
+
+static int hpp_entry_overhead_us(struct hpp_context *ctx,
+struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_us / ctx-total_period;
+   return scnprintf(ctx-s, ctx-size, %5.2f%%, percent);
+}
+
+static int hpp_header_overhead_guest_sys(struct hpp_context *ctx)
+{
+   return scnprintf(ctx-s, ctx-size, guest sys);
+}
+
+static int hpp_width_overhead_guest_sys(struct hpp_context *ctx __used)
+{
+   return 9;
+}
+
+static int hpp_color_overhead_guest_sys(struct hpp_context *ctx,
+   struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_guest_sys / ctx-total_period;
+   return percent_color_snprintf(ctx-s, ctx-size,   %5.2f%% , percent);
+}
+
+static int hpp_entry_overhead_guest_sys(struct hpp_context *ctx,
+   struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_guest_sys / ctx-total_period;
+   return scnprintf(ctx-s, ctx-size,   %5.2f%% , percent);
+}
+
+static int hpp_header_overhead_guest_us(struct hpp_context *ctx)
+{
+   return scnprintf(ctx-s, ctx-size, guest usr);
+}
+
+static int hpp_width_overhead_guest_us(struct hpp_context *ctx __used)
+{
+   return 9;
+}
+
+static int hpp_color_overhead_guest_us(struct hpp_context *ctx,
+  struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_guest_us / ctx-total_period;
+   return percent_color_snprintf(ctx-s, ctx-size,   %5.2f%% , percent);
+}
+
+static int hpp_entry_overhead_guest_us(struct hpp_context *ctx,
+  struct hist_entry *he)
+{
+   double percent = 100.0 * he-period_guest_us / ctx-total_period;
+   return scnprintf(ctx-s, ctx-size,   %5.2f%% , percent);
+}
+
+static int 

[PATCH 4/7] perf hists: Handle field separator properly

2012-08-06 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

When a field separator is given, the output format doesn't need to be
fancy like aligning to column length, coloring the percent value and
so on. And since there's a slight difference to normal format, fix it
not to break backward compatibility.

Cc: Stephane Eranian eran...@google.com
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/ui/hist.c | 45 ++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 6817fcb0b303..01724a9905c0 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -31,6 +31,10 @@ static int hpp_entry_overhead(struct hpp_context *ctx,
  struct hist_entry *he)
 {
double percent = 100.0 * he-period / ctx-total_period;
+
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, %.2f, percent);
+
return scnprintf(ctx-s, ctx-size,   %5.2f%%, percent);
 }
 
@@ -55,6 +59,10 @@ static int hpp_entry_overhead_sys(struct hpp_context *ctx,
  struct hist_entry *he)
 {
double percent = 100.0 * he-period_sys / ctx-total_period;
+
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, %.2f, percent);
+
return scnprintf(ctx-s, ctx-size, %5.2f%%, percent);
 }
 
@@ -79,6 +87,10 @@ static int hpp_entry_overhead_us(struct hpp_context *ctx,
 struct hist_entry *he)
 {
double percent = 100.0 * he-period_us / ctx-total_period;
+
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, %.2f, percent);
+
return scnprintf(ctx-s, ctx-size, %5.2f%%, percent);
 }
 
@@ -103,6 +115,10 @@ static int hpp_entry_overhead_guest_sys(struct hpp_context 
*ctx,
struct hist_entry *he)
 {
double percent = 100.0 * he-period_guest_sys / ctx-total_period;
+
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, %.2f, percent);
+
return scnprintf(ctx-s, ctx-size,   %5.2f%% , percent);
 }
 
@@ -127,6 +143,10 @@ static int hpp_entry_overhead_guest_us(struct hpp_context 
*ctx,
   struct hist_entry *he)
 {
double percent = 100.0 * he-period_guest_us / ctx-total_period;
+
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, %.2f, percent);
+
return scnprintf(ctx-s, ctx-size,   %5.2f%% , percent);
 }
 
@@ -143,6 +163,9 @@ static int hpp_width_samples(struct hpp_context *ctx __used)
 static int hpp_entry_samples(struct hpp_context *ctx,
 struct hist_entry *he)
 {
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, % PRIu64, he-nr_events);
+
return scnprintf(ctx-s, ctx-size, %11 PRIu64, he-nr_events);
 }
 
@@ -159,6 +182,9 @@ static int hpp_width_period(struct hpp_context *ctx __used)
 static int hpp_entry_period(struct hpp_context *ctx,
struct hist_entry *he)
 {
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size, % PRIu64, he-period);
+
return scnprintf(ctx-s, ctx-size, %12 PRIu64, he-period);
 }
 
@@ -190,10 +216,16 @@ static int hpp_entry_delta(struct hpp_context *ctx,
new_percent = 100.0 * he-period / new_total;
 
diff = new_percent - old_percent;
-   if (fabs(diff)  0.01)
+   if (fabs(diff)  0.01) {
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size,  );
return scnprintf(ctx-s, ctx-size,);
+   }
 
scnprintf(buf, sizeof(buf), %+4.2F%%, diff);
+
+   if (symbol_conf.field_sep)
+   scnprintf(ctx-s, ctx-size, %s, buf);
return scnprintf(ctx-s, ctx-size, %7.7s, buf);
 }
 
@@ -212,10 +244,16 @@ static int hpp_entry_displ(struct hpp_context *ctx,
 {
char buf[32];
 
-   if (!ctx-displacement)
+   if (!ctx-displacement) {
+   if (symbol_conf.field_sep)
+   return scnprintf(ctx-s, ctx-size,  );
return scnprintf(ctx-s, ctx-size,  );
+   }
 
scnprintf(buf, sizeof(buf), %+4ld, ctx-displacement);
+
+   if (symbol_conf.field_sep)
+   scnprintf(ctx-s, ctx-size, %s, buf);
return scnprintf(ctx-s, ctx-size, %6.6s, buf);
 }
 
@@ -641,11 +679,12 @@ static int hist_entry__fprintf(struct hist_entry *he, 
size_t size,
.displacement   = displacement,
.ptr= pair_hists,
};
+   bool color = !symbol_conf.field_sep;
 
if (size == 0 || size  sizeof(bf))
size = ctx.size = sizeof(bf);
 
-   ret = hist_entry__period_snprintf(ctx, he, true);
+   ret = hist_entry__period_snprintf(ctx, he, color);
hist_entry__sort_snprintf(he, bf + ret, size - ret, 

Re: [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions

2012-08-06 Thread Dan Carpenter
On Fri, Aug 03, 2012 at 05:40:13PM +0200, Damien Cassou wrote:
 @@ -233,7 +234,6 @@ static int mddi_nt35399_remove(struct platform_device 
 *pdev)
   struct panel_info *panel = platform_get_drvdata(pdev);
 
   setup_vsync(panel, 0);
 - kfree(panel);
   return 0;
  }
 --
 To unsubscribe from this list: send the line unsubscribe kernel-janitors in

It's weird.  This patch doesn't apply for me unless I add a blank
line between the } and the --.  I'm not sure if that line is
getting removed by your email client or by the kernel janitors email
list.

regards,
dan carpenter

--
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/7] netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()

2012-08-06 Thread Cong Wang
On Fri, 2012-08-03 at 12:10 +0200, Eric Dumazet wrote: 
 
 I did this , just take it ;)

Do we have to pass gfp to -ndo_netpoll_setup() too? It seems no, so far
I don't think we have to do that.

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/


[PATCH RFC] regulator: suppress printk if there is no real info

2012-08-06 Thread Uwe Kleine-König
This prevents the output of just

dummy:

in the boot log.

Signed-off-by: Uwe Kleine-König u.kleine-koe...@pengutronix.de
---
Hello,

probably this really only applies to the dummy regulator. If not it
might be more sensible to do:

if (!buf[0])
buf = no parameters;

or similar. Other than that I wonder if setting the devicename from
dummy to say regulator-dummy would be an improvement, too.

Best regards
Uwe

 drivers/regulator/core.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 8b4b382..9275259 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -808,7 +808,8 @@ static void print_constraints(struct regulator_dev *rdev)
if (constraints-valid_modes_mask  REGULATOR_MODE_STANDBY)
count += sprintf(buf + count, standby);
 
-   rdev_info(rdev, %s\n, buf);
+   if (buf[0])
+   rdev_info(rdev, %s\n, buf);
 
if ((constraints-min_uV != constraints-max_uV) 
!(constraints-valid_ops_mask  REGULATOR_CHANGE_VOLTAGE))
-- 
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/


[RFC V3 PATCH 00/25] memory,numa: introduce MOVABLE-dedicated node and online_movable for hotplug

2012-08-06 Thread Lai Jiangshan
A) Introduction:

This patchset adds MOVABLE-dedicated node and online_movable for 
memory-management.

It is used for anti-fragmentation(hugepage, big-order allocation...),
hot-removal-of-memory(virtualization, power-conserve, move memory between 
systems
to make better utilities of memories).

B) User Interface:

When users(big system manager) need config some node/memory as MOVABLE:
1 Use kernelcore_max_addr=XX when boot
2 Use movable_online hotplug action when running
We may introduce some more convenient interface, such as
movable_node=NODE_LIST boot option.

C) Patches

Patch1-3  Fix problems of the current code.(all related with hotplug)
Patch4cleanup for node_state_attr
Patch5introduce N_MEMORY
Patch6-18 use N_MEMORY instead N_HIGH_MEMORY.
  The patches are separated by subsystem,
  *these conversions was(must be) checked carefully*.
  Patch18 also changes the node_states initialization
Patch19   Add config to allow MOVABLE-dedicated node
Patch20-24Add kernelcore_max_addr
Patch25   Add online_movable and online_kernel


D) changes
change V3-v2:
Proper nodemask management

change V2-V1:

The original V1 patchset of MOVABLE-dedicated node is here:
http://comments.gmane.org/gmane.linux.kernel.mm/78122

The new V2 adds N_MEMORY and a notion of MOVABLE-dedicated node.
And fix some related problems.

The orignal V1 patchset of add online_movable is here:
https://lkml.org/lkml/2012/7/4/145

The new V2 discards the MIGRATE_HOTREMOVE approach, and use a more straight
implementation(only 1 patch).


Lai Jiangshan (21):
  page_alloc.c: don't subtract unrelated memmap from zone's present
pages
  memory_hotplug: fix missing nodemask management
  slub, hotplug: ignore unrelated node's hot-adding and hot-removing
  node: cleanup node_state_attr
  node_states: introduce N_MEMORY
  cpuset: use N_MEMORY instead N_HIGH_MEMORY
  procfs: use N_MEMORY instead N_HIGH_MEMORY
  memcontrol: use N_MEMORY instead N_HIGH_MEMORY
  oom: use N_MEMORY instead N_HIGH_MEMORY
  mm,migrate: use N_MEMORY instead N_HIGH_MEMORY
  mempolicy: use N_MEMORY instead N_HIGH_MEMORY
  hugetlb: use N_MEMORY instead N_HIGH_MEMORY
  vmstat: use N_MEMORY instead N_HIGH_MEMORY
  kthread: use N_MEMORY instead N_HIGH_MEMORY
  init: use N_MEMORY instead N_HIGH_MEMORY
  vmscan: use N_MEMORY instead N_HIGH_MEMORY
  page_alloc: use N_MEMORY instead N_HIGH_MEMORY change the node_states
initialization
  hotplug: update nodemasks management
  numa: add CONFIG_MOVABLE_NODE for movable-dedicated node
  page_alloc: add kernelcore_max_addr
  mm, memory-hotplug: add online_movable and online_kernel

Yasuaki Ishimatsu (4):
  x86: get pg_data_t's memory from other node
  x86: use memblock_set_current_limit() to set memblock.current_limit
  memblock: limit memory address from memblock
  memblock: compare current_limit with end variable at
memblock_find_in_range_node()

 Documentation/cgroups/cpusets.txt   |2 +-
 Documentation/kernel-parameters.txt |9 ++
 Documentation/memory-hotplug.txt|   24 +++-
 arch/x86/kernel/setup.c |4 +-
 arch/x86/mm/init_64.c   |4 +-
 arch/x86/mm/numa.c  |8 +-
 drivers/base/memory.c   |   19 ++-
 drivers/base/node.c |   28 +++--
 fs/proc/kcore.c |2 +-
 fs/proc/task_mmu.c  |4 +-
 include/linux/cpuset.h  |2 +-
 include/linux/memblock.h|1 +
 include/linux/memory.h  |2 +
 include/linux/memory_hotplug.h  |   13 ++-
 include/linux/nodemask.h|5 +
 init/main.c |2 +-
 kernel/cpuset.c |   32 +++---
 kernel/kthread.c|2 +-
 mm/Kconfig  |8 ++
 mm/hugetlb.c|   24 ++--
 mm/memblock.c   |   10 +-
 mm/memcontrol.c |   18 ++--
 mm/memory_hotplug.c |  232 ---
 mm/mempolicy.c  |   12 +-
 mm/migrate.c|2 +-
 mm/oom_kill.c   |2 +-
 mm/page_alloc.c |   96 +--
 mm/page_cgroup.c|2 +-
 mm/slub.c   |4 +-
 mm/vmscan.c |4 +-
 mm/vmstat.c |4 +-
 31 files changed, 437 insertions(+), 144 deletions(-)

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


[RFC V3 PATCH 05/25] node_states: introduce N_MEMORY

2012-08-06 Thread Lai Jiangshan
We have N_NORMAL_MEMORY for standing for the nodes that have normal memory with
zone_type = ZONE_NORMAL.

And we have N_HIGH_MEMORY for standing for the nodes that have normal or high
memory.

But we don't have any word to stand for the nodes that have *any* memory.

And we have N_CPU but without N_MEMORY.

Current code reuse the N_HIGH_MEMORY for this purpose because any node which
has memory must have high memory or normal memory currently.

A)  But this reusing is bad for *readability*. Because the name
N_HIGH_MEMORY just stands for high or normal:

A.example 1)
mem_cgroup_nr_lru_pages():
for_each_node_state(nid, N_HIGH_MEMORY)

The user will be confused(why this function just counts for high or
normal memory node? does it counts for ZONE_MOVABLE's lru pages?)
until someone else tell them N_HIGH_MEMORY is reused to stand for
nodes that have any memory.

A.cont) If we introduce N_MEMORY, we can reduce this confusing
AND make the code more clearly:

A.example 2) mm/page_cgroup.c use N_HIGH_MEMORY twice:

One is in page_cgroup_init(void):
for_each_node_state(nid, N_HIGH_MEMORY) {

It means if the node have memory, we will allocate page_cgroup map for
the node. We should use N_MEMORY instead here to gaim more clearly.

The second using is in alloc_page_cgroup():
if (node_state(nid, N_HIGH_MEMORY))
addr = vzalloc_node(size, nid);

It means if the node has high or normal memory that can be allocated
from kernel. We should keep N_HIGH_MEMORY here, and it will be better
if the any memory semantic of N_HIGH_MEMORY is removed.

B)  This reusing is out-dated if we introduce MOVABLE-dedicated node.
The MOVABLE-dedicated node should not appear in
node_stats[N_HIGH_MEMORY] nor node_stats[N_NORMAL_MEMORY],
because MOVABLE-dedicated node has no high or normal memory.

In x86_64, N_HIGH_MEMORY=N_NORMAL_MEMORY, if a MOVABLE-dedicated node
is in node_stats[N_HIGH_MEMORY], it is also means it is in
node_stats[N_NORMAL_MEMORY], it causes SLUB wrong.

The slub uses
for_each_node_state(nid, N_NORMAL_MEMORY)
and creates kmem_cache_node for MOVABLE-dedicated node and cause 
problem.

In one word, we need a N_MEMORY. We just intrude it as an alias to
N_HIGH_MEMORY and fix all im-proper usages of N_HIGH_MEMORY in late patches.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Christoph Lameter c...@linux.com
Acked-by: Hillf Danton dhi...@gmail.com
---
 include/linux/nodemask.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 7afc363..c6ebdc9 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -380,6 +380,7 @@ enum node_states {
 #else
N_HIGH_MEMORY = N_NORMAL_MEMORY,
 #endif
+   N_MEMORY = N_HIGH_MEMORY,
N_CPU,  /* The node has one or more cpus */
NR_NODE_STATES
 };
-- 
1.7.4.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/


[RFC V3 PATCH 16/25] vmscan: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Hillf Danton dhi...@gmail.com
---
 mm/vmscan.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 66e4310..1888026 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2921,7 +2921,7 @@ static int __devinit cpu_callback(struct notifier_block 
*nfb,
int nid;
 
if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
pg_data_t *pgdat = NODE_DATA(nid);
const struct cpumask *mask;
 
@@ -2976,7 +2976,7 @@ static int __init kswapd_init(void)
int nid;
 
swap_setup();
-   for_each_node_state(nid, N_HIGH_MEMORY)
+   for_each_node_state(nid, N_MEMORY)
kswapd_run(nid);
hotcpu_notifier(cpu_callback, 0);
return 0;
-- 
1.7.4.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/


[RFC V3 PATCH 18/25] hotplug: update nodemasks management

2012-08-06 Thread Lai Jiangshan
update nodemasks management for N_MEMORY

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 Documentation/memory-hotplug.txt |5 +++-
 include/linux/memory.h   |1 +
 mm/memory_hotplug.c  |   49 +
 3 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
index 6e6cbc7..70bc1c7 100644
--- a/Documentation/memory-hotplug.txt
+++ b/Documentation/memory-hotplug.txt
@@ -378,6 +378,7 @@ struct memory_notify {
unsigned long start_pfn;
unsigned long nr_pages;
int status_change_nid_normal;
+   int status_change_nid_high;
int status_change_nid;
 }
 
@@ -385,7 +386,9 @@ start_pfn is start_pfn of online/offline memory.
 nr_pages is # of pages of online/offline memory.
 status_change_nid_normal is set node id when N_NORMAL_MEMORY of nodemask
 is (will be) set/clear, if this is -1, then nodemask status is not changed.
-status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be)
+status_change_nid_high is set node id when N_HIGH_MEMORY of nodemask
+is (will be) set/clear, if this is -1, then nodemask status is not changed.
+status_change_nid is set node id when N_MEMORY of nodemask is (will be)
 set/clear. It means a new(memoryless) node gets new memory by online and a
 node loses all memory. If this is -1, then nodemask status is not changed.
 If status_changed_nid* = 0, callback should create/discard structures for the
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 6b9202b..8089e49 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -54,6 +54,7 @@ struct memory_notify {
unsigned long start_pfn;
unsigned long nr_pages;
int status_change_nid_normal;
+   int status_change_nid_high;
int status_change_nid;
 };
 
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 3438c4a..c2c96a4 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -462,7 +462,7 @@ static void check_nodemasks_changes_online(unsigned long 
nr_pages,
int nid = zone_to_nid(zone);
enum zone_type zone_last = ZONE_NORMAL;
 
-   if (N_HIGH_MEMORY == N_NORMAL_MEMORY)
+   if (N_MEMORY == N_NORMAL_MEMORY)
zone_last = ZONE_MOVABLE;
 
if (zone_idx(zone) = zone_last  !node_state(nid, N_NORMAL_MEMORY))
@@ -470,7 +470,20 @@ static void check_nodemasks_changes_online(unsigned long 
nr_pages,
else
arg-status_change_nid_normal = -1;
 
-   if (!node_state(nid, N_HIGH_MEMORY))
+#ifdef CONFIG_HIGHMEM
+   zone_last = ZONE_HIGH;
+   if (N_MEMORY == N_HIGH_MEMORY)
+   zone_last = ZONE_MOVABLE;
+
+   if (zone_idx(zone) = zone_last  !node_state(nid, N_HIGH_MEMORY))
+   arg-status_change_nid_high = nid;
+   else
+   arg-status_change_nid_high = -1;
+#else
+   arg-status_change_nid_high = arg-status_change_nid_normal;
+#endif
+
+   if (!node_state(nid, N_MEMORY))
arg-status_change_nid = nid;
else
arg-status_change_nid = -1;
@@ -481,7 +494,10 @@ static void set_nodemasks(int node, struct memory_notify 
*arg)
if (arg-status_change_nid_normal = 0)
node_set_state(node, N_NORMAL_MEMORY);
 
-   node_set_state(node, N_HIGH_MEMORY);
+   if (arg-status_change_nid_high = 0)
+   node_set_state(node, N_HIGH_MEMORY);
+
+   node_set_state(node, N_MEMORY);
 }
 
 
@@ -899,7 +915,7 @@ static void check_nodemasks_changes_offline(unsigned long 
nr_pages,
unsigned long present_pages = 0;
enum zone_type zt, zone_last = ZONE_NORMAL;
 
-   if (N_HIGH_MEMORY == N_NORMAL_MEMORY)
+   if (N_MEMORY == N_NORMAL_MEMORY)
zone_last = ZONE_MOVABLE;
 
for (zt = 0; zt = zone_last; zt++)
@@ -909,6 +925,21 @@ static void check_nodemasks_changes_offline(unsigned long 
nr_pages,
else
arg-status_change_nid_normal = -1;
 
+#ifdef CONIG_HIGHMEM
+   zone_last = ZONE_HIGH;
+   if (N_MEMORY == N_HIGH_MEMORY)
+   zone_last = ZONE_MOVABLE;
+
+   for (; zt = zone_last; zt++)
+   present_pages += pgdat-node_zones[zt].present_pages;
+   if (zone_idx(zone) = zone_last  nr_pages = present_pages)
+   arg-status_change_nid_high = zone_to_nid(zone);
+   else
+   arg-status_change_nid_high = -1;
+#else
+   arg-status_change_nid_high = arg-status_change_nid_normal;
+#endif
+
zone_last = ZONE_MOVABLE;
for (; zt = zone_last; zt++)
present_pages += pgdat-node_zones[zt].present_pages;
@@ -923,11 +954,17 @@ static void clear_nodemasks(int node, struct 
memory_notify *arg)
if (arg-status_change_nid_normal = 0)
node_clear_state(node, N_NORMAL_MEMORY);
 
-   if (N_HIGH_MEMORY == N_NORMAL_MEMORY)
+   if (N_MEMORY == N_NORMAL_MEMORY)
  

[RFC V3 PATCH 22/25] x86: use memblock_set_current_limit() to set memblock.current_limit

2012-08-06 Thread Lai Jiangshan
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com

memblock.current_limit is set directly though memblock_set_current_limit()
is prepared. So fix it.

Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 arch/x86/kernel/setup.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f4b9b80..bb9d9f8 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -889,7 +889,7 @@ void __init setup_arch(char **cmdline_p)
 
cleanup_highmap();
 
-   memblock.current_limit = get_max_mapped();
+   memblock_set_current_limit(get_max_mapped());
memblock_x86_fill();
 
/*
@@ -925,7 +925,7 @@ void __init setup_arch(char **cmdline_p)
max_low_pfn = max_pfn;
}
 #endif
-   memblock.current_limit = get_max_mapped();
+   memblock_set_current_limit(get_max_mapped());
dma_contiguous_reserve(0);
 
/*
-- 
1.7.4.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/


[RFC V3 PATCH 24/25] memblock: compare current_limit with end variable at memblock_find_in_range_node()

2012-08-06 Thread Lai Jiangshan
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com

memblock_find_in_range_node() does not compare memblock.current_limit
with end variable. Thus even if memblock.current_limit is smaller than
end variable, the function allocates memory address that is bigger than
memblock.current_limit.

The patch adds the check to memblock_find_in_range_node()

Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 mm/memblock.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 663b805..ce7fcb6 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -99,11 +99,12 @@ phys_addr_t __init_memblock 
memblock_find_in_range_node(phys_addr_t start,
phys_addr_t align, int nid)
 {
phys_addr_t this_start, this_end, cand;
+   phys_addr_t current_limit = memblock.current_limit;
u64 i;
 
/* pump up @end */
-   if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
-   end = memblock.current_limit;
+   if ((end == MEMBLOCK_ALLOC_ACCESSIBLE) || (end  current_limit))
+   end = current_limit;
 
/* avoid allocating the first page */
start = max_t(phys_addr_t, start, PAGE_SIZE);
-- 
1.7.4.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/


[RFC V3 PATCH 23/25] memblock: limit memory address from memblock

2012-08-06 Thread Lai Jiangshan
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com

Setting kernelcore_max_pfn means all memory which is bigger than
the boot parameter is allocated as ZONE_MOVABLE. So memory which
is allocated by memblock also should be limited by the parameter.

The patch limits memory from memblock.

Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 include/linux/memblock.h |1 +
 mm/memblock.c|5 -
 mm/page_alloc.c  |6 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 19dc455..f2977ae 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -42,6 +42,7 @@ struct memblock {
 
 extern struct memblock memblock;
 extern int memblock_debug;
+extern phys_addr_t memblock_limit;
 
 #define memblock_dbg(fmt, ...) \
if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
diff --git a/mm/memblock.c b/mm/memblock.c
index 5cc6731..663b805 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -931,7 +931,10 @@ int __init_memblock 
memblock_is_region_reserved(phys_addr_t base, phys_addr_t si
 
 void __init_memblock memblock_set_current_limit(phys_addr_t limit)
 {
-   memblock.current_limit = limit;
+   if (!memblock_limit || (memblock_limit  limit))
+   memblock.current_limit = limit;
+   else
+   memblock.current_limit = memblock_limit;
 }
 
 static void __init_memblock memblock_dump(struct memblock_type *type, char 
*name)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 65ac5c9..c4d3aa0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -209,6 +209,8 @@ static unsigned long __initdata required_kernelcore;
 static unsigned long __initdata required_movablecore;
 static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES];
 
+phys_addr_t memblock_limit;
+
 /* movable_zone is the real zone pages in ZONE_MOVABLE are taken from */
 int movable_zone;
 EXPORT_SYMBOL(movable_zone);
@@ -4876,7 +4878,9 @@ static int __init cmdline_parse_core(char *p, unsigned 
long *core)
  */
 static int __init cmdline_parse_kernelcore_max_addr(char *p)
 {
-   return cmdline_parse_core(p, required_kernelcore_max_pfn);
+   cmdline_parse_core(p, required_kernelcore_max_pfn);
+   memblock_limit = required_kernelcore_max_pfn  PAGE_SHIFT;
+   return 0;
 }
 early_param(kernelcore_max_addr, cmdline_parse_kernelcore_max_addr);
 #endif
-- 
1.7.4.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/


[RFC V3 PATCH 25/25] mm, memory-hotplug: add online_movable and online_kernel

2012-08-06 Thread Lai Jiangshan
When a memoryblock/memorysection is onlined by online_movable, the kernel
will not have directly reference to the page of the memoryblock,
thus we can remove that memory any time when needed.

It makes things easy when we dynamic hot-add/remove memory, make better
utilities of memories, and helps for THP.

Current constraints: Only the memoryblock which is adjacent to the ZONE_MOVABLE
can be onlined from ZONE_NORMAL to ZONE_MOVABLE.

For opposite onlining behavior, we also introduce online_kernel to change
a memoryblock of ZONE_MOVABLE to ZONE_KERNEL when online.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 Documentation/memory-hotplug.txt |   14 +-
 drivers/base/memory.c|   19 +---
 include/linux/memory_hotplug.h   |   13 +-
 mm/memory_hotplug.c  |  101 +-
 4 files changed, 137 insertions(+), 10 deletions(-)

diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
index 70bc1c7..8e5eacb 100644
--- a/Documentation/memory-hotplug.txt
+++ b/Documentation/memory-hotplug.txt
@@ -161,7 +161,8 @@ a recent addition and not present on older kernels.
in the memory block.
 'state'   : read-write
 at read:  contains online/offline state of memory.
-at write: user can specify online, offline command
+at write: user can specify online_kernel,
+online_movable, online, offline command
 which will be performed on al sections in the block.
 'phys_device' : read-only: designed to show the name of physical memory
 device.  This is not well implemented now.
@@ -255,6 +256,17 @@ For onlining, you have to write online to the section's 
state file as:
 
 % echo online  /sys/devices/system/memory/memoryXXX/state
 
+This onlining will not change the ZONE type of the target memory section,
+If the memory section is in ZONE_NORMAL, you can change it to ZONE_MOVABLE:
+
+% echo online_movable  /sys/devices/system/memory/memoryXXX/state
+(NOTE: current limit: this memory section must be adjacent to ZONE_MOVABLE)
+
+And if the memory section is in ZONE_MOVABLE, you can change it to ZONE_NORMAL:
+
+% echo online_kernel  /sys/devices/system/memory/memoryXXX/state
+(NOTE: current limit: this memory section must be adjacent to ZONE_NORMAL)
+
 After this, section memoryXXX's state will be 'online' and the amount of
 available memory will be increased.
 
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 7dda4f7..1ad2f48 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -246,7 +246,7 @@ static bool pages_correctly_reserved(unsigned long 
start_pfn,
  * OK to have direct references to sparsemem variables in here.
  */
 static int
-memory_block_action(unsigned long phys_index, unsigned long action)
+memory_block_action(unsigned long phys_index, unsigned long action, int 
online_type)
 {
unsigned long start_pfn, start_paddr;
unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
@@ -262,7 +262,7 @@ memory_block_action(unsigned long phys_index, unsigned long 
action)
if (!pages_correctly_reserved(start_pfn, nr_pages))
return -EBUSY;
 
-   ret = online_pages(start_pfn, nr_pages);
+   ret = online_pages(start_pfn, nr_pages, online_type);
break;
case MEM_OFFLINE:
start_paddr = page_to_pfn(first_page)  PAGE_SHIFT;
@@ -279,7 +279,8 @@ memory_block_action(unsigned long phys_index, unsigned long 
action)
 }
 
 static int memory_block_change_state(struct memory_block *mem,
-   unsigned long to_state, unsigned long from_state_req)
+   unsigned long to_state, unsigned long from_state_req,
+   int online_type)
 {
int ret = 0;
 
@@ -293,7 +294,7 @@ static int memory_block_change_state(struct memory_block 
*mem,
if (to_state == MEM_OFFLINE)
mem-state = MEM_GOING_OFFLINE;
 
-   ret = memory_block_action(mem-start_section_nr, to_state);
+   ret = memory_block_action(mem-start_section_nr, to_state, online_type);
 
if (ret) {
mem-state = from_state_req;
@@ -325,10 +326,14 @@ store_mem_state(struct device *dev,
 
mem = container_of(dev, struct memory_block, dev);
 
-   if (!strncmp(buf, online, min((int)count, 6)))
-   ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE);
+   if (!strncmp(buf, online_kernel, min((int)count, 13)))
+   ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE, 
ONLINE_KERNEL);
+   else if (!strncmp(buf, online_movable, min((int)count, 14)))
+   ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE, 
ONLINE_MOVABLE);
+   else if (!strncmp(buf, online, min((int)count, 6)))
+   

[RFC V3 PATCH 15/25] init: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 init/main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/init/main.c b/init/main.c
index 4121d1f..c9317aa 100644
--- a/init/main.c
+++ b/init/main.c
@@ -846,7 +846,7 @@ static int __init kernel_init(void * unused)
/*
 * init can allocate pages on any node
 */
-   set_mems_allowed(node_states[N_HIGH_MEMORY]);
+   set_mems_allowed(node_states[N_MEMORY]);
/*
 * init can run on any cpu.
 */
-- 
1.7.4.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/


[RFC V3 PATCH 17/25] page_alloc: use N_MEMORY instead N_HIGH_MEMORY change the node_states initialization

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Since we introduced N_MEMORY, we update the initialization of node_states.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 arch/x86/mm/init_64.c |4 +++-
 mm/page_alloc.c   |   40 ++--
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 2b6b4a3..005f00c 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -625,7 +625,9 @@ void __init paging_init(void)
 *   numa support is not compiled in, and later node_set_state
 *   will not set it back.
 */
-   node_clear_state(0, N_NORMAL_MEMORY);
+   node_clear_state(0, N_MEMORY);
+   if (N_MEMORY != N_NORMAL_MEMORY)
+   node_clear_state(0, N_NORMAL_MEMORY);
 
zone_sizes_init();
 }
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9312702..edffc35 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1646,7 +1646,7 @@ bool zone_watermark_ok_safe(struct zone *z, int order, 
unsigned long mark,
  *
  * If the zonelist cache is present in the passed in zonelist, then
  * returns a pointer to the allowed node mask (either the current
- * tasks mems_allowed, or node_states[N_HIGH_MEMORY].)
+ * tasks mems_allowed, or node_states[N_MEMORY].)
  *
  * If the zonelist cache is not available for this zonelist, does
  * nothing and returns NULL.
@@ -1675,7 +1675,7 @@ static nodemask_t *zlc_setup(struct zonelist *zonelist, 
int alloc_flags)
 
allowednodes = !in_interrupt()  (alloc_flags  ALLOC_CPUSET) ?
cpuset_current_mems_allowed :
-   node_states[N_HIGH_MEMORY];
+   node_states[N_MEMORY];
return allowednodes;
 }
 
@@ -3070,7 +3070,7 @@ static int find_next_best_node(int node, nodemask_t 
*used_node_mask)
return node;
}
 
-   for_each_node_state(n, N_HIGH_MEMORY) {
+   for_each_node_state(n, N_MEMORY) {
 
/* Don't want a node to appear more than once */
if (node_isset(n, *used_node_mask))
@@ -3212,7 +3212,7 @@ static int default_zonelist_order(void)
 * local memory, NODE_ORDER may be suitable.
  */
average_size = total_size /
-   (nodes_weight(node_states[N_HIGH_MEMORY]) + 1);
+   (nodes_weight(node_states[N_MEMORY]) + 1);
for_each_online_node(nid) {
low_kmem_size = 0;
total_size = 0;
@@ -4569,7 +4569,7 @@ unsigned long __init 
find_min_pfn_with_active_regions(void)
 /*
  * early_calculate_totalpages()
  * Sum pages in active regions for movable zone.
- * Populate N_HIGH_MEMORY for calculating usable_nodes.
+ * Populate N_MEMORY for calculating usable_nodes.
  */
 static unsigned long __init early_calculate_totalpages(void)
 {
@@ -4582,7 +4582,7 @@ static unsigned long __init 
early_calculate_totalpages(void)
 
totalpages += pages;
if (pages)
-   node_set_state(nid, N_HIGH_MEMORY);
+   node_set_state(nid, N_MEMORY);
}
return totalpages;
 }
@@ -4599,9 +4599,9 @@ static void __init find_zone_movable_pfns_for_nodes(void)
unsigned long usable_startpfn;
unsigned long kernelcore_node, kernelcore_remaining;
/* save the state before borrow the nodemask */
-   nodemask_t saved_node_state = node_states[N_HIGH_MEMORY];
+   nodemask_t saved_node_state = node_states[N_MEMORY];
unsigned long totalpages = early_calculate_totalpages();
-   int usable_nodes = nodes_weight(node_states[N_HIGH_MEMORY]);
+   int usable_nodes = nodes_weight(node_states[N_MEMORY]);
 
/*
 * If movablecore was specified, calculate what size of
@@ -4636,7 +4636,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 restart:
/* Spread kernelcore memory as evenly as possible throughout nodes */
kernelcore_node = required_kernelcore / usable_nodes;
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
unsigned long start_pfn, end_pfn;
 
/*
@@ -4728,23 +4728,27 @@ restart:
 
 out:
/* restore the node_state */
-   node_states[N_HIGH_MEMORY] = saved_node_state;
+   node_states[N_MEMORY] = saved_node_state;
 }
 
-/* Any regular memory on that node ? */
-static void check_for_regular_memory(pg_data_t *pgdat)
+/* Any regular or high memory on that node ? */
+static void check_for_memory(pg_data_t *pgdat, int nid)
 {
-#ifdef CONFIG_HIGHMEM
enum zone_type zone_type;
 
-   for (zone_type = 0; zone_type = ZONE_NORMAL; zone_type++) {
+   if 

[RFC V3 PATCH 20/25] page_alloc: add kernelcore_max_addr

2012-08-06 Thread Lai Jiangshan
Current ZONE_MOVABLE (kernelcore=) setting policy with boot option doesn't meet
our requirement. We need something like kernelcore_max_addr=XX boot option
to limit the kernelcore upper address.

The memory with higher address will be migratable(movable) and they
are easier to be offline(always ready to be offline when the system don't 
require
so much memory).

It makes things easy when we dynamic hot-add/remove memory, make better
utilities of memories, and helps for THP.

All kernelcore_max_addr=, kernelcore= and movablecore= can be safely specified
at the same time(or any 2 of them).

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 Documentation/kernel-parameters.txt |9 +
 mm/page_alloc.c |   29 -
 2 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 12783fa..48dff61 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1216,6 +1216,15 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
use the HighMem zone if it exists, and the Normal
zone if it does not.
 
+   kernelcore_max_addr=nn[KMG] [KNL,X86,IA-64,PPC] This parameter
+   is the same effect as kernelcore parameter, except it
+   specifies the up physical address of memory range
+   usable by the kernel for non-movable allocations.
+   If both kernelcore and kernelcore_max_addr are
+   specified, this requested's priority is higher than
+   kernelcore's.
+   See the kernelcore parameter.
+
kgdbdbgp=   [KGDB,HW] kgdb over EHCI usb debug port.
Format: Controller#[,poll interval]
The controller # is the number of the ehci usb debug
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 03ad63d..65ac5c9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -204,6 +204,7 @@ static unsigned long __meminitdata dma_reserve;
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 static unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
 static unsigned long __meminitdata 
arch_zone_highest_possible_pfn[MAX_NR_ZONES];
+static unsigned long __initdata required_kernelcore_max_pfn;
 static unsigned long __initdata required_kernelcore;
 static unsigned long __initdata required_movablecore;
 static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES];
@@ -4600,6 +4601,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 {
int i, nid;
unsigned long usable_startpfn;
+   unsigned long kernelcore_max_pfn;
unsigned long kernelcore_node, kernelcore_remaining;
/* save the state before borrow the nodemask */
nodemask_t saved_node_state = node_states[N_MEMORY];
@@ -4628,6 +4630,9 @@ static void __init find_zone_movable_pfns_for_nodes(void)
required_kernelcore = max(required_kernelcore, corepages);
}
 
+   if (required_kernelcore_max_pfn  !required_kernelcore)
+   required_kernelcore = totalpages;
+
/* If kernelcore was not specified, there is no ZONE_MOVABLE */
if (!required_kernelcore)
goto out;
@@ -4636,6 +4641,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)
find_usable_zone_for_movable();
usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone];
 
+   if (required_kernelcore_max_pfn)
+   kernelcore_max_pfn = required_kernelcore_max_pfn;
+   else
+   kernelcore_max_pfn = ULONG_MAX  PAGE_SHIFT;
+   kernelcore_max_pfn = max(kernelcore_max_pfn, usable_startpfn);
+
 restart:
/* Spread kernelcore memory as evenly as possible throughout nodes */
kernelcore_node = required_kernelcore / usable_nodes;
@@ -4662,8 +4673,12 @@ restart:
unsigned long size_pages;
 
start_pfn = max(start_pfn, zone_movable_pfn[nid]);
-   if (start_pfn = end_pfn)
+   end_pfn = min(kernelcore_max_pfn, end_pfn);
+   if (start_pfn = end_pfn) {
+   if (!zone_movable_pfn[nid])
+   zone_movable_pfn[nid] = start_pfn;
continue;
+   }
 
/* Account for what is only usable for kernelcore */
if (start_pfn  usable_startpfn) {
@@ -4854,6 +4869,18 @@ static int __init cmdline_parse_core(char *p, unsigned 
long *core)
return 0;
 }
 
+#ifdef CONFIG_MOVABLE_NODE
+/*
+ * kernelcore_max_addr=addr sets the up physical address of memory range
+ * for use for allocations that cannot be reclaimed or migrated.
+ */
+static int __init 

[RFC V3 PATCH 19/25] numa: add CONFIG_MOVABLE_NODE for movable-dedicated node

2012-08-06 Thread Lai Jiangshan
All are prepared, we can actually introduce N_MEMORY.
add CONFIG_MOVABLE_NODE make we can use it for movable-dedicated node

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 drivers/base/node.c  |6 ++
 include/linux/nodemask.h |4 
 mm/Kconfig   |8 
 mm/page_alloc.c  |3 +++
 4 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 4c3aa7c..653b5e2 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -620,6 +620,9 @@ static struct node_attr node_state_attr[] = {
 #ifdef CONFIG_HIGHMEM
[N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
 #endif
+#ifdef CONFIG_MOVABLE_NODE
+   [N_MEMORY] = _NODE_ATTR(has_memory, N_MEMORY),
+#endif
[N_CPU] = _NODE_ATTR(has_cpu, N_CPU),
 };
 
@@ -630,6 +633,9 @@ static struct attribute *node_state_attrs[] = {
 #ifdef CONFIG_HIGHMEM
node_state_attr[N_HIGH_MEMORY].attr.attr,
 #endif
+#ifdef CONFIG_MOVABLE_NODE
+   node_state_attr[N_MEMORY].attr.attr,
+#endif
node_state_attr[N_CPU].attr.attr,
NULL
 };
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index c6ebdc9..4e2cbfa 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -380,7 +380,11 @@ enum node_states {
 #else
N_HIGH_MEMORY = N_NORMAL_MEMORY,
 #endif
+#ifdef CONFIG_MOVABLE_NODE
+   N_MEMORY,   /* The node has memory(regular, high, movable) 
*/
+#else
N_MEMORY = N_HIGH_MEMORY,
+#endif
N_CPU,  /* The node has one or more cpus */
NR_NODE_STATES
 };
diff --git a/mm/Kconfig b/mm/Kconfig
index 82fed4e..4371c65 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -140,6 +140,14 @@ config ARCH_DISCARD_MEMBLOCK
 config NO_BOOTMEM
boolean
 
+config MOVABLE_NODE
+   boolean Enable to assign a node has only movable memory
+   depends on HAVE_MEMBLOCK
+   depends on NO_BOOTMEM
+   depends on X86_64
+   depends on NUMA
+   default y
+
 # eventually, we can have this option just 'select SPARSEMEM'
 config MEMORY_HOTPLUG
bool Allow for memory hot-add
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index edffc35..03ad63d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -91,6 +91,9 @@ nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
 #ifdef CONFIG_HIGHMEM
[N_HIGH_MEMORY] = { { [0] = 1UL } },
 #endif
+#ifdef CONFIG_MOVABLE_NODE
+   [N_MEMORY] = { { [0] = 1UL } },
+#endif
[N_CPU] = { { [0] = 1UL } },
 #endif /* NUMA */
 };
-- 
1.7.4.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/


[RFC V3 PATCH 21/25] x86: get pg_data_t's memory from other node

2012-08-06 Thread Lai Jiangshan
From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com

If system can create movable node which all memory of the
node is allocated as ZONE_MOVABLE, setup_node_data() cannot
allocate memory for the node's pg_data_t.
So when memblock_alloc_nid() fails, setup_node_data() retries
memblock_alloc().

Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com
Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 arch/x86/mm/numa.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 2d125be..a86e315 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -223,9 +223,13 @@ static void __init setup_node_data(int nid, u64 start, u64 
end)
remapped = true;
} else {
nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
-   if (!nd_pa) {
-   pr_err(Cannot find %zu bytes in node %d\n,
+   if (!nd_pa)
+   printk(KERN_WARNING Cannot find %zu bytes in node 
%d\n,
   nd_size, nid);
+   nd_pa = memblock_alloc(nd_size, SMP_CACHE_BYTES);
+   if (!nd_pa) {
+   pr_err(Cannot find %zu bytes in other node\n,
+  nd_size);
return;
}
nd = __va(nd_pa);
-- 
1.7.4.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: [PATCH v6 00/11] omap: musb: Add device tree support

2012-08-06 Thread ABRAHAM, KISHON VIJAY
On Mon, Aug 6, 2012 at 2:22 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:39:49PM +0530, Kishon Vijay Abraham I wrote:
 This patch series adds device tree support for MUSB and device
 tree support for all the related modules to get MUSB working in
 OMAP platform.

 A new omap-usb2 phy driver has been added (with only dt suppport)
 to perform phy configurations. Previously this configuration was
 performed by twl6030, using pdata function pointers.

 With the addition of omap-usb2 to perform phy configurations,
 twl6030 is made as a comparator driver to detect VBUS and ID events
 and notify it to the glue layer.

 musb core is _NOT_ yet converted to support device tree support as it
 would need lot of driver re-design because of its enormous use of
 function pointers. That will be in _TO DO_ list.

 Changes from v5:
 minor cleanups like checking for return value in get_sync and few changes
 in the documentation has been done.

 Changes from v4:
 duplicate getting of 'mode' property is removed in omap-musb glue.

 Changes from v3:
 remove the address in the node name of usb_otg_hs since the usb_otg_hs
 node doesn't have a reg property. Thanks Ajay Gupta for finding this.

 Changes from v2:
 Fixed Sergei's comment to remove *0x* prefix in usb2phy@0x4a0ad080

 Changes from v1:
 * Fixed Rajendra Nayak comments (regulator naming, compatible naming of
 musb and other minor cleanups.)
 * It's agreed to have ocp2scp in drivers/bus and usb2 phy is a child of
 ocp2scp, the documentation is updated accordingly.

 Changes from RFC:
 Removed the dependency on [RFC PATCH 00/11] OMAP System Control Module.
 Writing to control module register is now handled in otg driver itself.
 Once the system control module driver get upstreamed, I'll send a patch
 to make use of API's in control module driver to write to control
 module register.

 This series was developed on
 git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv

 This patch series depends on
 [PATCH 0/2] omap: add ocp2scp as a bus driver

 Performed MUSB device mode testing on OMAP4 panda, OMAP4 SDP
 and OMAP3 beagle.

 Kishon Vijay Abraham I (11):
   drivers: usb: otg: add a new driver for omap usb2 phy
   arm/dts: omap: Add omap-usb2 dt data
   drivers: usb: otg: make twl6030_usb as a comparator driver to
 omap_usb2
   arm: omap: hwmod: add a new addr space in otg for writing to control
 module
   drivers: usb: twl6030: Add dt support for twl6030 usb
   arm/dts: Add twl6030-usb data
   drivers: usb: twl4030: Add device tree support for twl4030 usb
   arm/dts: Add twl4030-usb data
   drivers: usb: musb: Add device tree support for omap musb glue
   arm/dts: omap: Add usb_otg and glue data
   arm: omap: phy: remove unused functions from omap-phy-internal.c

 When you send your next series, can you please split the stuff based on
 their dependencies or at least note here what depends on what ? I mean,
 I cannot take the DT patches without an Acked-by Grant and Tony, but the
 drivers themselves I could take queue them since they're already in good
 shape ;-)

 Maybe just start the series with patches without dependencies on one
 another, and the rest of the series would be ones that need to go
 together, or something. That'll help me ;-)

Ok Felipe.

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


[RFC V3 PATCH 13/25] vmstat: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Christoph Lameter c...@linux.com
---
 mm/vmstat.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 1d9..aa3da12 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -917,7 +917,7 @@ static int pagetypeinfo_show(struct seq_file *m, void *arg)
pg_data_t *pgdat = (pg_data_t *)arg;
 
/* check memoryless node */
-   if (!node_state(pgdat-node_id, N_HIGH_MEMORY))
+   if (!node_state(pgdat-node_id, N_MEMORY))
return 0;
 
seq_printf(m, Page block order: %d\n, pageblock_order);
@@ -1279,7 +1279,7 @@ static int unusable_show(struct seq_file *m, void *arg)
pg_data_t *pgdat = (pg_data_t *)arg;
 
/* check memoryless node */
-   if (!node_state(pgdat-node_id, N_HIGH_MEMORY))
+   if (!node_state(pgdat-node_id, N_MEMORY))
return 0;
 
walk_zones_in_node(m, pgdat, unusable_show_print);
-- 
1.7.4.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/


[RFC V3 PATCH 10/25] mm,migrate: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Christoph Lameter c...@linux.com
---
 mm/migrate.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index be26d5c..dbe4f86 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1226,7 +1226,7 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t 
task_nodes,
if (node  0 || node = MAX_NUMNODES)
goto out_pm;
 
-   if (!node_state(node, N_HIGH_MEMORY))
+   if (!node_state(node, N_MEMORY))
goto out_pm;
 
err = -EACCES;
-- 
1.7.4.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/


[RFC V3 PATCH 09/25] oom: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Hillf Danton dhi...@gmail.com
---
 mm/oom_kill.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index ac300c9..1e58f12 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -257,7 +257,7 @@ static enum oom_constraint constrained_alloc(struct 
zonelist *zonelist,
 * the page allocator means a mempolicy is in effect.  Cpuset policy
 * is enforced in get_page_from_freelist().
 */
-   if (nodemask  !nodes_subset(node_states[N_HIGH_MEMORY], *nodemask)) {
+   if (nodemask  !nodes_subset(node_states[N_MEMORY], *nodemask)) {
*totalpages = total_swap_pages;
for_each_node_mask(nid, *nodemask)
*totalpages += node_spanned_pages(nid);
-- 
1.7.4.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/


[RFC V3 PATCH 08/25] memcontrol: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 mm/memcontrol.c  |   18 +-
 mm/page_cgroup.c |2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f72b5e5..4402c2e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -797,7 +797,7 @@ static unsigned long mem_cgroup_nr_lru_pages(struct 
mem_cgroup *memcg,
int nid;
u64 total = 0;
 
-   for_each_node_state(nid, N_HIGH_MEMORY)
+   for_each_node_state(nid, N_MEMORY)
total += mem_cgroup_node_nr_lru_pages(memcg, nid, lru_mask);
return total;
 }
@@ -1549,9 +1549,9 @@ static void mem_cgroup_may_update_nodemask(struct 
mem_cgroup *memcg)
return;
 
/* make a nodemask where this memcg uses memory from */
-   memcg-scan_nodes = node_states[N_HIGH_MEMORY];
+   memcg-scan_nodes = node_states[N_MEMORY];
 
-   for_each_node_mask(nid, node_states[N_HIGH_MEMORY]) {
+   for_each_node_mask(nid, node_states[N_MEMORY]) {
 
if (!test_mem_cgroup_node_reclaimable(memcg, nid, false))
node_clear(nid, memcg-scan_nodes);
@@ -1622,7 +1622,7 @@ static bool mem_cgroup_reclaimable(struct mem_cgroup 
*memcg, bool noswap)
/*
 * Check rest of nodes.
 */
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
if (node_isset(nid, memcg-scan_nodes))
continue;
if (test_mem_cgroup_node_reclaimable(memcg, nid, noswap))
@@ -3700,7 +3700,7 @@ move_account:
drain_all_stock_sync(memcg);
ret = 0;
mem_cgroup_start_move(memcg);
-   for_each_node_state(node, N_HIGH_MEMORY) {
+   for_each_node_state(node, N_MEMORY) {
for (zid = 0; !ret  zid  MAX_NR_ZONES; zid++) {
enum lru_list lru;
for_each_lru(lru) {
@@ -4025,7 +4025,7 @@ static int mem_control_numa_stat_show(struct cgroup 
*cont, struct cftype *cft,
 
total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL);
seq_printf(m, total=%lu, total_nr);
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid, LRU_ALL);
seq_printf(m,  N%d=%lu, nid, node_nr);
}
@@ -4033,7 +4033,7 @@ static int mem_control_numa_stat_show(struct cgroup 
*cont, struct cftype *cft,
 
file_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL_FILE);
seq_printf(m, file=%lu, file_nr);
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
LRU_ALL_FILE);
seq_printf(m,  N%d=%lu, nid, node_nr);
@@ -4042,7 +4042,7 @@ static int mem_control_numa_stat_show(struct cgroup 
*cont, struct cftype *cft,
 
anon_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL_ANON);
seq_printf(m, anon=%lu, anon_nr);
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
LRU_ALL_ANON);
seq_printf(m,  N%d=%lu, nid, node_nr);
@@ -4051,7 +4051,7 @@ static int mem_control_numa_stat_show(struct cgroup 
*cont, struct cftype *cft,
 
unevictable_nr = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_UNEVICTABLE));
seq_printf(m, unevictable=%lu, unevictable_nr);
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(memcg, nid,
BIT(LRU_UNEVICTABLE));
seq_printf(m,  N%d=%lu, nid, node_nr);
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index eb750f8..e775239 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -271,7 +271,7 @@ void __init page_cgroup_init(void)
if (mem_cgroup_disabled())
return;
 
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
unsigned long start_pfn, end_pfn;
 
start_pfn = node_start_pfn(nid);
-- 
1.7.4.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/


[RFC V3 PATCH 14/25] kthread: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 kernel/kthread.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 3d3de63..4139962 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -280,7 +280,7 @@ int kthreadd(void *unused)
set_task_comm(tsk, kthreadd);
ignore_signals(tsk);
set_cpus_allowed_ptr(tsk, cpu_all_mask);
-   set_mems_allowed(node_states[N_HIGH_MEMORY]);
+   set_mems_allowed(node_states[N_MEMORY]);
 
current-flags |= PF_NOFREEZE;
 
-- 
1.7.4.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/


[RFC V3 PATCH 12/25] hugetlb: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Hillf Danton dhi...@gmail.com
---
 drivers/base/node.c |2 +-
 mm/hugetlb.c|   24 
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 5d7731e..4c3aa7c 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -227,7 +227,7 @@ static node_registration_func_t __hugetlb_unregister_node;
 static inline bool hugetlb_register_node(struct node *node)
 {
if (__hugetlb_register_node 
-   node_state(node-dev.id, N_HIGH_MEMORY)) {
+   node_state(node-dev.id, N_MEMORY)) {
__hugetlb_register_node(node);
return true;
}
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index e198831..661db47 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1046,7 +1046,7 @@ static void return_unused_surplus_pages(struct hstate *h,
 * on-line nodes with memory and will handle the hstate accounting.
 */
while (nr_pages--) {
-   if (!free_pool_huge_page(h, node_states[N_HIGH_MEMORY], 1))
+   if (!free_pool_huge_page(h, node_states[N_MEMORY], 1))
break;
}
 }
@@ -1150,14 +1150,14 @@ static struct page *alloc_huge_page(struct 
vm_area_struct *vma,
 int __weak alloc_bootmem_huge_page(struct hstate *h)
 {
struct huge_bootmem_page *m;
-   int nr_nodes = nodes_weight(node_states[N_HIGH_MEMORY]);
+   int nr_nodes = nodes_weight(node_states[N_MEMORY]);
 
while (nr_nodes) {
void *addr;
 
addr = __alloc_bootmem_node_nopanic(
NODE_DATA(hstate_next_node_to_alloc(h,
-   node_states[N_HIGH_MEMORY])),
+   node_states[N_MEMORY])),
huge_page_size(h), huge_page_size(h), 0);
 
if (addr) {
@@ -1229,7 +1229,7 @@ static void __init hugetlb_hstate_alloc_pages(struct 
hstate *h)
if (!alloc_bootmem_huge_page(h))
break;
} else if (!alloc_fresh_huge_page(h,
-node_states[N_HIGH_MEMORY]))
+node_states[N_MEMORY]))
break;
}
h-max_huge_pages = i;
@@ -1497,7 +1497,7 @@ static ssize_t nr_hugepages_store_common(bool 
obey_mempolicy,
if (!(obey_mempolicy 
init_nodemask_of_mempolicy(nodes_allowed))) {
NODEMASK_FREE(nodes_allowed);
-   nodes_allowed = node_states[N_HIGH_MEMORY];
+   nodes_allowed = node_states[N_MEMORY];
}
} else if (nodes_allowed) {
/*
@@ -1507,11 +1507,11 @@ static ssize_t nr_hugepages_store_common(bool 
obey_mempolicy,
count += h-nr_huge_pages - h-nr_huge_pages_node[nid];
init_nodemask_of_node(nodes_allowed, nid);
} else
-   nodes_allowed = node_states[N_HIGH_MEMORY];
+   nodes_allowed = node_states[N_MEMORY];
 
h-max_huge_pages = set_max_huge_pages(h, count, nodes_allowed);
 
-   if (nodes_allowed != node_states[N_HIGH_MEMORY])
+   if (nodes_allowed != node_states[N_MEMORY])
NODEMASK_FREE(nodes_allowed);
 
return len;
@@ -1812,7 +1812,7 @@ static void hugetlb_register_all_nodes(void)
 {
int nid;
 
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
struct node *node = node_devices[nid];
if (node-dev.id == nid)
hugetlb_register_node(node);
@@ -1906,8 +1906,8 @@ void __init hugetlb_add_hstate(unsigned order)
h-free_huge_pages = 0;
for (i = 0; i  MAX_NUMNODES; ++i)
INIT_LIST_HEAD(h-hugepage_freelists[i]);
-   h-next_nid_to_alloc = first_node(node_states[N_HIGH_MEMORY]);
-   h-next_nid_to_free = first_node(node_states[N_HIGH_MEMORY]);
+   h-next_nid_to_alloc = first_node(node_states[N_MEMORY]);
+   h-next_nid_to_free = first_node(node_states[N_MEMORY]);
snprintf(h-name, HSTATE_NAME_LEN, hugepages-%lukB,
huge_page_size(h)/1024);
 
@@ -1995,11 +1995,11 @@ static int hugetlb_sysctl_handler_common(bool 
obey_mempolicy,
if (!(obey_mempolicy 
   init_nodemask_of_mempolicy(nodes_allowed))) {
NODEMASK_FREE(nodes_allowed);
-   nodes_allowed = node_states[N_HIGH_MEMORY];
+   

Re: Huge performance degradation for UDP between 2.4.17 and 2.6

2012-08-06 Thread leroy christophe


Le 05/08/2012 10:28, Eric Dumazet a écrit :

On Sun, 2012-08-05 at 10:16 +0200, LEROY christophe wrote:

Le 02/08/2012 16:13, Eric Dumazet a écrit :

On Thu, 2012-08-02 at 14:27 +0200, leroy christophe wrote:

Hi

I'm having a big issue with UDP. Using a powerpc board (MPC860).

With our board running kernel 2.4.17, I'm able to send 16 voice
packets (UDP, 96 bytes per packet) in 11 seconds.
With the same board running either Kernel 2.6.35.14 or Kernel 3.4.7, I
need 55 seconds to send the same amount of packets.


Is there anything to tune in order to get same output rate as with
Kernel 2.4 ?

kernel size is probably too big for your old / slow cpu.

Maybe you added too many features on your 3.4.7 kernel. (netfilter ?
SLUB debugging ...)

Its hard to say, 2.4.17 had less features and was faster.


Thanks for your answer.
Yes I have netfilter as I need it. However, I tried without it and still
need about 37 seconds to send the 16 packets I was sending in 11
seconds with 2.4.17

I don't think there is any problem with size of the kernel. I still have
plenty of memory available.


I believe you misunderstood me.

I was referring to cpu caches ( dcache  icache )


All debugging is turned off, and I'm not using SLUB but SLOB.
I have 32Mbytes of RAM. Would SLUB be more performant than SLOB ?

I never used SLOB I cannot comment

Please provide (on 3.4.7)

cat /proc/cpuinfo
lsmod
dmesg


Ok, I have recompiled with SLUB.
Find attached cpuinfo, lsmod and dmesg. I do not have any modules loaded.

Module  Size  Used byNot tainted
processor   : 0
cpu : 8xx
clock   : 132.00MHz
revision: 0.0 (pvr 0050 )
bogomips: 16.50
timebase: 825
platform: CMPC885
model   : MIAE
Memory  : 128 MB
[0.00] Using CMPC885 machine description
[0.00] Linux version 3.4.7-s3k-3.8.3+-svn2796 
(root@localhost.localdomain) (gcc version 4.4.4 (GCC) ) #19 PREEMPT Sun Aug 5 
06:43:31 CEST 2012
[0.00] Top of RAM: 0x800, Total RAM: 0x800
[0.00] Memory hole size: 0MB
[0.00] Zone PFN ranges:
[0.00]   DMA  0x - 0x8000
[0.00]   Normal   empty
[0.00] Movable zone start PFN for each node
[0.00] Early memory PFN ranges
[0.00] 0: 0x - 0x8000
[0.00] On node 0 totalpages: 32768
[0.00] free_area_init_node: node 0, pgdat c03f4be8, node_mem_map 
c0433000
[0.00]   DMA zone: 256 pages used for memmap
[0.00]   DMA zone: 0 pages reserved
[0.00]   DMA zone: 32512 pages, LIFO batch:7
[0.00] MMU: Allocated 72 bytes of context maps for 16 contexts
[0.00] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[0.00] pcpu-alloc: [0] 0 
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 32512
[0.00] Kernel command line: console=ttyCPM0,115200N8 
ip=172.25.231.39:172.25.231.59::255.0.0.0:miae:eth0:off
[0.00] PID hash table entries: 512 (order: -1, 2048 bytes)
[0.00] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[0.00] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[0.00] Memory: 125432k/131072k available (3972k kernel code, 5640k 
reserved, 140k data, 178k bss, 488k init)
[0.00] Kernel virtual memory layout:
[0.00]   * 0xfffdf000..0xf000  : fixmap
[0.00]   * 0xfde0..0xfe00  : consistent mem
[0.00]   * 0xfddf6000..0xfde0  : early ioremap
[0.00]   * 0xc900..0xfddf6000  : vmalloc  ioremap
[0.00] SLUB: Genslabs=14, HWalign=16, Order=0-3, MinObjects=0, CPUs=1, 
Nodes=1
[0.00] NR_IRQS:512 nr_irqs:512 16
[0.00] Decrementer Frequency = 0x7de290
[0.00] time_init: decrementer frequency = 8.25 MHz
[0.00] time_init: processor frequency   = 132.00 MHz
[0.00] clocksource: timebase mult[79364d93] shift[24] registered
[0.00] clockevent: decrementer mult[21cac08] shift[32] cpu[0]
[0.00] console [ttyCPM0] enabled
[0.144102] pid_max: default: 32768 minimum: 301
[0.149489] Mount-cache hash table entries: 512
[0.175086] devtmpfs: initialized
[0.178575] device: 'platform': device_add
[0.179079] bus: 'platform': registered
[0.179451] bus: 'cpu': registered
[0.179551] device: 'cpu': device_add
[0.181718] NET: Registered protocol family 16
[0.186374] device class 'bdi': registering
[0.188054] device class 'gpio': registering
[0.189423] device class 'tty': registering
[0.191855] bus: 'spi': registered
[0.191932] device class 'spi_master': registering
[0.193842] gpiochip_find_base: found new base at 1008
[0.193974] device: 'gpiochip1008': device_add
[0.195387] gpiochip_add: registered GPIOs 1008 to 1023 on device: 
/soc@ff00/cpm@9c0/gpio-controller@950
[0.205830] gpiochip_find_base: found new base at 976
[

[RFC V3 PATCH 07/25] procfs: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Hillf Danton dhi...@gmail.com
---
 fs/proc/kcore.c|2 +-
 fs/proc/task_mmu.c |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 86c67ee..e96d4f1 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -249,7 +249,7 @@ static int kcore_update_ram(void)
/* Not inializedupdate now */
/* find out max pfn */
end_pfn = 0;
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
unsigned long node_end;
node_end  = NODE_DATA(nid)-node_start_pfn +
NODE_DATA(nid)-node_spanned_pages;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 4540b8f..ed3d381 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1080,7 +1080,7 @@ static struct page *can_gather_numa_stats(pte_t pte, 
struct vm_area_struct *vma,
return NULL;
 
nid = page_to_nid(page);
-   if (!node_isset(nid, node_states[N_HIGH_MEMORY]))
+   if (!node_isset(nid, node_states[N_MEMORY]))
return NULL;
 
return page;
@@ -1232,7 +1232,7 @@ static int show_numa_map(struct seq_file *m, void *v, int 
is_pid)
if (md-writeback)
seq_printf(m,  writeback=%lu, md-writeback);
 
-   for_each_node_state(n, N_HIGH_MEMORY)
+   for_each_node_state(n, N_MEMORY)
if (md-node[n])
seq_printf(m,  N%d=%lu, n, md-node[n]);
 out:
-- 
1.7.4.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/


[PATCH] driver: misc: bmp085: remove of_match_table property.

2012-08-06 Thread Sourav Poddar
There is an automatic binding done for I2C devices in the of_i2c core
code. So, DT will be able to bind to any I2C device using the
already existing table: MODULE_DEVICE_TABLE(i2c, bmp085_id).

Tested on omap5430 evm.

Cc: Benoit Cousson b-cous...@ti.com
Cc: Felipe Balbi ba...@ti.com
Cc: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: Sourav Poddar sourav.pod...@ti.com
---
 drivers/misc/bmp085-i2c.c |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/bmp085-i2c.c b/drivers/misc/bmp085-i2c.c
index 9943971..a4f33c9 100644
--- a/drivers/misc/bmp085-i2c.c
+++ b/drivers/misc/bmp085-i2c.c
@@ -57,12 +57,6 @@ static int bmp085_i2c_remove(struct i2c_client *client)
return bmp085_remove(client-dev);
 }
 
-static const struct of_device_id bmp085_of_match[] = {
-   { .compatible = bosch,bmp085, },
-   { },
-};
-MODULE_DEVICE_TABLE(of, bmp085_of_match);
-
 static const struct i2c_device_id bmp085_id[] = {
{ BMP085_NAME, 0 },
{ bmp180, 0 },
@@ -74,7 +68,6 @@ static struct i2c_driver bmp085_i2c_driver = {
.driver = {
.owner  = THIS_MODULE,
.name   = BMP085_NAME,
-   .of_match_table = bmp085_of_match
},
.id_table   = bmp085_id,
.probe  = bmp085_i2c_probe,
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] timer: do not define __mod_timer as inline function

2012-08-06 Thread Yuanhan Liu
__mod_timer() is a bit 'huge' to be defined as inline.

$ size kernel/timer*.o
   textdata bss dec hex filename
  1890840348257   3119979df kernel/timer-before.o
  1796140348257   30252762c kernel/timer-after.o

Cc: Thomas Gleixner t...@linutronix.de
Cc: Ingo Molnar mi...@kernel.org
Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
---
 kernel/timer.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index a61c093..0be4216 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -736,7 +736,7 @@ static struct tvec_base *lock_timer_base(struct timer_list 
*timer,
}
 }
 
-static inline int
+static int
 __mod_timer(struct timer_list *timer, unsigned long expires,
bool pending_only, int pinned)
 {
-- 
1.7.7.6

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


[RFC V3 PATCH 11/25] mempolicy: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 mm/mempolicy.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1d771e4..ad0381d 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -212,9 +212,9 @@ static int mpol_set_nodemask(struct mempolicy *pol,
/* if mode is MPOL_DEFAULT, pol is NULL. This is right. */
if (pol == NULL)
return 0;
-   /* Check N_HIGH_MEMORY */
+   /* Check N_MEMORY */
nodes_and(nsc-mask1,
- cpuset_current_mems_allowed, node_states[N_HIGH_MEMORY]);
+ cpuset_current_mems_allowed, node_states[N_MEMORY]);
 
VM_BUG_ON(!nodes);
if (pol-mode == MPOL_PREFERRED  nodes_empty(*nodes))
@@ -1363,7 +1363,7 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, 
maxnode,
goto out_put;
}
 
-   if (!nodes_subset(*new, node_states[N_HIGH_MEMORY])) {
+   if (!nodes_subset(*new, node_states[N_MEMORY])) {
err = -EINVAL;
goto out_put;
}
@@ -2314,7 +2314,7 @@ void __init numa_policy_init(void)
 * fall back to the largest node if they're all smaller.
 */
nodes_clear(interleave_nodes);
-   for_each_node_state(nid, N_HIGH_MEMORY) {
+   for_each_node_state(nid, N_MEMORY) {
unsigned long total_pages = node_present_pages(nid);
 
/* Preserve the largest node */
@@ -2395,7 +2395,7 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, 
int no_context)
*nodelist++ = '\0';
if (nodelist_parse(nodelist, nodes))
goto out;
-   if (!nodes_subset(nodes, node_states[N_HIGH_MEMORY]))
+   if (!nodes_subset(nodes, node_states[N_MEMORY]))
goto out;
} else
nodes_clear(nodes);
@@ -2429,7 +2429,7 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, 
int no_context)
 * Default to online nodes with memory if no nodelist
 */
if (!nodelist)
-   nodes = node_states[N_HIGH_MEMORY];
+   nodes = node_states[N_MEMORY];
break;
case MPOL_LOCAL:
/*
-- 
1.7.4.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/


[RFC V3 PATCH 03/25] slub, hotplug: ignore unrelated node's hot-adding and hot-removing

2012-08-06 Thread Lai Jiangshan
SLUB only fucus on the nodes which has normal memory, so ignore the other
node's hot-adding and hot-removing.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 mm/slub.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 8c691fa..f8b137a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3568,7 +3568,7 @@ static void slab_mem_offline_callback(void *arg)
struct memory_notify *marg = arg;
int offline_node;
 
-   offline_node = marg-status_change_nid;
+   offline_node = marg-status_change_nid_normal;
 
/*
 * If the node still has available memory. we need kmem_cache_node
@@ -3601,7 +3601,7 @@ static int slab_mem_going_online_callback(void *arg)
struct kmem_cache_node *n;
struct kmem_cache *s;
struct memory_notify *marg = arg;
-   int nid = marg-status_change_nid;
+   int nid = marg-status_change_nid_normal;
int ret = 0;
 
/*
-- 
1.7.4.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/


[RFC V3 PATCH 01/25] page_alloc.c: don't subtract unrelated memmap from zone's present pages

2012-08-06 Thread Lai Jiangshan
A)==
Currently, memory-page-map(struct page array) is not defined in struct zone.
It is defined in several ways:

FLATMEM: global memmap, can be allocated from any zone = ZONE_NORMAL
CONFIG_DISCONTIGMEM: node-specific memmap, can be allocated from any
 zone = ZONE_NORMAL within that node.
CONFIG_SPARSEMEM: memorysection-specific memmap, can be allocated from any zone,
  when CONFIG_SPARSEMEM_VMEMMAP, it is even not physical 
continuous.

So, the memmap has nothing directly related with the zone. And it's memory can 
be
allocated outside, so it is wrong to subtract memmap's size from zone's
present pages.

B)==
When system has large holes, the subtracted-present-pages-size will become
very small or negative, make the memory management works bad at the zone or
make the zone unusable even the real-present-pages-size is actually large.

C)==
And subtracted-present-pages-size has problem when memory-hot-removing,
the zone-zone-present_pages may overflow and become huge(unsigned long).

D)==
memory-page-map is large and long living unreclaimable memory, it is good to
subtract them for proper watermark.
So a new proper approach is needed to do it similarly
and new approach should also handle other long living unreclaimable memory.

Current blindly subtracted-present-pages-size approach does wrong, remove it.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 mm/page_alloc.c |   20 +---
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4a4f921..9312702 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4357,30 +4357,12 @@ static void __paginginit free_area_init_core(struct 
pglist_data *pgdat,
 
for (j = 0; j  MAX_NR_ZONES; j++) {
struct zone *zone = pgdat-node_zones + j;
-   unsigned long size, realsize, memmap_pages;
+   unsigned long size, realsize;
 
size = zone_spanned_pages_in_node(nid, j, zones_size);
realsize = size - zone_absent_pages_in_node(nid, j,
zholes_size);
 
-   /*
-* Adjust realsize so that it accounts for how much memory
-* is used by this zone for memmap. This affects the watermark
-* and per-cpu initialisations
-*/
-   memmap_pages =
-   PAGE_ALIGN(size * sizeof(struct page))  PAGE_SHIFT;
-   if (realsize = memmap_pages) {
-   realsize -= memmap_pages;
-   if (memmap_pages)
-   printk(KERN_DEBUG
-%s zone: %lu pages used for memmap\n,
-  zone_names[j], memmap_pages);
-   } else
-   printk(KERN_WARNING
- %s zone: %lu pages exceeds realsize %lu\n,
-   zone_names[j], memmap_pages, realsize);
-
/* Account for reserved pages */
if (j == 0  realsize  dma_reserve) {
realsize -= dma_reserve;
-- 
1.7.4.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/


[RFC V3 PATCH 06/25] cpuset: use N_MEMORY instead N_HIGH_MEMORY

2012-08-06 Thread Lai Jiangshan
N_HIGH_MEMORY stands for the nodes that has normal or high memory.
N_MEMORY stands for the nodes that has any memory.

The code here need to handle with the nodes which have memory, we should
use N_MEMORY instead.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
Acked-by: Hillf Danton dhi...@gmail.com
---
 Documentation/cgroups/cpusets.txt |2 +-
 include/linux/cpuset.h|2 +-
 kernel/cpuset.c   |   32 
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/Documentation/cgroups/cpusets.txt 
b/Documentation/cgroups/cpusets.txt
index cefd3d8..12e01d4 100644
--- a/Documentation/cgroups/cpusets.txt
+++ b/Documentation/cgroups/cpusets.txt
@@ -218,7 +218,7 @@ and name space for cpusets, with a minimum of additional 
kernel code.
 The cpus and mems files in the root (top_cpuset) cpuset are
 read-only.  The cpus file automatically tracks the value of
 cpu_online_mask using a CPU hotplug notifier, and the mems file
-automatically tracks the value of node_states[N_HIGH_MEMORY]--i.e.,
+automatically tracks the value of node_states[N_MEMORY]--i.e.,
 nodes with memory--using the cpuset_track_online_nodes() hook.
 
 
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 838320f..8c8a60d29 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -144,7 +144,7 @@ static inline nodemask_t cpuset_mems_allowed(struct 
task_struct *p)
return node_possible_map;
 }
 
-#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
+#define cpuset_current_mems_allowed (node_states[N_MEMORY])
 static inline void cpuset_init_current_mems_allowed(void) {}
 
 static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index f33c715..2b133db 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -302,10 +302,10 @@ static void guarantee_online_cpus(const struct cpuset *cs,
  * are online, with memory.  If none are online with memory, walk
  * up the cpuset hierarchy until we find one that does have some
  * online mems.  If we get all the way to the top and still haven't
- * found any online mems, return node_states[N_HIGH_MEMORY].
+ * found any online mems, return node_states[N_MEMORY].
  *
  * One way or another, we guarantee to return some non-empty subset
- * of node_states[N_HIGH_MEMORY].
+ * of node_states[N_MEMORY].
  *
  * Call with callback_mutex held.
  */
@@ -313,14 +313,14 @@ static void guarantee_online_cpus(const struct cpuset *cs,
 static void guarantee_online_mems(const struct cpuset *cs, nodemask_t *pmask)
 {
while (cs  !nodes_intersects(cs-mems_allowed,
-   node_states[N_HIGH_MEMORY]))
+   node_states[N_MEMORY]))
cs = cs-parent;
if (cs)
nodes_and(*pmask, cs-mems_allowed,
-   node_states[N_HIGH_MEMORY]);
+   node_states[N_MEMORY]);
else
-   *pmask = node_states[N_HIGH_MEMORY];
-   BUG_ON(!nodes_intersects(*pmask, node_states[N_HIGH_MEMORY]));
+   *pmask = node_states[N_MEMORY];
+   BUG_ON(!nodes_intersects(*pmask, node_states[N_MEMORY]));
 }
 
 /*
@@ -1100,7 +1100,7 @@ static int update_nodemask(struct cpuset *cs, struct 
cpuset *trialcs,
return -ENOMEM;
 
/*
-* top_cpuset.mems_allowed tracks node_stats[N_HIGH_MEMORY];
+* top_cpuset.mems_allowed tracks node_stats[N_MEMORY];
 * it's read-only
 */
if (cs == top_cpuset) {
@@ -1122,7 +1122,7 @@ static int update_nodemask(struct cpuset *cs, struct 
cpuset *trialcs,
goto done;
 
if (!nodes_subset(trialcs-mems_allowed,
-   node_states[N_HIGH_MEMORY])) {
+   node_states[N_MEMORY])) {
retval =  -EINVAL;
goto done;
}
@@ -2034,7 +2034,7 @@ static struct cpuset *cpuset_next(struct list_head *queue)
  * before dropping down to the next.  It always processes a node before
  * any of its children.
  *
- * In the case of memory hot-unplug, it will remove nodes from N_HIGH_MEMORY
+ * In the case of memory hot-unplug, it will remove nodes from N_MEMORY
  * if all present pages from a node are offlined.
  */
 static void
@@ -2073,7 +2073,7 @@ scan_cpusets_upon_hotplug(struct cpuset *root, enum 
hotplug_event event)
 
/* Continue past cpusets with all mems online */
if (nodes_subset(cp-mems_allowed,
-   node_states[N_HIGH_MEMORY]))
+   node_states[N_MEMORY]))
continue;
 
oldmems = cp-mems_allowed;
@@ -2081,7 +2081,7 @@ scan_cpusets_upon_hotplug(struct cpuset *root, enum 
hotplug_event event)
  

Re: [PATCH] drivers: net: irda: bfin_sir: fix compile error

2012-08-06 Thread Bob Liu
Hi Samuel,

Would you please take a look at this patch?
Since without this patch, regression test for blackfin will fail:
http://kisskb.ellerman.id.au/kisskb/matrix/

Thank you!

On Mon, Jul 30, 2012 at 2:44 PM, Bob Liu lliu...@gmail.com wrote:
 From: Sonic Zhang sonic.zh...@analog.com

 Bit IREN is replaced by UMOD_IRDA and UMOD_MASK since blackfin 60x added, but
 this driver didn't update which will cause bfin_sir build error:

 drivers/net/irda/bfin_sir.c:161:9: error: 'IREN' undeclared (first use in this
 function)
 drivers/net/irda/bfin_sir.c:435:18: error: 'IREN' undeclared (first use in
 this function)
 drivers/net/irda/bfin_sir.c:521:11: error: 'IREN' undeclared (first use in
 this function)

 This patch fix it.

 Signed-off-by: Sonic Zhang sonic.zh...@analog.com
 Signed-off-by: Bob Liu lliu...@gmail.com
 ---
  drivers/net/irda/bfin_sir.c |8 
  1 file changed, 4 insertions(+), 4 deletions(-)

 diff --git a/drivers/net/irda/bfin_sir.c b/drivers/net/irda/bfin_sir.c
 index a561ae4..c6a0299 100644
 --- a/drivers/net/irda/bfin_sir.c
 +++ b/drivers/net/irda/bfin_sir.c
 @@ -158,7 +158,7 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, 
 int speed)
 /* If not add the 'RPOLC', we can't catch the receive interrupt.
  * It's related with the HW layout and the IR transiver.
  */
 -   val |= IREN | RPOLC;
 +   val |= UMOD_IRDA | RPOLC;
 UART_PUT_GCTL(port, val);
 return ret;
  }
 @@ -432,7 +432,7 @@ static void bfin_sir_shutdown(struct bfin_sir_port *port, 
 struct net_device *dev
 bfin_sir_stop_rx(port);

 val = UART_GET_GCTL(port);
 -   val = ~(UCEN | IREN | RPOLC);
 +   val = ~(UCEN | UMOD_MASK | RPOLC);
 UART_PUT_GCTL(port, val);

  #ifdef CONFIG_SIR_BFIN_DMA
 @@ -518,10 +518,10 @@ static void bfin_sir_send_work(struct work_struct *work)
  * reset all the UART.
  */
 val = UART_GET_GCTL(port);
 -   val = ~(IREN | RPOLC);
 +   val = ~(UMOD_MASK | RPOLC);
 UART_PUT_GCTL(port, val);
 SSYNC();
 -   val |= IREN | RPOLC;
 +   val |= UMOD_IRDA | RPOLC;
 UART_PUT_GCTL(port, val);
 SSYNC();
 /* bfin_sir_set_speed(port, self-speed); */
 --
 1.7.9.5



-- 
Regards,
--Bob
--
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: No 3.5 version on www.kernel.org

2012-08-06 Thread Borislav Petkov
On Mon, Aug 06, 2012 at 08:48:56AM +0200, Tino Keitel wrote:
 Hi,
 
 when looking at http://www.kernel.org/, kernel 3.4.7 is shown as the
 latest stable kernel, and 3.6-rc1 as the latest mainline kernel. The
 3.5 version is not mentioned. Why is the latest stable kernel something
 older than 3.5?

Someone already asked this. Let's cc one more party (although
webmaster@.. could be going to the same people :-)).

-- 
Regards/Gruss,
Boris.
--
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/


[RFC V3 PATCH 04/25] node: cleanup node_state_attr

2012-08-06 Thread Lai Jiangshan
Make it more readability and easy to add new state.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 drivers/base/node.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index af1a177..5d7731e 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -614,23 +614,23 @@ static ssize_t show_node_state(struct device *dev,
{ __ATTR(name, 0444, show_node_state, NULL), state }
 
 static struct node_attr node_state_attr[] = {
-   _NODE_ATTR(possible, N_POSSIBLE),
-   _NODE_ATTR(online, N_ONLINE),
-   _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY),
-   _NODE_ATTR(has_cpu, N_CPU),
+   [N_POSSIBLE] = _NODE_ATTR(possible, N_POSSIBLE),
+   [N_ONLINE] = _NODE_ATTR(online, N_ONLINE),
+   [N_NORMAL_MEMORY] = _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY),
 #ifdef CONFIG_HIGHMEM
-   _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
+   [N_HIGH_MEMORY] = _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
 #endif
+   [N_CPU] = _NODE_ATTR(has_cpu, N_CPU),
 };
 
 static struct attribute *node_state_attrs[] = {
-   node_state_attr[0].attr.attr,
-   node_state_attr[1].attr.attr,
-   node_state_attr[2].attr.attr,
-   node_state_attr[3].attr.attr,
+   node_state_attr[N_POSSIBLE].attr.attr,
+   node_state_attr[N_ONLINE].attr.attr,
+   node_state_attr[N_NORMAL_MEMORY].attr.attr,
 #ifdef CONFIG_HIGHMEM
-   node_state_attr[4].attr.attr,
+   node_state_attr[N_HIGH_MEMORY].attr.attr,
 #endif
+   node_state_attr[N_CPU].attr.attr,
NULL
 };
 
-- 
1.7.4.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/


[RFC V3 PATCH 02/25] memory_hotplug: fix missing nodemask management

2012-08-06 Thread Lai Jiangshan
Currently memory_hotplug only manages the node_states[N_HIGH_MEMORY],
it forgot to manage node_states[N_NORMAL_MEMORY]. fix it.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 Documentation/memory-hotplug.txt |5 ++-
 include/linux/memory.h   |1 +
 mm/memory_hotplug.c  |   94 +++--
 3 files changed, 83 insertions(+), 17 deletions(-)

diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
index 6d0c251..6e6cbc7 100644
--- a/Documentation/memory-hotplug.txt
+++ b/Documentation/memory-hotplug.txt
@@ -377,15 +377,18 @@ The third argument is passed by pointer of struct 
memory_notify.
 struct memory_notify {
unsigned long start_pfn;
unsigned long nr_pages;
+   int status_change_nid_normal;
int status_change_nid;
 }
 
 start_pfn is start_pfn of online/offline memory.
 nr_pages is # of pages of online/offline memory.
+status_change_nid_normal is set node id when N_NORMAL_MEMORY of nodemask
+is (will be) set/clear, if this is -1, then nodemask status is not changed.
 status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be)
 set/clear. It means a new(memoryless) node gets new memory by online and a
 node loses all memory. If this is -1, then nodemask status is not changed.
-If status_changed_nid = 0, callback should create/discard structures for the
+If status_changed_nid* = 0, callback should create/discard structures for the
 node if necessary.
 
 --
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 1ac7f6e..6b9202b 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -53,6 +53,7 @@ int arch_get_memory_phys_device(unsigned long start_pfn);
 struct memory_notify {
unsigned long start_pfn;
unsigned long nr_pages;
+   int status_change_nid_normal;
int status_change_nid;
 };
 
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 427bb29..3438c4a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -456,6 +456,34 @@ static int online_pages_range(unsigned long start_pfn, 
unsigned long nr_pages,
return 0;
 }
 
+static void check_nodemasks_changes_online(unsigned long nr_pages,
+   struct zone *zone, struct memory_notify *arg)
+{
+   int nid = zone_to_nid(zone);
+   enum zone_type zone_last = ZONE_NORMAL;
+
+   if (N_HIGH_MEMORY == N_NORMAL_MEMORY)
+   zone_last = ZONE_MOVABLE;
+
+   if (zone_idx(zone) = zone_last  !node_state(nid, N_NORMAL_MEMORY))
+   arg-status_change_nid_normal = nid;
+   else
+   arg-status_change_nid_normal = -1;
+
+   if (!node_state(nid, N_HIGH_MEMORY))
+   arg-status_change_nid = nid;
+   else
+   arg-status_change_nid = -1;
+}
+
+static void set_nodemasks(int node, struct memory_notify *arg)
+{
+   if (arg-status_change_nid_normal = 0)
+   node_set_state(node, N_NORMAL_MEMORY);
+
+   node_set_state(node, N_HIGH_MEMORY);
+}
+
 
 int __ref online_pages(unsigned long pfn, unsigned long nr_pages)
 {
@@ -467,13 +495,18 @@ int __ref online_pages(unsigned long pfn, unsigned long 
nr_pages)
struct memory_notify arg;
 
lock_memory_hotplug();
+   /*
+* This doesn't need a lock to do pfn_to_page().
+* The section can't be removed here because of the
+* memory_block-state_mutex.
+*/
+   zone = page_zone(pfn_to_page(pfn));
+
arg.start_pfn = pfn;
arg.nr_pages = nr_pages;
-   arg.status_change_nid = -1;
+   check_nodemasks_changes_online(nr_pages, zone, arg);
 
nid = page_to_nid(pfn_to_page(pfn));
-   if (node_present_pages(nid) == 0)
-   arg.status_change_nid = nid;
 
ret = memory_notify(MEM_GOING_ONLINE, arg);
ret = notifier_to_errno(ret);
@@ -483,12 +516,6 @@ int __ref online_pages(unsigned long pfn, unsigned long 
nr_pages)
return ret;
}
/*
-* This doesn't need a lock to do pfn_to_page().
-* The section can't be removed here because of the
-* memory_block-state_mutex.
-*/
-   zone = page_zone(pfn_to_page(pfn));
-   /*
 * If this zone is not populated, then it is not in zonelist.
 * This means the page allocator ignores this zone.
 * So, zonelist must be updated after online.
@@ -523,7 +550,7 @@ int __ref online_pages(unsigned long pfn, unsigned long 
nr_pages)
 
if (onlined_pages) {
kswapd_run(zone_to_nid(zone));
-   node_set_state(zone_to_nid(zone), N_HIGH_MEMORY);
+   set_nodemasks(zone_to_nid(zone), arg);
}
 
vm_total_pages = nr_free_pagecache_pages();
@@ -865,6 +892,44 @@ check_pages_isolated(unsigned long start_pfn, unsigned 
long end_pfn)
return offlined;
 }
 
+static void check_nodemasks_changes_offline(unsigned long nr_pages,
+   struct zone *zone, struct 

[PATCH 1/3] backlight: atmel-pwm-bl: remove goto err_free_mem

2012-08-06 Thread Jingoo Han
This patch removes goto err_free_mem, which makes code a bit smaller.

Cc: Hans-Christian Egtvedt egtv...@samfundet.no
Cc: Richard Purdie rpur...@rpsys.net
Signed-off-by: Jingoo Han jg1@samsung.com
---
 drivers/video/backlight/atmel-pwm-bl.c |   15 +--
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/atmel-pwm-bl.c 
b/drivers/video/backlight/atmel-pwm-bl.c
index df1cbb7..832d07d 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -135,24 +135,20 @@ static int atmel_pwm_bl_probe(struct platform_device 
*pdev)
pwmbl-pdev = pdev;
 
pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   retval = -ENODEV;
-   goto err_free_mem;
-   }
+   if (!pdata)
+   return -ENODEV;
 
if (pdata-pwm_compare_max  pdata-pwm_duty_max ||
pdata-pwm_duty_min  pdata-pwm_duty_max ||
-   pdata-pwm_frequency == 0) {
-   retval = -EINVAL;
-   goto err_free_mem;
-   }
+   pdata-pwm_frequency == 0)
+   return -EINVAL;
 
pwmbl-pdata = pdata;
pwmbl-gpio_on = pdata-gpio_on;
 
retval = pwm_channel_alloc(pdata-pwm_channel, pwmbl-pwmc);
if (retval)
-   goto err_free_mem;
+   return retval;
 
if (pwmbl-gpio_on != -1) {
retval = devm_gpio_request(pdev-dev, pwmbl-gpio_on,
@@ -200,7 +196,6 @@ err_free_bl_dev:
backlight_device_unregister(bldev);
 err_free_pwm:
pwm_channel_free(pwmbl-pwmc);
-err_free_mem:
return retval;
 }
 
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] backlight: aat2870: remove goto out

2012-08-06 Thread Jingoo Han
This patch removes goto out, which makes code a bit smaller.

Cc: Jin Park jinyou...@nvidia.com
Cc: Richard Purdie rpur...@rpsys.net
Signed-off-by: Jingoo Han jg1@samsung.com
---
 drivers/video/backlight/aat2870_bl.c |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/video/backlight/aat2870_bl.c 
b/drivers/video/backlight/aat2870_bl.c
index 7ff7522..619a1e0 100644
--- a/drivers/video/backlight/aat2870_bl.c
+++ b/drivers/video/backlight/aat2870_bl.c
@@ -135,14 +135,12 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
if (!pdata) {
dev_err(pdev-dev, No platform data\n);
-   ret = -ENXIO;
-   goto out;
+   return -ENXIO;
}
 
if (pdev-id != AAT2870_ID_BL) {
dev_err(pdev-dev, Invalid device ID, %d\n, pdev-id);
-   ret = -EINVAL;
-   goto out;
+   return -EINVAL;
}
 
aat2870_bl = devm_kzalloc(pdev-dev,
@@ -151,8 +149,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
if (!aat2870_bl) {
dev_err(pdev-dev,
Failed to allocate memory for aat2870 backlight\n);
-   ret = -ENOMEM;
-   goto out;
+   return -ENOMEM;
}
 
memset(props, 0, sizeof(struct backlight_properties));
@@ -163,8 +160,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
if (IS_ERR(bd)) {
dev_err(pdev-dev,
Failed allocate memory for backlight device\n);
-   ret = PTR_ERR(bd);
-   goto out;
+   return PTR_ERR(bd);
}
 
aat2870_bl-pdev = pdev;
@@ -201,7 +197,6 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
 out_bl_dev_unregister:
backlight_device_unregister(bd);
-out:
return ret;
 }
 
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] driver: misc: bmp085: remove of_match_table property.

2012-08-06 Thread Felipe Balbi
On Mon, Aug 06, 2012 at 02:58:44PM +0530, Sourav Poddar wrote:
 There is an automatic binding done for I2C devices in the of_i2c core
 code. So, DT will be able to bind to any I2C device using the
 already existing table: MODULE_DEVICE_TABLE(i2c, bmp085_id).
 
 Tested on omap5430 evm.
 
 Cc: Benoit Cousson b-cous...@ti.com
 Cc: Felipe Balbi ba...@ti.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Signed-off-by: Sourav Poddar sourav.pod...@ti.com

Acked-by: Felipe Balbi ba...@ti.com

 ---
  drivers/misc/bmp085-i2c.c |7 ---
  1 files changed, 0 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/misc/bmp085-i2c.c b/drivers/misc/bmp085-i2c.c
 index 9943971..a4f33c9 100644
 --- a/drivers/misc/bmp085-i2c.c
 +++ b/drivers/misc/bmp085-i2c.c
 @@ -57,12 +57,6 @@ static int bmp085_i2c_remove(struct i2c_client *client)
   return bmp085_remove(client-dev);
  }
  
 -static const struct of_device_id bmp085_of_match[] = {
 - { .compatible = bosch,bmp085, },
 - { },
 -};
 -MODULE_DEVICE_TABLE(of, bmp085_of_match);
 -
  static const struct i2c_device_id bmp085_id[] = {
   { BMP085_NAME, 0 },
   { bmp180, 0 },
 @@ -74,7 +68,6 @@ static struct i2c_driver bmp085_i2c_driver = {
   .driver = {
   .owner  = THIS_MODULE,
   .name   = BMP085_NAME,
 - .of_match_table = bmp085_of_match
   },
   .id_table   = bmp085_id,
   .probe  = bmp085_i2c_probe,
 -- 
 1.7.1
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/

-- 
balbi


signature.asc
Description: Digital signature


  1   2   3   4   5   6   7   8   9   10   >