[PATCH] ufs: fix return value check in ufs_alloc_lastblock()

2012-09-20 Thread Wei Yongjun
From: Wei Yongjun 

In case of error, the function ufs_get_locked_page() returns ERR_PTR()
or NULL pointer. The IS_ERR() test in the error handling should be
replaced with IS_ERR_OR_NULL().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun 
---
 fs/ufs/truncate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index f04f89f..82426ed 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -391,7 +391,7 @@ static int ufs_alloc_lastblock(struct inode *inode)
 
lastpage = ufs_get_locked_page(mapping, lastfrag >>
   (PAGE_CACHE_SHIFT - inode->i_blkbits));
-   if (IS_ERR(lastpage)) {
+   if (IS_ERR_OR_NULL(lastpage)) {
err = -EIO;
goto out;
}

--
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/6] xfrm_user info leaks

2012-09-20 Thread Mathias Krause
On Fri, Sep 21, 2012 at 12:09 AM, David Miller  wrote:
> From: Mathias Krause 
> Date: Wed, 19 Sep 2012 23:33:37 +0200
>
>> the following series fixes various info leaks in the xfrm netlink
>> interface. As always, a test case can be supplied on request.
>>
>> Patches 1 to 5 are probably material for stable, too. Patch 6 is just a
>> minor optimization I stumbled across while auditing the code.
>>
>> Please apply!
>
> All applied, and I made sure to use v3 of patch #5 (which you marked
> as 5/7 instead of 5/6 :-)

Sorry for the confusion. Looks like I've to learn a few more git
tricks, so this won't happen again ;)

> Also, these have been queued up for -stable as well.

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 1/4] perf header: Add struct perf_session_env

2012-09-20 Thread Namhyung Kim
From: Namhyung Kim 

The struct perf_session_env will preserve environment information at
the time of perf record.  It can be accessed anytime after parsing a
perf.data file if needed.

Signed-off-by: Namhyung Kim 
---
 tools/perf/util/header.h | 24 
 1 file changed, 24 insertions(+)

diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 209dad4fee2b..99bdd3abce59 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -58,6 +58,29 @@ struct perf_header;
 int perf_file_header__read(struct perf_file_header *header,
   struct perf_header *ph, int fd);
 
+struct perf_session_env {
+   char*hostname;
+   char*os_release;
+   char*version;
+   char*arch;
+   int nr_cpus_online;
+   int nr_cpus_avail;
+   char*cpu_desc;
+   char*cpuid;
+   unsigned long long  total_mem;
+
+   int nr_cmdline;
+   char*cmdline;
+   int nr_sibling_cores;
+   char*sibling_cores;
+   int nr_sibling_threads;
+   char*sibling_threads;
+   int nr_numa_nodes;
+   char*numa_nodes;
+   int nr_pmu_mappings;
+   char*pmu_mappings;
+};
+
 struct perf_header {
int frozen;
boolneeds_swap;
@@ -67,6 +90,7 @@ struct perf_header {
u64 event_offset;
u64 event_size;
DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
+   struct perf_session_env env;
 };
 
 struct perf_evlist;
-- 
1.7.11.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 3/4] perf header: Use pre-processed session env when printing

2012-09-20 Thread Namhyung Kim
>From now on each feature information is processed and saved in perf
header so that it can be used for printing.  The event desc and branch
stack features are not touched since they're not saved.

Cc: Stephane Eranian 
Cc: Robert Richter 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/header.c | 279 +--
 1 file changed, 102 insertions(+), 177 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 65659c1f8f53..05a6cf532891 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1103,118 +1103,80 @@ static int write_branch_stack(int fd __maybe_unused,
return 0;
 }
 
-static void print_hostname(struct perf_header *ph, int fd, FILE *fp)
+static void print_hostname(struct perf_header *ph, int fd __maybe_unused,
+  FILE *fp)
 {
-   char *str = do_read_string(fd, ph);
-   fprintf(fp, "# hostname : %s\n", str);
-   free(str);
+   fprintf(fp, "# hostname : %s\n", ph->env.hostname);
 }
 
-static void print_osrelease(struct perf_header *ph, int fd, FILE *fp)
+static void print_osrelease(struct perf_header *ph, int fd __maybe_unused,
+   FILE *fp)
 {
-   char *str = do_read_string(fd, ph);
-   fprintf(fp, "# os release : %s\n", str);
-   free(str);
+   fprintf(fp, "# os release : %s\n", ph->env.os_release);
 }
 
-static void print_arch(struct perf_header *ph, int fd, FILE *fp)
+static void print_arch(struct perf_header *ph, int fd __maybe_unused, FILE *fp)
 {
-   char *str = do_read_string(fd, ph);
-   fprintf(fp, "# arch : %s\n", str);
-   free(str);
+   fprintf(fp, "# arch : %s\n", ph->env.arch);
 }
 
-static void print_cpudesc(struct perf_header *ph, int fd, FILE *fp)
+static void print_cpudesc(struct perf_header *ph, int fd __maybe_unused,
+ FILE *fp)
 {
-   char *str = do_read_string(fd, ph);
-   fprintf(fp, "# cpudesc : %s\n", str);
-   free(str);
+   fprintf(fp, "# cpudesc : %s\n", ph->env.cpu_desc);
 }
 
-static void print_nrcpus(struct perf_header *ph, int fd, FILE *fp)
+static void print_nrcpus(struct perf_header *ph, int fd __maybe_unused,
+FILE *fp)
 {
-   ssize_t ret;
-   u32 nr;
-
-   ret = read(fd, , sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
-   nr = -1; /* interpreted as error */
-
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
-
-   fprintf(fp, "# nrcpus online : %u\n", nr);
-
-   ret = read(fd, , sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
-   nr = -1; /* interpreted as error */
-
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
-
-   fprintf(fp, "# nrcpus avail : %u\n", nr);
+   fprintf(fp, "# nrcpus online : %u\n", ph->env.nr_cpus_online);
+   fprintf(fp, "# nrcpus avail : %u\n", ph->env.nr_cpus_avail);
 }
 
-static void print_version(struct perf_header *ph, int fd, FILE *fp)
+static void print_version(struct perf_header *ph, int fd __maybe_unused,
+ FILE *fp)
 {
-   char *str = do_read_string(fd, ph);
-   fprintf(fp, "# perf version : %s\n", str);
-   free(str);
+   fprintf(fp, "# perf version : %s\n", ph->env.version);
 }
 
-static void print_cmdline(struct perf_header *ph, int fd, FILE *fp)
+static void print_cmdline(struct perf_header *ph, int fd __maybe_unused,
+ FILE *fp)
 {
-   ssize_t ret;
+   int nr, i;
char *str;
-   u32 nr, i;
-
-   ret = read(fd, , sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
-   return;
 
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
+   nr = ph->env.nr_cmdline;
+   str = ph->env.cmdline;
 
fprintf(fp, "# cmdline : ");
 
for (i = 0; i < nr; i++) {
-   str = do_read_string(fd, ph);
fprintf(fp, "%s ", str);
-   free(str);
+   str += strlen(str) + 1;
}
fputc('\n', fp);
 }
 
-static void print_cpu_topology(struct perf_header *ph, int fd, FILE *fp)
+static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused,
+  FILE *fp)
 {
-   ssize_t ret;
-   u32 nr, i;
+   int nr, i;
char *str;
 
-   ret = read(fd, , sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
-   return;
-
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
+   nr = ph->env.nr_sibling_cores;
+   str = ph->env.sibling_cores;
 
for (i = 0; i < nr; i++) {
-   str = do_read_string(fd, ph);
fprintf(fp, "# sibling cores   : %s\n", str);
-   free(str);
+   str += strlen(str) + 1;
}
 
-   ret = read(fd, , sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
-   return;
-
-   if (ph->needs_swap)
-   nr = bswap_32(nr);
+   nr = 

[PATCH 4/4] perf header: Remove unused @feat arg from ->process callback

2012-09-20 Thread Namhyung Kim
From: Namhyung Kim 

As the @feat arg is not used anywhere, get rid of it from the signature.

Cc: Stephane Eranian 
Cc: Robert Richter 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/header.c | 70 
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 05a6cf532891..6aae3290358e 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1580,18 +1580,16 @@ out:
return err;
 }
 
-static int process_tracing_data(struct perf_file_section *section
-   __maybe_unused,
- struct perf_header *ph __maybe_unused,
- int feat __maybe_unused, int fd, void *data)
+static int process_tracing_data(struct perf_file_section *section 
__maybe_unused,
+   struct perf_header *ph __maybe_unused,
+   int fd, void *data)
 {
trace_report(fd, data, false);
return 0;
 }
 
 static int process_build_id(struct perf_file_section *section,
-   struct perf_header *ph,
-   int feat __maybe_unused, int fd,
+   struct perf_header *ph, int fd,
void *data __maybe_unused)
 {
if (perf_header__read_build_ids(ph, fd, section->offset, section->size))
@@ -1600,40 +1598,40 @@ static int process_build_id(struct perf_file_section 
*section,
 }
 
 static int process_hostname(struct perf_file_section *section __maybe_unused,
-   struct perf_header *ph, int feat __maybe_unused,
-   int fd, void *data __maybe_unused)
+   struct perf_header *ph, int fd,
+   void *data __maybe_unused)
 {
ph->env.hostname = do_read_string(fd, ph);
return ph->env.hostname ? 0 : -ENOMEM;
 }
 
 static int process_osrelease(struct perf_file_section *section __maybe_unused,
-struct perf_header *ph, int feat __maybe_unused,
-int fd, void *data __maybe_unused)
+struct perf_header *ph, int fd,
+void *data __maybe_unused)
 {
ph->env.os_release = do_read_string(fd, ph);
return ph->env.os_release ? 0 : -ENOMEM;
 }
 
 static int process_version(struct perf_file_section *section __maybe_unused,
-  struct perf_header *ph, int feat __maybe_unused,
-  int fd, void *data __maybe_unused)
+  struct perf_header *ph, int fd,
+  void *data __maybe_unused)
 {
ph->env.version = do_read_string(fd, ph);
return ph->env.version ? 0 : -ENOMEM;
 }
 
 static int process_arch(struct perf_file_section *section __maybe_unused,
-   struct perf_header *ph, int feat __maybe_unused,
-   int fd, void *data __maybe_unused)
+   struct perf_header *ph, int fd,
+   void *data __maybe_unused)
 {
ph->env.arch = do_read_string(fd, ph);
return ph->env.arch ? 0 : -ENOMEM;
 }
 
 static int process_nrcpus(struct perf_file_section *section __maybe_unused,
- struct perf_header *ph, int feat __maybe_unused,
- int fd, void *data __maybe_unused)
+ struct perf_header *ph, int fd,
+ void *data __maybe_unused)
 {
size_t ret;
u32 nr;
@@ -1659,24 +1657,24 @@ static int process_nrcpus(struct perf_file_section 
*section __maybe_unused,
 }
 
 static int process_cpudesc(struct perf_file_section *section __maybe_unused,
-  struct perf_header *ph, int feat __maybe_unused,
-  int fd, void *data __maybe_unused)
+  struct perf_header *ph, int fd,
+  void *data __maybe_unused)
 {
ph->env.cpu_desc = do_read_string(fd, ph);
return ph->env.cpu_desc ? 0 : -ENOMEM;
 }
 
 static int process_cpuid(struct perf_file_section *section __maybe_unused,
-struct perf_header *ph, int feat __maybe_unused,
-int fd, void *data __maybe_unused)
+struct perf_header *ph,  int fd,
+void *data __maybe_unused)
 {
ph->env.cpuid = do_read_string(fd, ph);
return ph->env.cpuid ? 0 : -ENOMEM;
 }
 
 static int process_total_mem(struct perf_file_section *section __maybe_unused,
-struct perf_header *ph, int feat __maybe_unused,
-int fd, void *data __maybe_unused)
+struct perf_header *ph, int fd,
+void *data __maybe_unused)
 {
uint64_t mem;
size_t ret;
@@ -1706,7 +1704,8 @@ 

[PATCH 0/4] perf header: Save and reuse feature information in header (v4)

2012-09-20 Thread Namhyung Kim
Hi,

Currently the perf header information is used only at initial setup
time and discarded.  If it's saved we could reuse the information for
various purpose in the future.

Thanks,
Namhyung


v3 -> v4:
 * rename perf_header_info to perf_session_env (Arnaldo)

v2 -> v3:
 * patch 1-3 in v2 merged into tip
 * rebased on current acme/perf/core

v1 -> v2:
 * not touch EVENT_DESC feature handling
 * split out struct perf_header_info
 * simplify multi-string handling
 * add some cleanup patches

Namhyung Kim (4):
  perf header: Add struct perf_session_env
  perf header: Add ->process callbacks to most of features
  perf header: Use pre-processed session env when printing
  perf header: Remove unused @feat arg from ->process callback

 tools/perf/util/header.c | 547 +--
 tools/perf/util/header.h |  24 +++
 2 files changed, 408 insertions(+), 163 deletions(-)

-- 
1.7.11.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 2/4] perf header: Add ->process callbacks to most of features

2012-09-20 Thread Namhyung Kim
>From now on each feature information is processed and saved in perf
header so that it can be used wherever needed.  The BRANCH_STACK
feature is an exception since it needs nothing to be done.

Cc: Stephane Eranian 
Cc: Robert Richter 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/header.c | 318 +--
 1 file changed, 307 insertions(+), 11 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index acbf6336199e..65659c1f8f53 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -22,6 +22,7 @@
 #include "cpumap.h"
 #include "pmu.h"
 #include "vdso.h"
+#include "strbuf.h"
 
 static bool no_buildid_cache = false;
 
@@ -1673,6 +1674,99 @@ static int process_build_id(struct perf_file_section 
*section,
return 0;
 }
 
+static int process_hostname(struct perf_file_section *section __unused,
+   struct perf_header *ph,
+   int feat __unused, int fd, void *data __used)
+{
+   ph->env.hostname = do_read_string(fd, ph);
+   return ph->env.hostname ? 0 : -ENOMEM;
+}
+
+static int process_osrelease(struct perf_file_section *section __unused,
+struct perf_header *ph,
+int feat __unused, int fd, void *data __used)
+{
+   ph->env.os_release = do_read_string(fd, ph);
+   return ph->env.os_release ? 0 : -ENOMEM;
+}
+
+static int process_version(struct perf_file_section *section __unused,
+  struct perf_header *ph,
+  int feat __unused, int fd, void *data __used)
+{
+   ph->env.version = do_read_string(fd, ph);
+   return ph->env.version ? 0 : -ENOMEM;
+}
+
+static int process_arch(struct perf_file_section *section __unused,
+   struct perf_header *ph,
+   int feat __unused, int fd, void *data __used)
+{
+   ph->env.arch = do_read_string(fd, ph);
+   return ph->env.arch ? 0 : -ENOMEM;
+}
+
+static int process_nrcpus(struct perf_file_section *section __unused,
+ struct perf_header *ph,
+ int feat __unused, int fd, void *data __used)
+{
+   size_t ret;
+   u32 nr;
+
+   ret = read(fd, , sizeof(nr));
+   if (ret != sizeof(nr))
+   return -1;
+
+   if (ph->needs_swap)
+   nr = bswap_32(nr);
+
+   ph->env.nr_cpus_online = nr;
+
+   ret = read(fd, , sizeof(nr));
+   if (ret != sizeof(nr))
+   return -1;
+
+   if (ph->needs_swap)
+   nr = bswap_32(nr);
+
+   ph->env.nr_cpus_avail = nr;
+   return 0;
+}
+
+static int process_cpudesc(struct perf_file_section *section __unused,
+  struct perf_header *ph,
+  int feat __unused, int fd, void *data __used)
+{
+   ph->env.cpu_desc = do_read_string(fd, ph);
+   return ph->env.cpu_desc ? 0 : -ENOMEM;
+}
+
+static int process_cpuid(struct perf_file_section *section __unused,
+struct perf_header *ph,
+int feat __unused, int fd, void *data __used)
+{
+   ph->env.cpuid = do_read_string(fd, ph);
+   return ph->env.cpuid ? 0 : -ENOMEM;
+}
+
+static int process_total_mem(struct perf_file_section *section __unused,
+struct perf_header *ph,
+int feat __unused, int fd, void *data __used)
+{
+   uint64_t mem;
+   size_t ret;
+
+   ret = read(fd, , sizeof(mem));
+   if (ret != sizeof(mem))
+   return -1;
+
+   if (ph->needs_swap)
+   mem = bswap_64(mem);
+
+   ph->env.total_mem = mem;
+   return 0;
+}
+
 static struct perf_evsel *
 perf_evlist__find_by_index(struct perf_evlist *evlist, int idx)
 {
@@ -1723,6 +1817,208 @@ process_event_desc(struct perf_file_section *section 
__maybe_unused,
return 0;
 }
 
+static int process_cmdline(struct perf_file_section *section __unused,
+  struct perf_header *ph,
+  int feat __unused, int fd, void *data __used)
+{
+   size_t ret;
+   char *str;
+   u32 nr, i;
+   struct strbuf sb;
+
+   ret = read(fd, , sizeof(nr));
+   if (ret != sizeof(nr))
+   return -1;
+
+   if (ph->needs_swap)
+   nr = bswap_32(nr);
+
+   ph->env.nr_cmdline = nr;
+   strbuf_init(, 128);
+
+   for (i = 0; i < nr; i++) {
+   str = do_read_string(fd, ph);
+   if (!str)
+   goto error;
+
+   /* include a NULL character at the end */
+   strbuf_add(, str, strlen(str) + 1);
+   free(str);
+   }
+   ph->env.cmdline = strbuf_detach(, NULL);
+   return 0;
+
+error:
+   strbuf_release();
+   return -1;
+}
+
+static int process_cpu_topology(struct perf_file_section *section __unused,
+   

Re: [PATCH 0/5] charger-manager: Update charger-manager to support various charging conditions

2012-09-20 Thread Anton Vorontsov
On Tue, Aug 21, 2012 at 05:05:59PM +0900, Chanwoo Choi wrote:
[...]
> Chanwoo Choi (5):
>   charger-manager: Disable battery charging when charger cable is
> detached
>   charger-manager: Use replacement variable to check state of battery
>   charger-manager: Add support sysfs entry for charger
>   charger-manager: Check fully charged state of battery periodically
>   charger-manager: Support limit of maximum possible duration for
> charging/discharging

Thanks a lot for your work!

Patches 1-2 and 4-5 applied. Patch 3 failed to build, so I guess
it will need some fixes and resend.

Cheers,
Anton.
--
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] pwm_backlight: Add device tree support for Low Threshold Brightness

2012-09-20 Thread Stephen Warren
On 09/20/2012 10:51 PM, Philip, Avinash wrote:
> Some backlights perform poorly when driven by a PWM with a short
> duty-cycle. For such devices, the low threshold can be used to specify a
> lower bound for the duty-cycle and should be chosen to exclude the
> problematic range.
> 
> This patch adds support for an optional low-threshold-brightness
> property.

> diff --git 
> a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
> b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt

>  Optional properties:
>- pwm-names: a list of names for the PWM devices specified in the
> "pwms" property (see PWM binding[0])
> +  - low-threshold-brightness: brightness threshold low level. Low threshold
> +brightness set to value so that backlight present on low end of
> +brightness.

For my education, why not just specify values above this value in the
brightness-levels array; how do those two interact? It seems like any
description of that is missing from the PWM documentation, and would be
good to have in the DT binding too.

--
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/5] charger-manager: Add support sysfs entry for charger

2012-09-20 Thread Anton Vorontsov
On Tue, Aug 21, 2012 at 05:06:49PM +0900, Chanwoo Choi wrote:
> This patch add support sysfs entry for each charger(regulator).
> Charger-manager use one or more chargers for charging battery but
> some charger isn't necessary on specific scenario. So, if some charger
> isn't needed, can disable specific charger through 'externally_control'
> entry while system is on state and confirm the information(name, state)
> of charger.
> 
> the list of added sysfs entry
> - /sys/class/power_supply/battery/chargers/charger.[index]/name
> : show name of charger(regulator)
> - /sys/class/power_supply/battery/chargers/charger.[index]/state
> : show either enabled or disabled state of charger
> - /sys/class/power_supply/battery/chargers/charger.[index]/externally_control

The API looks sane.

For the future, you might want to get rid of the 'name', and instead
just point to a regulator device (via a sysfs symlink). I.e.

/sys/class/power_supply/battery/chargers/charger.[index]/device
would be a symlink to the regulator device.

But for the time being, I guess it's OK as is (although I wouldn't
mind if it'll use the symlink from the start. :-)

[...]
>   for (j = 0 ; j < charger->num_cables ; j++) {
>   struct charger_cable *cable = >cables[j];
> @@ -1287,6 +1386,71 @@ static int charger_manager_probe(struct 
> platform_device *pdev)
>   cable->charger = charger;
>   cable->cm = cm;
>   }
> +
[...]
> + charger->attr_g.attrs = charger->attrs;
> +
> + sysfs_attr_init(>attr_name.attr);

Notice that 'cable' is declared in the 'for' loop above,
so this doesn't compile for me:

  CHECK   drivers/power/charger-manager.c
drivers/power/charger-manager.c:1559:17: error: undefined identifier 'cable'
drivers/power/charger-manager.c:1564:17: error: undefined identifier 'cable'
drivers/power/charger-manager.c:1569:17: error: undefined identifier 'cable'
  CC  drivers/power/charger-manager.o
drivers/power/charger-manager.c: In function ‘charger_manager_probe’:
drivers/power/charger-manager.c:1559:3: error: ‘cable’ undeclared (first use in 
this function)
drivers/power/charger-manager.c:1559:3: note: each undeclared identifier is 
reported only once for each function it appears in
make[1]: *** [drivers/power/charger-manager.o] Error 1

Also:
- Please adhere to the codingstyle, there should be no spaces
  before ';' in the for loop statement.
- If possible, please consider splitting _probe routine, it is more
  than 300 lines long nowadays.

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


Re: [PATCH 4/5] charger-manager: Check fully charged state of battery periodically

2012-09-20 Thread Anton Vorontsov
On Tue, Aug 21, 2012 at 05:06:52PM +0900, Chanwoo Choi wrote:
> This patch check periodically fully charged state of battery to protect
> overcharge and overheat. If battery is fully charged, stop charging
> and check droped voltage with 'fullbatt_vchkdrop_ms' period. When voltage
> of battery is more droped than 'fullbatt_vchkdrop_uV' voltage,
> charger-manager will restart charging for battery.
> 
> Signed-off-by: Chanwoo Choi 
> Signed-off-by: Myungjoo Ham 
> Signed-off-by: Kyungmin Park 
> ---

Applied, thank you.

There were some minor issues, but I fixed them up:

[...]
> + } else if (!cm->emergency_stop
> + && is_ext_pwr_online(cm) && !cm->charger_enabled) {

Wrong && placement (should have been on the previous line).

> + fullbatt_vchk(>fullbatt_vchk_work.work);
> +
> + /*
> +  * Check whether fully charged state to protect overcharge
> +  * if charger-manager is charging for battery.
> +  */
> + } else if (!cm->emergency_stop
> + && is_full_charged(cm) && cm->charger_enabled) {

Ditto.
--
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 5/5] charger-manager: Support limit of maximum possible duration for charging/discharging

2012-09-20 Thread Anton Vorontsov
On Tue, Aug 21, 2012 at 05:06:57PM +0900, Chanwoo Choi wrote:
> This patch check maximum possible duration of charging/discharging.
> 
> If whole charging duration exceed 'desc->charging_max_duration_ms',
> cm stop charging to prevent overcharge/overheat. And if discharging
> duration exceed, charger cable is attached, after full-batt,
> cm start charging to maintain fully charged state for battery.
> 
> Signed-off-by: Chanwoo Choi 
> Signed-off-by: Myungjoo Ham 
> Signed-off-by: Kyungmin Park 
> ---

Applied, thanks!

But fyi:

[...]
> + if (!desc->charging_max_duration_ms
> + && !desc->discharging_max_duration_ms)

&& should have been on the previous line, plus the second line
should have been indented with one more tab. I fixed it up.

[...]
> + if (!desc->charging_max_duration_ms
> + || !desc->discharging_max_duration_ms) {

Ditto.

> + dev_info(>dev, "Cannot limit charging duration"
> + " checking mechanism to prevent "
> + " overcharge/overheat and control"

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


[PATCH v2] pwm_backlight: Add device tree support for Low Threshold Brightness

2012-09-20 Thread Philip, Avinash
Some backlights perform poorly when driven by a PWM with a short
duty-cycle. For such devices, the low threshold can be used to specify a
lower bound for the duty-cycle and should be chosen to exclude the
problematic range.

This patch adds support for an optional low-threshold-brightness
property.

Signed-off-by: Philip, Avinash 
---
Changes since v1:
- Updated commit message.
- Changes to low-threshold-brightness.
- Merged example section to original.

:100644 100644 1e4fc72... 5baebff... M  
Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
:100644 100644 995f016... 29e6fe1... M  drivers/video/backlight/pwm_bl.c
 .../bindings/video/backlight/pwm-backlight.txt |4 
 drivers/video/backlight/pwm_bl.c   |5 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
index 1e4fc72..5baebff 100644
--- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
+++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
@@ -14,6 +14,9 @@ Required properties:
 Optional properties:
   - pwm-names: a list of names for the PWM devices specified in the
"pwms" property (see PWM binding[0])
+  - low-threshold-brightness: brightness threshold low level. Low threshold
+brightness set to value so that backlight present on low end of
+brightness.
 
 [0]: Documentation/devicetree/bindings/pwm/pwm.txt
 
@@ -25,4 +28,5 @@ Example:
 
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <6>;
+   low-threshold-brightness = <50>;
};
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 995f016..29e6fe1 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -143,6 +143,11 @@ static int pwm_backlight_parse_dt(struct device *dev,
 
data->dft_brightness = value;
data->max_brightness--;
+
+   ret = of_property_read_u32(node, "low-threshold-brightness",
+  );
+   if (!ret)
+   data->lth_brightness = value;
}
 
/*
-- 
1.7.0.4

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


Re: RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)

2012-09-20 Thread Thanasis
on 09/21/2012 02:20 AM Francois Romieu wrote the following:

> 
> Thanasis, can you narrow down a bit the failing revision ?

Sure, let me know how to do it please.
FWIW , attached full lspci -k output.

00:00.0 Host bridge: Intel Corporation Mobile 945GSE Express Memory Controller 
Hub (rev 03)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: agpgart-intel
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GSE Express 
Integrated Graphics Controller (rev 03)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: i915
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML 
Express Integrated Graphics Controller (rev 03)
Subsystem: Acer Incorporated [ALI] Device 015b
00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio 
Controller (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: HDA Intel
00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 
02)
Kernel driver in use: pcieport
00:1c.1 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 2 (rev 
02)
Kernel driver in use: pcieport
00:1c.2 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 3 (rev 
02)
Kernel driver in use: pcieport
00:1c.3 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 4 (rev 
02)
Kernel driver in use: pcieport
00:1d.0 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller 
#1 (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: uhci_hcd
00:1d.1 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller 
#2 (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: uhci_hcd
00:1d.2 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller 
#3 (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: uhci_hcd
00:1d.3 USB controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller 
#4 (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: uhci_hcd
00:1d.7 USB controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller 
(rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: ehci_hcd
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge 
(rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7-M Family) SATA 
Controller [IDE mode] (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: ata_piix
00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: i801_smbus
01:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: sdhci-pci
01:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
01:00.3 System peripheral: JMicron Technology Corp. MS Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: jmb38x_ms
01:00.4 System peripheral: JMicron Technology Corp. xD Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E 
PCI Express Fast Ethernet controller (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: r8169
03:00.0 Ethernet controller: Atheros Communications Inc. AR242x / AR542x 
Wireless Network Adapter (PCI-Express) (rev 01)
Subsystem: Foxconn International, Inc. Device e008
Kernel driver in use: ath5k
04:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: sdhci-pci
04:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
04:00.3 System peripheral: JMicron Technology Corp. MS Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b
Kernel driver in use: jmb38x_ms
04:00.4 System peripheral: JMicron Technology Corp. xD Host Controller
Subsystem: Acer Incorporated [ALI] Device 015b


RE: [RFC/PATCH 2/2] block: Adding ROW scheduling algorithm

2012-09-20 Thread Tanya Brokhman
Hi Jan

> There seems to a bug with ROW. After about 43 hours of continued
> operation, programs (./configure was what I ran at the time this
> happened) first become slow, then got stuck in D state within a minute.
Ctrl-
> C/Z worked at first, soon not, then these messages appeared in dmesg.
> 
> [319952.630605] row: forced dispatching is broken (nr_sorted=17), please
> report this [319952.631174] row: forced dispatching is broken
(nr_sorted=17),
> please report this

Thank you very much for reporting this! 
We're now at the testing phase as well. We didn't encounter the bug you
observed but I'll look into it. Thanks again.

Thanks,
Tanya Brokhman
---
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

--
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] hppfs: fix the return value of get_inode()

2012-09-20 Thread Wei Yongjun
From: Wei Yongjun 

In case of error, the function get_inode() returns ERR_PTR().
But the users hppfs_lookup() and hppfs_fill_super() use NULL
test for check the return value, not IS_ERR(), so we'd better
change the return value of get_inode() to NULL instead of
ERR_PTR().

dpatch engine is used to generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun 
---
 fs/hppfs/hppfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index c1dffe4..31b1e85 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -674,7 +674,7 @@ static struct inode *get_inode(struct super_block *sb, 
struct dentry *dentry)
 
if (!inode) {
dput(dentry);
-   return ERR_PTR(-ENOMEM);
+   return NULL;
}
 
if (S_ISDIR(dentry->d_inode->i_mode)) {


--
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] pwm_backlight: Add device tree support for Low Threshold Brightness

2012-09-20 Thread Philip, Avinash
On Wed, Sep 19, 2012 at 12:14:25, Thierry Reding wrote:
> On Wed, Aug 01, 2012 at 06:51:21AM +, Philip, Avinash wrote:
> > On Mon, Jul 30, 2012 at 12:28:05, Thierry Reding wrote:
> > > On Wed, Jul 25, 2012 at 05:54:02PM +0530, Philip, Avinash wrote:
> > > > Low Threshold Brightness should be configured to have a linear relation
> > > > in brightness scale. This patch adds device tree support for low
> > > > threshold brightness as optional one for pwm_backlight.
> > > 
> > > I think this should be more explicit as to why this is required, perhaps
> > > something like this:
> > > 
> > >   Some backlights perform poorly when driven by a PWM with a short
> > >   duty-cycle. For such devices, the low threshold can be used to
> > >   specify a lower bound for the duty-cycle and should be chosen to
> > >   exclude the problematic range.
> > > 
> > >   This patch adds support for an optional low-threshold-brightness
> > >   property.
[snip]
> 
> I think you never sent an updated patch or maybe I missed it. But I
> noticed that this patch has now ended up in Andrew's tree without the
> comments being addressed. Can you please follow up?

I will send a revised patch.

Thanks
Avinash

--
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 23/26] raid1: use bio_alloc_pages()

2012-09-20 Thread Kent Overstreet
On Thu, Sep 20, 2012 at 05:48:27PM -0700, Tejun Heo wrote:
> On Mon, Sep 10, 2012 at 05:22:34PM -0700, Kent Overstreet wrote:
> > Signed-off-by: Kent Overstreet 
> > CC: Jens Axboe 
> > CC: NeilBrown 
> 
> I think it's better to merge this and the previous patch.  It's not
> like we're converting a lot of users.

Ok, will do.
--
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] smb347_charger: fix battery status reporting logic for charger faults

2012-09-20 Thread Pallala, Ramakrishna
> On Wed, Sep 19, 2012 at 10:37:34AM +0300, Mika Westerberg wrote:
> > On Tue, Sep 18, 2012 at 09:58:07PM +0530, Ramakrishna Pallala wrote:
> > > This patch checks for charger status register for determining the
> > > battery charging status and reports Discharing/Charging/Not
> > > Charging/Full accordingly.
> > >
> > > This patch also adds the interrupt support for Safety Timer Expiration.
> > > This interrupt is helpful in debugging the cause for charger fault.
> > >
> > > Resending this patch because previous patch missed Anton's attention
> 
> Not that it missed my attention, it's just that I'm in "apply-mode"
> only 3-4 times per dev cycle. So, patches may lay in my "battery"
> folder for some time.
> 
> That's mostly because I have somewhat limited time, but also that way I can
> collect Acks and give other folks a chance to take a look at the patches.  :-)
> 
> But if you suspect the patch missed my attention (which also happens
> sometimes), it's totally fine to resend it or ping me, as you did.
> 
> > > Signed-off-by: Ramakrishna Pallala 
> >
> > Acked-by: Mika Westerberg 
> 
> Applied, thank you guys!

Got it Thanks :-)


Re: [PATCH v2 22/26] block: Add bio_alloc_pages()

2012-09-20 Thread Kent Overstreet
On Thu, Sep 20, 2012 at 05:47:11PM -0700, Tejun Heo wrote:
> On Mon, Sep 10, 2012 at 05:22:33PM -0700, Kent Overstreet wrote:
> > +   bio_for_each_segment_all(bv, bio, i) {
> > +   bv->bv_page = alloc_page(gfp_mask);
> > +   if (!bv->bv_page) {
> > +   while (bv-- != bio->bi_io_vec)
> > +   __free_page(bv->bv_page);
> 
> I don't know.  I feel stupid.  I think it's because the loop variable
> changes between loop condition test and actual body of loop.  How
> about the following?  It is pointing to the member of the same array
> so I think it's not even violating pointer comparison rules.
> 
>   while (--bv >= bio->bi_io_vec)
>   __free_page(bv->bv_page);

I can't remember why I did it that way, but I think I like yours better
- I'll change it.
--
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 v3 15/16] memcg/sl[au]b: shrink dead caches

2012-09-20 Thread JoonSoo Kim
Hi Glauber.

2012/9/18 Glauber Costa :
> diff --git a/mm/slub.c b/mm/slub.c
> index 0b68d15..9d79216 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2602,6 +2602,7 @@ redo:
> } else
> __slab_free(s, page, x, addr);
>
> +   kmem_cache_verify_dead(s);
>  }

As far as u know, I am not a expert and don't know anything about memcg.
IMHO, this implementation may hurt system performance in some case.

In case of memcg is destoried, remained kmem_cache is marked "dead".
After it is marked,
every free operation to this "dead" kmem_cache call
kmem_cache_verify_dead() and finally call kmem_cache_shrink().
kmem_cache_shrink() do invoking kmalloc and flush_all() and taking a
lock for online node and invoking kfree.
Especially, flush_all() may hurt performance largely, because it call
has_cpu_slab() against all the cpus.

And I know some other case it can hurt system performance.
But, I don't mention it, because above case is sufficient to worry.

And, I found one case that destroying memcg's kmem_cache don't works properly.
If we destroy memcg after all object is freed, current implementation
doesn't destroy kmem_cache.
kmem_cache_destroy_work_func() check "cachep->memcg_params.nr_pages == 0",
but in this case, it return false, because kmem_cache may have
cpu_slab, and cpu_partials_slabs.
As we already free all objects, kmem_cache_verify_dead() is not invoked forever.
I think that we need another kmem_cache_shrink() in
kmem_cache_destroy_work_func().

I don't convince that I am right, so think carefully my humble opinion.

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


Re: [RFC/PATCH 2/2] block: Adding ROW scheduling algorithm

2012-09-20 Thread Jan Engelhardt

On Wednesday 2012-09-19 07:29, Jan Engelhardt wrote:
>On Monday 2012-08-06 18:35, Jeff Moyer wrote:
>>Tatyana Brokhman writes:
>>
>>> This patch adds the implementation of a new scheduling algorithm - ROW.
>>> The policy of this algorithm is to prioritize READ requests over WRITE
>>> as much as possible without starving the WRITE requests.
>>
>>Perhaps you could start off by describing the workload, and describing
>>why the existing I/O schedulers do not perform well.

There seems to a bug with ROW. After about 43 hours of continued
operation, programs (./configure was what I ran at the time this
happened) first become slow, then got stuck in D state within a
minute. Ctrl-C/Z worked at first, soon not, then these messages
appeared in dmesg.

[319952.630605] row: forced dispatching is broken (nr_sorted=17), please report
this
[319952.631174] row: forced dispatching is broken (nr_sorted=17), please report
this
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] perf tools: configure shell path at compile time

2012-09-20 Thread David Ahern

On 9/20/12 4:13 PM, Irina Tirdea wrote:

From: Irina Tirdea 

Shell path /bin/sh is hardcoded in various places in perf. Android has a
different folder structure and does not have /bin/sh.

Set the shell path at compile time in the Makefile by setting PERF_SHELL_PATH.
By default it is set to /bin/sh.


code change below uses PERF_SHELL_DIR; it's not a directory so 
PERF_SHELL_PATH per the above comment is better.


David




Signed-off-by: Irina Tirdea 
---
  tools/perf/Makefile |6 +-
  tools/perf/builtin-help.c   |2 +-
  tools/perf/builtin-script.c |   12 ++--
  3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index eab4a36..9021a1f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -828,7 +828,11 @@ $(OUTPUT)builtin-help.o: builtin-help.c 
$(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFL
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
'-DPERF_MAN_PATH="$(mandir_SQ)"' \
-   '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
+   '-DPERF_INFO_PATH="$(infodir_SQ)"' \
+   '-DPERF_SHELL_DIR="/bin/sh"' $<
+
+$(OUTPUT)builtin-script.o: builtin-script.c $(OUTPUT)PERF-CFLAGS
+   $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_SHELL_DIR='"/bin/sh"' $<

  $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h 
$(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25c8b94..a1d9703 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -171,7 +171,7 @@ static void exec_man_cmd(const char *cmd, const char *page)
  {
struct strbuf shell_cmd = STRBUF_INIT;
strbuf_addf(_cmd, "%s %s", cmd, page);
-   execl("/bin/sh", "sh", "-c", shell_cmd.buf, NULL);
+   execl(PERF_SHELL_DIR, "sh", "-c", shell_cmd.buf, NULL);
warning("failed to exec '%s': %s", cmd, strerror(errno));
  }

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 1be843a..4cc2c96 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1326,7 +1326,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
goto out;
}

-   __argv[j++] = "/bin/sh";
+   __argv[j++] = PERF_SHELL_DIR;
__argv[j++] = rec_script_path;
if (system_wide)
__argv[j++] = "-a";
@@ -1337,7 +1337,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
__argv[j++] = argv[i];
__argv[j++] = NULL;

-   execvp("/bin/sh", (char **)__argv);
+   execvp(PERF_SHELL_DIR, (char **)__argv);
free(__argv);
exit(-1);
}
@@ -1353,7 +1353,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
}

j = 0;
-   __argv[j++] = "/bin/sh";
+   __argv[j++] = PERF_SHELL_DIR;
__argv[j++] = rep_script_path;
for (i = 1; i < rep_args + 1; i++)
__argv[j++] = argv[i];
@@ -1361,7 +1361,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
__argv[j++] = "-";
__argv[j++] = NULL;

-   execvp("/bin/sh", (char **)__argv);
+   execvp(PERF_SHELL_DIR, (char **)__argv);
free(__argv);
exit(-1);
}
@@ -1390,7 +1390,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
goto out;
}

-   __argv[j++] = "/bin/sh";
+   __argv[j++] = PERF_SHELL_DIR;
__argv[j++] = script_path;
if (system_wide)
__argv[j++] = "-a";
@@ -1398,7 +1398,7 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
__argv[j++] = argv[i];
__argv[j++] = NULL;

-   execvp("/bin/sh", (char **)__argv);
+   execvp(PERF_SHELL_DIR, (char **)__argv);
free(__argv);
exit(-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/


mm: frontswap: fix a wrong if condition in frontswap_shrink

2012-09-20 Thread Zhenzhong Duan
pages_to_unuse is set to 0 to unuse all frontswap pages
But that doesn't happen since a wrong condition in frontswap_shrink
cancels it.

Signed-off-by: Zhenzhong Duan 
---
 mm/frontswap.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/frontswap.c b/mm/frontswap.c
index 6b3e71a..db2a86f 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -275,7 +275,7 @@ static int __frontswap_shrink(unsigned long target_pages,
if (total_pages <= target_pages) {
/* Nothing to do */
*pages_to_unuse = 0;
-   return 0;
+   return 1;
}
total_pages_to_unuse = total_pages - target_pages;
return __frontswap_unuse_pages(total_pages_to_unuse, pages_to_unuse, 
type);
@@ -302,7 +302,7 @@ void frontswap_shrink(unsigned long target_pages)
spin_lock(_lock);
ret = __frontswap_shrink(target_pages, _to_unuse, );
spin_unlock(_lock);
-   if (ret == 0 && pages_to_unuse)
+   if (ret == 0)
try_to_unuse(type, true, pages_to_unuse);
return;
 }
-- 
1.7.3

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


KGTP (Linux debugger and tracer) 20120920 release (add LKM plugin and per cpu TSV update)

2012-09-20 Thread Hui Zhu
Hi guys,

KGTP is a flexible , lightweight and realtime Linux debugger and tracer.
To use it, you don't need patch or rebuild the Linux kernel. Just
build KGTP module and insmod it is OK.

It makes Linux Kernel supply a GDB remote debug interface. Then GDB in
current machine or remote machine can debug and trace Linux through
GDB tracepoint and some other functions without stopping the Linux
Kernel.
And even if the board doesn't have GDB on it and doesn't have
interface for remote debug. It can debug the Linux Kernel using
offline debug (See
http://code.google.com/p/kgtp/wiki/HOWTO#/sys/kernel/debug/gtpframe_and_offline_debug).
KGTP supports X86-32, X86-64, MIPS and ARM.
KGTP is tested on Linux kernel 2.6.18 to upstream.
And it can work with Android (See
http://code.google.com/p/kgtp/wiki/HowToUseKGTPinAndroid).

Please go to http://code.google.com/p/kgtp/wiki/HOWTO or
http://code.google.com/p/kgtp/wiki/HOWTO (Chinese) to get more info
about howto use KGTP.

Now, KGTP 20120920 release.
You can get the package for it from
http://kgtp.googlecode.com/files/kgtp_20120920.tar.bz2
or
svn co https://kgtp.googlecode.com/svn/tags/20120920

The main change of this release is:
C plugin support.  With this function, you can dynamic add new
function to KGTP with LKM.
To get more info about it.  Please goto
http://code.google.com/p/kgtp/wiki/HOWTO#How_to_add_plugin_in_C

Per_cpu trace state variables function was updated.  The usage and
format was changed.  This change make it more easy to be used.  And I
also update the doc to make it more clear.  Please goto
http://code.google.com/p/kgtp/wiki/HOWTO#Per_cpu_trace_state_variables
get it.

Please goto http://code.google.com/p/kgtp/wiki/UPDATE get more info
about this release.

According to the comments of Christoph, Geoff and Andi.  I make lite
patch for review.  Please goto https://lkml.org/lkml/2012/5/9/90 to
see it.

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


linux-next: manual merge of the battery tree with the mfd tree

2012-09-20 Thread Stephen Rothwell
Hi Anton,

Today's linux-next merge of the battery tree got a conflict in
include/linux/mfd/88pm860x.h between commit a70abacb06b8 ("mfd: 88pm860x:
Use REG resource in regulator") from the mfd tree and commit a830d28b48bf
("power_supply: Enable battery-charger for 88pm860x") from the battery
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc include/linux/mfd/88pm860x.h
index d515e5c,b7c5a3c..000
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@@ -359,22 -460,8 +440,23 @@@ struct pm860x_platform_data 
struct pm860x_rtc_pdata *rtc;
struct pm860x_touch_pdata   *touch;
struct pm860x_power_pdata   *power;
+   struct charger_desc *chg_desc;
 -  struct regulator_init_data  *regulator;
 +  struct regulator_init_data  *buck1;
 +  struct regulator_init_data  *buck2;
 +  struct regulator_init_data  *buck3;
 +  struct regulator_init_data  *ldo1;
 +  struct regulator_init_data  *ldo2;
 +  struct regulator_init_data  *ldo3;
 +  struct regulator_init_data  *ldo4;
 +  struct regulator_init_data  *ldo5;
 +  struct regulator_init_data  *ldo6;
 +  struct regulator_init_data  *ldo7;
 +  struct regulator_init_data  *ldo8;
 +  struct regulator_init_data  *ldo9;
 +  struct regulator_init_data  *ldo10;
 +  struct regulator_init_data  *ldo12;
 +  struct regulator_init_data  *ldo_vibrator;
 +  struct regulator_init_data  *ldo14;
  
unsigned short  companion_addr; /* I2C address of companion chip */
int i2c_port;   /* Controlled by GI2C or PI2C */


pgpnh89shEGfb.pgp
Description: PGP signature


Re: [PATCH 1/4] module: add syscall to load module from fd

2012-09-20 Thread Mimi Zohar
On Fri, 2012-09-21 at 12:22 +1000, James Morris wrote:
> On Thu, 20 Sep 2012, Kees Cook wrote:
> 
> > Earlier proposals for appending signatures to kernel modules would not be
> > useful in Chrome OS, since it would involve adding an additional set of
> > keys to our kernel and builds for no good reason: we already trust the
> > contents of our root filesystem. We don't need to verify those kernel
> > modules a second time. Having to do signature checking on module loading
> > would slow us down and be redundant. All we need to know is where a
> > module is coming from so we can say yes/no to loading it.
> 
> Just out of interest, has anyone else expressed interest in using this 
> feature?

I'm not so interested in this particular use case, but am interested in
using the new syscall's file descriptor for measuring/appraising a
kernel module's integrity.

thanks,

Mimi


--
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] module: add syscall to load module from fd

2012-09-20 Thread Kees Cook
On Thu, Sep 20, 2012 at 7:22 PM, James Morris  wrote:
> On Thu, 20 Sep 2012, Kees Cook wrote:
>
>> Earlier proposals for appending signatures to kernel modules would not be
>> useful in Chrome OS, since it would involve adding an additional set of
>> keys to our kernel and builds for no good reason: we already trust the
>> contents of our root filesystem. We don't need to verify those kernel
>> modules a second time. Having to do signature checking on module loading
>> would slow us down and be redundant. All we need to know is where a
>> module is coming from so we can say yes/no to loading it.
>
> Just out of interest, has anyone else expressed interest in using this
> feature?

Yes, in the earlier threads, Mimi spoke up in favor of it as a
possible path for IMA to do signature checking. She sent patches that
updated the LSM hooks to include callback to IMA that were sent to the
lsm list:
http://marc.info/?l=linux-security-module=134739023306344=2

Serge and Eric both Acked the new hooks too.

-Kees

-Kees

-- 
Kees Cook
Chrome OS Security
--
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 rcu] Move TINY_RCU quiescent state out of extended quiescent state

2012-09-20 Thread Paul E. McKenney
On Fri, Sep 21, 2012 at 10:08:56AM +0800, Li Zhong wrote:
> TINY_RCU's rcu_idle_enter_common() invokes rcu_sched_qs() in order
> to inform the RCU core of the quiescent state implied by idle entry.
> Of course, idle is also an extended quiescent state, so that the call
> to rcu_sched_qs() speeds up RCU's invoking of any callbacks that might
> be queued.  This speed-up is important when entering into dyntick-idle
> mode -- if there are no further scheduling-clock interrupts, the callbacks
> might never be invoked, which could result in a system hang.
> 
> However, processing callbacks does event tracing, which in turn
> implies RCU read-side critical sections, which are illegal in extended
> quiescent states.  This patch therefore moves the call to rcu_sched_qs()
> so that it precedes the point at which we set the new value of 
> rcu_dynticks_nesting, which may indicate RCU is in an extended quiescent
> state. 

Thank you, Zhong.  Queued, as those checking the SOBs below might
guess.  ;-)

Thanx, paul

> Signed-off-by: Li Zhong 
> Signed-off-by: Paul E. McKenney 
> ---
>  kernel/rcutiny.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
> index 2e073a2..e4c6a59 100644
> --- a/kernel/rcutiny.c
> +++ b/kernel/rcutiny.c
> @@ -75,9 +75,9 @@ static void rcu_idle_enter_common(long long newval)
> current->pid, current->comm,
> idle->pid, idle->comm); /* must be idle task! */
>   }
> + rcu_sched_qs(0); /* implies rcu_bh_qsctr_inc(0) */
>   barrier();
>   rcu_dynticks_nesting = newval;
> - rcu_sched_qs(0); /* implies rcu_bh_qsctr_inc(0) */
>  }
> 
>  /*
> -- 
> 1.7.9.5
> 
> 
> 

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


Re: [PATCH] module: add finit_module syscall to asm-generic

2012-09-20 Thread Rusty Russell
Arnd Bergmann  writes:

> On Thursday 20 September 2012, Kees Cook wrote:
>> 
>> This adds the finit_module syscall to the generic syscall list.
>> 
>> Signed-off-by: Kees Cook 
>> ---
>> This depends on the finit_module patchset in Rusty's tree, based on
>> https://lkml.org/lkml/2012/9/7/559
>
> Acked-by: Arnd Bergmann 
>
> Please queue this along with the other patches.

OK, I'm still holding them back from linux-next due to the question of
signatures & the new syscall.  But I expect we'll resign ourselves to an
appended signature, and they'll be fine as-is.

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: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Bjorn Helgaas
On Thu, Sep 20, 2012 at 7:51 PM, Yinghai Lu  wrote:
> On Thu, Sep 20, 2012 at 4:59 PM, Bjorn Helgaas  wrote:
>> On Thu, Sep 20, 2012 at 2:38 PM, Yinghai Lu  wrote:
>>> in that case, VFs  are stopped before PF, so they are not in device
>>> tree anymore.
>>> so pci_get_domain_bus_and_slot will not find those VFs.
>>>
>>> So the reference to PF is not released. Also vit_bus may not be released 
>>> too.
>>>
>>> So you have to rework
>>> pci_get_domain_bus_and_slot to make it work on pci devices get stopped 
>>> only.
>>>
>>> or just drop this from the tree.
>>
>> pci_find_bus() is a broken interface (because there's no reference
>> counting or safety with respect to hot-plug), and if the design
>> depends on it, that means the design is broken, too.  I don't think
>> reworking pci_get_domain_bus_and_slot() is the right answer.
>>
>> It's not clear to me why we need the split between stopping and
>> removing devices.  That split leads to these zombie devices that have
>> been stopped and are no longer findable by bus_find_device() (which is
>> used by pci_get_domain_bus_and_slot()), but still "exist" in some
>> fashion until they're removed.  It's unreasonable for random PCI and
>> driver code to have to worry about that zombie state.
>
> That is not zombie state. that is driver unloaded, and not in /sys, /proc.
> that pci device only can be found under bus->devices.

It doesn't matter whether we call this a "zombie state" or just refer
to it as "devices not in /sys & /proc but still in bus->devices."  The
point is that this state is not very useful, and code outside the PCI
core should not have to know that it exists.

> just like we have pci_device_add and pci_bus_add_device
> or acpi add and acpi start.

The fact that ACPI drivers have both .add() and .start() methods is
another artifact of poor design, in my opinion.  No other subsystem
has that split, as far as I know.  The ACPI split exists because of a
messed-up ACPI hotplug implementation.  That doesn't mean we should
copy it.

>> I'm not happy about either reverting Jiang's patch or splitting
>> stop/remove again.  It complicates the design and the code.  I'll
>> apply them because they're regressions, and we don't have time for
>> redesign before 3.7.  But I encourage you to think about how to do
>> this more cleanly.
>
> That will need to redesign sriov implementation.

That's right.  If we can improve the situation by redesigning, that's
what we should do.  The present situation, where we keep adding
special cases because "that's the way the rest of the system works" is
not sustainable in the long term.

> Also that pci root bus add/start, stop/remove will need special
> sequence to make ioapic
> and dmar to be started early before normal pci device drivers and
> stopped after normal pci device drivers.

This is another thing I'm curious about.  How do you handle this
situation today (before host bridge hot-add)?

The DMAR I'm not so worried about because as far as I know, there's no
such thing as a DMAR that's discovered by PCI enumeration.  We should
discover it via ACPI, and that can happen before we enumerate anything
behind a host bridge, so I don't really see any ordering problem
between the DMAR and the PCI devices that would use it.

However, I know there *are* IOAPICs that are enumerated as PCI
devices, and I don't know whether we can deduce a relationship between
the IOAPIC and the devices that use it.  Don't we have this problem
already?  I assume that even without hot-adding a host bridge, we
might discover a PCI IOAPIC that was present at boot, and we'd have to
make sure to bind a driver to it before we use any of the PCI devices
connected to it.  How does that work?

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


linux-next: manual merge of the md tree with the tree

2012-09-20 Thread Stephen Rothwell
Hi Neil,

Today's linux-next merge of the md tree got a conflict in fs/bio.c
between commit 4363ac7c13a9 ("block: Implement support for WRITE SAME")
from the block tree and commit 368e564836d3 ("block: makes bio_split
support bio without data") from the md tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/bio.c
index f855e0e,dbb7a6c..000
--- a/fs/bio.c
+++ b/fs/bio.c
@@@ -1485,20 -1511,19 +1485,21 @@@ struct bio_pair *bio_split(struct bio *
bp->bio2.bi_size -= first_sectors << 9;
bp->bio1.bi_size = first_sectors << 9;
  
-   bp->bv1 = bi->bi_io_vec[0];
-   bp->bv2 = bi->bi_io_vec[0];
- 
-   if (bio_is_rw(bi)) {
-   bp->bv2.bv_offset += first_sectors << 9;
-   bp->bv2.bv_len -= first_sectors << 9;
-   bp->bv1.bv_len = first_sectors << 9;
-   }
+   if (bi->bi_vcnt != 0) {
+   bp->bv1 = bi->bi_io_vec[0];
+   bp->bv2 = bi->bi_io_vec[0];
 -  bp->bv2.bv_offset += first_sectors << 9;
 -  bp->bv2.bv_len -= first_sectors << 9;
 -  bp->bv1.bv_len = first_sectors << 9;
++  if (bio_is_rw(bi)) {
++  bp->bv2.bv_offset += first_sectors << 9;
++  bp->bv2.bv_len -= first_sectors << 9;
++  bp->bv1.bv_len = first_sectors << 9;
++  }
  
-   bp->bio1.bi_io_vec = >bv1;
-   bp->bio2.bi_io_vec = >bv2;
+   bp->bio1.bi_io_vec = >bv1;
+   bp->bio2.bi_io_vec = >bv2;
  
-   bp->bio1.bi_max_vecs = 1;
-   bp->bio2.bi_max_vecs = 1;
+   bp->bio1.bi_max_vecs = 1;
+   bp->bio2.bi_max_vecs = 1;
+   }
  
bp->bio1.bi_end_io = bio_pair_end_1;
bp->bio2.bi_end_io = bio_pair_end_2;


pgpfkFSiOFuw3.pgp
Description: PGP signature


linux-next: manual merge of the md tree with the block tree

2012-09-20 Thread Stephen Rothwell
Hi Neil,

Today's linux-next merge of the md tree got a conflict in
drivers/md/raid0.c between commit 4363ac7c13a9 ("block: Implement support
for WRITE SAME") from the block tree and commit c9264cda8f11 ("md: raid 0
supports TRIM") from the md tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/md/raid0.c
index a9e4fa9,1a8e5e3..000
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@@ -422,7 -431,7 +431,8 @@@ static int raid0_run(struct mddev *mdde
if (md_check_no_bitmap(mddev))
return -EINVAL;
blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
 +  blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
+   blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
  
/* if private is not null, we are here after takeover */
if (mddev->private == NULL) {


pgpWAvXrKom72.pgp
Description: PGP signature


Re: [PATCH V3] perf: Fix parallel build

2012-09-20 Thread Namhyung Kim
On Thu, 20 Sep 2012 21:31:44 -0500, Eric Sandeen wrote:
> Parallel builds of perf were failing for me on a 32p box, with:
>
> * new build flags or prefix
> util/pmu.l:7:23: error: pmu-bison.h: No such file or directory
>
> ...
>
> make: *** [util/pmu-flex.o] Error 1
> make: *** Waiting for unfinished jobs
>
> This can pretty quickly be seen by adding a sleep in front of
> the bison calls in tools/perf/Makefile and running make -j4 on a
> smaller box i.e.:
>
>   sleep 10; $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o 
> $(OUTPUT)util/pmu-bison.c
>
> Adding the following dependencies fixes it for me.
>
> Signed-off-by: Eric Sandeen 

Reviewed-by: Namhyung Kim 

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


Re: [PATCH 2/3] clk: Add devm_clk_{register,unregister}()

2012-09-20 Thread Stephen Boyd
On 09/18/12 23:05, Stephen Boyd wrote:
> +void devm_clk_unregister(struct device *dev, struct clk *clk)
> +{
> + WARN_ON(devres_destroy(dev, devm_clk_release, devm_clk_match, clk));

Hm... I guess this needs to be devres_release() instead of destroy. Can
you squash this in or should I resend for the few character change?

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 6852809..f02f4fe 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1509,7 +1509,7 @@ static int devm_clk_match(struct device *dev, void *res, 
void *data)
  */
 void devm_clk_unregister(struct device *dev, struct clk *clk)
 {
-   WARN_ON(devres_destroy(dev, devm_clk_release, devm_clk_match, clk));
+   WARN_ON(devres_release(dev, devm_clk_release, devm_clk_match, clk));
 }
 EXPORT_SYMBOL(devm_clk_unregister);
 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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/2] do not disable sg when packet requires no checksum

2012-09-20 Thread David Miller
From: Ed Cashin 
Date: Wed, 19 Sep 2012 18:46:07 -0700

> This two-part patchset replaces an earlier net-only patch that
> added an explicit check for the AoE protocol to harmonize_features
> in net/core/dev.c.
> 
> Following the suggestions of Ben Hutchings, this patchset makes
> the decision in the network layer protocol agnostic instead of
> using ETH_P_AOE as a special case.  It relies on fresh skbs being
> CHECKSUM_NONE but makes that explicit with an assertion.
> 
> Ed L. Cashin (2):
>   aoe: assert AoE packets marked as requiring no checksum
>   net: do not disable sg for packets requiring no checksum

Applied and queued up for -stable, thanks Ed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3] perf: Fix parallel build

2012-09-20 Thread Eric Sandeen
Parallel builds of perf were failing for me on a 32p box, with:

* new build flags or prefix
util/pmu.l:7:23: error: pmu-bison.h: No such file or directory

...

make: *** [util/pmu-flex.o] Error 1
make: *** Waiting for unfinished jobs

This can pretty quickly be seen by adding a sleep in front of
the bison calls in tools/perf/Makefile and running make -j4 on a
smaller box i.e.:

sleep 10; $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o 
$(OUTPUT)util/pmu-bison.c

Adding the following dependencies fixes it for me.

Signed-off-by: Eric Sandeen 
---

V2: Fix other bison dependency caught by Namhyung Kim , 
thanks.
V3: Add $(OUTPUT) to generated deps, thanks again.

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 35655c3..01325cd 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -221,13 +221,13 @@ export PERL_PATH
 FLEX = flex
 BISON= bison
 
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
+$(OUTPUT)util/parse-events-flex.c: util/parse-events.l 
$(OUTPUT)util/parse-events-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h 
$(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
 
 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
-o $(OUTPUT)util/parse-events-bison.c
 
-$(OUTPUT)util/pmu-flex.c: util/pmu.l
+$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
util/pmu.l > $(OUTPUT)util/pmu-flex.c
 
 $(OUTPUT)util/pmu-bison.c: util/pmu.y


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


Re: [PATCH 1/4] module: add syscall to load module from fd

2012-09-20 Thread James Morris
On Thu, 20 Sep 2012, Kees Cook wrote:

> Earlier proposals for appending signatures to kernel modules would not be
> useful in Chrome OS, since it would involve adding an additional set of
> keys to our kernel and builds for no good reason: we already trust the
> contents of our root filesystem. We don't need to verify those kernel
> modules a second time. Having to do signature checking on module loading
> would slow us down and be redundant. All we need to know is where a
> module is coming from so we can say yes/no to loading it.

Just out of interest, has anyone else expressed interest in using this 
feature?



-- 
James Morris

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


[PATCH 10/10] ARM: msm: Migrate to common clock framework

2012-09-20 Thread Stephen Boyd
Move the existing clock code in mach-msm to the common clock
framework. We lose our capability to set the rate of and enable a
clock through debugfs. This is ok though because the debugfs
features are mainly used for testing and development of new clock
code.

To maintain compatibility with the original MSM clock code we
make a wrapper for clk_reset() that calls the struct msm_clk
specific reset function. This is necessary for the usb and sdcc
devices on MSM until a better suited API is made available.

Cc: Saravana Kannan 
Cc: Mike Turquette 
Signed-off-by: Stephen Boyd 
---
 arch/arm/Kconfig|   1 +
 arch/arm/mach-msm/Makefile  |   1 -
 arch/arm/mach-msm/clock-debug.c | 123 --
 arch/arm/mach-msm/clock-pcom.c  | 118 ++---
 arch/arm/mach-msm/clock-pcom.h  |  30 
 arch/arm/mach-msm/clock.c   | 146 ++--
 arch/arm/mach-msm/clock.h   |  46 +++-
 arch/arm/mach-msm/devices-msm7x00.c |   2 +-
 arch/arm/mach-msm/devices-msm7x30.c |   2 +-
 arch/arm/mach-msm/devices-qsd8x50.c |   2 +-
 10 files changed, 108 insertions(+), 363 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-debug.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 433e9b8..2809213 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -727,6 +727,7 @@ config ARCH_MSM
select GENERIC_CLOCKEVENTS
select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP
+   select COMMON_CLK
help
  Support for Qualcomm MSM/QSD based systems.  This runs on the
  apps processor of the MSM/QSD and depends on a shared memory
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 3dbae74..700d77b 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,6 +1,5 @@
 obj-y += io.o timer.o
 obj-y += clock.o
-obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
deleted file mode 100644
index c4b34d7..000
--- a/arch/arm/mach-msm/clock-debug.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "clock.h"
-
-static int clock_debug_rate_set(void *data, u64 val)
-{
-   struct clk *clock = data;
-   int ret;
-
-   ret = clk_set_rate(clock, val);
-   if (ret != 0)
-   printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
-   (clock->flags & CLK_MIN) ? "_min" : "", ret);
-   return ret;
-}
-
-static int clock_debug_rate_get(void *data, u64 *val)
-{
-   struct clk *clock = data;
-   *val = clk_get_rate(clock);
-   return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_debug_rate_get,
-   clock_debug_rate_set, "%llu\n");
-
-static int clock_debug_enable_set(void *data, u64 val)
-{
-   struct clk *clock = data;
-   int rc = 0;
-
-   if (val)
-   rc = clock->ops->enable(clock->id);
-   else
-   clock->ops->disable(clock->id);
-
-   return rc;
-}
-
-static int clock_debug_enable_get(void *data, u64 *val)
-{
-   struct clk *clock = data;
-
-   *val = clock->ops->is_enabled(clock->id);
-
-   return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(clock_enable_fops, clock_debug_enable_get,
-   clock_debug_enable_set, "%llu\n");
-
-static int clock_debug_local_get(void *data, u64 *val)
-{
-   struct clk *clock = data;
-
-   *val = clock->ops->is_local(clock->id);
-
-   return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get,
-   NULL, "%llu\n");
-
-static struct dentry *debugfs_base;
-
-int __init clock_debug_init(void)
-{
-   debugfs_base = debugfs_create_dir("clk", NULL);
-   if (!debugfs_base)
-   return -ENOMEM;
-   return 0;
-}
-
-int __init clock_debug_add(struct clk *clock)
-{
-   char temp[50], *ptr;
-   struct dentry *clk_dir;
-
-   if (!debugfs_base)
-   return -ENOMEM;
-
-   strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
-   for (ptr = temp; *ptr; ptr++)
-   *ptr = tolower(*ptr);
-
-   clk_dir = debugfs_create_dir(temp, debugfs_base);
-   if (!clk_dir)
-   return 

[PATCH 05/10] ARM: msm: Remove custom clk_set_flags() API

2012-09-20 Thread Stephen Boyd
Nobody is using this API upstream and it's just contributing
cruft. Remove it so the MSM clock API is closer to the generic
struct clock API.

Cc: Saravana Kannan 
Signed-off-by: Stephen Boyd 
---
 arch/arm/mach-msm/clock-pcom.c   | 10 --
 arch/arm/mach-msm/clock.c|  8 
 arch/arm/mach-msm/clock.h|  6 --
 arch/arm/mach-msm/include/mach/clk.h |  3 ---
 4 files changed, 27 deletions(-)

diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c
index a52c970..bb75f8e 100644
--- a/arch/arm/mach-msm/clock-pcom.c
+++ b/arch/arm/mach-msm/clock-pcom.c
@@ -85,15 +85,6 @@ static int pc_clk_set_max_rate(unsigned id, unsigned rate)
return (int)id < 0 ? -EINVAL : 0;
 }
 
-static int pc_clk_set_flags(unsigned id, unsigned flags)
-{
-   int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_FLAGS, , );
-   if (rc < 0)
-   return rc;
-   else
-   return (int)id < 0 ? -EINVAL : 0;
-}
-
 static unsigned pc_clk_get_rate(unsigned id)
 {
if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, , NULL))
@@ -130,7 +121,6 @@ struct clk_ops clk_ops_pcom = {
.set_rate = pc_clk_set_rate,
.set_min_rate = pc_clk_set_min_rate,
.set_max_rate = pc_clk_set_max_rate,
-   .set_flags = pc_clk_set_flags,
.get_rate = pc_clk_get_rate,
.is_enabled = pc_clk_is_enabled,
.round_rate = pc_clk_round_rate,
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index d9145df..5fac2df 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -121,14 +121,6 @@ struct clk *clk_get_parent(struct clk *clk)
 }
 EXPORT_SYMBOL(clk_get_parent);
 
-int clk_set_flags(struct clk *clk, unsigned long flags)
-{
-   if (clk == NULL || IS_ERR(clk))
-   return -EINVAL;
-   return clk->ops->set_flags(clk->id, flags);
-}
-EXPORT_SYMBOL(clk_set_flags);
-
 /* EBI1 is the only shared clock that several clients want to vote on as of
  * this commit. If this changes in the future, then it might be better to
  * make clk_min_rate handle the voting or make ebi1_clk_set_min_rate more
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index 2c007f6..a25ff58 100644
--- a/arch/arm/mach-msm/clock.h
+++ b/arch/arm/mach-msm/clock.h
@@ -21,11 +21,6 @@
 #include 
 #include 
 
-#define CLKFLAG_INVERT 0x0001
-#define CLKFLAG_NOINVERT   0x0002
-#define CLKFLAG_NONEST 0x0004
-#define CLKFLAG_NORESET0x0008
-
 #define CLK_FIRST_AVAILABLE_FLAG   0x0100
 #define CLKFLAG_AUTO_OFF   0x0200
 #define CLKFLAG_MIN0x0400
@@ -39,7 +34,6 @@ struct clk_ops {
int (*set_rate)(unsigned id, unsigned rate);
int (*set_min_rate)(unsigned id, unsigned rate);
int (*set_max_rate)(unsigned id, unsigned rate);
-   int (*set_flags)(unsigned id, unsigned flags);
unsigned (*get_rate)(unsigned id);
unsigned (*is_enabled)(unsigned id);
long (*round_rate)(unsigned id, unsigned rate);
diff --git a/arch/arm/mach-msm/include/mach/clk.h 
b/arch/arm/mach-msm/include/mach/clk.h
index e8d3842..5f1c37d 100644
--- a/arch/arm/mach-msm/include/mach/clk.h
+++ b/arch/arm/mach-msm/include/mach/clk.h
@@ -34,7 +34,4 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate);
 /* Assert/Deassert reset to a hardware block associated with a clock */
 int clk_reset(struct clk *clk, enum clk_reset_action action);
 
-/* Set clock-specific configuration parameters */
-int clk_set_flags(struct clk *clk, unsigned long flags);
-
 #endif
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 08/10] ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver

2012-09-20 Thread Stephen Boyd
In the near future we'll be moving clock-pcom to a platform
driver, in which case these two users of clk_get() in mach-msm
need to be updated. Have board-trout-panel.c make the proc_comm
call directly so that we don't have to port this board specific
code to the driver right now and reorder the initcall order of
dma.c so that it initializes after the clock driver probes but
before any drivers use dma APIs.

Signed-off-by: Stephen Boyd 
---
 arch/arm/mach-msm/Makefile|  9 ++---
 arch/arm/mach-msm/board-trout-panel.c | 19 +++
 arch/arm/mach-msm/dma.c   |  5 ++---
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 17519fa..3dbae74 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -5,12 +5,15 @@ obj-$(CONFIG_DEBUG_FS) += clock-debug.o
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
 
-obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o
-obj-$(CONFIG_ARCH_MSM7X30) += dma.o
-obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
+obj-$(CONFIG_ARCH_MSM7X00A) += irq.o
+obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
+obj-$(CONFIG_ARCH_MSM7X00A) += dma.o
+obj-$(CONFIG_ARCH_MSM7X30) += dma.o
+obj-$(CONFIG_ARCH_QSD8X50) += dma.o
+
 obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
 obj-$(CONFIG_MSM_SMD) += last_radio_log.o
 obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o
diff --git a/arch/arm/mach-msm/board-trout-panel.c 
b/arch/arm/mach-msm/board-trout-panel.c
index 89bf6b4..0be703b 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -19,6 +18,7 @@
 
 #include "board-trout.h"
 #include "proc_comm.h"
+#include "clock-pcom.h"
 #include "devices.h"
 
 #define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255
@@ -170,7 +170,6 @@ static struct mddi_table mddi_toshiba_init_table[] = {
 #define INTMASK_VWAKEOUT (1U << 0)
 
 
-static struct clk *gp_clk;
 static int trout_new_backlight = 1;
 static struct vreg *vreg_mddi_1v5;
 static struct vreg *vreg_lcm_2v85;
@@ -273,18 +272,14 @@ int __init trout_init_panel(void)
} else {
uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT,
GPIO_NO_PULL, GPIO_8MA);
+   uint32_t id = P_GP_CLK;
+   uint32_t rate = 1920;
+
msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, , 0);
 
-   gp_clk = clk_get(NULL, "gp_clk");
-   if (IS_ERR(gp_clk)) {
-   printk(KERN_ERR "trout_init_panel: could not get gp"
-  "clock\n");
-   gp_clk = NULL;
-   }
-   rc = clk_set_rate(gp_clk, 1920);
-   if (rc)
-   printk(KERN_ERR "trout_init_panel: set clock rate "
-  "failed\n");
+   msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, , );
+   if (id < 0)
+   pr_err("trout_init_panel: set clock rate failed\n");
}
 
rc = platform_device_register(_device_mdp);
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
index 354b91d..37a4ddd 100644
--- a/arch/arm/mach-msm/dma.c
+++ b/arch/arm/mach-msm/dma.c
@@ -258,6 +258,7 @@ static int __init msm_init_datamover(void)
clk = clk_get(NULL, "adm_clk");
if (IS_ERR(clk))
return PTR_ERR(clk);
+   clk_prepare(clk);
msm_dmov_clk = clk;
ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, 
"msmdatamover", NULL);
if (ret)
@@ -265,6 +266,4 @@ static int __init msm_init_datamover(void)
disable_irq(INT_ADM_AARM);
return 0;
 }
-
-arch_initcall(msm_init_datamover);
-
+module_init(msm_init_datamover);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 07/10] ARM: msm: Remove clock-7x30.h include file

2012-09-20 Thread Stephen Boyd
This file is not used outside of the two users in the clock-7x30
array. Those two clocks are virtual "source" clocks that don't
really need to exist outside of the clock driver. Let's remove
them from the array, since they're not doing anything anyway, and
then remove the clock-7x30.h include file along with it.

Cc: Saravana Kannan 
Signed-off-by: Stephen Boyd 
---
 arch/arm/mach-msm/clock-7x30.h  | 155 
 arch/arm/mach-msm/devices-msm7x30.c |   2 -
 2 files changed, 157 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h

diff --git a/arch/arm/mach-msm/clock-7x30.h b/arch/arm/mach-msm/clock-7x30.h
deleted file mode 100644
index 1410445..000
--- a/arch/arm/mach-msm/clock-7x30.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
-#define __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
-
-enum {
-   L_7X30_NONE_CLK = -1,
-   L_7X30_ADM_CLK,
-   L_7X30_I2C_CLK,
-   L_7X30_I2C_2_CLK,
-   L_7X30_QUP_I2C_CLK,
-   L_7X30_UART1DM_CLK,
-   L_7X30_UART1DM_P_CLK,
-   L_7X30_UART2DM_CLK,
-   L_7X30_UART2DM_P_CLK,
-   L_7X30_EMDH_CLK,
-   L_7X30_EMDH_P_CLK,
-   L_7X30_PMDH_CLK,
-   L_7X30_PMDH_P_CLK,
-   L_7X30_GRP_2D_CLK,
-   L_7X30_GRP_2D_P_CLK,
-   L_7X30_GRP_3D_SRC_CLK,
-   L_7X30_GRP_3D_CLK,
-   L_7X30_GRP_3D_P_CLK,
-   L_7X30_IMEM_CLK,
-   L_7X30_SDC1_CLK,
-   L_7X30_SDC1_P_CLK,
-   L_7X30_SDC2_CLK,
-   L_7X30_SDC2_P_CLK,
-   L_7X30_SDC3_CLK,
-   L_7X30_SDC3_P_CLK,
-   L_7X30_SDC4_CLK,
-   L_7X30_SDC4_P_CLK,
-   L_7X30_MDP_CLK,
-   L_7X30_MDP_P_CLK,
-   L_7X30_MDP_LCDC_PCLK_CLK,
-   L_7X30_MDP_LCDC_PAD_PCLK_CLK,
-   L_7X30_MDP_VSYNC_CLK,
-   L_7X30_MI2S_CODEC_RX_M_CLK,
-   L_7X30_MI2S_CODEC_RX_S_CLK,
-   L_7X30_MI2S_CODEC_TX_M_CLK,
-   L_7X30_MI2S_CODEC_TX_S_CLK,
-   L_7X30_MI2S_M_CLK,
-   L_7X30_MI2S_S_CLK,
-   L_7X30_LPA_CODEC_CLK,
-   L_7X30_LPA_CORE_CLK,
-   L_7X30_LPA_P_CLK,
-   L_7X30_MIDI_CLK,
-   L_7X30_MDC_CLK,
-   L_7X30_ROTATOR_IMEM_CLK,
-   L_7X30_ROTATOR_P_CLK,
-   L_7X30_SDAC_M_CLK,
-   L_7X30_SDAC_CLK,
-   L_7X30_UART1_CLK,
-   L_7X30_UART2_CLK,
-   L_7X30_UART3_CLK,
-   L_7X30_TV_CLK,
-   L_7X30_TV_DAC_CLK,
-   L_7X30_TV_ENC_CLK,
-   L_7X30_HDMI_CLK,
-   L_7X30_TSIF_REF_CLK,
-   L_7X30_TSIF_P_CLK,
-   L_7X30_USB_HS_SRC_CLK,
-   L_7X30_USB_HS_CLK,
-   L_7X30_USB_HS_CORE_CLK,
-   L_7X30_USB_HS_P_CLK,
-   L_7X30_USB_HS2_CLK,
-   L_7X30_USB_HS2_CORE_CLK,
-   L_7X30_USB_HS2_P_CLK,
-   L_7X30_USB_HS3_CLK,
-   L_7X30_USB_HS3_CORE_CLK,
-   L_7X30_USB_HS3_P_CLK,
-   L_7X30_VFE_CLK,
-   L_7X30_VFE_P_CLK,
-   L_7X30_VFE_MDC_CLK,
-   L_7X30_VFE_CAMIF_CLK,
-   L_7X30_CAMIF_PAD_P_CLK,
-   L_7X30_CAM_M_CLK,
-   L_7X30_JPEG_CLK,
-   L_7X30_JPEG_P_CLK,
-   L_7X30_VPE_CLK,
-   L_7X30_MFC_CLK,
-   L_7X30_MFC_DIV2_CLK,
-   L_7X30_MFC_P_CLK,
-   L_7X30_SPI_CLK,
-   L_7X30_SPI_P_CLK,
-   L_7X30_CSI0_CLK,
-   L_7X30_CSI0_VFE_CLK,
-   L_7X30_CSI0_P_CLK,
-   L_7X30_CSI1_CLK,
-   L_7X30_CSI1_VFE_CLK,
-   L_7X30_CSI1_P_CLK,
-   L_7X30_GLBL_ROOT_CLK,
-
-   L_7X30_AXI_LI_VG_CLK,
-   L_7X30_AXI_LI_GRP_CLK,
-   L_7X30_AXI_LI_JPEG_CLK,
-   L_7X30_AXI_GRP_2D_CLK,
-   L_7X30_AXI_MFC_CLK,
-   L_7X30_AXI_VPE_CLK,
-   L_7X30_AXI_LI_VFE_CLK,
-   L_7X30_AXI_LI_APPS_CLK,
-   L_7X30_AXI_MDP_CLK,
-   L_7X30_AXI_IMEM_CLK,
-   L_7X30_AXI_LI_ADSP_A_CLK,
-   L_7X30_AXI_ROTATOR_CLK,
-
-   L_7X30_NR_CLKS
-};
-
-struct clk_ops;
-extern struct clk_ops clk_ops_7x30;
-
-struct clk_ops *clk_7x30_is_local(uint32_t id);
-int clk_7x30_init(void);
-
-void pll_enable(uint32_t pll);
-void pll_disable(uint32_t pll);
-
-extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable);
-
-#define CLK_7X30(clk_name, clk_id, clk_dev, clk_flags) {   \
-   .con_id = clk_name, \
-   .dev_id = clk_dev, \
-   .clk = &(struct clk){ \
-   .id = L_7X30_##clk_id, \
-   .remote_id = P_##clk_id, \
-   .flags = clk_flags, \
-   .dbg_name = #clk_id, \
-   }, \
-   }
-
-#define CLK_7X30S(clk_name, l_id, r_id, clk_dev, clk_flags) {  \
-   .con_id = clk_name, \
-   .dev_id = clk_dev, \
-   .clk = &(struct 

[PATCH 09/10] ARM: msm: Make proc_comm clock control into a platform driver

2012-09-20 Thread Stephen Boyd
To move closer to the generic struct clock framework move the
proc_comm based clock code to a platform driver. The data
describing the struct clks still live in the devices-$ARCH file,
but the clock initialization is done at driver binding time.

Cc: Saravana Kannan 
Signed-off-by: Stephen Boyd 
---
 arch/arm/mach-msm/board-halibut.c  |  2 +-
 arch/arm/mach-msm/board-msm7x30.c  |  2 +-
 arch/arm/mach-msm/board-qsd8x50.c  |  2 +-
 arch/arm/mach-msm/board-trout.c|  3 +--
 arch/arm/mach-msm/clock-pcom.c | 23 +--
 arch/arm/mach-msm/clock-pcom.h |  5 +
 arch/arm/mach-msm/clock.c  |  2 +-
 arch/arm/mach-msm/clock.h  |  3 +++
 arch/arm/mach-msm/devices-msm7x00.c| 12 ++--
 arch/arm/mach-msm/devices-msm7x30.c| 11 +--
 arch/arm/mach-msm/devices-qsd8x50.c| 11 +--
 arch/arm/mach-msm/devices.h| 15 +++
 arch/arm/mach-msm/include/mach/board.h |  5 -
 13 files changed, 65 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-msm/board-halibut.c 
b/arch/arm/mach-msm/board-halibut.c
index 6ce542e..3c8cfe4 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = {
 };
 
 static struct platform_device *devices[] __initdata = {
+   _clock_7x01a,
_device_uart3,
_device_smd,
_device_nand,
@@ -90,7 +91,6 @@ static void __init halibut_fixup(struct tag *tags, char 
**cmdline,
 static void __init halibut_map_io(void)
 {
msm_map_common_io();
-   msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
 }
 
 static void __init halibut_init_late(void)
diff --git a/arch/arm/mach-msm/board-msm7x30.c 
b/arch/arm/mach-msm/board-msm7x30.c
index effa6f4..22e267e 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] 
= {
 };
 
 static struct platform_device *devices[] __initdata = {
+   _clock_7x30,
 #if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
 _device_uart2,
 #endif
@@ -115,7 +116,6 @@ static void __init msm7x30_init(void)
 static void __init msm7x30_map_io(void)
 {
msm_map_msm7x30_io();
-   msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30);
 }
 
 static void __init msm7x30_init_late(void)
diff --git a/arch/arm/mach-msm/board-qsd8x50.c 
b/arch/arm/mach-msm/board-qsd8x50.c
index b16b71a..4d5d7ef 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = {
 };
 
 static struct platform_device *devices[] __initdata = {
+   _clock_8x50,
_device_uart3,
_device_smd,
_device_otg,
@@ -171,7 +172,6 @@ static void __init qsd8x50_init_mmc(void)
 static void __init qsd8x50_map_io(void)
 {
msm_map_qsd8x50_io();
-   msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50);
 }
 
 static void __init qsd8x50_init_irq(void)
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 4ba0800..c8352e7 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -36,6 +36,7 @@
 extern int trout_init_mmc(unsigned int);
 
 static struct platform_device *devices[] __initdata = {
+   _clock_7x01a,
_device_uart3,
_device_smd,
_device_nand,
@@ -93,8 +94,6 @@ static void __init trout_map_io(void)
/* route UART3 to the "H2W" extended usb connector */
writeb(0x80, TROUT_CPLD_BASE + 0x00);
 #endif
-
-   msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
 }
 
 static void __init trout_init_late(void)
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c
index bb75f8e..7c4c60a 100644
--- a/arch/arm/mach-msm/clock-pcom.c
+++ b/arch/arm/mach-msm/clock-pcom.c
@@ -14,8 +14,9 @@
  */
 
 #include 
-#include 
-#include 
+#include 
+#include 
+
 #include 
 
 #include "proc_comm.h"
@@ -126,3 +127,21 @@ struct clk_ops clk_ops_pcom = {
.round_rate = pc_clk_round_rate,
.is_local = pc_clk_is_local,
 };
+
+static int __devinit msm_clock_pcom_probe(struct platform_device *pdev)
+{
+   struct pcom_clk_pdata *pdata = pdev->dev.platform_data;
+   msm_clock_init(pdata->lookup, pdata->num_lookups);
+   return 0;
+}
+
+static struct platform_driver msm_clock_pcom_driver = {
+   .probe  = msm_clock_pcom_probe,
+   .driver = {
+   .name   = "msm-clock-pcom",
+   .owner  = THIS_MODULE,
+   },
+};
+module_platform_driver(msm_clock_pcom_driver);
+
+MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/clock-pcom.h b/arch/arm/mach-msm/clock-pcom.h
index 974d003..87406a3 100644
--- a/arch/arm/mach-msm/clock-pcom.h
+++ b/arch/arm/mach-msm/clock-pcom.h
@@ -123,6 +123,11 @@
 struct clk_ops;
 extern struct clk_ops 

[PATCH 03/10] msm: iommu: Convert to clk_prepare/unprepare

2012-09-20 Thread Stephen Boyd
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework. We never unprepare the clocks until
driver remove because the clocks are enabled and disabled in irq
context. Finer grained power management is possible in the future
via runtime power management techniques.

Signed-off-by: Stephen Boyd 
---
 drivers/iommu/msm_iommu_dev.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
index 8e8fb07..d344f6a 100644
--- a/drivers/iommu/msm_iommu_dev.c
+++ b/drivers/iommu/msm_iommu_dev.c
@@ -160,7 +160,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
goto fail;
}
 
-   ret = clk_enable(iommu_pclk);
+   ret = clk_prepare_enable(iommu_pclk);
if (ret)
goto fail_enable;
 
@@ -170,7 +170,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
if (clk_get_rate(iommu_clk) == 0)
clk_set_min_rate(iommu_clk, 1);
 
-   ret = clk_enable(iommu_clk);
+   ret = clk_prepare_enable(iommu_clk);
if (ret) {
clk_put(iommu_clk);
goto fail_pclk;
@@ -261,7 +261,7 @@ fail_clk:
clk_put(iommu_clk);
}
 fail_pclk:
-   clk_disable(iommu_pclk);
+   clk_disable_unprepare(iommu_pclk);
 fail_enable:
clk_put(iommu_pclk);
 fail:
@@ -275,8 +275,11 @@ static int msm_iommu_remove(struct platform_device *pdev)
 
drv = platform_get_drvdata(pdev);
if (drv) {
-   if (drv->clk)
+   if (drv->clk) {
+   clk_unprepare(drv->clk);
clk_put(drv->clk);
+   }
+   clk_unprepare(drv->pclk);
clk_put(drv->pclk);
memset(drv, 0, sizeof(*drv));
kfree(drv);
@@ -314,14 +317,14 @@ static int msm_iommu_ctx_probe(struct platform_device 
*pdev)
INIT_LIST_HEAD(_drvdata->attached_elm);
platform_set_drvdata(pdev, ctx_drvdata);
 
-   ret = clk_enable(drvdata->pclk);
+   ret = clk_prepare_enable(drvdata->pclk);
if (ret)
goto fail;
 
if (drvdata->clk) {
-   ret = clk_enable(drvdata->clk);
+   ret = clk_prepare_enable(drvdata->clk);
if (ret) {
-   clk_disable(drvdata->pclk);
+   clk_disable_unprepare(drvdata->pclk);
goto fail;
}
}
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 00/10] Convert MSM to common clock framework

2012-09-20 Thread Stephen Boyd
This patchset moves the existing MSM clock code and affected drivers to the
common clock framework. A prerequisite of moving to the common clock
framework is to use clk_prepare() and clk_enable() so the first
few patches migrate drivers to that call (clk_prepare() is a no-op on MSM
right now). It also removes some custom clock APIs that MSM provides
and finally moves the proc_comm clock code to the common struct clock.

This patch series will be used as the foundation of the MSM 8660/8960
clock code that I plan to send out soon.

These patches have one dependency on the devm_clk_register() function
which I already posted to the list[1]. They're based on linux-next-20120917.

Stephen Boyd (10):
  usb: otg: msm: Convert to clk_prepare/unprepare
  msm_sdcc: Convert to clk_prepare/unprepare
  msm: iommu: Convert to clk_prepare/unprepare
  msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()
  ARM: msm: Remove custom clk_set_flags() API
  ARM: msm: Remove custom clk_set_{max,min}_rate() API
  ARM: msm: Remove clock-7x30.h include file
  ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver
  ARM: msm: Make proc_comm clock control into a platform driver
  ARM: msm: Migrate to common clock framework

 arch/arm/Kconfig   |   1 +
 arch/arm/mach-msm/Makefile |  10 +-
 arch/arm/mach-msm/board-halibut.c  |   2 +-
 arch/arm/mach-msm/board-msm7x30.c  |   2 +-
 arch/arm/mach-msm/board-qsd8x50.c  |   2 +-
 arch/arm/mach-msm/board-trout-panel.c  |  19 ++--
 arch/arm/mach-msm/board-trout.c|   3 +-
 arch/arm/mach-msm/clock-7x30.h | 155 --
 arch/arm/mach-msm/clock-debug.c| 130 --
 arch/arm/mach-msm/clock-pcom.c | 149 ++---
 arch/arm/mach-msm/clock-pcom.h |  31 +++---
 arch/arm/mach-msm/clock.c  | 166 +
 arch/arm/mach-msm/clock.h  |  51 +++---
 arch/arm/mach-msm/devices-msm7x00.c|  12 ++-
 arch/arm/mach-msm/devices-msm7x30.c|  13 ++-
 arch/arm/mach-msm/devices-qsd8x50.c|  11 ++-
 arch/arm/mach-msm/devices.h|  15 +--
 arch/arm/mach-msm/dma.c|   5 +-
 arch/arm/mach-msm/include/mach/board.h |   5 -
 arch/arm/mach-msm/include/mach/clk.h   |   9 --
 drivers/iommu/msm_iommu_dev.c  |  20 ++--
 drivers/mmc/host/msm_sdcc.c|  14 ++-
 drivers/usb/otg/msm_otg.c  |  38 
 23 files changed, 222 insertions(+), 641 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
 delete mode 100644 arch/arm/mach-msm/clock-debug.c

[1] https://lkml.org/lkml/2012/9/19/28

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 04/10] msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()

2012-09-20 Thread Stephen Boyd
Calling clk_set_min_rate() is no better than just calling
clk_set_rate() because MSM clock code already takes care of
calling the min_rate ops if the clock really needs
clk_set_min_rate() called on it.

Signed-off-by: Stephen Boyd 
---
 drivers/iommu/msm_iommu_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
index d344f6a..9144a6b 100644
--- a/drivers/iommu/msm_iommu_dev.c
+++ b/drivers/iommu/msm_iommu_dev.c
@@ -29,7 +29,6 @@
 
 #include 
 #include 
-#include 
 
 struct iommu_ctx_iter_data {
/* input */
@@ -168,7 +167,7 @@ static int msm_iommu_probe(struct platform_device *pdev)
 
if (!IS_ERR(iommu_clk)) {
if (clk_get_rate(iommu_clk) == 0)
-   clk_set_min_rate(iommu_clk, 1);
+   clk_set_rate(iommu_clk, 1);
 
ret = clk_prepare_enable(iommu_clk);
if (ret) {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 02/10] msm_sdcc: Convert to clk_prepare/unprepare

2012-09-20 Thread Stephen Boyd
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework.

Signed-off-by: Stephen Boyd 
---
 drivers/mmc/host/msm_sdcc.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 1d14cda..10cc05b 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1269,10 +1269,18 @@ msmsdcc_probe(struct platform_device *pdev)
goto clk_put;
}
 
+   ret = clk_prepare(host->pclk);
+   if (ret)
+   goto clk_put;
+
+   ret = clk_prepare(host->clk);
+   if (ret)
+   goto clk_unprepare_p;
+
/* Enable clocks */
ret = msmsdcc_enable_clocks(host);
if (ret)
-   goto clk_put;
+   goto clk_unprepare;
 
host->pclk_rate = clk_get_rate(host->pclk);
host->clk_rate = clk_get_rate(host->clk);
@@ -1387,6 +1395,10 @@ msmsdcc_probe(struct platform_device *pdev)
free_irq(host->stat_irq, host);
  clk_disable:
msmsdcc_disable_clocks(host, 0);
+ clk_unprepare:
+   clk_unprepare(host->clk);
+ clk_unprepare_p:
+   clk_unprepare(host->pclk);
  clk_put:
clk_put(host->clk);
  pclk_put:
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 01/10] usb: otg: msm: Convert to clk_prepare/unprepare

2012-09-20 Thread Stephen Boyd
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework.

Cc: Felipe Balbi 
Signed-off-by: Stephen Boyd 
---
 drivers/usb/otg/msm_otg.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 9f5fc90..2ae0639 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
motg->pdata->otg_control == OTG_PMIC_CONTROL)
writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
-   clk_disable(motg->pclk);
-   clk_disable(motg->clk);
+   clk_disable_unprepare(motg->pclk);
+   clk_disable_unprepare(motg->clk);
if (motg->core_clk)
-   clk_disable(motg->core_clk);
+   clk_disable_unprepare(motg->core_clk);
 
if (!IS_ERR(motg->pclk_src))
-   clk_disable(motg->pclk_src);
+   clk_disable_unprepare(motg->pclk_src);
 
if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
motg->pdata->otg_control == OTG_PMIC_CONTROL) {
@@ -552,12 +552,12 @@ static int msm_otg_resume(struct msm_otg *motg)
return 0;
 
if (!IS_ERR(motg->pclk_src))
-   clk_enable(motg->pclk_src);
+   clk_prepare_enable(motg->pclk_src);
 
-   clk_enable(motg->pclk);
-   clk_enable(motg->clk);
+   clk_prepare_enable(motg->pclk);
+   clk_prepare_enable(motg->clk);
if (motg->core_clk)
-   clk_enable(motg->core_clk);
+   clk_prepare_enable(motg->core_clk);
 
if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
motg->pdata->otg_control == OTG_PMIC_CONTROL) {
@@ -1468,7 +1468,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
if (IS_ERR(motg->pclk_src))
goto put_clk;
clk_set_rate(motg->pclk_src, INT_MAX);
-   clk_enable(motg->pclk_src);
+   clk_prepare_enable(motg->pclk_src);
} else
motg->pclk_src = ERR_PTR(-ENOENT);
 
@@ -1511,8 +1511,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
goto free_regs;
}
 
-   clk_enable(motg->clk);
-   clk_enable(motg->pclk);
+   clk_prepare_enable(motg->clk);
+   clk_prepare_enable(motg->pclk);
 
ret = msm_hsusb_init_vddcx(motg, 1);
if (ret) {
@@ -1532,7 +1532,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
}
 
if (motg->core_clk)
-   clk_enable(motg->core_clk);
+   clk_prepare_enable(motg->core_clk);
 
writel(0, USB_USBINTR);
writel(0, USB_OTGSC);
@@ -1579,8 +1579,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
 free_irq:
free_irq(motg->irq, motg);
 disable_clks:
-   clk_disable(motg->pclk);
-   clk_disable(motg->clk);
+   clk_disable_unprepare(motg->pclk);
+   clk_disable_unprepare(motg->clk);
 ldo_exit:
msm_hsusb_ldo_init(motg, 0);
 vddcx_exit:
@@ -1593,7 +1593,7 @@ put_core_clk:
clk_put(motg->pclk);
 put_pclk_src:
if (!IS_ERR(motg->pclk_src)) {
-   clk_disable(motg->pclk_src);
+   clk_disable_unprepare(motg->pclk_src);
clk_put(motg->pclk_src);
}
 put_clk:
@@ -1643,12 +1643,12 @@ static int __devexit msm_otg_remove(struct 
platform_device *pdev)
if (cnt >= PHY_SUSPEND_TIMEOUT_USEC)
dev_err(phy->dev, "Unable to suspend PHY\n");
 
-   clk_disable(motg->pclk);
-   clk_disable(motg->clk);
+   clk_disable_unprepare(motg->pclk);
+   clk_disable_unprepare(motg->clk);
if (motg->core_clk)
-   clk_disable(motg->core_clk);
+   clk_disable_unprepare(motg->core_clk);
if (!IS_ERR(motg->pclk_src)) {
-   clk_disable(motg->pclk_src);
+   clk_disable_unprepare(motg->pclk_src);
clk_put(motg->pclk_src);
}
msm_hsusb_ldo_init(motg, 0);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 06/10] ARM: msm: Remove custom clk_set_{max,min}_rate() API

2012-09-20 Thread Stephen Boyd
There are no users of this API anymore so let's just remove it.
If a need arises in the future we can extend the common clock API
to handle it.

Cc: Saravana Kannan 
Signed-off-by: Stephen Boyd 
---
 arch/arm/mach-msm/clock-debug.c  |  9 +
 arch/arm/mach-msm/clock.c| 12 
 arch/arm/mach-msm/include/mach/clk.h |  6 --
 3 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
index 4886404..c4b34d7 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -25,14 +25,7 @@ static int clock_debug_rate_set(void *data, u64 val)
struct clk *clock = data;
int ret;
 
-   /* Only increases to max rate will succeed, but that's actually good
-* for debugging purposes so we don't check for error. */
-   if (clock->flags & CLK_MAX)
-   clk_set_max_rate(clock, val);
-   if (clock->flags & CLK_MIN)
-   ret = clk_set_min_rate(clock, val);
-   else
-   ret = clk_set_rate(clock, val);
+   ret = clk_set_rate(clock, val);
if (ret != 0)
printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
(clock->flags & CLK_MIN) ? "_min" : "", ret);
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 5fac2df..8d07b25 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -97,18 +97,6 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
 }
 EXPORT_SYMBOL(clk_round_rate);
 
-int clk_set_min_rate(struct clk *clk, unsigned long rate)
-{
-   return clk->ops->set_min_rate(clk->id, rate);
-}
-EXPORT_SYMBOL(clk_set_min_rate);
-
-int clk_set_max_rate(struct clk *clk, unsigned long rate)
-{
-   return clk->ops->set_max_rate(clk->id, rate);
-}
-EXPORT_SYMBOL(clk_set_max_rate);
-
 int clk_set_parent(struct clk *clk, struct clk *parent)
 {
return -ENOSYS;
diff --git a/arch/arm/mach-msm/include/mach/clk.h 
b/arch/arm/mach-msm/include/mach/clk.h
index 5f1c37d..fd4f4a7 100644
--- a/arch/arm/mach-msm/include/mach/clk.h
+++ b/arch/arm/mach-msm/include/mach/clk.h
@@ -25,12 +25,6 @@ enum clk_reset_action {
 
 struct clk;
 
-/* Rate is minimum clock rate in Hz */
-int clk_set_min_rate(struct clk *clk, unsigned long rate);
-
-/* Rate is maximum clock rate in Hz */
-int clk_set_max_rate(struct clk *clk, unsigned long rate);
-
 /* Assert/Deassert reset to a hardware block associated with a clock */
 int clk_reset(struct clk *clk, enum clk_reset_action action);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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] perf: Fix parallel build

2012-09-20 Thread Eric Sandeen
On 9/20/12 9:07 PM, Namhyung Kim wrote:
> Hi again,
> 
> On Thu, 20 Sep 2012 20:12:50 -0500, Eric Sandeen wrote:
>> -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
>> +$(OUTPUT)util/parse-events-flex.c: util/parse-events.l 
>> util/parse-events-bison.c
> 
> I realized that the generated *-bison.c files should have $(OUTPUT)
> prefix since they can be under another directory than *.[ly] files.
> 
> 
>>  $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h 
>> $(PARSER_DEBUG_FLEX) -t util/parse-events.l > 
>> $(OUTPUT)util/parse-events-flex.c
>>  
>>  $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
>>  $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
>> -o $(OUTPUT)util/parse-events-bison.c
>>  
>> -$(OUTPUT)util/pmu-flex.c: util/pmu.l
>> +$(OUTPUT)util/pmu-flex.c: util/pmu.l util/pmu-bison.c
> 
> Ditto.

Sorry.  Too long since I worked on Makefiles :(

V3 soon ;)

-Eric

> Thanks,
> Namhyung
> 
> 
>>  $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
>> util/pmu.l > $(OUTPUT)util/pmu-flex.c
>>  
>>  $(OUTPUT)util/pmu-bison.c: util/pmu.y

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


Re: [PATCH v6 1/6] thermal: add generic cpufreq cooling implementation

2012-09-20 Thread jonghwa3 . lee
Hi, Amit,
On 2012년 08월 16일 20:41, Amit Daniel Kachhap wrote:

>  diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
>  new file mode 100644
>  index 000..66cbd52
>  --- /dev/null
>  +++ b/drivers/thermal/cpu_cooling.c
>  @@ -0,0 +1,586 @@

>  +/**
>  + * cpufreq_cooling_register - function to create cpufreq cooling device.
>  + * @clip_cpus: cpumask of cpus where the frequency constraints will happen.
>  + */
>  +struct thermal_cooling_device *cpufreq_cooling_register(
>  +   struct cpumask *clip_cpus)
>  +{
>  +   struct thermal_cooling_device *cool_dev;
>  +   struct cpufreq_cooling_device *cpufreq_dev = NULL;
>  +   unsigned int cpufreq_dev_count = 0, min = 0, max = 0;
>  +   char dev_name[THERMAL_NAME_LENGTH];
>  +   int ret = 0, id = 0, i;
>  +   struct cpufreq_policy policy;
>  +   ret = get_idr(_idr,_dev->id);
>  +   if (ret) {
>  +   kfree(cpufreq_dev);
>  +   return ERR_PTR(-EINVAL);
>  +   }
>  +
>  +   sprintf(dev_name, "thermal-cpufreq-%d", cpufreq_dev->id);
>  +
>  +   cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev,
>  +_cooling_ops);
>  +   if (!cool_dev) {
>  +   release_idr(_idr, cpufreq_dev->id);
>  +   kfree(cpufreq_dev);
>  +   return ERR_PTR(-EINVAL);
>  +   }
>  +   cpufreq_dev->id = id;


Why is this needed? Should every cpufreq_dev instance's id be same for
zero? It looks odd. And it also has problem which can be occurred when
it release id during unregistering cpufreq_dev. I think it should keep
the idr value taken before.


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


--
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: Davicom DM9000C driver

2012-09-20 Thread Michael Chen
Dear Arnd and Linux Expert,

First of all, appreciate you all for your efforts on our DM9000C driver. 

Davicom Semiconductor Inc. is a fabless IC design house, located in Taiwan.
DM9000C is 10/100Mbps Ethernet IC with ISA-like interface.

Meanwhile, to facilitate the coming works with you efficiently, the key
members at Davicom side will be:
Mr. Allen Huang, PM
Mr. Russell Liu, Sr. FAE
Mr. Joseph Chang, Sr. Software Manager

Look forward to your guidance to make our product driver conform Linux.

Thanks.

BR,
Michael Chen
Director
Davicom Semiconductor Inc.
www.davicom.com.tw

-Original Message-
From: Arnd Bergmann [mailto:a...@arndb.de] 
Sent: Thursday, September 20, 2012 7:03 PM
To: Jonathan Corbet
Cc: Allen Huang ("黃偉格"); linux-kernel@vger.kernel.org; 'Michael Chen';
'Charles'; 'Joseph Chang'
Subject: Re: Davicom DM9000C driver

On Thursday 20 September 2012, Arnd Bergmann wrote:
> On Wednesday 19 September 2012, Jonathan Corbet wrote:
> > On Wed, 19 Sep 2012 13:58:08 +0800
> > Allen Huang (黃偉格)   wrote:
> > 
> > > I'm Allen Huang from Davicom. We are hereby opensourcing the linux
> > > driver for our DM9000C. 
> > 
> > That is great, but please read the development process documentation on
> > how best to submit something like this.  We would much rather see a
patch
> > (inline, not as an attachment) to facilitate the review.
> 
> More importantly, the patch should be against the version that is
> already present in the kernel as drivers/net/ethernet/davicom/dm9000.c,
> which appears to be mostly the same as the version that is submitted
> here.
> 
> So while all the comments on the driver are valuable, they also apply
> to the code we already have since 2005.

For fun, I've also tracked down the version that the new submission is
branched from, it's 2.6.29 with a small number of bug fixes that
are in later version. Here is the diff against the 2.6.29 version
of the driver. There are a few changes to the PHY handling that
are not also upstream in 3.6. It's probably worth submitting them
separately with a good explanation why they are required.

Arnd

diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 254ec62..2cd4f0b 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -17,6 +17,13 @@
  * Additional updates, Copyright:
  * Ben Dooks 
  * Sascha Hauer 
+ *  
+ * 2010.07.20 V_R1 1.Write PHY Reg27 = 0xE100
+ *  2.Just
enable PHY once after GPIO setting in dm9000_init_dm9000()
+ *  3.Remove
power down PHY in dm9000_shutdown()
+ * 2010.07.20 V_R2 1.Delay 20ms after PHY power on
+ *  2.Reset PHY
after PHY power on in dm9000_init_dm9000()
+ * 2012.06.05 KT2.6.31_R2 1. Add the solution to fix the power-on FIFO data
bytes shift issue! (Wr NCR 0x03)
  */
 
 #include 
@@ -25,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -45,7 +53,7 @@
 #define DM9000_PHY 0x40/* PHY address 0x01 */
 
 #define CARDNAME   "dm9000"
-#define DRV_VERSION"1.31"
+#define DRV_VERSION"2.6.31"
 
 /*
  * Transmit timeout, default 5 seconds.
@@ -126,6 +134,10 @@ typedef struct board_info {
u32 msg_enable;
 } board_info_t;
 
+static void
+dm9000_phy_write(struct net_device *dev,
+int phyaddr_unused, int reg, int value);
+
 /* debug code */
 
 #define dm9000_dbg(db, lev, msg...) do {   \
@@ -556,6 +568,18 @@ static void dm9000_show_carrier(board_info_t *db,
dev_info(db->dev, "%s: link down\n", ndev->name);
 }
 
+
+static unsigned char dm9000_type_to_char(enum dm9000_type type)
+{
+   switch (type) {
+   case TYPE_DM9000E: return 'e';
+   case TYPE_DM9000A: return 'a';
+   case TYPE_DM9000B: return 'b';
+   }
+
+   return '?';
+}
+
 static void
 dm9000_poll_work(struct work_struct *w)
 {
@@ -563,8 +587,11 @@ dm9000_poll_work(struct work_struct *w)
board_info_t *db = container_of(dw, board_info_t, phy_poll);
struct net_device *ndev = db->ndev;
 
-   if (db->flags & DM9000_PLATF_SIMPLE_PHY &&
-   !(db->flags & DM9000_PLATF_EXT_PHY)) {
+//JJ2
+// if (db->flags & DM9000_PLATF_SIMPLE_PHY &&
+// !(db->flags & DM9000_PLATF_EXT_PHY)) {
+//  =
+   if(1){  
unsigned nsr = dm9000_read_locked(db, DM9000_NSR);
unsigned old_carrier = netif_carrier_ok(ndev) ? 1 : 0;
unsigned new_carrier;
@@ -572,6 +599,12 @@ dm9000_poll_work(struct work_struct *w)
new_carrier = (nsr & NSR_LINKST) ? 1 : 0;
 
if (old_carrier != new_carrier) {
+   
+   if (new_carrier)
+ printk(KERN_INFO "[dm9000%c %s Ethernet Driver,
V%s]: 

Re: [PATCH V2] perf: Fix parallel build

2012-09-20 Thread Namhyung Kim
Hi again,

On Thu, 20 Sep 2012 20:12:50 -0500, Eric Sandeen wrote:
> -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
> +$(OUTPUT)util/parse-events-flex.c: util/parse-events.l 
> util/parse-events-bison.c

I realized that the generated *-bison.c files should have $(OUTPUT)
prefix since they can be under another directory than *.[ly] files.


>   $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h 
> $(PARSER_DEBUG_FLEX) -t util/parse-events.l > 
> $(OUTPUT)util/parse-events-flex.c
>  
>  $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
>   $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
> -o $(OUTPUT)util/parse-events-bison.c
>  
> -$(OUTPUT)util/pmu-flex.c: util/pmu.l
> +$(OUTPUT)util/pmu-flex.c: util/pmu.l util/pmu-bison.c

Ditto.

Thanks,
Namhyung


>   $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
> util/pmu.l > $(OUTPUT)util/pmu-flex.c
>  
>  $(OUTPUT)util/pmu-bison.c: util/pmu.y
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm: fix NR_ISOLATED_[ANON|FILE] mismatch

2012-09-20 Thread Johannes Weiner
On Fri, Sep 21, 2012 at 08:24:08AM +0900, Minchan Kim wrote:
> On Thu, Sep 20, 2012 at 11:41:11AM -0400, Johannes Weiner wrote:
> > On Thu, Sep 20, 2012 at 08:51:56AM +0900, Minchan Kim wrote:
> > > From: Minchan Kim 
> > > Date: Thu, 20 Sep 2012 08:39:52 +0900
> > > Subject: [PATCH] mm: revert 0def08e3, mm/mempolicy.c: check return code of
> > >  check_range

[...]

> From: Minchan Kim 
> Date: Fri, 21 Sep 2012 08:17:37 +0900
> Subject: [PATCH] mm: enhance comment and bug check
> 
> This patch updates comment and bug check.
> It can be fold into [1].
> 
> [1] mm-revert-0def08e3-mm-mempolicyc-check-return-code-of-check_range.patch
> 
> Cc: KOSAKI Motohiro 
> Suggested-by: Johannes Weiner 
> Signed-off-by: Minchan Kim 

Thanks!  To the patch and this update:

Acked-by: Johannes Weiner 
--
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 rcu] Move TINY_RCU quiescent state out of extended quiescent state

2012-09-20 Thread Li Zhong
TINY_RCU's rcu_idle_enter_common() invokes rcu_sched_qs() in order
to inform the RCU core of the quiescent state implied by idle entry.
Of course, idle is also an extended quiescent state, so that the call
to rcu_sched_qs() speeds up RCU's invoking of any callbacks that might
be queued.  This speed-up is important when entering into dyntick-idle
mode -- if there are no further scheduling-clock interrupts, the callbacks
might never be invoked, which could result in a system hang.

However, processing callbacks does event tracing, which in turn
implies RCU read-side critical sections, which are illegal in extended
quiescent states.  This patch therefore moves the call to rcu_sched_qs()
so that it precedes the point at which we set the new value of 
rcu_dynticks_nesting, which may indicate RCU is in an extended quiescent
state. 

Signed-off-by: Li Zhong 
Signed-off-by: Paul E. McKenney 
---
 kernel/rcutiny.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 2e073a2..e4c6a59 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -75,9 +75,9 @@ static void rcu_idle_enter_common(long long newval)
  current->pid, current->comm,
  idle->pid, idle->comm); /* must be idle task! */
}
+   rcu_sched_qs(0); /* implies rcu_bh_qsctr_inc(0) */
barrier();
rcu_dynticks_nesting = newval;
-   rcu_sched_qs(0); /* implies rcu_bh_qsctr_inc(0) */
 }
 
 /*
-- 
1.7.9.5



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


Re: [PATCH 1/2] ACPI: Reorder IPMI driver before any other ACPI drivers

2012-09-20 Thread Corey Minyard

On 09/20/2012 08:26 PM, Matthew Garrett wrote:

On Thu, Sep 20, 2012 at 08:19:48PM -0500, Corey Minyard wrote:

On 09/20/2012 04:46 PM, Matthew Garrett wrote:

Drivers may make calls that require the ACPI IPMI driver to have been
initialised already, so make sure that it appears earlier in the build
order.

The IPMI driver uses the ACPI namespace as an option to know the
address and characteristics of the device.  Does that still work?

Yes, the ACPI interpreter is initialised earlier than the IPMI driver
discovery.


Cool, I'm good with these, then.

Thanks,

-corey
--
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 net-next] net1080: Neaten netdev_dbg use

2012-09-20 Thread David Miller
From: Joe Perches 
Date: Thu, 20 Sep 2012 17:10:23 -0700

> Remove unnecessary temporary variable and #ifdef DEBUG block.
> 
> Signed-off-by: Joe Perches 

Applied, thanks Joe.
--
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/


Subject: [PATCH] drivers-core: move device_pm_remove behind bus_remove_device

2012-09-20 Thread Zhang, LongX
From: LongX Zhang 

device_pm_remove will call pm_runtime_remove which would disable
runtime PM of the device. After that pm_runtime_get* or
pm_runtime_put* will be ingored. So if we disable the runtime PM
before device really be removed, drivers' _remove callback may
access HW even pm_runtime_get* fails. That is bad.

Signed-off-by: LongX Zhang 
---
 drivers/base/core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5e6e00b..81ea7f2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1169,7 +1169,6 @@ void device_del(struct device *dev)
if (dev->bus)
blocking_notifier_call_chain(>bus->p->bus_notifier,
 BUS_NOTIFY_DEL_DEVICE, dev);
-   device_pm_remove(dev);
dpm_sysfs_remove(dev);
if (parent)
klist_del(>p->knode_parent);
@@ -1194,6 +1193,7 @@ void device_del(struct device *dev)
device_remove_file(dev, _attr);
device_remove_attrs(dev);
bus_remove_device(dev);
+   device_pm_remove(dev);
driver_deferred_probe_del(dev);
 
/*
-- 
1.7.10

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


Re: [PATCH 4/5] PCI/IOV: simplify code by hotplug safe pci_get_domain_bus_and_slot()

2012-09-20 Thread Yinghai Lu
On Thu, Sep 20, 2012 at 4:59 PM, Bjorn Helgaas  wrote:
> On Thu, Sep 20, 2012 at 2:38 PM, Yinghai Lu  wrote:
>> in that case, VFs  are stopped before PF, so they are not in device
>> tree anymore.
>> so pci_get_domain_bus_and_slot will not find those VFs.
>>
>> So the reference to PF is not released. Also vit_bus may not be released too.
>>
>> So you have to rework
>> pci_get_domain_bus_and_slot to make it work on pci devices get stopped 
>> only.
>>
>> or just drop this from the tree.
>
> pci_find_bus() is a broken interface (because there's no reference
> counting or safety with respect to hot-plug), and if the design
> depends on it, that means the design is broken, too.  I don't think
> reworking pci_get_domain_bus_and_slot() is the right answer.
>
> It's not clear to me why we need the split between stopping and
> removing devices.  That split leads to these zombie devices that have
> been stopped and are no longer findable by bus_find_device() (which is
> used by pci_get_domain_bus_and_slot()), but still "exist" in some
> fashion until they're removed.  It's unreasonable for random PCI and
> driver code to have to worry about that zombie state.

That is not zombie state. that is driver unloaded, and not in /sys, /proc.
that pci device only can be found under bus->devices.

just like we have pci_device_add and pci_bus_add_device
or acpi add and acpi start.

Splitting stop and remove should be more clean than mixing stop and remove.

>
> I'll revert this patch for now to fix the regression.  Of course, that
> means we will still have the old problem of using the unsafe
> pci_find_bus().
>
>> BTW, Bjorn,
>> for the similar reason,  you need to apply
>> http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;h=e5a50aa3dfca1331c7c783412b1524bea06d2752
>> ...
>> the reason is:
>>
>> We stop all VFs at first , stop PF
>> before we stop PF, we can not remove VFs,
>>
>> otherwise virtfn_remove does not work properly to remove reference and
>> virtfn bus while can not find vf.
>
> I'll apply this one, too, for now.  I put them both on the
> pci/yinghai-revert-pci_find_bus-and-remove-cleanup branch.  Let me
> know if that's not what you expected.

Yes, they are good.

>
> I'm not happy about either reverting Jiang's patch or splitting
> stop/remove again.  It complicates the design and the code.  I'll
> apply them because they're regressions, and we don't have time for
> redesign before 3.7.  But I encourage you to think about how to do
> this more cleanly.

That will need to redesign sriov implementation.

Also that pci root bus add/start, stop/remove will need special
sequence to make ioapic
and dmar to be started early before normal pci device drivers and
stopped after normal pci device drivers.

-Yinghai
--
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 3/3] PCI/PM: Disable PME poll for PCIe devices

2012-09-20 Thread Huang Ying
On Thu, 2012-09-20 at 21:31 +0200, Rafael J. Wysocki wrote:
> On Monday, September 17, 2012, Huang Ying wrote:
> > PME poll is not necessary for PCIe devices, because PCIe devices use
> > in-band PME message and IRQ on PCIe port to report PME.
> 
> Alas, not all of them as it turns out and even if they do, it doesn't
> work for some of them. That's why we've added the PCIe devices polling
> (quite recently, for that matter).
> 
> If you'd spent some time on some proper research regarding that (like browsing
> the changelogs of git commits modifying the relevant part of 
> drivers/pci/pci.c),
> you'd have known that already.
> 
> And that actually is quite important, because I don't have to remember every
> single PM-related change we're making in the PCI layer.  I _incidentally_ do
> remember this one, but that may not happen next time.  Please do the research
> _before_ proposing changes of this kind.

Sorry.  I should have done more research before sending the patch out.
Will do more research next time.

Best Regards,
Huang Ying


--
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] poweroff: fix bug in orderly_poweroff

2012-09-20 Thread Feng Hong
Hi, Serge, Andrew,

Will following an acceptable change log ?

/
orderly_poweroff is trying to poweroff platform by two steps:
step 1: Call user space application to poweroff
step 2: If user space poweroff fail, then do a force power off if force param 
is set.
The bug here is, step 1 is always successful with param UMH_NO_WAIT, which obey
the design goal of orderly_poweroff.

We have two choices here:
UMH_WAIT_EXEC which means wait for the exec, but not the process;
UMH_WAIT_PROC which means wait for the process to complete.
we need to trade off the two choices:

If using UMH_WAIT_EXEC, there is potential issue comments by Serge E. Hallyn: 
The exec will
have started, but may for whatever (very unlikely) reason fail.

If using UMH_WAIT_PROC, there is potential issue comments by Eric W. Biederman: 
If the caller
is not running in a kernel thread then we can easily get into a case where the 
user space caller
will block waiting for us when we are waiting for the user space caller.

Thanks for their excellent ideas, based on the above discussion, we finally 
choose UMH_WAIT_EXEC,
which is much more safe, if the user application really fails, we just complain 
the application
itself, it seems a better choice here.
//

--
Best Regards,
Feng Hong
Application Processor Software Engnieer 
Marvell Technology (Shanghai) Ltd


-Original Message-
From: Andrew Morton [mailto:a...@linux-foundation.org] 
Sent: 2012年9月21日 8:25
To: Feng Hong
Cc: Serge E. Hallyn; gorcu...@openvz.org; keesc...@chromium.org; 
serge.hal...@canonical.com; ebied...@xmission.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] poweroff: fix bug in orderly_poweroff

On Thu, 20 Sep 2012 17:16:35 -0700
Feng Hong  wrote:

> I am just a graduate and it's my first time to send a patch to
> opensource, so thank you very much for reminding me the "changelog
> affairs", it seems this patch has been added to -mm tree as attached
> mail, and I have no chance to change the comments, right ?  Then I must
> remember this and be careful next time.  Thanks again for reminding me!

It depends.  If the person who committed the patch was using a git tree
then it can be difficult for them to alter a changelog.

But the -mm tree is not mastered in git (for this and other reasons),
and I alter changelogs all the time.  So please feel free to send
replacement text and I shall copy-n-paste that text straight into the patch.



Re: [PATCH] [V2]power: battery: Generic battery driver using IIO

2012-09-20 Thread Anton Vorontsov
On Tue, Sep 18, 2012 at 11:33:20PM +0530, anish kumar wrote:
> From: anish kumar 
> 
> In last version:
> Addressed concerns raised by lars:
> a. made the adc_bat per device.
> b. get the IIO channel using hardcoded channel names.
> c. Minor issues related to gpio_is_valid and some code
>refactoring.
> 
> In V1:
> Addressed concerns raised by Anton:
> a. changed the struct name to gab(generic adc battery).
> b. Added some functions to neaten the code.
> c. Some minor coding guidelines changes.
> d. Used the latest function introduce by lars:
>iio_read_channel_processed to streamline the code.
> 
> In V2:
> Addressed concerns by lars:
> a. No need of allocating memory for channels.Make it array.
> b. Code restructring, coding style and following kernel guidelines changes
>suggested by him.
> 
> Signed-off-by: anish kumar 
> ---

OK, the code turns into a nicely looking driver, congratulations!

I noticed that patch depends on iio_read_channel_processed(), so it will
have to go via IIO tree. But I'll happily give you my ack, once the final
bits are fixed...

The biggest issues is that the patch is missing Kconfig and Makefile
entries. :-)

And some cosmetic stuff down below...

>  drivers/power/generic-adc-battery.c   |  429 
> +
>  include/linux/power/generic-adc-battery.h |   28 ++
>  2 files changed, 457 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/power/generic-adc-battery.c
>  create mode 100644 include/linux/power/generic-adc-battery.h
> 
> diff --git a/drivers/power/generic-adc-battery.c 
> b/drivers/power/generic-adc-battery.c
> new file mode 100644
> index 000..746a210
> --- /dev/null
> +++ b/drivers/power/generic-adc-battery.c
> @@ -0,0 +1,429 @@
> +/*
> + * Generic battery driver code using IIO
> + * Copyright (C) 2012, Anish Kumar 
> + * based on jz4740-battery.c
> + * based on s3c_adc_battery.c
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file COPYING in the main directory of this archive for
> + * more details.
> + *
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define JITTER_DEFAULT 10 /* hope 10ms is enough */
> +
> +enum gab_chan_type {
> + VOLTAGE = 0,
> + CURRENT,
> + POWER,
> + MAX_CHAN_TYPE

These are still in the global namespace. Please prefix them with
GAB_.

> +};
> +
> +/*
> + * gab_chan_name suggests the standard channel names for commonly used
> + * channel types.
> + */
> +static const char *const gab_chan_name[] = {
> + [VOLTAGE]   = "voltage",
> + [CURRENT]   = "current",
> + [POWER] = "power",
> +};
> +
> +struct gab {
> + struct power_supply psy;
> + struct iio_channel  *channel[MAX_CHAN_TYPE];
> + struct gab_platform_data*pdata;
> + struct delayed_work bat_work;
> + int level;
> + int status;
> + int cable_plugged:1;

This gives me:

CHECK   drivers/power/generic-adc-battery.c
drivers/power/generic-adc-battery.c:53:32: error: dubious one-bit signed 
bitfield

You can just use 'bool' instead of 'int'.

> +};
> +
> +struct gab *to_generic_bat(struct power_supply *psy)
> +{
> + return  container_of(psy, struct gab, psy);

No need for double whitespace.

> +}
> +
> +static void gab_ext_power_changed(struct power_supply *psy)
> +{
> + struct gab *adc_bat;
> + adc_bat = to_generic_bat(psy);

This can be merged into one line.

struct gab *adc_bat = to_generic_bat(psy);

> +
> + schedule_delayed_work(_bat->bat_work,
> + msecs_to_jiffies(0));

This will fit into one line.

> +}
> +
> +static const enum power_supply_property gab_props[] = {
> + POWER_SUPPLY_PROP_STATUS,
> + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
> + POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
> + POWER_SUPPLY_PROP_CHARGE_NOW,
> + POWER_SUPPLY_PROP_VOLTAGE_NOW,
> + POWER_SUPPLY_PROP_CURRENT_NOW,
> + POWER_SUPPLY_PROP_TECHNOLOGY,
> + POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
> + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
> + POWER_SUPPLY_PROP_MODEL_NAME,
> +};
> +
> +/*
> + * This properties are set based on the received platform data and this
> + * should correspond one-to-one with enum chan_type.
> + */
> +static const enum power_supply_property gab_dyn_props[] = {
> + POWER_SUPPLY_PROP_VOLTAGE_NOW,
> + POWER_SUPPLY_PROP_CURRENT_NOW,
> + POWER_SUPPLY_PROP_POWER_NOW,
> +};
> +
> +static bool gab_charge_finished(struct gab *adc_bat)
> +{
> + struct gab_platform_data *pdata = adc_bat->pdata;
> + bool ret = gpio_get_value(pdata->gpio_charge_finished);
> + bool inv = pdata->gpio_inverted;
> +
> + if (!gpio_is_valid(pdata->gpio_charge_finished))
> + return false;
> + return ret ^ inv;
> +}
> +
> +static int gab_get_status(struct gab *adc_bat)
> +{

Re: kernel BUG at kernel/sched/core.c:1465!

2012-09-20 Thread Michael Wang
On 09/20/2012 08:58 PM, Borislav Petkov wrote:
> On Thu, Sep 20, 2012 at 02:38:47PM +0800, Michael Wang wrote:
>> Could you please try below patch and see whether the new WARNING
>> appear or not?
>>
>> And cc Tejun Heo  since wq_worker_sleeping() doesn't
>> work as it's introduced...
> 
> Ok, now that you mentioned workqueues, I remember the powernow-k8
> workaround from Tejun a couple of days ago and looking at Linus' tree
> from today, he actually merged a fix for exactly that:
> 
> commit c5c473e29c641380aef4a9d1f9c39de49219980f
> Merge: 925a6f0bf8bd 6889125b8b4e
> Author: Linus Torvalds 
> Date:   Wed Sep 19 11:00:07 2012 -0700
> 
> Merge branch 'for-3.6-fixes' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
> 
> Pull workqueue / powernow-k8 fix from Tejun Heo:
>  "This is the fix for the bug where cpufreq/powernow-k8 was tripping
>   BUG_ON() in try_to_wake_up_local() by migrating workqueue worker to a
>   different CPU.
> 
> and this is exactly the same BUG_ON I'm hitting. and powernowk8_target
> is in the stack trace so it has to be the same issue.
> 
> I'll update my tree to latest Linus and retest.

Happen to see the problem solved.

Regards,
Michael Wang

> 
> Thanks for pointing this out.
> 

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


Re: linux-next: build failure after merge of the final tree (net-next tree related)

2012-09-20 Thread Stephen Rothwell
Hi Dave,

On Thu, 20 Sep 2012 17:36:22 +1000 Stephen Rothwell  
wrote:
>
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> drivers/net/ethernet/i825xx/znet.c: In function 'hardware_init':
> drivers/net/ethernet/i825xx/znet.c:868:2: error: implicit declaration of 
> function 'isa_virt_to_bus' [-Werror=implicit-function-declaration]
> 
> Caused by commit 1d3ff76759b7 ("i825xx: znet: fix compiler warnings when
> building a 64-bit kernel").  Is there some Kconfig dependency missing 
> (CONFIG_ISA)?
> 
> I have reverted that commit for today.

Today, I have added the following merge fix patch instead of reverting the
above (just until PowerPC can be fixed one way or the other).  I don't
know if you want to put this into the net-next tree, but it may be a
reasonable temporary measure.

From: Stephen Rothwell 
Date: Fri, 21 Sep 2012 11:32:09 +1000
Subject: [PATCH] i825xx: znet: temporarily disable on PPC

due to build problems

Signed-off-by: Stephen Rothwell 
---
 drivers/net/ethernet/i825xx/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/i825xx/Kconfig 
b/drivers/net/ethernet/i825xx/Kconfig
index fed5080..9fce38b 100644
--- a/drivers/net/ethernet/i825xx/Kconfig
+++ b/drivers/net/ethernet/i825xx/Kconfig
@@ -151,6 +151,7 @@ config SUN3_82586
 config ZNET
tristate "Zenith Z-Note support (EXPERIMENTAL)"
depends on EXPERIMENTAL && ISA_DMA_API
+   depends on !PPC
---help---
  The Zenith Z-Note notebook computer has a built-in network
  (Ethernet) card, and this is the Linux driver for it. Note that the
-- 
1.7.10.280.gaa39

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpdoLLQvO0kM.pgp
Description: PGP signature


linux-next: manual merge of the net-next tree with the net tree

2012-09-20 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the net-next tree got a conflict in 
drivers/net/usb/qmi_wwan.c between commit 9db273f45686 ("net: qmi_wwan: adding 
Huawei E367, ZTE MF683 and Pantech P4200") from the net tree and commit 
bd877e489126 ("net: qmi_wwan: use a single bind function for all device types") 
from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/net/usb/qmi_wwan.c
index 3543c9e,e7b53f0..000
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@@ -366,21 -353,17 +353,21 @@@ static const struct usb_device_id produ
},
  
/* 2. Combined interface devices matching on class+protocol */
 +  {   /* Huawei E367 and possibly others in "Windows mode" */
 +  USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 
USB_CLASS_VENDOR_SPEC, 1, 7),
 +  .driver_info= (unsigned long)_wwan_info,
 +  },
{   /* Huawei E392, E398 and possibly others in "Windows mode" */
USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 
USB_CLASS_VENDOR_SPEC, 1, 17),
-   .driver_info= (unsigned long)_wwan_shared,
+   .driver_info= (unsigned long)_wwan_info,
},
 -  {   /* Pantech UML290 */
 -  USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, 
USB_CLASS_VENDOR_SPEC, 0xf0, 0xff),
 +  {   /* Pantech UML290, P4200 and more */
 +  USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 
0xf0, 0xff),
-   .driver_info= (unsigned long)_wwan_shared,
+   .driver_info= (unsigned long)_wwan_info,
},
{   /* Pantech UML290 - newer firmware */
 -  USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, 
USB_CLASS_VENDOR_SPEC, 0xf1, 0xff),
 +  USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 
0xf1, 0xff),
-   .driver_info= (unsigned long)_wwan_shared,
+   .driver_info= (unsigned long)_wwan_info,
},
  
/* 3. Combined interface devices matching on interface number */


pgpFwQcgU0opt.pgp
Description: PGP signature


[PATCH] backlight: platform-lcd: Add support for device tree based probe

2012-09-20 Thread Jingoo Han
This patch adds the of_match_table to platform-lcd driver to be
probed when platform-lcd device node is found in the device tree.

Cc: Richard Purdie 
Signed-off-by: Jingoo Han 
---
 drivers/video/backlight/platform_lcd.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/video/backlight/platform_lcd.c 
b/drivers/video/backlight/platform_lcd.c
index b667234..574d5ee 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -145,6 +145,14 @@ static SIMPLE_DEV_PM_OPS(platform_lcd_pm_ops, 
platform_lcd_suspend,
platform_lcd_resume);
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id platform_lcd_of_match[] = {
+   { .compatible = "platform-lcd" },
+   {},
+};
+MODULE_DEVICE_TABLE(of, platform_lcd_of_match);
+#endif
+
 static struct platform_driver platform_lcd_driver = {
.driver = {
.name   = "platform-lcd",
@@ -152,6 +160,7 @@ static struct platform_driver platform_lcd_driver = {
 #ifdef CONFIG_PM
.pm = _lcd_pm_ops,
 #endif
+   .of_match_table = of_match_ptr(platform_lcd_of_match),
},
.probe  = platform_lcd_probe,
.remove = __devexit_p(platform_lcd_remove),
-- 
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 1/2] ACPI: Reorder IPMI driver before any other ACPI drivers

2012-09-20 Thread Matthew Garrett
On Thu, Sep 20, 2012 at 08:19:48PM -0500, Corey Minyard wrote:
> On 09/20/2012 04:46 PM, Matthew Garrett wrote:
> >Drivers may make calls that require the ACPI IPMI driver to have been
> >initialised already, so make sure that it appears earlier in the build
> >order.
> 
> The IPMI driver uses the ACPI namespace as an option to know the
> address and characteristics of the device.  Does that still work?

Yes, the ACPI interpreter is initialised earlier than the IPMI driver 
discovery.

-- 
Matthew Garrett | mj...@srcf.ucam.org
--
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/3] Add a core driver for SI476x MFD

2012-09-20 Thread andrey.smir...@convergeddevices.net
On 09/13/2012 11:44 PM, Hans Verkuil wrote:
> Hi Andrey!
>
> Thanks for posting this driver. One request for the future: please split this
> patch up in smaller pieces: one for each c source for example. That makes it
> easier to review.

Will do for next version.

> +
> +/**
> + * __core_send_command() - sends a command to si476x and waits its
> + * response
> + * @core:si476x_device structure for the device we are
> + *communicating with
> + * @command:  command id
> + * @args: command arguments we are sending
> + * @argn: actual size of @args
> + * @response: buffer to place the expected response from the device
> + * @respn:actual size of @response
> + * @usecs:amount of time to wait before reading the response (in
> + *usecs)
> + *
> + * Function returns 0 on succsess and negative error code on
> + * failure
> + */
> +static int __core_send_command(struct si476x_core *core,
> + const u8 command,
> + const u8 args[],
> + const int argn,
> + u8 resp[],
> + const int respn,
> + const int usecs)
> +{
> + struct i2c_client *client = core->client;
> + int err;
> + u8  data[CMD_MAX_ARGS_COUNT + 1];
> +
> + if (argn > CMD_MAX_ARGS_COUNT) {
> + err = -ENOMEM;
> + goto exit;
> Why goto exit? There is no clean up after the exit label, so just return
> immediately. Ditto for all the other goto exit's in this function.

To have only just on point of exit from the function that's just
personal coding style preference.
There are no technical reasons behind that, I can change that.

>
>> +}
>> +
>> +if (!client->adapter) {
>> +err = -ENODEV;
>> +goto exit;
>> +}
>> +
>> +/* First send the command and its arguments */
>> +data[0] = command;
>> +memcpy([1], args, argn);
>> +DBG_BUFFER(>dev, "Command:\n", data, argn + 1);
>> +
>> +err = si476x_i2c_xfer(core, SI476X_I2C_SEND, (char *) data, argn + 1);
>> +if (err != argn + 1) {
>> +dev_err(>client->dev,
>> +"Error while sending command 0x%02x\n",
>> +command);
>> +err = (err >= 0) ? -EIO : err;
>> +goto exit;
>> +}
>> +/* Set CTS to zero only after the command is send to avoid
>> + * possible racing conditions when working in polling mode */
>> +atomic_set(>cts, 0);
>> +
>> +if (!wait_event_timeout(core->command,
>> +atomic_read(>cts),
>> +usecs_to_jiffies(usecs) + 1))
>> +dev_warn(>client->dev,
>> + "(%s) [CMD 0x%02x] Device took too much time to 
>> answer.\n",
>> + __func__, command);
>> +
>> +/*
>> +  When working in polling mode, for some reason the tuner will
>> +  report CTS bit as being set in the first status byte read,
>> +  but all the consequtive ones will return zros until the
>> +  tuner is actually completed the POWER_UP command. To
>> +  workaround that we wait for second CTS to be reported
>> + */
>> +if (unlikely(!core->client->irq && command == CMD_POWER_UP)) {
>> +if (!wait_event_timeout(core->command,
>> +atomic_read(>cts),
>> +usecs_to_jiffies(usecs) + 1))
>> +dev_warn(>client->dev,
>> + "(%s) Power up took too much time.\n",
>> + __func__);
>> +}
>> +
>> +/* Then get the response */
>> +err = si476x_i2c_xfer(core, SI476X_I2C_RECV, resp, respn);
>> +if (err != respn) {
>> +dev_err(>client->dev,
>> +"Error while reading response for command 0x%02x\n",
>> +command);
>> +err = (err >= 0) ? -EIO : err;
>> +goto exit;
>> +}
>> +DBG_BUFFER(>dev, "Response:\n", resp, respn);
>> +
>> +err = 0;
>> +
>> +if (resp[0] & SI476X_ERR) {
>> +dev_err(>client->dev, "Chip set error flag\n");
>> +err = si476x_core_parse_and_nag_about_error(core);
>> +goto exit;
>> +}
>> +
>> +if (!(resp[0] & SI476X_CTS))
>> +err = -EBUSY;
>> +exit:
>> +return err;
>> +}
>> +
>> +#define CORE_SEND_COMMAND(core, cmd, args, resp, timeout)   \
>> +__core_send_command(core, cmd, args,\
>> +ARRAY_SIZE(args),   \
>> +resp, ARRAY_SIZE(resp), \
>> +timeout)
>> +
>> +
>> +static int __cmd_tune_seek_freq(struct si476x_core *core,
>> +uint8_t cmd,
>> +const uint8_t args[], size_t argn,
>> + 

Re: [PATCH 1/2] ACPI: Reorder IPMI driver before any other ACPI drivers

2012-09-20 Thread Corey Minyard

On 09/20/2012 04:46 PM, Matthew Garrett wrote:

Drivers may make calls that require the ACPI IPMI driver to have been
initialised already, so make sure that it appears earlier in the build
order.


The IPMI driver uses the ACPI namespace as an option to know the address 
and characteristics of the device.  Does that still work?


-corey



Signed-off-by: Matthew Garrett 
---
  drivers/acpi/Makefile | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 47199e2..82422fe 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -47,6 +47,10 @@ acpi-y   += video_detect.o
  endif
  
  # These are (potentially) separate modules

+
+# IPMI may be used by other drivers, so it has to initialise before them
+obj-$(CONFIG_ACPI_IPMI)+= acpi_ipmi.o
+
  obj-$(CONFIG_ACPI_AC) += ac.o
  obj-$(CONFIG_ACPI_BUTTON) += button.o
  obj-$(CONFIG_ACPI_FAN)+= fan.o
@@ -70,6 +74,5 @@ processor-y   += processor_idle.o 
processor_thermal.o
  processor-$(CONFIG_CPU_FREQ)  += processor_perflib.o
  
  obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o

-obj-$(CONFIG_ACPI_IPMI)+= acpi_ipmi.o
  
  obj-$(CONFIG_ACPI_APEI)		+= apei/


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


Re: [PATCH 00/22] lp8727_charger: clean up code

2012-09-20 Thread Anton Vorontsov
On Fri, Aug 31, 2012 at 09:22:39AM +, Kim, Milo wrote:
> LP8727 driver should be fixed for several reasons.
> 
> (a) Need to clean up _probe() and _remove()
> (b) Not secure code when the platform data is NULL
> (c) Improved the interrupt handling
> (d) Lots of definitions should be unique.
> (e) Others...
> 
> Patch v2.
> These patches are submitted more separately.

Nice! All 22 applied, thank you so much!

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


[PATCH V2] perf: Fix parallel build

2012-09-20 Thread Eric Sandeen
Parallel builds of perf were failing for me on a 32p box, with:

* new build flags or prefix
util/pmu.l:7:23: error: pmu-bison.h: No such file or directory

...

make: *** [util/pmu-flex.o] Error 1
make: *** Waiting for unfinished jobs

This can pretty quickly be seen by adding a sleep in front of
the bison calls in tools/perf/Makefile and running make -j4 on a
smaller box i.e.:

sleep 10; $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o 
$(OUTPUT)util/pmu-bison.c

Adding the following dependencies fixes it for me.

Signed-off-by: Eric Sandeen 
---

V2: Fix other bison dependency caught by Namhyung Kim , 
thanks.

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 35655c3..8d883de 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -221,13 +221,13 @@ export PERL_PATH
 FLEX = flex
 BISON= bison
 
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
+$(OUTPUT)util/parse-events-flex.c: util/parse-events.l 
util/parse-events-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h 
$(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
 
 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
-o $(OUTPUT)util/parse-events-bison.c
 
-$(OUTPUT)util/pmu-flex.c: util/pmu.l
+$(OUTPUT)util/pmu-flex.c: util/pmu.l util/pmu-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
util/pmu.l > $(OUTPUT)util/pmu-flex.c
 
 $(OUTPUT)util/pmu-bison.c: util/pmu.y

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


Re: [PATCH] perf: Fix parallel build

2012-09-20 Thread Eric Sandeen
On 9/20/12 7:24 PM, Namhyung Kim wrote:
> Hi Eric,
> 
> On Thu, 20 Sep 2012 18:53:01 -0500, Eric Sandeen wrote:
>> Parallel builds of perf were failing for me on a 32p box, with:
>>
>> * new build flags or prefix
>> util/pmu.l:7:23: error: pmu-bison.h: No such file or directory
>>
>> ...
>>
>> make: *** [util/pmu-flex.o] Error 1
>> make: *** Waiting for unfinished jobs
>>
>> This can pretty quickly be seen by adding a sleep in front of
>> the bison call in tools/perf/Makefile and running make -j4 on a
>> smaller box:
>>
>>  sleep 10; $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o 
>> $(OUTPUT)util/pmu-bison.c
>>
>> Adding the following dependency fixes it for me:
>>
>> Signed-off-by: Eric Sandeen 
>> ---
>>
>> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
>> index bad726a..6c389d9 100644
>> --- a/tools/perf/Makefile
>> +++ b/tools/perf/Makefile
>> @@ -219,7 +219,7 @@ $(OUTPUT)util/parse-events-flex.c: util/parse-events.l
>>  $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
>>  $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
>> -o $(OUTPUT)util/parse-events-bison.c
>>  
>> -$(OUTPUT)util/pmu-flex.c: util/pmu.l
>> +$(OUTPUT)util/pmu-flex.c: util/pmu.l util/pmu-bison.c
>>  $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
>> util/pmu.l > $(OUTPUT)util/pmu-flex.c
>>  
>>  $(OUTPUT)util/pmu-bison.c: util/pmu.y
> 
> I guess the $(OUTPUT)util/parse-events-flex.c: line has the same
> problem.  Could you check and submit a patch for that too?
> 
> Thanks,
> Namhyung
> 

Whoops you are right, will resent V2 shortly, thanks.

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


[PATCH] pda_power: remove ac_draw_failed goto and label

2012-09-20 Thread Paul Parsons

A previous patch added the ac_draw_failed goto and label to
pda_power_probe(). The goto would be invoked after a failed call to
regulator_get().

However the way ac_draw is used - always after a check for NULL -
suggests that a failed call to regulator_get() was not fatal.

This patch removes the ac_draw_failed goto and label, partly reverting
the previous patch.

This patch also removes the assignment of an error code to ret after a
failed call to regulator_get(), since the error code is now never used.

Signed-off-by: Paul Parsons 
Cc: Philipp Zabel 
---
 drivers/power/pda_power.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index d3be834d..7df7c5f 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -284,9 +284,7 @@ static int pda_power_probe(struct platform_device *pdev)
ac_draw = regulator_get(dev, "ac_draw");
if (IS_ERR(ac_draw)) {
dev_dbg(dev, "couldn't get ac_draw regulator\n");
-   ret = PTR_ERR(ac_draw);
ac_draw = NULL;
-   goto ac_draw_failed;
}

update_status();
@@ -416,7 +414,6 @@ ac_supply_failed:
regulator_put(ac_draw);
ac_draw = NULL;
}
-ac_draw_failed:
if (pdata->exit)
pdata->exit(dev);
 init_failed:
--
1.7.8.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/


Re: [PATCH v2 21/26] block: Convert some code to bio_for_each_segment_all()

2012-09-20 Thread Kent Overstreet
On Thu, Sep 20, 2012 at 05:38:32PM -0700, Tejun Heo wrote:
> On Mon, Sep 10, 2012 at 05:22:32PM -0700, Kent Overstreet wrote:
> > A few places in the code were either open coding or using the wrong
> > version - fix.
> > 
> > Signed-off-by: Kent Overstreet 
> > CC: Jens Axboe 
> > CC: NeilBrown 
> > ---
> > --- a/drivers/md/raid1.c
> > +++ b/drivers/md/raid1.c
> > @@ -921,7 +921,7 @@ static void alloc_behind_pages(struct bio *bio, struct 
> > r1bio *r1_bio)
> > if (unlikely(!bvecs))
> > return;
> >  
> > -   bio_for_each_segment(bvec, bio, i) {
> > +   bio_for_each_segment_all(bvec, bio, i) {
> 
> I don't get this conversion.  Why is this necessary?

Not necessary, just a consistency thing - this bio is a clone that md
owns (and the clone was trimmed, so we know bi_idx is 0).

Also, it wasn't an issue here but after the patch that introduces the
bvec iter it's no longer possible to modify the biovec through
bio_for_each_segment_all() - it doesn't increment a pointer to the
current bvec, you pass in a struct bio_vec (not a pointer) which is
updated with what the current biovec would be (taking into account
bi_bvec_done and bi_size).

So because of that it is IMO more worthwhile to be consistent about
bio_for_each_segment()/bio_for_each_segment_all() usage.

Suppose I should stick all that in the patch description.
--
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 23/26] raid1: use bio_alloc_pages()

2012-09-20 Thread Tejun Heo
On Mon, Sep 10, 2012 at 05:22:34PM -0700, Kent Overstreet wrote:
> Signed-off-by: Kent Overstreet 
> CC: Jens Axboe 
> CC: NeilBrown 

I think it's better to merge this and the previous patch.  It's not
like we're converting a lot of users.

Thanks.

-- 
tejun
--
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 22/26] block: Add bio_alloc_pages()

2012-09-20 Thread Tejun Heo
On Mon, Sep 10, 2012 at 05:22:33PM -0700, Kent Overstreet wrote:
> + bio_for_each_segment_all(bv, bio, i) {
> + bv->bv_page = alloc_page(gfp_mask);
> + if (!bv->bv_page) {
> + while (bv-- != bio->bi_io_vec)
> + __free_page(bv->bv_page);

I don't know.  I feel stupid.  I think it's because the loop variable
changes between loop condition test and actual body of loop.  How
about the following?  It is pointing to the member of the same array
so I think it's not even violating pointer comparison rules.

while (--bv >= bio->bi_io_vec)
__free_page(bv->bv_page);

-- 
tejun
--
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] ARM: OMAP: hwmod: revise deassert sequence

2012-09-20 Thread Paul Walmsley
Hi

On Wed, 22 Aug 2012, Omar Ramirez Luna wrote:

> For a reset sequence to complete cleanly, a module needs its
> associated clocks to be enabled, otherwise the timeout check
> in prcm code can print a false failure (failed to hardreset)
> that occurs because the clocks aren't powered ON and the status
> bit checked can't transition without them.
> 
> Signed-off-by: Omar Ramirez Luna 

Queued for 3.7, with the same caveats mentioned regarding patch 1.


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


Re: [PATCH 1/2] ARM: OMAP: hwmod: partially un-reset hwmods might not be properly enabled

2012-09-20 Thread Paul Walmsley
Hi Omar

On Wed, 22 Aug 2012, Omar Ramirez Luna wrote:

> Some IP blocks might not be using/controlling more than one
> reset line, this check loosens the restriction to fully use
> hwmod framework for those drivers.
> 
> E.g.: ipu has reset lines: mmu_cache, cpu0 and cpu1.
> - As of now cpu1 is not used and hence (with previous check) the
>   IP block isn't fully enabled by hwmod code.
> - Usually ipu and dsp processors configure their mmu module first
>   and then enable the processors, this involves:
> * Deasserting mmu reset line, and enabling the module.
> * Deasserting cpu0 reset line, and enabling the processor.
>   The ones portrayed in this example are controlled through
>   rproc_fw_boot in drivers/remoteproc/remoteproc_core.c
> 
> While at it, prevent _omap4_module_disable if all the hardreset
> lines on an IP block are not under reset.
> 
> This will allow the driver to:
>   a. Deassert the reset line.
>   b. Enable the hwmod through runtime PM default callbacks.
>   c. Do its usecase.
>   d. Disable hwmod through runtime PM.
>   e. Assert the reset line.
> 
> Signed-off-by: Omar Ramirez Luna 

Well, I don't think this is the right long-term solution, but I'd like to 
see this moving forward.  So this one has been queued for 3.7.  Hopefully 
we can figure out the right thing once the PRM driver is ready (which will 
handle the low-level hard resets).


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


[PATCH 11/14] userns: Convert s390 getting uid and gid system calls to use kuid and kgid

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Convert getresuid, getresgid, getuid, geteuid, getgid, getegid

Convert struct cred kuids and kgids into userspace uids and gids when
returning them.

These s390 system calls slipped through the cracks in my first
round of converstions :(

Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Signed-off-by: Eric W. Biederman 
---
 arch/s390/kernel/compat_linux.c |   36 
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index d122508..73995a7 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -131,13 +131,19 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 
suid)
low2highuid(suid));
 }
 
-asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 
__user *suid)
+asmlinkage long sys32_getresuid16(u16 __user *ruidp, u16 __user *euidp, u16 
__user *suidp)
 {
+   const struct cred *cred = current_cred();
int retval;
+   u16 ruid, euid, suid;
 
-   if (!(retval = put_user(high2lowuid(current->cred->uid), ruid)) &&
-   !(retval = put_user(high2lowuid(current->cred->euid), euid)))
-   retval = put_user(high2lowuid(current->cred->suid), suid);
+   ruid = high2lowuid(from_kuid_munged(cred->user_ns, cred->uid));
+   euid = high2lowuid(from_kuid_munged(cred->user_ns, cred->euid));
+   suid = high2lowuid(from_kuid_munged(cred->user_ns, cred->suid));
+
+   if (!(retval   = put_user(ruid, ruidp)) &&
+   !(retval   = put_user(euid, euidp)))
+   retval = put_user(suid, suidp);
 
return retval;
 }
@@ -148,13 +154,19 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 
sgid)
low2highgid(sgid));
 }
 
-asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 
__user *sgid)
+asmlinkage long sys32_getresgid16(u16 __user *rgidp, u16 __user *egidp, u16 
__user *sgidp)
 {
+   const struct cred *cred = current_cred();
int retval;
+   u16 rgid, egid, sgid;
+
+   rgid = high2lowgid(from_kgid_munged(cred->user_ns, cred->gid));
+   egid = high2lowgid(from_kgid_munged(cred->user_ns, cred->egid));
+   sgid = high2lowgid(from_kgid_munged(cred->user_ns, cred->sgid));
 
-   if (!(retval = put_user(high2lowgid(current->cred->gid), rgid)) &&
-   !(retval = put_user(high2lowgid(current->cred->egid), egid)))
-   retval = put_user(high2lowgid(current->cred->sgid), sgid);
+   if (!(retval   = put_user(rgid, rgidp)) &&
+   !(retval   = put_user(egid, egidp)))
+   retval = put_user(sgid, sgidp);
 
return retval;
 }
@@ -258,22 +270,22 @@ asmlinkage long sys32_setgroups16(int gidsetsize, u16 
__user *grouplist)
 
 asmlinkage long sys32_getuid16(void)
 {
-   return high2lowuid(current->cred->uid);
+   return high2lowuid(from_kuid_munged(current_user_ns(), current_uid()));
 }
 
 asmlinkage long sys32_geteuid16(void)
 {
-   return high2lowuid(current->cred->euid);
+   return high2lowuid(from_kuid_munged(current_user_ns(), current_euid()));
 }
 
 asmlinkage long sys32_getgid16(void)
 {
-   return high2lowgid(current->cred->gid);
+   return high2lowgid(from_kgid_munged(current_user_ns(), current_gid()));
 }
 
 asmlinkage long sys32_getegid16(void)
 {
-   return high2lowgid(current->cred->egid);
+   return high2lowgid(from_kgid_munged(current_user_ns(), current_egid()));
 }
 
 /*
-- 
1.7.5.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 13/14] userns: On ia64 deal with current_uid and current_gid being kuid and kgid

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

These ia64 uses of current_uid and current_gid slipped through the
cracks when I was converting everything to kuids and kgids convert
them now.

Cc: Tony Luck 
Cc: Fenghua Yu 
Signed-off-by: "Eric W. Biederman" 
---
 arch/ia64/kernel/mca_drv.c |3 ++-
 arch/ia64/kernel/perfmon.c |   32 
 arch/ia64/kernel/signal.c  |4 ++--
 3 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index 1c2e894..9392e02 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -158,7 +158,8 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned 
long ipsr)
ia64_mlogbuf_dump();
printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
"iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
-  raw_smp_processor_id(), current->pid, current_uid(),
+  raw_smp_processor_id(), current->pid,
+   from_kuid(_user_ns, current_uid()),
iip, ipsr, paddr, current->comm);
 
spin_lock(_bh_lock);
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 3fa4bc5..5a5c222 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2380,8 +2380,8 @@ static int
 pfm_bad_permissions(struct task_struct *task)
 {
const struct cred *tcred;
-   uid_t uid = current_uid();
-   gid_t gid = current_gid();
+   kuid_t uid = current_uid();
+   kgid_t gid = current_gid();
int ret;
 
rcu_read_lock();
@@ -2389,20 +2389,20 @@ pfm_bad_permissions(struct task_struct *task)
 
/* inspired by ptrace_attach() */
DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d 
sgid=%d\n",
-   uid,
-   gid,
-   tcred->euid,
-   tcred->suid,
-   tcred->uid,
-   tcred->egid,
-   tcred->sgid));
-
-   ret = ((uid != tcred->euid)
-  || (uid != tcred->suid)
-  || (uid != tcred->uid)
-  || (gid != tcred->egid)
-  || (gid != tcred->sgid)
-  || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
+   from_kuid(_user_ns, uid),
+   from_kgid(_user_ns, gid),
+   from_kuid(_user_ns, tcred->euid),
+   from_kuid(_user_ns, tcred->suid),
+   from_kuid(_user_ns, tcred->uid),
+   from_kgid(_user_ns, tcred->egid),
+   from_kgid(_user_ns, tcred->sgid)));
+
+   ret = ((!uid_eq(uid, tcred->euid))
+  || (!uid_eq(uid, tcred->suid))
+  || (!uid_eq(uid, tcred->uid))
+  || (!gid_eq(gid, tcred->egid))
+  || (!gid_eq(gid, tcred->sgid))
+  || (!gid_eq(gid, tcred->gid))) && !capable(CAP_SYS_PTRACE);
 
rcu_read_unlock();
return ret;
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index a199be1..37dd795 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -220,7 +220,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
si.si_errno = 0;
si.si_code = SI_KERNEL;
si.si_pid = task_pid_vnr(current);
-   si.si_uid = current_uid();
+   si.si_uid = from_kuid_munged(current_user_ns(), current_uid());
si.si_addr = sc;
force_sig_info(SIGSEGV, , current);
return retval;
@@ -317,7 +317,7 @@ force_sigsegv_info (int sig, void __user *addr)
si.si_errno = 0;
si.si_code = SI_KERNEL;
si.si_pid = task_pid_vnr(current);
-   si.si_uid = current_uid();
+   si.si_uid = from_kuid_munged(current_user_ns(), current_uid());
si.si_addr = addr;
force_sig_info(SIGSEGV, , current);
return 0;
-- 
1.7.5.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 12/14] userns: On ppc convert current_uid from a kuid before printing.

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Signed-off-by: "Eric W. Biederman" 
---
 arch/powerpc/mm/fault.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 08ffcf5..e5f028b 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -470,7 +470,7 @@ bad_area_nosemaphore:
if (is_exec && (error_code & DSISR_PROTFAULT))
printk_ratelimited(KERN_CRIT "kernel tried to execute 
NX-protected"
   " page (%lx) - exploit attempt? (uid: %d)\n",
-  address, current_uid());
+  address, from_kuid(_user_ns, 
current_uid()));
 
return SIGSEGV;
 
-- 
1.7.5.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 14/14] userns: On alpha modify linux_to_osf_stat to use convert from kuids and kgids

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Silencing build errors and potentially allowing people to use osf
system calls in from processes running in a non-default user namespace.

It seems this stat call was missed in my first round of converting the
stat system calls, bother.

Cc: Richard Henderson 
Cc: Ivan Kokshaysky 
Cc: Matt Turner 
Signed-off-by: "Eric W. Biederman" 
---
 arch/alpha/kernel/osf_sys.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 98a1036..32c5f9d 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -278,8 +278,8 @@ linux_to_osf_stat(struct kstat *lstat, struct osf_stat 
__user *osf_stat)
tmp.st_dev  = lstat->dev;
tmp.st_mode = lstat->mode;
tmp.st_nlink= lstat->nlink;
-   tmp.st_uid  = lstat->uid;
-   tmp.st_gid  = lstat->gid;
+   tmp.st_uid  = from_kuid_munged(current_user_ns(), lstat->uid);
+   tmp.st_gid  = from_kgid_munged(current_user_ns(), lstat->gid);
tmp.st_rdev = lstat->rdev;
tmp.st_ldev = lstat->rdev;
tmp.st_size = lstat->size;
-- 
1.7.5.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] pstore: avoid recursive spinlocks in the oops_in_progress case

2012-09-20 Thread Anton Vorontsov
On Thu, Sep 20, 2012 at 11:48:32PM +, Luck, Tony wrote:
> > True, but the lock is used to protect pstore->buf, I doubt that
> > any backend will actually want to grab it, no?
> 
> The lock is doing double duty to protect the buffer, and the back-end driver.
> 
> But even if we split it into two (one for the buffer, taken by pstore, and one
> internal to the backend to protect interaction with the f/w). Ifwe ignore the
> fact that we can't get the lock that protects  the buffer means it is very 
> likely
> that we corrupt the previous record that was being written by clobbering the
> buffer with the data for this new record.
> 
> I'd prefer to maximize the chances that the earlier record gets written.

Sure, I applied the original patch.

Btw, do you expect that backends protect themselves from concurrent
->write calls, or pstore guarantees to protect backends?

Because the latter is not always possible, for example in tracing: we
won't able to grab locks at all (but not all backends can do tracing
anyway -- they must do things atomically).

Plus, sometimes having the global lock is not "efficient", backends
know better: they might have separate locks per message type.

And my plan was to get rid of the fact that backends touch pstore->buf
directly. Backends would always receive anonymous 'buf' pointer (we
already have write_buf callback that does exactly this), and thus it
would be backends' worry to protect against concurrency. In this
scheme, pstore's console code won't need to grab locks at all: we'll
just pass console string to the backend directly.

And backends, if they can't do writes atomically, will grab their
own locks.

Thanks,
Anton.
--
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 21/26] block: Convert some code to bio_for_each_segment_all()

2012-09-20 Thread Tejun Heo
On Mon, Sep 10, 2012 at 05:22:32PM -0700, Kent Overstreet wrote:
> A few places in the code were either open coding or using the wrong
> version - fix.
> 
> Signed-off-by: Kent Overstreet 
> CC: Jens Axboe 
> CC: NeilBrown 
> ---
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -921,7 +921,7 @@ static void alloc_behind_pages(struct bio *bio, struct 
> r1bio *r1_bio)
>   if (unlikely(!bvecs))
>   return;
>  
> - bio_for_each_segment(bvec, bio, i) {
> + bio_for_each_segment_all(bvec, bio, i) {

I don't get this conversion.  Why is this necessary?

-- 
tejun
--
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 20/26] block: Add bio_for_each_segment_all()

2012-09-20 Thread Tejun Heo
Hello,

On Mon, Sep 10, 2012 at 05:22:31PM -0700, Kent Overstreet wrote:
> This is part of the immutable bvec prep work; bio_for_each_segment() is
> going to have a different implementation so these need to be split
> apart.
>
> This change is also to better document the intent of code that's using
> it - bio_for_each_segment_all() is only legal to use for code that owns
> the bio.

How about something like following?

 __bio_for_each_segment() iterates bvecs from the specified index
 instead of bio->bv_idx.  Currently, the only usage is to walk all the
 bvecs after the bio has been advanced by specifying 0 index.

 To help immutable bvec implementation, replace it with
 bio_for_each_segment_all() which also better documents the intent of
 code that's using it.  Note that bio_for_each_segment_all() should
 only be used by the code which owns the bio.

-- 
tejun
--
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 19/26] bounce: Refactor __blk_queue_bounce to not use bi_io_vec

2012-09-20 Thread Kent Overstreet
On Thu, Sep 20, 2012 at 05:27:06PM -0700, Tejun Heo wrote:
> On Mon, Sep 10, 2012 at 05:22:30PM -0700, Kent Overstreet wrote:
> > A bunch of what __blk_queue_bounce() was doing was problematic for the
> > immutable bvec work; this cleans that up and the code is quite a bit
> > smaller, too.
> > 
> > The __bio_for_each_segment() in copy_to_high_bio_irq() was changed
> > because that one's looping over the original bio, not the bounce bio -
> > since the bounce code doesn't own that bio the __ version wasn't
> > correct.
> 
> Also, I can't understand the above at all.  I can think why it
> wouldn't be necessary but why is it wrong because bounce code doesn't
> own it?

Another prep work thing - in current code, it isn't really wrong
(slightly inconsistent though).

But the idea is that anything that doesn't own the bio shouldn't assume
anything about bi_idx; the bounce code should loop over the bio starting
from wherever it was when the bio got to the bounce code, not the start
of the bio.

A later patch makes this clearer - __bio_for_each_segment() gets removed
in favor of bio_for_each_segment_all(), and it documents that
bio_for_each_segment_all() is only for code that owns the bio.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf: Fix parallel build

2012-09-20 Thread Namhyung Kim
Hi Eric,

On Thu, 20 Sep 2012 18:53:01 -0500, Eric Sandeen wrote:
> Parallel builds of perf were failing for me on a 32p box, with:
>
> * new build flags or prefix
> util/pmu.l:7:23: error: pmu-bison.h: No such file or directory
>
> ...
>
> make: *** [util/pmu-flex.o] Error 1
> make: *** Waiting for unfinished jobs
>
> This can pretty quickly be seen by adding a sleep in front of
> the bison call in tools/perf/Makefile and running make -j4 on a
> smaller box:
>
>   sleep 10; $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o 
> $(OUTPUT)util/pmu-bison.c
>
> Adding the following dependency fixes it for me:
>
> Signed-off-by: Eric Sandeen 
> ---
>
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index bad726a..6c389d9 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -219,7 +219,7 @@ $(OUTPUT)util/parse-events-flex.c: util/parse-events.l
>  $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
>   $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
> -o $(OUTPUT)util/parse-events-bison.c
>  
> -$(OUTPUT)util/pmu-flex.c: util/pmu.l
> +$(OUTPUT)util/pmu-flex.c: util/pmu.l util/pmu-bison.c
>   $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
> util/pmu.l > $(OUTPUT)util/pmu-flex.c
>  
>  $(OUTPUT)util/pmu-bison.c: util/pmu.y

I guess the $(OUTPUT)util/parse-events-flex.c: line has the same
problem.  Could you check and submit a patch for that too?

Thanks,
Namhyung
--
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 19/26] bounce: Refactor __blk_queue_bounce to not use bi_io_vec

2012-09-20 Thread Kent Overstreet
On Thu, Sep 20, 2012 at 05:25:55PM -0700, Tejun Heo wrote:
> Hello, Kent.
> 
> On Mon, Sep 10, 2012 at 05:22:30PM -0700, Kent Overstreet wrote:
> > A bunch of what __blk_queue_bounce() was doing was problematic for the
> > immutable bvec work; this cleans that up and the code is quite a bit
> > smaller, too.
> > 
> > The __bio_for_each_segment() in copy_to_high_bio_irq() was changed
> > because that one's looping over the original bio, not the bounce bio -
> > since the bounce code doesn't own that bio the __ version wasn't
> > correct.
> 
> I do like the new implementation.  I think the function is broken
> before and after tho.  Allocating from fs_bio_set from block layer is
> never safe and nothing seems to prevent multiple allocators compete in
> the bounce page mempool.  This will need a separate bioset and the
> multiple mempool allocation would have to be put inside a mutex.

Yeah, I should've at least made a note of that.

I should really add "audit all uses of fs_bio_set" to my todo list.

> Also, how was this tested?

Changed queue_bounce_pfn() to return 0, forcing all io to be bounced.
--
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 06/14] userns: Convert EVM to deal with kuids and kgids in it's hmac computation

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Mimi Zohar 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 init/Kconfig|1 -
 security/integrity/evm/evm_crypto.c |4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 8450442..96ee3f3 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -926,7 +926,6 @@ config UIDGID_CONVERTED
# List of kernel pieces that need user namespace work
# Features
depends on IMA = n
-   depends on EVM = n
 
# Networking
depends on NET_9P = n
diff --git a/security/integrity/evm/evm_crypto.c 
b/security/integrity/evm/evm_crypto.c
index 49a464f..dfb2691 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -106,8 +106,8 @@ static void hmac_add_misc(struct shash_desc *desc, struct 
inode *inode,
memset(_misc, 0, sizeof hmac_misc);
hmac_misc.ino = inode->i_ino;
hmac_misc.generation = inode->i_generation;
-   hmac_misc.uid = inode->i_uid;
-   hmac_misc.gid = inode->i_gid;
+   hmac_misc.uid = from_kuid(_user_ns, inode->i_uid);
+   hmac_misc.gid = from_kgid(_user_ns, inode->i_gid);
hmac_misc.mode = inode->i_mode;
crypto_shash_update(desc, (const u8 *)_misc, sizeof hmac_misc);
crypto_shash_final(desc, digest);
-- 
1.7.5.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] pda_power: ac_draw used before set

2012-09-20 Thread Anton Vorontsov
On Fri, Sep 21, 2012 at 01:16:38AM +0100, Paul Parsons wrote:
> >>When I reboot my iPAQ hx4700 in its cradle, the battery will not begin
> >>to charge even though the AC supply is connected. Charging will start
> >>only after the PDA power driver is tickled by some other power event,
> >>such as reseating the iPAQ in its cradle or connecting the USB cable.
> >>
> >>The problem lies in pda_power_probe(), where ac_draw is used by the call
> >>to update_charger() before being set by the call to regulator_get().
> >>
> >>Moving the regulator_get() call to before the update_charger() call
> >>fixes the problem.
> >>
> >>Signed-off-by: Paul Parsons 
> >>Cc: Philipp Zabel 
> >>---
> >
> >Great to see that someone is still using hx4700. :-)
> >
> >Thanks for the patch, it is merged now!
> 
> I am having second thoughts about the goto ac_draw_failed I added.
> This will cause pda_power_probe() to fail if regulator_get() fails.
> However the way ac_draw is used - always after a check for NULL -
> suggests that a failed call to regulator_get() was not fatal.
> 
> I am happy to submit another patch to remove the goto and label.

Sure thing, just send another patch on top.

Thanks!
Anton.
--
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 07/14] userns: Add user namespace support to IMA

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Use kuid's in the IMA rules.

When reporting the current uid in audit logs use from_kuid
to get a usable value.

Cc: Mimi Zohar 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 init/Kconfig|4 
 security/integrity/ima/ima_audit.c  |5 +++--
 security/integrity/ima/ima_policy.c |   14 +++---
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 96ee3f3..570cd33 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -923,10 +923,6 @@ config UIDGID_CONVERTED
bool
default y
 
-   # List of kernel pieces that need user namespace work
-   # Features
-   depends on IMA = n
-
# Networking
depends on NET_9P = n
 
diff --git a/security/integrity/ima/ima_audit.c 
b/security/integrity/ima/ima_audit.c
index 7a57f67..c586faa 100644
--- a/security/integrity/ima/ima_audit.c
+++ b/security/integrity/ima/ima_audit.c
@@ -39,8 +39,9 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
 
ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u",
-current->pid, current_cred()->uid,
-audit_get_loginuid(current),
+current->pid,
+from_kuid(_user_ns, current_cred()->uid),
+from_kuid(_user_ns, audit_get_loginuid(current)),
 audit_get_sessionid(current));
audit_log_task_context(ab);
audit_log_format(ab, " op=");
diff --git a/security/integrity/ima/ima_policy.c 
b/security/integrity/ima/ima_policy.c
index 1a95830..c84df05 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -39,7 +39,7 @@ struct ima_measure_rule_entry {
enum ima_hooks func;
int mask;
unsigned long fsmagic;
-   uid_t uid;
+   kuid_t uid;
struct {
void *rule; /* LSM file metadata specific */
int type;   /* audit type */
@@ -71,7 +71,7 @@ static struct ima_measure_rule_entry default_rules[] = {
 .flags = IMA_FUNC | IMA_MASK},
{.action = MEASURE,.func = BPRM_CHECK,.mask = MAY_EXEC,
 .flags = IMA_FUNC | IMA_MASK},
-   {.action = MEASURE,.func = FILE_CHECK,.mask = MAY_READ,.uid = 0,
+   {.action = MEASURE,.func = FILE_CHECK,.mask = MAY_READ,.uid = 
GLOBAL_ROOT_UID,
 .flags = IMA_FUNC | IMA_MASK | IMA_UID},
 };
 
@@ -112,7 +112,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry 
*rule,
if ((rule->flags & IMA_FSMAGIC)
&& rule->fsmagic != inode->i_sb->s_magic)
return false;
-   if ((rule->flags & IMA_UID) && rule->uid != cred->uid)
+   if ((rule->flags & IMA_UID) && !uid_eq(rule->uid, cred->uid))
return false;
for (i = 0; i < MAX_LSM_RULES; i++) {
int rc = 0;
@@ -277,7 +277,7 @@ static int ima_parse_rule(char *rule, struct 
ima_measure_rule_entry *entry)
 
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_RULE);
 
-   entry->uid = -1;
+   entry->uid = INVALID_UID;
entry->action = UNKNOWN;
while ((p = strsep(, " \t")) != NULL) {
substring_t args[MAX_OPT_ARGS];
@@ -361,15 +361,15 @@ static int ima_parse_rule(char *rule, struct 
ima_measure_rule_entry *entry)
case Opt_uid:
ima_log_string(ab, "uid", args[0].from);
 
-   if (entry->uid != -1) {
+   if (uid_valid(entry->uid)) {
result = -EINVAL;
break;
}
 
result = strict_strtoul(args[0].from, 10, );
if (!result) {
-   entry->uid = (uid_t) lnum;
-   if (entry->uid != lnum)
+   entry->uid = make_kuid(current_user_ns(), 
(uid_t)lnum);
+   if (!uid_valid(entry->uid) || (((uid_t)lnum) != 
lnum))
result = -EINVAL;
else
entry->flags |= IMA_UID;
-- 
1.7.5.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 v2 2/9] ARM: OMAP3: hwmod data: add mmu data for iva and isp

2012-09-20 Thread Paul Walmsley
Hi

On Wed, 12 Sep 2012, Omar Ramirez Luna wrote:

> Add mmu hwmod data for iva and isp.
> 
> Due to compatibility an ifdef CONFIG_OMAP_IOMMU_IVA2 needs to be
> propagated (previously on iommu resource info) to hwmod data in OMAP3,
> so users of iommu and tidspbridge can avoid issues of two modules
> managing mmu data/irqs/resets; this until tidspbridge can be migrated
> to iommu framework.
> 
> Cc: Benoit Cousson 
> Signed-off-by: Omar Ramirez Luna 

During testing, this patch was found to cause boot warnings on
AM3517-based devices.  The ISP MMUs do not appear to be present on
those chips.  The patch has been modified to restrict these hwmods to
OMAP34xx/36xx chips; updated patch below.


- Paul

From: Paul Walmsley 
Date: Thu, 20 Sep 2012 18:23:22 -0600
Subject: [PATCH] ARM: OMAP3: hwmod data: add mmu data for iva and isp

Add mmu hwmod data for iva and isp.

Due to compatibility an ifdef CONFIG_OMAP_IOMMU_IVA2 needs to be
propagated (previously on iommu resource info) to hwmod data in OMAP3,
so users of iommu and tidspbridge can avoid issues of two modules
managing mmu data/irqs/resets; this until tidspbridge can be migrated
to iommu framework.

Cc: Benoit Cousson 
Signed-off-by: Omar Ramirez Luna 
[p...@pwsan.com: fixed some kerneldoc and whitespace; ISP MMUs not present
 on AM35xx so restricted these hwmods to 34xx/36xx]
Signed-off-by: Paul Walmsley 
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  125 
 arch/arm/plat-omap/include/plat/iommu.h|   13 +++
 2 files changed, 138 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index f1328bc..11442d8 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2858,6 +2859,122 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 
= {
.user   = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/*
+ * 'mmu' class
+ * The memory management unit performs virtual to physical address translation
+ * for its requestors.
+ */
+
+static struct omap_hwmod_class_sysconfig mmu_sysc = {
+   .rev_offs   = 0x000,
+   .sysc_offs  = 0x010,
+   .syss_offs  = 0x014,
+   .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+  SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+   .idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+   .sysc_fields= _hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_mmu_hwmod_class = {
+   .name = "mmu",
+   .sysc = _sysc,
+};
+
+/* mmu isp */
+
+static struct omap_mmu_dev_attr mmu_isp_dev_attr = {
+   .da_start   = 0x0,
+   .da_end = 0xf000,
+   .nr_tlb_entries = 8,
+};
+
+static struct omap_hwmod omap3xxx_mmu_isp_hwmod;
+static struct omap_hwmod_irq_info omap3xxx_mmu_isp_irqs[] = {
+   { .irq = 24 },
+   { .irq = -1 }
+};
+
+static struct omap_hwmod_addr_space omap3xxx_mmu_isp_addrs[] = {
+   {
+   .pa_start   = 0x480bd400,
+   .pa_end = 0x480bd47f,
+   .flags  = ADDR_TYPE_RT,
+   },
+   { }
+};
+
+/* l4_core -> mmu isp */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmu_isp = {
+   .master = _l4_core_hwmod,
+   .slave  = _mmu_isp_hwmod,
+   .addr   = omap3xxx_mmu_isp_addrs,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod omap3xxx_mmu_isp_hwmod = {
+   .name   = "mmu_isp",
+   .class  = _mmu_hwmod_class,
+   .mpu_irqs   = omap3xxx_mmu_isp_irqs,
+   .main_clk   = "cam_ick",
+   .dev_attr   = _isp_dev_attr,
+   .flags  = HWMOD_NO_IDLEST,
+};
+
+#ifdef CONFIG_OMAP_IOMMU_IVA2
+
+/* mmu iva */
+
+static struct omap_mmu_dev_attr mmu_iva_dev_attr = {
+   .da_start   = 0x1100,
+   .da_end = 0xf000,
+   .nr_tlb_entries = 32,
+};
+
+static struct omap_hwmod omap3xxx_mmu_iva_hwmod;
+static struct omap_hwmod_irq_info omap3xxx_mmu_iva_irqs[] = {
+   { .irq = 28 },
+   { .irq = -1 }
+};
+
+static struct omap_hwmod_rst_info omap3xxx_mmu_iva_resets[] = {
+   { .name = "mmu", .rst_shift = 1, .st_shift = 9 },
+};
+
+static struct omap_hwmod_addr_space omap3xxx_mmu_iva_addrs[] = {
+   {
+   .pa_start   = 0x5d00,
+   .pa_end = 0x5d7f,
+   .flags  = ADDR_TYPE_RT,
+   },
+   { }
+};
+
+/* l3_main -> iva mmu */
+static struct omap_hwmod_ocp_if omap3xxx_l3_main__mmu_iva = {
+   .master = _l3_main_hwmod,
+   .slave  = _mmu_iva_hwmod,
+   .addr   = omap3xxx_mmu_iva_addrs,
+   .user   = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod omap3xxx_mmu_iva_hwmod = {
+   .name   = "mmu_iva",
+   .class  = 

[PATCH 09/14] userns: Convert binder ipc to use kuids

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Arve Hjønnevåg 
Cc: Greg Kroah-Hartman 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 drivers/staging/android/binder.c |   14 +++---
 init/Kconfig |3 ---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 574e992..8e35d4b 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -47,7 +47,7 @@ static HLIST_HEAD(binder_dead_nodes);
 static struct dentry *binder_debugfs_dir_entry_root;
 static struct dentry *binder_debugfs_dir_entry_proc;
 static struct binder_node *binder_context_mgr_node;
-static uid_t binder_context_mgr_uid = -1;
+static kuid_t binder_context_mgr_uid = INVALID_UID;
 static int binder_last_id;
 static struct workqueue_struct *binder_deferred_workqueue;
 
@@ -356,7 +356,7 @@ struct binder_transaction {
unsigned intflags;
longpriority;
longsaved_priority;
-   uid_t   sender_euid;
+   kuid_t  sender_euid;
 };
 
 static void
@@ -2427,7 +2427,7 @@ retry:
}
tr.code = t->code;
tr.flags = t->flags;
-   tr.sender_euid = t->sender_euid;
+   tr.sender_euid = from_kuid(current_user_ns(), t->sender_euid);
 
if (t->from) {
struct task_struct *sender = t->from->proc->tsk;
@@ -2705,12 +2705,12 @@ static long binder_ioctl(struct file *filp, unsigned 
int cmd, unsigned long arg)
ret = -EBUSY;
goto err;
}
-   if (binder_context_mgr_uid != -1) {
-   if (binder_context_mgr_uid != current->cred->euid) {
+   if (uid_valid(binder_context_mgr_uid)) {
+   if (!uid_eq(binder_context_mgr_uid, 
current->cred->euid)) {
pr_err("binder: BINDER_SET_"
   "CONTEXT_MGR bad uid %d != %d\n",
-  current->cred->euid,
-  binder_context_mgr_uid);
+  from_kuid(_user_ns, 
current->cred->euid),
+  from_kuid(_user_ns, 
binder_context_mgr_uid));
ret = -EPERM;
goto err;
}
diff --git a/init/Kconfig b/init/Kconfig
index 570cd33..8691098 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -952,9 +952,6 @@ config UIDGID_CONVERTED
depends on UFS_FS = n
depends on XFS_FS = n
 
-   # The rare drivers that won't build
-   depends on ANDROID_BINDER_IPC = n
-
 config UIDGID_STRICT_TYPE_CHECKS
bool "Require conversions between uid/gids and their internal 
representation"
depends on UIDGID_CONVERTED
-- 
1.7.5.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 10/14] userns: Convert s390 hypfs to use kuid and kgid where appropriate

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Signed-off-by: "Eric W. Biederman" 
---
 arch/s390/hypfs/inode.c |   20 ++--
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 6767b43..124ec1a 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -31,8 +31,8 @@ static struct dentry *hypfs_create_update_file(struct 
super_block *sb,
   struct dentry *dir);
 
 struct hypfs_sb_info {
-   uid_t uid;  /* uid used for files and dirs */
-   gid_t gid;  /* gid used for files and dirs */
+   kuid_t uid; /* uid used for files and dirs */
+   kgid_t gid; /* gid used for files and dirs */
struct dentry *update_file; /* file to trigger update */
time_t last_update; /* last update time in secs since 1970 
*/
struct mutex lock;  /* lock to protect update process */
@@ -229,6 +229,8 @@ static int hypfs_parse_options(char *options, struct 
super_block *sb)
 {
char *str;
substring_t args[MAX_OPT_ARGS];
+   kuid_t uid;
+   kgid_t gid;
 
if (!options)
return 0;
@@ -243,12 +245,18 @@ static int hypfs_parse_options(char *options, struct 
super_block *sb)
case opt_uid:
if (match_int([0], ))
return -EINVAL;
-   hypfs_info->uid = option;
+   uid = make_kuid(current_user_ns(), option);
+   if (!uid_valid(uid))
+   return -EINVAL;
+   hypfs_info->uid = uid;
break;
case opt_gid:
if (match_int([0], ))
return -EINVAL;
-   hypfs_info->gid = option;
+   gid = make_kgid(current_user_ns(), option);
+   if (!gid_valid(gid))
+   return -EINVAL;
+   hypfs_info->gid = gid;
break;
case opt_err:
default:
@@ -263,8 +271,8 @@ static int hypfs_show_options(struct seq_file *s, struct 
dentry *root)
 {
struct hypfs_sb_info *hypfs_info = root->d_sb->s_fs_info;
 
-   seq_printf(s, ",uid=%u", hypfs_info->uid);
-   seq_printf(s, ",gid=%u", hypfs_info->gid);
+   seq_printf(s, ",uid=%u", from_kuid_munged(_user_ns, 
hypfs_info->uid));
+   seq_printf(s, ",gid=%u", from_kgid_munged(_user_ns, 
hypfs_info->gid));
return 0;
 }
 
-- 
1.7.5.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 08/14] userns: Teach security_path_chown to take kuids and kgids

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Don't make the security modules deal with raw user space uid and
gids instead pass in a kuid_t and a kgid_t so that security modules
only have to deal with internal kernel uids and gids.

Cc: Al Viro 
Cc: James Morris 
Cc: John Johansen 
Cc: Kentaro Takeda 
Cc: Tetsuo Handa 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 fs/open.c|2 +-
 include/linux/security.h |6 +++---
 security/apparmor/lsm.c  |2 +-
 security/capability.c|2 +-
 security/security.c  |2 +-
 security/tomoyo/tomoyo.c |   12 +++-
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index f3d96e7..2b25739 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -534,7 +534,7 @@ static int chown_common(struct path *path, uid_t user, 
gid_t group)
newattrs.ia_valid |=
ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
mutex_lock(>i_mutex);
-   error = security_path_chown(path, user, group);
+   error = security_path_chown(path, uid, gid);
if (!error)
error = notify_change(path->dentry, );
mutex_unlock(>i_mutex);
diff --git a/include/linux/security.h b/include/linux/security.h
index 4e5a73c..ebb92cb 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1437,7 +1437,7 @@ struct security_operations {
int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
struct path *new_dir, struct dentry *new_dentry);
int (*path_chmod) (struct path *path, umode_t mode);
-   int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
+   int (*path_chown) (struct path *path, kuid_t uid, kgid_t gid);
int (*path_chroot) (struct path *path);
 #endif
 
@@ -2832,7 +2832,7 @@ int security_path_link(struct dentry *old_dentry, struct 
path *new_dir,
 int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
 struct path *new_dir, struct dentry *new_dentry);
 int security_path_chmod(struct path *path, umode_t mode);
-int security_path_chown(struct path *path, uid_t uid, gid_t gid);
+int security_path_chown(struct path *path, kuid_t uid, kgid_t gid);
 int security_path_chroot(struct path *path);
 #else  /* CONFIG_SECURITY_PATH */
 static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
@@ -2888,7 +2888,7 @@ static inline int security_path_chmod(struct path *path, 
umode_t mode)
return 0;
 }
 
-static inline int security_path_chown(struct path *path, uid_t uid, gid_t gid)
+static inline int security_path_chown(struct path *path, kuid_t uid, kgid_t 
gid)
 {
return 0;
 }
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 8ea39aa..8c2a7f6 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -352,7 +352,7 @@ static int apparmor_path_chmod(struct path *path, umode_t 
mode)
return common_perm_mnt_dentry(OP_CHMOD, path->mnt, path->dentry, 
AA_MAY_CHMOD);
 }
 
-static int apparmor_path_chown(struct path *path, uid_t uid, gid_t gid)
+static int apparmor_path_chown(struct path *path, kuid_t uid, kgid_t gid)
 {
struct path_cond cond =  { path->dentry->d_inode->i_uid,
   path->dentry->d_inode->i_mode
diff --git a/security/capability.c b/security/capability.c
index 61095df..a40aac6 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -284,7 +284,7 @@ static int cap_path_chmod(struct path *path, umode_t mode)
return 0;
 }
 
-static int cap_path_chown(struct path *path, uid_t uid, gid_t gid)
+static int cap_path_chown(struct path *path, kuid_t uid, kgid_t gid)
 {
return 0;
 }
diff --git a/security/security.c b/security/security.c
index 860aeb3..f9a2f2e 100644
--- a/security/security.c
+++ b/security/security.c
@@ -434,7 +434,7 @@ int security_path_chmod(struct path *path, umode_t mode)
return security_ops->path_chmod(path, mode);
 }
 
-int security_path_chown(struct path *path, uid_t uid, gid_t gid)
+int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
 {
if (unlikely(IS_PRIVATE(path->dentry->d_inode)))
return 0;
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index c2d04a5..d88eb3a 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -373,13 +373,15 @@ static int tomoyo_path_chmod(struct path *path, umode_t 
mode)
  *
  * Returns 0 on success, negative value otherwise.
  */
-static int tomoyo_path_chown(struct path *path, uid_t uid, gid_t gid)
+static int tomoyo_path_chown(struct path *path, kuid_t uid, kgid_t gid)
 {
int error = 0;
-   if (uid != (uid_t) -1)
-   error = tomoyo_path_number_perm(TOMOYO_TYPE_CHOWN, path, uid);
-   if (!error && gid != (gid_t) -1)
-   error = tomoyo_path_number_perm(TOMOYO_TYPE_CHGRP, path, gid);
+   if (uid_valid(uid))
+   error = 

[PATCH 04/14] userns: Convert selinux to use kuid and kgid where appropriate

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Stephen Smalley 
Cc: James Morris 
Cc: Eric Paris 
Signed-off-by: "Eric W. Biederman" 
---
 security/selinux/selinuxfs.c   |6 +++---
 security/selinux/ss/services.c |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 298e695..55af8c5 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -174,7 +174,7 @@ static ssize_t sel_write_enforce(struct file *file, const 
char __user *buf,
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
"enforcing=%d old_enforcing=%d auid=%u ses=%u",
new_value, selinux_enforcing,
-   audit_get_loginuid(current),
+   from_kuid(_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current));
selinux_enforcing = new_value;
if (selinux_enforcing)
@@ -305,7 +305,7 @@ static ssize_t sel_write_disable(struct file *file, const 
char __user *buf,
goto out;
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
"selinux=0 auid=%u ses=%u",
-   audit_get_loginuid(current),
+   from_kuid(_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current));
}
 
@@ -551,7 +551,7 @@ static ssize_t sel_write_load(struct file *file, const char 
__user *buf,
 out1:
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
"policy loaded auid=%u ses=%u",
-   audit_get_loginuid(current),
+   from_kuid(_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current));
 out:
mutex_unlock(_mutex);
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 4321b8f..b4feecc 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2440,7 +2440,7 @@ int security_set_bools(int len, int *values)
sym_name(, SYM_BOOLS, i),
!!values[i],
policydb.bool_val_to_struct[i]->state,
-   audit_get_loginuid(current),
+   from_kuid(_user_ns, 
audit_get_loginuid(current)),
audit_get_sessionid(current));
}
if (values[i])
-- 
1.7.5.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 05/14] userns: Convert hostfs to use kuid and kgid where appropriate

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Jeff Dike 
Cc: Richard Weinberger 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 fs/hostfs/hostfs_kern.c |8 
 init/Kconfig|2 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 1241465..6c9f3a9 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -542,8 +542,8 @@ static int read_name(struct inode *ino, char *name)
ino->i_ino = st.ino;
ino->i_mode = st.mode;
set_nlink(ino, st.nlink);
-   ino->i_uid = st.uid;
-   ino->i_gid = st.gid;
+   i_uid_write(ino, st.uid);
+   i_gid_write(ino, st.gid);
ino->i_atime = st.atime;
ino->i_mtime = st.mtime;
ino->i_ctime = st.ctime;
@@ -808,11 +808,11 @@ int hostfs_setattr(struct dentry *dentry, struct iattr 
*attr)
}
if (attr->ia_valid & ATTR_UID) {
attrs.ia_valid |= HOSTFS_ATTR_UID;
-   attrs.ia_uid = attr->ia_uid;
+   attrs.ia_uid = from_kuid(_user_ns, attr->ia_uid);
}
if (attr->ia_valid & ATTR_GID) {
attrs.ia_valid |= HOSTFS_ATTR_GID;
-   attrs.ia_gid = attr->ia_gid;
+   attrs.ia_gid = from_kgid(_user_ns, attr->ia_gid);
}
if (attr->ia_valid & ATTR_SIZE) {
attrs.ia_valid |= HOSTFS_ATTR_SIZE;
diff --git a/init/Kconfig b/init/Kconfig
index 381f765..8450442 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -957,8 +957,6 @@ config UIDGID_CONVERTED
depends on UFS_FS = n
depends on XFS_FS = n
 
-   depends on !UML || HOSTFS = n
-
# The rare drivers that won't build
depends on ANDROID_BINDER_IPC = n
 
-- 
1.7.5.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 03/14] userns: Convert tomoyo to use kuid and kgid where appropriate

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Acked-by: Tetsuo Handa 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 init/Kconfig|3 ---
 security/tomoyo/audit.c |   23 ---
 security/tomoyo/common.c|4 +++-
 security/tomoyo/common.h|4 ++--
 security/tomoyo/condition.c |   20 ++--
 5 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 637faf8..381f765 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -962,9 +962,6 @@ config UIDGID_CONVERTED
# The rare drivers that won't build
depends on ANDROID_BINDER_IPC = n
 
-   # Security modules
-   depends on SECURITY_TOMOYO = n
-
 config UIDGID_STRICT_TYPE_CHECKS
bool "Require conversions between uid/gids and their internal 
representation"
depends on UIDGID_CONVERTED
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index 7ef9fa3..c1b0037 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -168,9 +168,14 @@ static char *tomoyo_print_header(struct 
tomoyo_request_info *r)
   stamp.day, stamp.hour, stamp.min, stamp.sec, r->profile,
   tomoyo_mode[r->mode], tomoyo_yesno(r->granted), gpid,
   tomoyo_sys_getpid(), tomoyo_sys_getppid(),
-  current_uid(), current_gid(), current_euid(),
-  current_egid(), current_suid(), current_sgid(),
-  current_fsuid(), current_fsgid());
+  from_kuid(_user_ns, current_uid()),
+  from_kgid(_user_ns, current_gid()),
+  from_kuid(_user_ns, current_euid()),
+  from_kgid(_user_ns, current_egid()),
+  from_kuid(_user_ns, current_suid()),
+  from_kgid(_user_ns, current_sgid()),
+  from_kuid(_user_ns, current_fsuid()),
+  from_kgid(_user_ns, current_fsgid()));
if (!obj)
goto no_obj_info;
if (!obj->validate_done) {
@@ -191,15 +196,19 @@ static char *tomoyo_print_header(struct 
tomoyo_request_info *r)
tomoyo_buffer_len - 1 - pos,
" path%u.parent={ uid=%u gid=%u "
"ino=%lu perm=0%o }", (i >> 1) + 1,
-   stat->uid, stat->gid, (unsigned long)
-   stat->ino, stat->mode & S_IALLUGO);
+   from_kuid(_user_ns, stat->uid),
+   from_kgid(_user_ns, stat->gid),
+   (unsigned long)stat->ino,
+   stat->mode & S_IALLUGO);
continue;
}
pos += snprintf(buffer + pos, tomoyo_buffer_len - 1 - pos,
" path%u={ uid=%u gid=%u ino=%lu major=%u"
" minor=%u perm=0%o type=%s", (i >> 1) + 1,
-   stat->uid, stat->gid, (unsigned long)
-   stat->ino, MAJOR(dev), MINOR(dev),
+   from_kuid(_user_ns, stat->uid),
+   from_kgid(_user_ns, stat->gid),
+   (unsigned long)stat->ino,
+   MAJOR(dev), MINOR(dev),
mode & S_IALLUGO, tomoyo_filetype(mode));
if (S_ISCHR(mode) || S_ISBLK(mode)) {
dev = stat->rdev;
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 2e0f12c..f89a033 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -925,7 +925,9 @@ static bool tomoyo_manager(void)
 
if (!tomoyo_policy_loaded)
return true;
-   if (!tomoyo_manage_by_non_root && (task->cred->uid || task->cred->euid))
+   if (!tomoyo_manage_by_non_root &&
+   (!uid_eq(task->cred->uid,  GLOBAL_ROOT_UID) ||
+!uid_eq(task->cred->euid, GLOBAL_ROOT_UID)))
return false;
exe = tomoyo_get_exe();
if (!exe)
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 75e4dc1..af010b6 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -561,8 +561,8 @@ struct tomoyo_address_group {
 
 /* Subset of "struct stat". Used by conditional ACL and audit logs. */
 struct tomoyo_mini_stat {
-   uid_t uid;
-   gid_t gid;
+   kuid_t uid;
+   kgid_t gid;
ino_t ino;
umode_t mode;
dev_t dev;
diff --git a/security/tomoyo/condition.c b/security/tomoyo/condition.c
index 986330b..63681e8 100644
--- a/security/tomoyo/condition.c
+++ b/security/tomoyo/condition.c
@@ -813,28 +813,28 @@ bool tomoyo_condition(struct tomoyo_request_info *r,
unsigned long value = 0;
  

[PATCH 02/14] userns: Convert apparmor to use kuid and kgid where appropriate

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: John Johansen 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 init/Kconfig  |1 -
 security/apparmor/domain.c|4 ++--
 security/apparmor/file.c  |   12 +++-
 security/apparmor/include/audit.h |2 +-
 security/apparmor/include/file.h  |4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index f315997..637faf8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -964,7 +964,6 @@ config UIDGID_CONVERTED
 
# Security modules
depends on SECURITY_TOMOYO = n
-   depends on SECURITY_APPARMOR = n
 
 config UIDGID_STRICT_TYPE_CHECKS
bool "Require conversions between uid/gids and their internal 
representation"
diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
index b81ea10..60f0c76 100644
--- a/security/apparmor/domain.c
+++ b/security/apparmor/domain.c
@@ -721,7 +721,7 @@ audit:
if (!permtest)
error = aa_audit_file(profile, , GFP_KERNEL,
  OP_CHANGE_HAT, AA_MAY_CHANGEHAT, NULL,
- target, 0, info, error);
+ target, GLOBAL_ROOT_UID, info, error);
 
 out:
aa_put_profile(hat);
@@ -848,7 +848,7 @@ int aa_change_profile(const char *ns_name, const char 
*hname, bool onexec,
 audit:
if (!permtest)
error = aa_audit_file(profile, , GFP_KERNEL, op, request,
- name, hname, 0, info, error);
+ name, hname, GLOBAL_ROOT_UID, info, 
error);
 
aa_put_namespace(ns);
aa_put_profile(target);
diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index cf19d40..cd21ec5 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -65,7 +65,7 @@ static void audit_file_mask(struct audit_buffer *ab, u32 mask)
 static void file_audit_cb(struct audit_buffer *ab, void *va)
 {
struct common_audit_data *sa = va;
-   uid_t fsuid = current_fsuid();
+   kuid_t fsuid = current_fsuid();
 
if (sa->aad->fs.request & AA_AUDIT_FILE_MASK) {
audit_log_format(ab, " requested_mask=");
@@ -76,8 +76,10 @@ static void file_audit_cb(struct audit_buffer *ab, void *va)
audit_file_mask(ab, sa->aad->fs.denied);
}
if (sa->aad->fs.request & AA_AUDIT_FILE_MASK) {
-   audit_log_format(ab, " fsuid=%d", fsuid);
-   audit_log_format(ab, " ouid=%d", sa->aad->fs.ouid);
+   audit_log_format(ab, " fsuid=%d",
+from_kuid(_user_ns, fsuid));
+   audit_log_format(ab, " ouid=%d",
+from_kuid(_user_ns, sa->aad->fs.ouid));
}
 
if (sa->aad->fs.target) {
@@ -103,7 +105,7 @@ static void file_audit_cb(struct audit_buffer *ab, void *va)
  */
 int aa_audit_file(struct aa_profile *profile, struct file_perms *perms,
  gfp_t gfp, int op, u32 request, const char *name,
- const char *target, uid_t ouid, const char *info, int error)
+ const char *target, kuid_t ouid, const char *info, int error)
 {
int type = AUDIT_APPARMOR_AUTO;
struct common_audit_data sa;
@@ -201,7 +203,7 @@ static struct file_perms compute_perms(struct aa_dfa *dfa, 
unsigned int state,
 */
perms.kill = 0;
 
-   if (current_fsuid() == cond->uid) {
+   if (uid_eq(current_fsuid(), cond->uid)) {
perms.allow = map_old_perms(dfa_user_allow(dfa, state));
perms.audit = map_old_perms(dfa_user_audit(dfa, state));
perms.quiet = map_old_perms(dfa_user_quiet(dfa, state));
diff --git a/security/apparmor/include/audit.h 
b/security/apparmor/include/audit.h
index 4b7e189..69d8cae 100644
--- a/security/apparmor/include/audit.h
+++ b/security/apparmor/include/audit.h
@@ -125,7 +125,7 @@ struct apparmor_audit_data {
const char *target;
u32 request;
u32 denied;
-   uid_t ouid;
+   kuid_t ouid;
} fs;
};
 };
diff --git a/security/apparmor/include/file.h b/security/apparmor/include/file.h
index f98fd47..967b2de 100644
--- a/security/apparmor/include/file.h
+++ b/security/apparmor/include/file.h
@@ -71,7 +71,7 @@ struct path;
 
 /* need to make conditional which ones are being set */
 struct path_cond {
-   uid_t uid;
+   kuid_t uid;
umode_t mode;
 };
 
@@ -146,7 +146,7 @@ static inline u16 dfa_map_xindex(u16 mask)
 
 int aa_audit_file(struct aa_profile *profile, struct file_perms *perms,
  gfp_t gfp, int op, u32 request, const char *name,
- const char *target, uid_t ouid, const char *info, int error);
+ const char *target, kuid_t ouid, const char *info, int 

[PATCH 01/14] userns: Convert loop to use kuid_t instead of uid_t

2012-09-20 Thread Eric W. Biederman
From: "Eric W. Biederman" 

Cc: Signed-off-by: Jens Axboe 
Acked-by: Serge Hallyn 
Signed-off-by: Eric W. Biederman 
---
 drivers/block/loop.c |4 ++--
 include/linux/loop.h |2 +-
 init/Kconfig |1 -
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 3bba655..e9d594f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1038,10 +1038,10 @@ loop_set_status(struct loop_device *lo, const struct 
loop_info64 *info)
 {
int err;
struct loop_func_table *xfer;
-   uid_t uid = current_uid();
+   kuid_t uid = current_uid();
 
if (lo->lo_encrypt_key_size &&
-   lo->lo_key_owner != uid &&
+   !uid_eq(lo->lo_key_owner, uid) &&
!capable(CAP_SYS_ADMIN))
return -EPERM;
if (lo->lo_state != Lo_bound)
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 11a41a8..9635116 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -44,7 +44,7 @@ struct loop_device {
int lo_encrypt_key_size;
struct loop_func_table *lo_encryption;
__u32   lo_init[2];
-   uid_t   lo_key_owner;   /* Who set the key */
+   kuid_t  lo_key_owner;   /* Who set the key */
int (*ioctl)(struct loop_device *, int cmd, 
 unsigned long arg); 
 
diff --git a/init/Kconfig b/init/Kconfig
index f0371a6..f315997 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -960,7 +960,6 @@ config UIDGID_CONVERTED
depends on !UML || HOSTFS = n
 
# The rare drivers that won't build
-   depends on BLK_DEV_LOOP = n
depends on ANDROID_BINDER_IPC = n
 
# Security modules
-- 
1.7.5.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/


  1   2   3   4   5   6   7   8   9   10   >