Re: [PATCH 2/2] cpu: intel, amd: mask cleared cpuid features

2012-07-24 Thread Vladimir Davydov

On 07/25/2012 04:57 AM, H. Peter Anvin wrote:

On 07/24/2012 04:09 AM, Vladimir Davydov wrote:

We have not encountered this situation in our environments and I hope we
won't :-)

But look, these CPUID functions cover majority of CPU features, don't
they? So, most of "normal" apps inside VM will survive migration.
Perhaps, some low-level utils won't. I guess that's why there are no
MSRs for other levels provided by vendors.


You will once Ivy Bridge becomes common.


Ivy Bridge has CPUID faulting, which allows masking all CPUID 
levels/functions.



-hpa



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: manual merge of the mfd tree with Linus' tree

2012-07-24 Thread Laxman Dewangan

On Wednesday 25 July 2012 06:48 AM, Stephen Rothwell wrote:

* PGP Signed by an unknown key

Hi Samuel,

Today's linux-next merge of the mfd tree got a conflict in
arch/arm/configs/tegra_defconfig between commit dbebe1589d3a ("ARM:
tegra: defconfig updates") from Linus' tree and commit 05f3ad2b8ae5
("ARM: tegra: defconfig: Enable tps6586x gpio") from the mfd tree.

Just context changes.  I fixed it up (see below) and can carry the fix as
necessary.

Yes, this fix is proper.

Thanks,
Laxman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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-pm] ACPI & Power Management Patches for Linux-3.6-merge - part 1

2012-07-24 Thread Amit Kachhap
On 25 July 2012 09:10, Len Brown  wrote:
> Here is my initial queue of patches for Linux 3.6.
> Please let me know if you see troubles with any of them.

Hi Len,

I cannot see my patches (V5)
http://www.spinics.net/lists/linux-pm/msg27866.html in your list. V4
version was part of your pull request for the last merge window. Also
because of Durgadoss's "Thermal trip points writeable" patch present
in this list one small rework is needed. I will update it and resend
it shortly.

Thanks,
Amit Daniel

>
> thanks,
> Len Brown, Intel Open Source Technology Center
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


tasklist_lock lockdep warnings on 3.6

2012-07-24 Thread Sasha Levin
Hi all,

I've stumbled on the following while fuzzing with trinity inside a KVM tools 
guest on 3.6 kernel:

[  250.495512] ==
[  250.496020] [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
[  250.496020] 3.5.0-sasha-01646-g39c0dda #269 Tainted: GW
[  250.496020] --
[  250.496020] trinity-child15/6956 [HC0[0]:SC0[0]:HE0:SE1] is trying to 
acquire:
[  250.496020]  (tasklist_lock){.+.+..}, at: [] 
posix_cpu_timer_del+0x2a/0x110
[  250.496020]
[  250.496020] and this task is already holding:
[  250.496020]  (&(&new_timer->it_lock)->rlock){-.-...}, at: 
[] exit_itimers+0x50/0x140
[  250.496020] which would create a new lock dependency:
[  250.496020]  (&(&new_timer->it_lock)->rlock){-.-...} -> 
(tasklist_lock){.+.+..}
[  250.496020]
[  250.496020] but this new dependency connects a HARDIRQ-irq-safe lock:
[  250.496020]  (&(&new_timer->it_lock)->rlock){-.-...}
... which became HARDIRQ-irq-safe at:
[  250.496020]   [] mark_irqflags+0x7c/0x190
[  250.496020]   [] __lock_acquire+0x936/0xb60
[  250.496020]   [] lock_acquire+0x1ca/0x270
[  250.496020]   [] _raw_spin_lock_irqsave+0x79/0xc0
[  250.496020]   [] posix_timer_fn+0x32/0xd0
[  250.496020]   [] __run_hrtimer+0x27e/0x4d0
[  250.496020]   [] hrtimer_interrupt+0x119/0x220
[  250.496020]   [] smp_apic_timer_interrupt+0x85/0xa0
[  250.496020]   [] apic_timer_interrupt+0x6f/0x80
[  250.496020]   [] rcu_lockdep_current_cpu_online+0x6e/0xa0
[  250.496020]   [] proc_sys_compare+0x7e/0x130
[  250.496020]   [] __d_lookup+0x18c/0x2e0
[  250.496020]   [] lookup_fast+0x136/0x240
[  250.496020]   [] link_path_walk+0x22c/0x8f0
[  250.496020]   [] path_lookupat+0x57/0x720
[  250.496020]   [] do_path_lookup+0x2c/0xc0
[  250.496020]   [] user_path_at_empty+0x64/0xa0
[  250.496020]   [] user_path_at+0xc/0x10
[  250.496020]   [] sys_chdir+0x1e/0x70
[  250.496020]   [] system_call_fastpath+0x1a/0x1f
[  250.496020]
[  250.496020] to a HARDIRQ-irq-unsafe lock:
[  250.496020]  (&(&p->alloc_lock)->rlock){+.+...}
... which became HARDIRQ-irq-unsafe at:
[  250.496020] ...  [] mark_irqflags+0x100/0x190
[  250.496020]   [] __lock_acquire+0x936/0xb60
[  250.496020]   [] lock_acquire+0x1ca/0x270
[  250.496020]   [] _raw_spin_lock+0x3b/0x70
[  250.496020]   [] set_task_comm+0x31/0x1c0
[  250.496020]   [] kthreadd+0x2c/0x170
[  250.496020]   [] kernel_thread_helper+0x4/0x10
[  250.496020]
[  250.496020] other info that might help us debug this:
[  250.496020]
[  250.496020] Chain exists of:
  &(&new_timer->it_lock)->rlock --> tasklist_lock --> &(&p->alloc_lock)->rlock

[  250.496020]  Possible interrupt unsafe locking scenario:
[  250.496020]
[  250.496020]CPU0CPU1
[  250.496020]
[  250.496020]   lock(&(&p->alloc_lock)->rlock);
[  250.496020]local_irq_disable();
[  250.496020]
lock(&(&new_timer->it_lock)->rlock);
[  250.496020]lock(tasklist_lock);
[  250.496020]   
[  250.496020] lock(&(&new_timer->it_lock)->rlock);
[  250.496020]
[  250.496020]  *** DEADLOCK ***
[  250.496020]
[  250.496020] 1 lock held by trinity-child15/6956:
[  250.496020]  #0:  (&(&new_timer->it_lock)->rlock){-.-...}, at: 
[] exit_itimers+0x50/0x140
[  250.496020]
the dependencies between HARDIRQ-irq-safe lock and the holding lock:
[  250.496020] -> (&(&new_timer->it_lock)->rlock){-.-...} ops: 6221 {
[  250.496020]IN-HARDIRQ-W at:
[  250.496020] [] mark_irqflags+0x7c/0x190
[  250.496020] [] 
__lock_acquire+0x936/0xb60
[  250.496020] [] lock_acquire+0x1ca/0x270
[  250.496020] [] 
_raw_spin_lock_irqsave+0x79/0xc0
[  250.496020] [] posix_timer_fn+0x32/0xd0
[  250.496020] [] 
__run_hrtimer+0x27e/0x4d0
[  250.496020] [] 
hrtimer_interrupt+0x119/0x220
[  250.496020] [] 
smp_apic_timer_interrupt+0x85/0xa0
[  250.496020] [] 
apic_timer_interrupt+0x6f/0x80
[  250.496020] [] 
rcu_lockdep_current_cpu_online+0x6e/0xa0
[  250.496020] [] 
proc_sys_compare+0x7e/0x130
[  250.496020] [] __d_lookup+0x18c/0x2e0
[  250.496020] [] lookup_fast+0x136/0x240
[  250.496020] [] 
link_path_walk+0x22c/0x8f0
[  250.496020] [] path_lookupat+0x57/0x720
[  250.496020] [] do_path_lookup+0x2c/0xc0
[  250.496020] [] 
user_path_at_empty+0x64/0xa0
[  250.496020] [] user_path_at+0xc/0x10
[  250.496020] [] sys_chdir+0x1e/0x70
[  250.496020] [] 
system_call_fastpath+0x1a/0x1f
[  250.496020]IN-SOFTIRQ-W at:
[  250.496020] [] mark_irqflags+0xa7/0x190
[  250.4

[PATCH] mmc: card: Add Sanitize unit test

2012-07-24 Thread Maya Erez
This test write data to the card, then send DISCARD on random
addresses on the card, send SANITIZE to the card to erase all
the unmapped areas.

Signed-off-by: Maya Erez 
---
This patch depends of the following patches:
  [PATCH RESEND v7 1/2] block: ioctl support for sanitize in eMMC 4.5
  [PATCH RESEND v7 2/2] mmc: card: Adding support for sanitize in eMMC 4.5
  [PATCH v4 2/3] block: Add test-iosched scheduler
  [PATCH v4 3/3] mmc: card: Add eMMC4.5 write packed commands unit-tests

---
 block/test-iosched.c  |3 +
 drivers/mmc/card/mmc_block_test.c |  120 +
 include/linux/test-iosched.h  |1 +
 3 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/block/test-iosched.c b/block/test-iosched.c
index 6f0b0b3..e04befd 100644
--- a/block/test-iosched.c
+++ b/block/test-iosched.c
@@ -173,6 +173,9 @@ int test_iosched_add_unique_test_req(int is_err_expcted,
bio->bi_size = nr_sects << 9;
bio->bi_sector = start_sec;
break;
+   case REQ_UNIQUE_SANITIZE:
+   bio->bi_rw = REQ_WRITE | REQ_SANITIZE;
+   break;
default:
test_pr_err("%s: Invalid request type %d", __func__,
req_unique);
diff --git a/drivers/mmc/card/mmc_block_test.c 
b/drivers/mmc/card/mmc_block_test.c
index f2a0ac7..25af8cc 100644
--- a/drivers/mmc/card/mmc_block_test.c
+++ b/drivers/mmc/card/mmc_block_test.c
@@ -33,11 +33,16 @@
 #define PACKED_HDR_RW_MASK 0xFF00
 #define PACKED_HDR_NUM_REQS_MASK 0x00FF
 #define PACKED_HDR_BITS_16_TO_29_SET 0x3FFF
+#define SECTOR_SIZE 512
+#define NUM_OF_SECTORS_PER_BIO ((BIO_U32_SIZE * 4) / SECTOR_SIZE)
+#define BIO_TO_SECTOR(x)   (x * NUM_OF_SECTORS_PER_BIO)
 
 #define test_pr_debug(fmt, args...) pr_debug("%s: "fmt"\n", MODULE_NAME, args)
 #define test_pr_info(fmt, args...) pr_info("%s: "fmt"\n", MODULE_NAME, args)
 #define test_pr_err(fmt, args...) pr_err("%s: "fmt"\n", MODULE_NAME, args)
 
+#define SANITIZE_TEST_TIMEOUT 24
+
 enum is_random {
NON_RANDOM_TEST,
RANDOM_TEST,
@@ -83,6 +88,8 @@ enum mmc_block_test_testcases {
TEST_CMD23_BITS_16TO29_SET,
TEST_CMD23_HDR_BLK_NOT_IN_COUNT,
INVALID_CMD_MAX_TESTCASE = TEST_CMD23_HDR_BLK_NOT_IN_COUNT,
+
+   TEST_WRITE_DISCARD_SANITIZE_READ,
 };
 
 enum mmc_block_test_group {
@@ -98,6 +105,7 @@ struct mmc_block_test_debug {
struct dentry *err_check_test;
struct dentry *send_invalid_packed_test;
struct dentry *random_test_seed;
+   struct dentry *discard_sanitize_test;
 };
 
 struct mmc_block_test_data {
@@ -454,6 +462,8 @@ static char *get_test_case_str(struct test_data *td)
return "Test invalid - cmd23 bits [16-29] set";
case TEST_CMD23_HDR_BLK_NOT_IN_COUNT:
return "Test invalid - cmd23 header block not in count";
+   case TEST_WRITE_DISCARD_SANITIZE_READ:
+   return "\nTest write, discard, sanitize";
default:
 return "Unknown testcase";
}
@@ -1080,6 +1090,63 @@ static int validate_packed_commands_settings(void)
return 0;
 }
 
+static void pseudo_rnd_sector_and_size(unsigned int *seed,
+  unsigned int min_start_sector,
+  unsigned int *start_sector,
+  unsigned int *num_of_bios)
+{
+   unsigned int max_sec = min_start_sector + TEST_MAX_SECTOR_RANGE;
+   do {
+   *start_sector = pseudo_random_seed(seed,
+  1, max_sec);
+   *num_of_bios = pseudo_random_seed(seed,
+ 1, TEST_MAX_BIOS_PER_REQ);
+   if (!(*num_of_bios))
+   *num_of_bios = 1;
+   } while ((*start_sector < min_start_sector) ||
+(*start_sector + (*num_of_bios * BIO_U32_SIZE * 4)) > max_sec);
+}
+
+/* sanitize test functions */
+static int prepare_write_discard_sanitize_read(struct test_data *td)
+{
+   unsigned int start_sector;
+   unsigned int num_of_bios = 0;
+   static unsigned int total_bios;
+   unsigned int *num_bios_seed;
+   int i = 0;
+
+   if (mbtd->random_test_seed == 0) {
+   mbtd->random_test_seed =
+   (unsigned int)(get_jiffies_64() & 0x);
+   test_pr_info("%s: got seed from jiffies %d",
+__func__, mbtd->random_test_seed);
+   }
+   num_bios_seed = &mbtd->random_test_seed;
+
+   do {
+   pseudo_rnd_sector_and_size(num_bios_seed, td->start_sector,
+  &start_sector, &num_of_bios);
+
+   /* DISCARD */
+   total_bios += num_of_bios;
+   test_pr_info("%s: discard req: id=%d, startSec=%d, NumBios=%d",
+  __func__, td->u

Re: [PATCH] fixed a macro coding style issue

2012-07-24 Thread Dmitry Torokhov
On Wed, Jul 25, 2012 at 07:15:12AM +0100, Al Viro wrote:
> On Tue, Jul 24, 2012 at 10:37:55PM -0700, Dmitry Torokhov wrote:
> > On Wed, Jul 25, 2012 at 01:20:56PM +0800, Baodong Chen wrote:
> > > Fixed a coding style issue in driver/input/input.c
> > > 
> > > Signed-off-by: Baodong Chen 
> > > ---
> > >  drivers/input/input.c |6 --
> > >  1 files changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/input/input.c b/drivers/input/input.c
> > > index 8921c61..c96e983 100644
> > > --- a/drivers/input/input.c
> > > +++ b/drivers/input/input.c
> > > @@ -845,11 +845,13 @@ int input_set_keycode(struct input_dev *dev,
> > >  EXPORT_SYMBOL(input_set_keycode);
> > >  
> > >  #define MATCH_BIT(bit, max) \
> > > + do { \
> > >   for (i = 0; i < BITS_TO_LONGS(max); i++) \
> > >   if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
> > >   break; \
> > > - if (i != BITS_TO_LONGS(max)) \
> > > - continue;
> > > + if (i != BITS_TO_LONGS(max)) \
> > > + continue; \
> > > + } while (0)
> > 
> > This changes semantics. While current implementation of MATCH_BIT might
> > not be great style, it is not supposed to be used outside of
> > input_match_device(), and the replacement is completely broken.
> 
> Replacement is certainly completely broken, but "might not be great style"
> is quite an understatement.  Everything else aside, it's too obfuscated
> and ugly for anything outside of IOCCC and too verbose for IOCCC.
> 
> Damnit, at least turn that into
> static inline int is_subset(unsigned long *bitmap1, unsigned long *bitmap2, 
> size_t bits)
> {
>   int i;
>   for (i = BITS_TO_LONGS(bits); i; bitmap1++, bitmap2++, i--)
>   if ((*bitmap1 & *bitmap2) != *bitmap1)
>   return 0;
>   return 1;
> }
> and just before your loop
> /* ignore ones that don't have bits required by id */
> #define MATCH_BIT(array, bits) if (!is_subset(id->array, dev->array, bits)) 
> continue;

Hmm, we already have bitmap_subset(), I think we can simply use it.

> with #undef MATCH_BIT right after the loop, to make it damn clean that it's 
> local.
> And frankly, I'd consider expanding that variant and killing the macro off.
> Macros that affect control flow are vile and actively confusing for reader.

I agree. In my defense it is quite old code...

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


UNABLE TO PROCESS LOG SUBMISSION: hello

2012-07-24 Thread Contest Robot
(This is an automatic reply.)
 
Your message to iar...@iaru.org could not be processed because the
Subject: of the message

hello

is not a valid callsign.  Please resubmit your log with an email 
Subject: header that looks like this
 
Subject: your-callsign
 
If you are submitting a log for a special callsign (such as a 1x1 call
like N6O), or if you are unsure why you were sent this error message
please contact me at conte...@arrl.org to make alternate arrangements.
 
Thanks for your cooperation.  73.
 
ARRL Contest Branch

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Bcache v15 07/16] Closures

2012-07-24 Thread Kent Overstreet
On Tue, Jul 24, 2012 at 09:04:50AM -0700, Alex Elsayed wrote:
> Out of curiosity, have you seen Featherstitch[1]?. Valerie Aurora did a 
> really nice article[2] about it for LWN a ways back.

I don't think I had. Not sure if any of it is applicable, but
interesting stuff :)

> 
> 
> [1] http://featherstitch.cs.ucla.edu/
> [2] https://lwn.net/Articles/354861/
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] ARM: mach-shmobile: sh7372: Add IPMMU device

2012-07-24 Thread Hideki EIRAKU
This patch adds an IPMMU device and notifies the IPMMU driver which
devices are connected via the IPMMU module.  All devices connected to the main
memory bus via the IPMMU module MUST be registered when SHMOBILE_IPMMU and
SHMOBILE_IOMMU are enabled because physical address cannot be used
while the IPMMU module's MMU function is enabled.

Signed-off-by: Hideki EIRAKU 
---
 arch/arm/mach-shmobile/board-ap4evb.c   |5 +
 arch/arm/mach-shmobile/board-mackerel.c |5 +
 arch/arm/mach-shmobile/setup-sh7372.c   |   22 ++
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-ap4evb.c 
b/arch/arm/mach-shmobile/board-ap4evb.c
index ace6024..c35bb75 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -59,6 +59,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1434,6 +1435,10 @@ static void __init ap4evb_init(void)
 
sh7372_add_standard_devices();
 
+   ipmmu_add_device(&lcdc_device.dev);
+   ipmmu_add_device(&lcdc1_device.dev);
+   ipmmu_add_device(&ceu_device.dev);
+
/* HDMI */
gpio_request(GPIO_FN_HDMI_HPD, NULL);
gpio_request(GPIO_FN_HDMI_CEC, NULL);
diff --git a/arch/arm/mach-shmobile/board-mackerel.c 
b/arch/arm/mach-shmobile/board-mackerel.c
index 150122a..1dc9f44 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1612,6 +1613,10 @@ static void __init mackerel_init(void)
 
sh7372_add_standard_devices();
 
+   ipmmu_add_device(&lcdc_device.dev);
+   ipmmu_add_device(&hdmi_lcdc_device.dev);
+   ipmmu_add_device(&ceu_device.dev);
+
platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
 
sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c 
b/arch/arm/mach-shmobile/setup-sh7372.c
index fafce9c..5045638 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1005,6 +1006,23 @@ static struct platform_device spu1_device = {
.num_resources  = ARRAY_SIZE(spu1_resources),
 };
 
+/* IPMMUI (an IPMMU module for ICB/LMB) */
+static struct resource ipmmu_resources[] = {
+   [0] = {
+   .name   = "IPMMUI",
+   .start  = 0xfe951000,
+   .end= 0xfe9510ff,
+   .flags  = IORESOURCE_MEM,
+   },
+};
+
+static struct platform_device ipmmu_device = {
+   .name   = "ipmmu",
+   .id = -1,
+   .resource   = ipmmu_resources,
+   .num_resources  = ARRAY_SIZE(ipmmu_resources),
+};
+
 static struct platform_device *sh7372_early_devices[] __initdata = {
&scif0_device,
&scif1_device,
@@ -1016,6 +1034,7 @@ static struct platform_device *sh7372_early_devices[] 
__initdata = {
&cmt2_device,
&tmu00_device,
&tmu01_device,
+   &ipmmu_device,
 };
 
 static struct platform_device *sh7372_late_devices[] __initdata = {
@@ -1057,6 +1076,9 @@ void __init sh7372_add_standard_devices(void)
platform_add_devices(sh7372_early_devices,
ARRAY_SIZE(sh7372_early_devices));
 
+   ipmmu_add_device(&vpu_device.dev);
+   ipmmu_add_device(&jpu_device.dev);
+
platform_add_devices(sh7372_late_devices,
ARRAY_SIZE(sh7372_late_devices));
 
-- 
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/


[PATCH 0/2] Renesas IPMMU driver for sh7372

2012-07-24 Thread Hideki EIRAKU
This is the Renesas IPMMU driver, IOMMU API implementation and IPMMU
device support for sh7372 (AP4EVB and Mackerel).

The IPMMU module supports the MMU function and the PMB function.  The
MMU function provides address translation by pagetable compatible with
ARMv6.  The PMB function provides address translation including
tile-linear translation.  This is implementation of the MMU function.

Hideki EIRAKU (2):
  iommu/shmobile: Add iommu driver for Renesas IPMMU modules
  ARM: mach-shmobile: sh7372: Add IPMMU device

 arch/arm/mach-shmobile/Kconfig  |6 +
 arch/arm/mach-shmobile/Makefile |3 +
 arch/arm/mach-shmobile/board-ap4evb.c   |5 +
 arch/arm/mach-shmobile/board-mackerel.c |5 +
 arch/arm/mach-shmobile/include/mach/ipmmu.h |   10 +
 arch/arm/mach-shmobile/ipmmu.c  |  137 
 arch/arm/mach-shmobile/setup-sh7372.c   |   22 ++
 drivers/iommu/Kconfig   |7 +
 drivers/iommu/Makefile  |1 +
 drivers/iommu/shmobile-iommu.c  |  318 +++
 10 files changed, 514 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/include/mach/ipmmu.h
 create mode 100644 arch/arm/mach-shmobile/ipmmu.c
 create mode 100644 drivers/iommu/shmobile-iommu.c

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


[PATCH 2/3] media: videobuf2-dma-contig: use dma_mmap_coherent if available

2012-07-24 Thread Hideki EIRAKU
Previously the vb2_dma_contig_mmap() function was using a dma_addr_t as a
physical address.  The two addressses are not necessarily the same.
For example, when using the IOMMU funtion on certain platforms, dma_addr_t
addresses are not directly mappable physical address.
dma_mmap_coherent() maps the address correctly.
It is available on ARM platforms.

Signed-off-by: Hideki EIRAKU 
---
 drivers/media/video/videobuf2-dma-contig.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-contig.c 
b/drivers/media/video/videobuf2-dma-contig.c
index 4b71326..4dc85ab 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -101,14 +101,32 @@ static unsigned int vb2_dma_contig_num_users(void 
*buf_priv)
 static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma)
 {
struct vb2_dc_buf *buf = buf_priv;
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+   int ret;
+#endif
 
if (!buf) {
printk(KERN_ERR "No buffer to map\n");
return -EINVAL;
}
 
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+   ret = dma_mmap_coherent(buf->conf->dev, vma, buf->vaddr, buf->dma_addr,
+   buf->size);
+   if (ret) {
+   pr_err("Remapping memory failed, error: %d\n", ret);
+   return ret;
+   }
+   vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
+   vma->vm_private_data = &buf->handler;
+   vma->vm_ops = &vb2_common_vm_ops;
+   vma->vm_ops->open(vma);
+   return 0;
+#else
return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size,
  &vb2_common_vm_ops, &buf->handler);
+#endif
 }
 
 static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr,
-- 
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/


[PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available

2012-07-24 Thread Hideki EIRAKU
fb_mmap() implemented in fbmem.c uses smem_start as the physical
address of the frame buffer.  In the sh_mobile_lcdc driver, the
smem_start is a dma_addr_t that is not a physical address when IOMMU is
enabled.  dma_mmap_coherent() maps the address correctly.  It is
available on ARM platforms.

Signed-off-by: Hideki EIRAKU 
---
 drivers/video/sh_mobile_lcdcfb.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e672698..65732c4 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct 
fb_info *info)
return 0;
 }
 
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+static int
+sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+   struct sh_mobile_lcdc_chan *ch = info->par;
+
+   return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
+ch->dma_handle, ch->fb_size);
+}
+#endif
+
 static struct fb_ops sh_mobile_lcdc_ops = {
.owner  = THIS_MODULE,
.fb_setcolreg   = sh_mobile_lcdc_setcolreg,
@@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
.fb_release = sh_mobile_release,
.fb_check_var   = sh_mobile_check_var,
.fb_set_par = sh_mobile_set_par,
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+   .fb_mmap= sh_mobile_fb_mmap,
+#endif
 };
 
 static void
-- 
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/


[PATCH 0/3] Use dma_mmap_coherent to support IOMMU mapper

2012-07-24 Thread Hideki EIRAKU
There is a dma_mmap_coherent() API in some architectures.  This API
provides a mmap function for memory allocated by dma_alloc_coherent().
Some drivers mmap a dma_addr_t returned by dma_alloc_coherent() as a
physical address.  But such drivers do not work correctly when IOMMU
mapper is used.

Hideki EIRAKU (3):
  ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT
  media: videobuf2-dma-contig: use dma_mmap_coherent if available
  fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available

 arch/arm/include/asm/dma-mapping.h |1 +
 drivers/media/video/videobuf2-dma-contig.c |   18 ++
 drivers/video/sh_mobile_lcdcfb.c   |   14 ++
 3 files changed, 33 insertions(+), 0 deletions(-)

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


[PATCH 1/3] ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT

2012-07-24 Thread Hideki EIRAKU
ARCH_HAS_DMA_MMAP_COHERENT indicates that there is dma_mmap_coherent() API
in this architecture.  The name is already defined in PowerPC.

Signed-off-by: Hideki EIRAKU 
---
 arch/arm/include/asm/dma-mapping.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h 
b/arch/arm/include/asm/dma-mapping.h
index bbef15d..f41cd30 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -187,6 +187,7 @@ extern int arm_dma_mmap(struct device *dev, struct 
vm_area_struct *vma,
struct dma_attrs *attrs);
 
 #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
+#define ARCH_HAS_DMA_MMAP_COHERENT
 
 static inline int dma_mmap_attrs(struct device *dev, struct vm_area_struct 
*vma,
  void *cpu_addr, dma_addr_t dma_addr,
-- 
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/


[PATCH 1/2] iommu/shmobile: Add iommu driver for Renesas IPMMU modules

2012-07-24 Thread Hideki EIRAKU
This is the Renesas IPMMU driver and IOMMU API implementation.

The IPMMU module supports the MMU function and the PMB function.  The
MMU function provides address translation by pagetable compatible with
ARMv6.  The PMB function provides address translation including
tile-linear translation.  This patch implements the MMU function.

The iommu driver does not register a platform driver directly because:
- the register space of the MMU function and the PMB function
  have a common register (used for settings flush), so they should ideally
  have a way to appropriately share this register.
- the MMU function uses the IOMMU API while the PMB function does not.
- the two functions may be used independently.

Signed-off-by: Hideki EIRAKU 
---
 arch/arm/mach-shmobile/Kconfig  |6 +
 arch/arm/mach-shmobile/Makefile |3 +
 arch/arm/mach-shmobile/include/mach/ipmmu.h |   10 +
 arch/arm/mach-shmobile/ipmmu.c  |  137 
 drivers/iommu/Kconfig   |7 +
 drivers/iommu/Makefile  |1 +
 drivers/iommu/shmobile-iommu.c  |  318 +++
 7 files changed, 482 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/include/mach/ipmmu.h
 create mode 100644 arch/arm/mach-shmobile/ipmmu.c
 create mode 100644 drivers/iommu/shmobile-iommu.c

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index df33909..2ebe04d 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -197,6 +197,12 @@ endmenu
 config SH_CLK_CPG
bool
 
+config SHMOBILE_IPMMU
+   bool "IPMMU/IPMMUI driver"
+   default n
+   help
+ This enables build of the IPMMU/IPMMUI driver.
+
 source "drivers/sh/Kconfig"
 
 endif
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 8aa1962..ffca2b9 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -58,3 +58,6 @@ obj-$(CONFIG_MACH_KZM9G)  += board-kzm9g.o
 # Framework support
 obj-$(CONFIG_SMP)  += $(smp-y)
 obj-$(CONFIG_GENERIC_GPIO) += $(pfc-y)
+
+# IPMMU/IPMMUI
+obj-$(CONFIG_SHMOBILE_IPMMU)   += ipmmu.o
diff --git a/arch/arm/mach-shmobile/include/mach/ipmmu.h 
b/arch/arm/mach-shmobile/include/mach/ipmmu.h
new file mode 100644
index 000..afbd9eb
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/ipmmu.h
@@ -0,0 +1,10 @@
+#ifdef CONFIG_SHMOBILE_IPMMU
+void ipmmu_tlb_flush(void);
+void ipmmu_tlb_set(unsigned long phys, int size, int asid);
+void ipmmu_add_device(struct device *dev);
+int ipmmu_iommu_init(struct device *dev);
+#else
+static inline void ipmmu_add_device(struct device *dev)
+{
+}
+#endif
diff --git a/arch/arm/mach-shmobile/ipmmu.c b/arch/arm/mach-shmobile/ipmmu.c
new file mode 100644
index 000..b728a83
--- /dev/null
+++ b/arch/arm/mach-shmobile/ipmmu.c
@@ -0,0 +1,137 @@
+/*
+ * IPMMU/IPMMUI
+ * Copyright (C) 2012  Hideki EIRAKU
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define IMCTR1 0x000
+#define IMCTR2 0x004
+#define IMASID 0x010
+#define IMTTBR 0x014
+#define IMTTBCR 0x018
+
+static void __iomem *ipmmu_base;
+static int tlb_enabled;
+static int tlb_asid, tlb_size;
+static unsigned long tlb_phys;
+
+void __attribute__((weak)) ipmmu_add_device(struct device *dev)
+{
+}
+
+void ipmmu_tlb_flush(void)
+{
+   if (!ipmmu_base)
+   return;
+   if (tlb_enabled)
+   iowrite32(0x3, ipmmu_base + IMCTR1); /* flush the TLB */
+   else
+   iowrite32(0x2, ipmmu_base + IMCTR1);
+}
+
+static void update_tlb(void)
+{
+   if (!ipmmu_base)
+   return;
+   switch (tlb_size) {
+   default:
+   tlb_enabled = 0;
+   break;
+   case 0x2000:
+   iowrite32(1, ipmmu_base + IMTTBCR);
+   tlb_enabled = 1;
+   break;
+   case 0x1000:
+   iowrite32(2, ipmmu_base + IMTTBCR);
+   tlb_enabled = 1;
+   break;
+   case 0x800:
+   iowrite32(3, ipmmu_base + IMTTBCR);
+   tlb_enabled = 1;
+   break;
+   case 0x400:
+   iowrite32(4, ipmmu_base + IMTTBCR);
+   tlb_enabled = 1;
+   break

[Fwd: [ANNOUNCE] autofs 5.0.7 release]

2012-07-24 Thread Ian Kent
Hi all,

Oops, I sent this without updating the autofs mailing list address in my
release announcement template and I didn't sign the message which I
wanted to do.

Sorry for the noise.

Ian

 Forwarded Message 
From: Ian Kent 
To: aut...@linux.kernel.org
Cc: linux-fsde...@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [ANNOUNCE] autofs 5.0.7 release
Date: Wed, 25 Jul 2012 14:19:28 +0800

Hi all,

Once again this is long overdue so there are many changes.

The kernel patches are not being updated any more because of the
introduction of the vfs-automount changes to the VFS. If there
are needs in this area we will need to discuss how to deal with
them on the mailing list.

Known issues (haven't changed since 5.0.6)
==

- Quoted strings in the master map are still not yet handled.
- When the active restart is being used it will happily re-connect a
  mount that is unresponsive, perhaps because the server is not
  responding. A forced expire (USR1 signal) should be enough to clean
  up.

autofs
==

The package can be found at:

ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5

It is autofs-5.0.7.tar.[gz|bz2|xz]

No source rpm is there as it can be produced by using:

rpmbuild -ts autofs-5.0.7.tar.gz

and the binary rpm by using:

rpmbuild -tb autofs-5.0.7.tar.gz

See the INSTALL file for information about configure options and
kernel requirements.

Here are the entries from the CHANGELOG which outline the updates:

25/07/2012 autofs-5.0.7
===
- fix ipv6 name for lookup fix.
- improve mount location error reporting.
- fix paged query more results check.
- fix dumpmaps not reading maps.
- fix result null check in read_one_map().
- fix LDAP result leaks on error paths.
- fix fix LDAP result leaks on error paths.
- code analysis fixes part 1.
- fix not bind mounting local filesystem.
- add "dir" map-type.
- fix wait for master source mutex.
- fix submount shutdown race.
- fix fix map source check in file lookup.
- add disable move mount configure option.
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
- fix ipv6 configure check.
- add piddir to configure.
- add systemd unit support.
- remove empty command line arguments (passed by systemd).
- fix rpc build error.
- fix improve mount location error reporting.
- fix fix wait for master source mutex.
- add sss lookup module.
- teach automount about sss source.
- fix init script usage message.
- ignore duplicate exports in auto.net.
- add kernel verion check function.
- add function to check mount.nfs version.
- reinstate singleton mount probe.
- rework error return handling in rpc code.
- catch EHOSTUNREACH and bail out early.
- systemd support fixes.
- check scandir() return value.
- allow for kernel packet size change (in kernel 3.3.0+).
- fix function to check mount.nfs version.
- fix typo in libtirpc file name.
- fix rework error return handling in rpc code.
- allow MOUNT_WAIT to override probe.
- improve UDP RPC timeout handling.
- use strtok_r() in linux_version_code().
- fix sss wildcard match.
- fix dlopen() error handling in sss module.
- fix configure string length tests for sss library.
- report map not read when debug logging.
- duplicate parent options for included maps.
- update ->timeout() function to not return timeout.
- move timeout to map_source (allow per direct map timeout).
- fix kernel verion check of version components.
- dont retry ldap connect if not required.
- fix initialization in rpc create_client().
- fix libtirpc name clash.
- check if /etc/mtab is a link to /proc/self/mounts.
- fix nfs4 contacts portmap.
- make autofs wait longer for shutdown completion.
- fix sss map age not updated.
- fix remount deadlock.
- fix umount recovery of busy direct mount.
- fix offset mount point directory removal.
- fix remount of multi mount.
- fix devce ioctl alloc path check.
- add hup signal handling to hosts map.
- fix systemd argument passing.
- fix get_nfs_info() can incorrectly fail.
- fix offset directory removal.
- check negative cache much earlier.
- dont use pthread_rwlock_tryrdlock().
- mount_nfs.so to honor explicit NFSv4 requests.
- mount_nfs.so fix port=0 option behavior v3.
- documentation fix some typos and misleading comments.

Ian



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


[PATCH] spi: omap2-mcspi: In case of dma errors fall back to pio

2012-07-24 Thread Shubhrajyoti D
In case there are dma errors currently the driver exits.
Make the spi driver fall back to pio mode in case of dma errors.

If the DMA engine is not selected the driver
exits.This patch makes the spi fall back to pio in that case.

Also adds a field dma_unusable to struct omap2_mcspi.
 
Signed-off-by: Shubhrajyoti D 
---
 drivers/spi/spi-omap2-mcspi.c |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index bc47781..f243a39 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -129,6 +129,7 @@ struct omap2_mcspi {
struct omap2_mcspi_dma  *dma_channels;
struct device   *dev;
struct omap2_mcspi_regs ctx;
+   int dma_unusable;
 };
 
 struct omap2_mcspi_cs {
@@ -845,7 +846,7 @@ static int omap2_mcspi_setup(struct spi_device *spi)
if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) {
ret = omap2_mcspi_request_dma(spi);
if (ret < 0)
-   return ret;
+   mcspi->dma_unusable = 1;
}
 
ret = omap2_mcspi_enable_clocks(mcspi);
@@ -956,7 +957,8 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, 
struct spi_message *m)
__raw_writel(0, cs->base
+ OMAP2_MCSPI_TX0);
 
-   if (m->is_dma_mapped || t->len >= DMA_MIN_BYTES)
+   if (!mcspi->dma_unusable && (m->is_dma_mapped ||
+   t->len >= DMA_MIN_BYTES))
count = omap2_mcspi_txrx_dma(spi, t);
else
count = omap2_mcspi_txrx_pio(spi, t);
@@ -1030,7 +1032,8 @@ static int omap2_mcspi_transfer_one_message(struct 
spi_master *master,
return -EINVAL;
}
 
-   if (m->is_dma_mapped || len < DMA_MIN_BYTES)
+   if (mcspi->dma_unusable || m->is_dma_mapped ||
+   len < DMA_MIN_BYTES)
continue;
 
if (tx_buf != NULL) {
@@ -1054,6 +1057,7 @@ static int omap2_mcspi_transfer_one_message(struct 
spi_master *master,
return -EINVAL;
}
}
+
}
 
omap2_mcspi_work(mcspi, m);
@@ -1216,9 +1220,12 @@ static int __devinit omap2_mcspi_probe(struct 
platform_device *pdev)
mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
}
 
-   if (status < 0)
-   goto dma_chnl_free;
-
+   if (status < 0) {
+   dev_err(&pdev->dev, "cannot get DMA channel switching to 
pio\n");
+   mcspi->dma_unusable = 1;
+   status = 0;
+   kfree(mcspi->dma_channels);
+   }
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
pm_runtime_enable(&pdev->dev);
@@ -1229,14 +1236,12 @@ static int __devinit omap2_mcspi_probe(struct 
platform_device *pdev)
status = spi_register_master(master);
if (status < 0)
goto err_spi_register;
-
return status;
 
 err_spi_register:
spi_master_put(master);
 disable_pm:
pm_runtime_disable(&pdev->dev);
-dma_chnl_free:
kfree(mcspi->dma_channels);
 free_master:
kfree(master);
-- 
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/


[ANNOUNCE] autofs 5.0.7 release

2012-07-24 Thread Ian Kent
Hi all,

Once again this is long overdue so there are many changes.

The kernel patches are not being updated any more because of the
introduction of the vfs-automount changes to the VFS. If there
are needs in this area we will need to discuss how to deal with
them on the mailing list.

Known issues (haven't changed since 5.0.6)
==

- Quoted strings in the master map are still not yet handled.
- When the active restart is being used it will happily re-connect a
  mount that is unresponsive, perhaps because the server is not
  responding. A forced expire (USR1 signal) should be enough to clean
  up.

autofs
==

The package can be found at:

ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5

It is autofs-5.0.7.tar.[gz|bz2|xz]

No source rpm is there as it can be produced by using:

rpmbuild -ts autofs-5.0.7.tar.gz

and the binary rpm by using:

rpmbuild -tb autofs-5.0.7.tar.gz

See the INSTALL file for information about configure options and
kernel requirements.

Here are the entries from the CHANGELOG which outline the updates:

25/07/2012 autofs-5.0.7
===
- fix ipv6 name for lookup fix.
- improve mount location error reporting.
- fix paged query more results check.
- fix dumpmaps not reading maps.
- fix result null check in read_one_map().
- fix LDAP result leaks on error paths.
- fix fix LDAP result leaks on error paths.
- code analysis fixes part 1.
- fix not bind mounting local filesystem.
- add "dir" map-type.
- fix wait for master source mutex.
- fix submount shutdown race.
- fix fix map source check in file lookup.
- add disable move mount configure option.
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
- fix ipv6 configure check.
- add piddir to configure.
- add systemd unit support.
- remove empty command line arguments (passed by systemd).
- fix rpc build error.
- fix improve mount location error reporting.
- fix fix wait for master source mutex.
- add sss lookup module.
- teach automount about sss source.
- fix init script usage message.
- ignore duplicate exports in auto.net.
- add kernel verion check function.
- add function to check mount.nfs version.
- reinstate singleton mount probe.
- rework error return handling in rpc code.
- catch EHOSTUNREACH and bail out early.
- systemd support fixes.
- check scandir() return value.
- allow for kernel packet size change (in kernel 3.3.0+).
- fix function to check mount.nfs version.
- fix typo in libtirpc file name.
- fix rework error return handling in rpc code.
- allow MOUNT_WAIT to override probe.
- improve UDP RPC timeout handling.
- use strtok_r() in linux_version_code().
- fix sss wildcard match.
- fix dlopen() error handling in sss module.
- fix configure string length tests for sss library.
- report map not read when debug logging.
- duplicate parent options for included maps.
- update ->timeout() function to not return timeout.
- move timeout to map_source (allow per direct map timeout).
- fix kernel verion check of version components.
- dont retry ldap connect if not required.
- fix initialization in rpc create_client().
- fix libtirpc name clash.
- check if /etc/mtab is a link to /proc/self/mounts.
- fix nfs4 contacts portmap.
- make autofs wait longer for shutdown completion.
- fix sss map age not updated.
- fix remount deadlock.
- fix umount recovery of busy direct mount.
- fix offset mount point directory removal.
- fix remount of multi mount.
- fix devce ioctl alloc path check.
- add hup signal handling to hosts map.
- fix systemd argument passing.
- fix get_nfs_info() can incorrectly fail.
- fix offset directory removal.
- check negative cache much earlier.
- dont use pthread_rwlock_tryrdlock().
- mount_nfs.so to honor explicit NFSv4 requests.
- mount_nfs.so fix port=0 option behavior v3.
- documentation fix some typos and misleading comments.

Ian

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


Re: [PATCH] extcon: extcon_gpio: Replace gpio_request_one by devm_gpio_request_one

2012-07-24 Thread Chanwoo Choi
On 07/24/2012 10:26 AM, Axel Lin wrote:

> commit 01eaf24 "extcon: Convert extcon_gpio to devm_gpio_request_one"
> missed the replacement for devm_gpio_request_one. fix it.
> 
> Signed-off-by: Axel Lin 
> ---
>  drivers/extcon/extcon_gpio.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon_gpio.c b/drivers/extcon/extcon_gpio.c
> index fe3db45..3cc152e 100644
> --- a/drivers/extcon/extcon_gpio.c
> +++ b/drivers/extcon/extcon_gpio.c
> @@ -107,7 +107,8 @@ static int __devinit gpio_extcon_probe(struct 
> platform_device *pdev)
>   if (ret < 0)
>   return ret;
>  
> - ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name);
> + ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
> + pdev->name);
>   if (ret < 0)
>   goto err;
>  

It is right.

Signed-off-by: Chanwoo Choi 

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 0/4] ACPI: hotplug messages improvement

2012-07-24 Thread Pandarathil, Vijaymohan R
Hi Toshi,

Tested your patches on a KVM setup. Since all your acpi_pr* macros are in the 
error path, I didn't see an easy way to trigger them. Instead added an 
acpi_pr_err() message in the success path and tested out vcpu addition/deletion 
sequence. No regressions seen in the functional tests and the ACPI err message 
comes out on the console and message buffer with a valid ACPI device path.

Vijay

Tested-by: Vijay Mohan Pandarathil


-Original Message-
From: Kani, Toshimitsu 
Sent: Friday, July 20, 2012 9:54 AM
To: l...@kernel.org; linux-a...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org; j...@perches.com; bhelg...@google.com; 
isimatu.yasu...@jp.fujitsu.com; liu...@gmail.com; 
srivatsa.b...@linux.vnet.ibm.com; pra...@redhat.com; imamm...@redhat.com; 
Pandarathil, Vijaymohan R; Kani, Toshimitsu
Subject: [PATCH v2 0/4] ACPI: hotplug messages improvement

This patchset improves logging messages for ACPI CPU, Memory, and
Container hotplug notify handlers.  The patchset introduces a set of
new macro interfaces, acpi_pr_(), and updates the notify
handlers to use them.  acpi_pr_() appends "ACPI" prefix and
ACPI object path to the messages.  This improves diagnostics in
hotplug operations since it identifies an object that caused an
issue in a log file.

v2:
 - Set buffer.pointer to NULL in acpi_printk().
 - Added acpi_pr_debug().

---
This patchset applies on top of the patch below.

[PATCH] ACPI: Add ACPI CPU hot-remove support
http://marc.info/?l=linux-acpi&m=134098193327362&w=2

---
Toshi Kani (4):
 ACPI: Add acpi_pr_() interfaces
 ACPI: Update CPU hotplug messages
 ACPI: Update Memory hotplug messages
 ACPI: Update Container hotplug messages

---
 drivers/acpi/acpi_memhotplug.c  |   24 
 drivers/acpi/container.c|6 +++---
 drivers/acpi/processor_driver.c |   36 +---
 drivers/acpi/utils.c|   34 ++
 include/acpi/acpi_bus.h |   20 
 5 files changed, 90 insertions(+), 30 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fixed a macro coding style issue

2012-07-24 Thread Al Viro
On Tue, Jul 24, 2012 at 10:37:55PM -0700, Dmitry Torokhov wrote:
> On Wed, Jul 25, 2012 at 01:20:56PM +0800, Baodong Chen wrote:
> > Fixed a coding style issue in driver/input/input.c
> > 
> > Signed-off-by: Baodong Chen 
> > ---
> >  drivers/input/input.c |6 --
> >  1 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/input/input.c b/drivers/input/input.c
> > index 8921c61..c96e983 100644
> > --- a/drivers/input/input.c
> > +++ b/drivers/input/input.c
> > @@ -845,11 +845,13 @@ int input_set_keycode(struct input_dev *dev,
> >  EXPORT_SYMBOL(input_set_keycode);
> >  
> >  #define MATCH_BIT(bit, max) \
> > +   do { \
> > for (i = 0; i < BITS_TO_LONGS(max); i++) \
> > if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
> > break; \
> > -   if (i != BITS_TO_LONGS(max)) \
> > -   continue;
> > +   if (i != BITS_TO_LONGS(max)) \
> > +   continue; \
> > +   } while (0)
> 
> This changes semantics. While current implementation of MATCH_BIT might
> not be great style, it is not supposed to be used outside of
> input_match_device(), and the replacement is completely broken.

Replacement is certainly completely broken, but "might not be great style"
is quite an understatement.  Everything else aside, it's too obfuscated
and ugly for anything outside of IOCCC and too verbose for IOCCC.

Damnit, at least turn that into
static inline int is_subset(unsigned long *bitmap1, unsigned long *bitmap2, 
size_t bits)
{
int i;
for (i = BITS_TO_LONGS(bits); i; bitmap1++, bitmap2++, i--)
if ((*bitmap1 & *bitmap2) != *bitmap1)
return 0;
return 1;
}
and just before your loop
/* ignore ones that don't have bits required by id */
#define MATCH_BIT(array, bits) if (!is_subset(id->array, dev->array, bits)) 
continue;
with #undef MATCH_BIT right after the loop, to make it damn clean that it's 
local.
And frankly, I'd consider expanding that variant and killing the macro off.
Macros that affect control flow are vile and actively confusing for reader.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] leds: triggers: send uevent when changing triggers

2012-07-24 Thread Bryan Wu
On Wed, Jul 25, 2012 at 8:32 AM, Colin Cross  wrote:
> Some triggers create sysfs files when they are enabled.  Send a uevent
> "change" notification whenever the trigger is changed to allow userspace
> processes such as udev to modify permissions on the new files.
>

This looks like an workaround only for led trigger, can we fix this in
sysfs level?

Thanks,
-Bryan

> Signed-off-by: Colin Cross 
> ---
>  drivers/leds/led-triggers.c |   13 +
>  1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
> index 46b4c76..a85ce09 100644
> --- a/drivers/leds/led-triggers.c
> +++ b/drivers/leds/led-triggers.c
> @@ -102,6 +102,12 @@ ssize_t led_trigger_show(struct device *dev, struct 
> device_attribute *attr,
>  void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger 
> *trigger)
>  {
> unsigned long flags;
> +   char *event = NULL;
> +   char *envp[2];
> +   const char *name;
> +
> +   name = trigger ? trigger->name : "none";
> +   event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
>
> /* Remove any existing trigger */
> if (led_cdev->trigger) {
> @@ -122,6 +128,13 @@ void led_trigger_set(struct led_classdev *led_cdev, 
> struct led_trigger *trigger)
> if (trigger->activate)
> trigger->activate(led_cdev);
> }
> +
> +   if (event) {
> +   envp[0] = event;
> +   envp[1] = NULL;
> +   kobject_uevent_env(&led_cdev->dev->kobj, KOBJ_CHANGE, envp);
> +   kfree(event);
> +   }
>  }
>  EXPORT_SYMBOL_GPL(led_trigger_set);
>
> --
> 1.7.7.3
>



-- 
Bryan Wu 
Kernel Developer+86.186-168-78255 Mobile
Canonical Ltd.  www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: arizona: Implement button detection support

2012-07-24 Thread Chanwoo Choi
Hi Mark,

On 07/21/2012 01:07 AM, Mark Brown wrote:

> As well as identifying accessories the accessory detection hardware on
> Arizona class devices can also detect a number of buttons which we should
> report via the input API.
> 
> Signed-off-by: Mark Brown 
> ---
>  drivers/extcon/extcon-arizona.c |   72 
> +++
>  1 file changed, 65 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 427a289..fa2114f 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -30,11 +31,14 @@
>  #include 
>  #include 
>  
> +#define ARIZONA_NUM_BUTTONS 6
> +
>  struct arizona_extcon_info {
>   struct device *dev;
>   struct arizona *arizona;
>   struct mutex lock;
>   struct regulator *micvdd;
> + struct input_dev *input;
>  
>   int micd_mode;
>   const struct arizona_micd_config *micd_modes;
> @@ -54,6 +58,18 @@ static const struct arizona_micd_config 
> micd_default_modes[] = {
>   { 0,  2 << ARIZONA_MICD_BIAS_SRC_SHIFT, 1 },
>  };
>  
> +static struct {
> + u16 status;
> + int report;
> +} arizona_lvl_to_key[ARIZONA_NUM_BUTTONS] = {
> + {  0x1, BTN_0 },
> + {  0x2, BTN_1 },
> + {  0x4, BTN_2 },
> + {  0x8, BTN_3 },
> + { 0x10, BTN_4 },
> + { 0x20, BTN_5 },
> +};
> +
>  #define ARIZONA_CABLE_MECHANICAL 0
>  #define ARIZONA_CABLE_MICROPHONE 1
>  #define ARIZONA_CABLE_HEADPHONE  2
> @@ -133,6 +149,7 @@ static void arizona_stop_mic(struct arizona_extcon_info 
> *info)
>  
>   if (change) {
>   regulator_disable(info->micvdd);
> + pm_runtime_mark_last_busy(info->dev);
>   pm_runtime_put_autosuspend(info->dev);
>   }
>  }
> @@ -141,8 +158,8 @@ static irqreturn_t arizona_micdet(int irq, void *data)
>  {
>   struct arizona_extcon_info *info = data;
>   struct arizona *arizona = info->arizona;
> - unsigned int val;
> - int ret;
> + unsigned int val, lvl;
> + int ret, i;
>  
>   mutex_lock(&info->lock);
>  
> @@ -219,13 +236,22 @@ static irqreturn_t arizona_micdet(int irq, void *data)
>  
>   /*
>* If we're still detecting and we detect a short then we've
> -  * got a headphone.  Otherwise it's a button press, the
> -  * button reporting is stubbed out for now.
> +  * got a headphone.  Otherwise it's a button press.
>*/
>   if (val & 0x3fc) {
>   if (info->mic) {
>   dev_dbg(arizona->dev, "Mic button detected\n");
>  
> + lvl = val & ARIZONA_MICD_LVL_MASK;
> + lvl >>= ARIZONA_MICD_LVL_SHIFT;
> +
> + for (i = 0; i < ARIZONA_NUM_BUTTONS; i++)
> + if (lvl & arizona_lvl_to_key[i].status)
> + input_report_key(info->input,
> +  
> arizona_lvl_to_key[i].report,
> +  1);
> + input_sync(info->input);
> +
>   } else if (info->detecting) {
>   dev_dbg(arizona->dev, "Headphone detected\n");
>   info->detecting = false;
> @@ -244,6 +270,10 @@ static irqreturn_t arizona_micdet(int irq, void *data)
>   }
>   } else {
>   dev_dbg(arizona->dev, "Mic button released\n");
> + for (i = 0; i < ARIZONA_NUM_BUTTONS; i++)
> + input_report_key(info->input,
> +  arizona_lvl_to_key[i].report, 0);

> + input_sync(info->input);

>   }


Why do you should report released event to all of buttons? I think that
you should only
report released event to previous pressed button. If user press two
button on the headset
at the same time and then user release only one button with pressed
another button, extcon-arizona driver have to report released event to
previous pressed button except for still pressed another button.

Thank you,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] fixed a macro coding style issue

2012-07-24 Thread Baodong Chen
this patch definitely changes semantics.
so please discard it, sorry about that!

On Wed, Jul 25, 2012 at 1:37 PM, Dmitry Torokhov
 wrote:
> On Wed, Jul 25, 2012 at 01:20:56PM +0800, Baodong Chen wrote:
>> Fixed a coding style issue in driver/input/input.c
>>
>> Signed-off-by: Baodong Chen 
>> ---
>>  drivers/input/input.c |6 --
>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/input.c b/drivers/input/input.c
>> index 8921c61..c96e983 100644
>> --- a/drivers/input/input.c
>> +++ b/drivers/input/input.c
>> @@ -845,11 +845,13 @@ int input_set_keycode(struct input_dev *dev,
>>  EXPORT_SYMBOL(input_set_keycode);
>>
>>  #define MATCH_BIT(bit, max) \
>> + do { \
>>   for (i = 0; i < BITS_TO_LONGS(max); i++) \
>>   if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
>>   break; \
>> - if (i != BITS_TO_LONGS(max)) \
>> - continue;
>> + if (i != BITS_TO_LONGS(max)) \
>> + continue; \
>> + } while (0)
>
> This changes semantics. While current implementation of MATCH_BIT might
> not be great style, it is not supposed to be used outside of
> input_match_device(), and the replacement is completely broken.
>
> Thanks.
>
> --
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 V7 4/4] (Updated) MIPS: Add defconfig for Loongson1B

2012-07-24 Thread Kelvin Cheung
This patch adds defconfig for Loongson1B.

Signed-off-by: Kelvin Cheung 

---
V7(updated):
Add CONFIG_USB_ANNOUNCE_NEW_DEVICES in default
configuration.
---
 arch/mips/configs/ls1b_defconfig |  109 ++
 1 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/configs/ls1b_defconfig

diff --git a/arch/mips/configs/ls1b_defconfig b/arch/mips/configs/ls1b_defconfig
new file mode 100644
index 000..80cff8b
--- /dev/null
+++ b/arch/mips/configs/ls1b_defconfig
@@ -0,0 +1,109 @@
+CONFIG_MACH_LOONGSON1=y
+CONFIG_PREEMPT=y
+# CONFIG_SECCOMP is not set
+CONFIG_EXPERIMENTAL=y
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_SYSVIPC=y
+CONFIG_BSD_PROCESS_ACCT=y
+CONFIG_BSD_PROCESS_ACCT_V3=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=16
+CONFIG_NAMESPACES=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+CONFIG_EXPERT=y
+CONFIG_PERF_EVENTS=y
+# CONFIG_COMPAT_BRK is not set
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_STANDALONE is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_SCSI=m
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_BLK_DEV_SD=m
+# CONFIG_SCSI_LOWLEVEL is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CHELSIO is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+CONFIG_STMMAC_ETH=y
+CONFIG_STMMAC_DA=y
+# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_WLAN is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_USB_HID=m
+CONFIG_HID_GENERIC=m
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_STORAGE=m
+CONFIG_USB_SERIAL=m
+CONFIG_USB_SERIAL_PL2303=m
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_LOONGSON1=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+CONFIG_EXT2_FS_SECURITY=y
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+CONFIG_EXT3_FS_SECURITY=y
+# CONFIG_DNOTIFY is not set
+CONFIG_VFAT_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_ISO8859_1=m
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_DEBUG_PREEMPT is not set
+# CONFIG_FTRACE is not set
+# CONFIG_EARLY_PRINTK is not set
-- 
1.7.1

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


[PATCH V7 3/4] (Updated) MIPS: Add Makefile and Kconfig for Loongson1B

2012-07-24 Thread Kelvin Cheung
This patch adds Makefile and Kconfig related to Loongson1B.

Signed-off-by: Kelvin Cheung 

---
V7(updated):
Change the load address of kernel to 0x8010.
---
 arch/mips/Kbuild.platforms  |1 +
 arch/mips/Kconfig   |   31 +++
 arch/mips/loongson1/Kconfig |   21 +
 arch/mips/loongson1/Makefile|   11 +++
 arch/mips/loongson1/Platform|7 +++
 arch/mips/loongson1/common/Makefile |5 +
 arch/mips/loongson1/ls1b/Makefile   |5 +
 7 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson1/Kconfig
 create mode 100644 arch/mips/loongson1/Makefile
 create mode 100644 arch/mips/loongson1/Platform
 create mode 100644 arch/mips/loongson1/common/Makefile
 create mode 100644 arch/mips/loongson1/ls1b/Makefile

diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
index 5ce8029..d64786d 100644
--- a/arch/mips/Kbuild.platforms
+++ b/arch/mips/Kbuild.platforms
@@ -14,6 +14,7 @@ platforms += jz4740
 platforms += lantiq
 platforms += lasat
 platforms += loongson
+platforms += loongson1
 platforms += mipssim
 platforms += mti-malta
 platforms += netlogic
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 08dfc79..61e1459 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -265,6 +265,17 @@ config MACH_LOONGSON
  Chinese Academy of Sciences (CAS) in the People's Republic
  of China. The chief architect is Professor Weiwu Hu.
 
+config MACH_LOONGSON1
+   bool "Loongson1 family of machines"
+   select SYS_SUPPORTS_ZBOOT
+   help
+ This enables the support of Loongson1 family of machines.
+
+ Loongson1 is a family of 32-bit MIPS-compatible SoCs.
+ developed at Institute of Computing Technology (ICT),
+ Chinese Academy of Sciences (CAS) in the People's Republic
+ of China.
+
 config MIPS_MALTA
bool "MIPS Malta board"
select ARCH_MAY_HAVE_PC_FDC
@@ -838,6 +849,7 @@ source "arch/mips/txx9/Kconfig"
 source "arch/mips/vr41xx/Kconfig"
 source "arch/mips/cavium-octeon/Kconfig"
 source "arch/mips/loongson/Kconfig"
+source "arch/mips/loongson1/Kconfig"
 source "arch/mips/netlogic/Kconfig"
 
 endmenu
@@ -1219,6 +1231,14 @@ config CPU_LOONGSON2F
  have a similar programming interface with FPGA northbridge used in
  Loongson2E.
 
+config CPU_LOONGSON1B
+   bool "Loongson 1B"
+   depends on SYS_HAS_CPU_LOONGSON1B
+   select CPU_LOONGSON1
+   help
+ The Loongson 1B is a 32-bit SoC, which implements the MIPS32
+ release 2 instruction set.
+
 config CPU_MIPS32_R1
bool "MIPS32 Release 1"
depends on SYS_HAS_CPU_MIPS32_R1
@@ -1548,6 +1568,14 @@ config CPU_LOONGSON2
select CPU_SUPPORTS_64BIT_KERNEL
select CPU_SUPPORTS_HIGHMEM
 
+config CPU_LOONGSON1
+   bool
+   select CPU_MIPS32
+   select CPU_MIPSR2
+   select CPU_HAS_PREFETCH
+   select CPU_SUPPORTS_32BIT_KERNEL
+   select CPU_SUPPORTS_HIGHMEM
+
 config CPU_BMIPS
bool
select CPU_MIPS32
@@ -1566,6 +1594,9 @@ config SYS_HAS_CPU_LOONGSON2F
select CPU_SUPPORTS_ADDRWINCFG if 64BIT
select CPU_SUPPORTS_UNCACHED_ACCELERATED
 
+config SYS_HAS_CPU_LOONGSON1B
+   bool
+
 config SYS_HAS_CPU_MIPS32_R1
bool
 
diff --git a/arch/mips/loongson1/Kconfig b/arch/mips/loongson1/Kconfig
new file mode 100644
index 000..237fa21
--- /dev/null
+++ b/arch/mips/loongson1/Kconfig
@@ -0,0 +1,21 @@
+if MACH_LOONGSON1
+
+choice
+   prompt "Machine Type"
+
+config LOONGSON1_LS1B
+   bool "Loongson LS1B board"
+   select CEVT_R4K
+   select CSRC_R4K
+   select SYS_HAS_CPU_LOONGSON1B
+   select DMA_NONCOHERENT
+   select BOOT_ELF32
+   select IRQ_CPU
+   select SYS_SUPPORTS_32BIT_KERNEL
+   select SYS_SUPPORTS_LITTLE_ENDIAN
+   select SYS_SUPPORTS_HIGHMEM
+   select SYS_HAS_EARLY_PRINTK
+
+endchoice
+
+endif # MACH_LOONGSON1
diff --git a/arch/mips/loongson1/Makefile b/arch/mips/loongson1/Makefile
new file mode 100644
index 000..e9123c2
--- /dev/null
+++ b/arch/mips/loongson1/Makefile
@@ -0,0 +1,11 @@
+#
+# Common code for all Loongson1 based systems
+#
+
+obj-$(CONFIG_MACH_LOONGSON1) += common/
+
+#
+# Loongson LS1B board
+#
+
+obj-$(CONFIG_LOONGSON1_LS1B)  += ls1b/
diff --git a/arch/mips/loongson1/Platform b/arch/mips/loongson1/Platform
new file mode 100644
index 000..99bdefe
--- /dev/null
+++ b/arch/mips/loongson1/Platform
@@ -0,0 +1,7 @@
+cflags-$(CONFIG_CPU_LOONGSON1)  += \
+   $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA 
-D_MIPS_ISA=_MIPS_ISA_MIPS32) \
+   -Wa,-mips32r2 -Wa,--trap
+
+platform-$(CONFIG_MACH_LOONGSON1)  += loongson1/
+cflags-$(CONFIG_MACH_LOONGSON1)+= 
-I$(srctree)/arch/mips/include/asm/mach-loongson1
+load-$(CONFIG_LOONGSON1_LS1B)  += 0x8010
diff --git a/arch/mips/lo

[PATCH V7 2/4] (Updated) MIPS: Add board support for Loongson1B

2012-07-24 Thread Kelvin Cheung
This patch adds basic platform devices for Loongson1B,
including serial port, ethernet, usb, rtc and interrupt handler.

Loongson1B UART is compatible with NS16550A.
Loongson1B GMAC is built around Synopsys IP Core.

Use normal descriptor instead of enhanced descriptor.
Thanks to Giuseppe for updating the normal descriptor
in stmmac driver.

Thanks to Zhao Zhang for implementing the RTC driver.

Signed-off-by: Kelvin Cheung 

---
V7(updated):
1.Remove 'ifdef' of platform devices. (Asked by Ralf)
2.Modify plat_stmmacenet_data accordingly due to the change
  of upstream.
---
 arch/mips/include/asm/mach-loongson1/irq.h   |   73 ++
 arch/mips/include/asm/mach-loongson1/loongson1.h |   44 ++
 arch/mips/include/asm/mach-loongson1/platform.h  |   23 +++
 arch/mips/include/asm/mach-loongson1/prom.h  |   24 +++
 arch/mips/include/asm/mach-loongson1/regs-clk.h  |   33 +
 arch/mips/include/asm/mach-loongson1/regs-wdt.h  |   22 +++
 arch/mips/include/asm/mach-loongson1/war.h   |   25 
 arch/mips/loongson1/common/clock.c   |  165 ++
 arch/mips/loongson1/common/irq.c |  147 +++
 arch/mips/loongson1/common/platform.c|  124 
 arch/mips/loongson1/common/prom.c|   87 
 arch/mips/loongson1/common/reset.c   |   45 ++
 arch/mips/loongson1/common/setup.c   |   29 
 arch/mips/loongson1/ls1b/board.c |   33 +
 14 files changed, 874 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-loongson1/irq.h
 create mode 100644 arch/mips/include/asm/mach-loongson1/loongson1.h
 create mode 100644 arch/mips/include/asm/mach-loongson1/platform.h
 create mode 100644 arch/mips/include/asm/mach-loongson1/prom.h
 create mode 100644 arch/mips/include/asm/mach-loongson1/regs-clk.h
 create mode 100644 arch/mips/include/asm/mach-loongson1/regs-wdt.h
 create mode 100644 arch/mips/include/asm/mach-loongson1/war.h
 create mode 100644 arch/mips/loongson1/common/clock.c
 create mode 100644 arch/mips/loongson1/common/irq.c
 create mode 100644 arch/mips/loongson1/common/platform.c
 create mode 100644 arch/mips/loongson1/common/prom.c
 create mode 100644 arch/mips/loongson1/common/reset.c
 create mode 100644 arch/mips/loongson1/common/setup.c
 create mode 100644 arch/mips/loongson1/ls1b/board.c

diff --git a/arch/mips/include/asm/mach-loongson1/irq.h 
b/arch/mips/include/asm/mach-loongson1/irq.h
new file mode 100644
index 000..ccc42cc
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson1/irq.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011 Zhang, Keguang 
+ *
+ * IRQ mappings for Loongson1.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+
+#ifndef __ASM_MACH_LOONGSON1_IRQ_H
+#define __ASM_MACH_LOONGSON1_IRQ_H
+
+/*
+ * CPU core Interrupt Numbers
+ */
+#define MIPS_CPU_IRQ_BASE  0
+#define MIPS_CPU_IRQ(x)(MIPS_CPU_IRQ_BASE + (x))
+
+#define SOFTINT0_IRQ   MIPS_CPU_IRQ(0)
+#define SOFTINT1_IRQ   MIPS_CPU_IRQ(1)
+#define INT0_IRQ   MIPS_CPU_IRQ(2)
+#define INT1_IRQ   MIPS_CPU_IRQ(3)
+#define INT2_IRQ   MIPS_CPU_IRQ(4)
+#define INT3_IRQ   MIPS_CPU_IRQ(5)
+#define INT4_IRQ   MIPS_CPU_IRQ(6)
+#define TIMER_IRQ  MIPS_CPU_IRQ(7) /* cpu timer */
+
+#define MIPS_CPU_IRQS  (MIPS_CPU_IRQ(7) + 1 - MIPS_CPU_IRQ_BASE)
+
+/*
+ * INT0~3 Interrupt Numbers
+ */
+#define LS1X_IRQ_BASE  MIPS_CPU_IRQS
+#define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x))
+
+#define LS1X_UART0_IRQ LS1X_IRQ(0, 2)
+#define LS1X_UART1_IRQ LS1X_IRQ(0, 3)
+#define LS1X_UART2_IRQ LS1X_IRQ(0, 4)
+#define LS1X_UART3_IRQ LS1X_IRQ(0, 5)
+#define LS1X_CAN0_IRQ  LS1X_IRQ(0, 6)
+#define LS1X_CAN1_IRQ  LS1X_IRQ(0, 7)
+#define LS1X_SPI0_IRQ  LS1X_IRQ(0, 8)
+#define LS1X_SPI1_IRQ  LS1X_IRQ(0, 9)
+#define LS1X_AC97_IRQ  LS1X_IRQ(0, 10)
+#define LS1X_DMA0_IRQ  LS1X_IRQ(0, 13)
+#define LS1X_DMA1_IRQ  LS1X_IRQ(0, 14)
+#define LS1X_DMA2_IRQ  LS1X_IRQ(0, 15)
+#define LS1X_PWM0_IRQ  LS1X_IRQ(0, 17)
+#define LS1X_PWM1_IRQ  LS1X_IRQ(0, 18)
+#define LS1X_PWM2_IRQ  LS1X_IRQ(0, 19)
+#define LS1X_PWM3_IRQ  LS1X_IRQ(0, 20)
+#define LS1X_RTC_INT0_IRQ  LS1X_IRQ(0, 21)
+#define LS1X_RTC_INT1_IRQ  LS1X_IRQ(0, 22)
+#define LS1X_RTC_INT2_IRQ  

RE: [RFC PATCH v2 07/32] PCI/portdrv: use PCIe capabilities access functions to simplify implementation

2012-07-24 Thread Kaneshige, Kenji
> -Original Message-
> From: Jiang Liu [mailto:liu...@gmail.com]
> Sent: Wednesday, July 25, 2012 1:31 AM
> To: Bjorn Helgaas; Don Dutile
> Cc: Jiang Liu; Yinghai Lu; Izumi, Taku/泉 拓; Rafael J . Wysocki; Kaneshige,
> Kenji/金重 憲治; Yijing Wang; linux-kernel@vger.kernel.org;
> linux-...@vger.kernel.org; Jiang Liu
> Subject: [RFC PATCH v2 07/32] PCI/portdrv: use PCIe capabilities access
> functions to simplify implementation
> 
> From: Jiang Liu 
> 
> Use PCIe capabilities access functions to simplify PCIe portdrv
> implementation.
> 
> Signed-off-by: Jiang Liu 
> Signed-off-by: Yijing Wang 
> ---
>  drivers/pci/pcie/portdrv_core.c |   20 
>  drivers/pci/pcie/portdrv_pci.c  |7 ++-
>  2 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/pci/pcie/portdrv_core.c
> b/drivers/pci/pcie/portdrv_core.c
> index bf320a9..37bff83 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -76,7 +76,6 @@ static int pcie_port_enable_msix(struct pci_dev *dev,
> int *vectors, int mask)
>   struct msix_entry *msix_entries;
>   int idx[PCIE_PORT_DEVICE_MAXSERVICES];
>   int nr_entries, status, pos, i, nvec;
> - u16 reg16;
>   u32 reg32;
> 
>   nr_entries = pci_msix_table_size(dev);
> @@ -120,9 +119,7 @@ static int pcie_port_enable_msix(struct pci_dev *dev,
> int *vectors, int mask)
>* the value in this field indicates which MSI-X Table entry
> is
>* used to generate the interrupt message."
>*/
> - pos = pci_pcie_cap(dev);
> - pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16);
> - entry = (reg16 & PCI_EXP_FLAGS_IRQ) >> 9;
> + entry = (dev->pcie_flags_reg & PCI_EXP_FLAGS_IRQ) >> 9;
>   if (entry >= nr_entries)
>   goto Error;

I think we need to use pci_read_config_word() for MSI setup.

"Interrupt Message Number" in the PCIe capability register can vary depending
on whether MSI or MSI-x is enabled. Please see PCIe spec for details.

Could you double-check that?

Regards,
Kenji Kaneshige



> 
> @@ -246,7 +243,7 @@ static void cleanup_service_irqs(struct pci_dev *dev)
>   */
>  static int get_port_device_capability(struct pci_dev *dev)
>  {
> - int services = 0, pos;
> + int services = 0;
>   u16 reg16;
>   u32 reg32;
>   int cap_mask = 0;
> @@ -265,11 +262,9 @@ static int get_port_device_capability(struct pci_dev
> *dev)
>   return 0;
>   }
> 
> - pos = pci_pcie_cap(dev);
> - pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16);
>   /* Hot-Plug Capable */
> - if ((cap_mask & PCIE_PORT_SERVICE_HP) && (reg16 &
> PCI_EXP_FLAGS_SLOT)) {
> - pci_read_config_dword(dev, pos + PCI_EXP_SLTCAP,
> ®32);
> + if ((cap_mask & PCIE_PORT_SERVICE_HP)) {
> + pci_pcie_capability_read_dword(dev, PCI_EXP_SLTCAP,
> ®32);
>   if (reg32 & PCI_EXP_SLTCAP_HPC) {
>   services |= PCIE_PORT_SERVICE_HP;
>   /*
> @@ -277,10 +272,11 @@ static int get_port_device_capability(struct pci_dev
> *dev)
>* enabled by the BIOS and the hot-plug service
> driver
>* is not loaded.
>*/
> - pos += PCI_EXP_SLTCTL;
> - pci_read_config_word(dev, pos, ®16);
> + pci_pcie_capability_read_word(dev,
> +   PCI_EXP_SLTCTL,
> ®16);
>   reg16 &= ~(PCI_EXP_SLTCTL_CCIE |
> PCI_EXP_SLTCTL_HPIE);
> - pci_write_config_word(dev, pos, reg16);
> + pci_pcie_capability_write_word(dev,
> +PCI_EXP_SLTCTL,
> reg16);
>   }
>   }
>   /* AER capable */
> diff --git a/drivers/pci/pcie/portdrv_pci.c
> b/drivers/pci/pcie/portdrv_pci.c
> index 24d1463..1b2b378 100644
> --- a/drivers/pci/pcie/portdrv_pci.c
> +++ b/drivers/pci/pcie/portdrv_pci.c
> @@ -64,14 +64,11 @@ __setup("pcie_ports=", pcie_port_setup);
>   */
>  void pcie_clear_root_pme_status(struct pci_dev *dev)
>  {
> - int rtsta_pos;
>   u32 rtsta;
> 
> - rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA;
> -
> - pci_read_config_dword(dev, rtsta_pos, &rtsta);
> + pci_pcie_capability_read_dword(dev, PCI_EXP_RTSTA, &rtsta);
>   rtsta |= PCI_EXP_RTSTA_PME;
> - pci_write_config_dword(dev, rtsta_pos, rtsta);
> + pci_pcie_capability_write_dword(dev, PCI_EXP_RTSTA, rtsta);
>  }
> 
>  static int pcie_portdrv_restore_config(struct pci_dev *dev)
> --
> 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] fixed a macro coding style issue

2012-07-24 Thread Dmitry Torokhov
On Wed, Jul 25, 2012 at 01:20:56PM +0800, Baodong Chen wrote:
> Fixed a coding style issue in driver/input/input.c
> 
> Signed-off-by: Baodong Chen 
> ---
>  drivers/input/input.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 8921c61..c96e983 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -845,11 +845,13 @@ int input_set_keycode(struct input_dev *dev,
>  EXPORT_SYMBOL(input_set_keycode);
>  
>  #define MATCH_BIT(bit, max) \
> + do { \
>   for (i = 0; i < BITS_TO_LONGS(max); i++) \
>   if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
>   break; \
> - if (i != BITS_TO_LONGS(max)) \
> - continue;
> + if (i != BITS_TO_LONGS(max)) \
> + continue; \
> + } while (0)

This changes semantics. While current implementation of MATCH_BIT might
not be great style, it is not supposed to be used outside of
input_match_device(), and the replacement is completely broken.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] fixed a macro coding style issue

2012-07-24 Thread Venu Byravarasu
> -Original Message-
> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
> ow...@vger.kernel.org] On Behalf Of Baodong Chen
> Sent: Wednesday, July 25, 2012 10:51 AM
> To: dmitry.torok...@gmail.com
> Cc: linux-in...@vger.kernel.org; linux-kernel@vger.kernel.org; Baodong
> Chen
> Subject: [PATCH] fixed a macro coding style issue
> 
> Fixed a coding style issue in driver/input/input.c
> 
> Signed-off-by: Baodong Chen 
> ---
>  drivers/input/input.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 8921c61..c96e983 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -845,11 +845,13 @@ int input_set_keycode(struct input_dev *dev,
>  EXPORT_SYMBOL(input_set_keycode);
> 
>  #define MATCH_BIT(bit, max) \
> + do { \
>   for (i = 0; i < BITS_TO_LONGS(max); i++) \
>   if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
>   break; \
> - if (i != BITS_TO_LONGS(max)) \
> - continue;
> + if (i != BITS_TO_LONGS(max)) \
> + continue; \

What is the need for extra indentation here?

> + } while (0)
> 
>  static const struct input_device_id *input_match_device(struct
> input_handler *handler,
>   struct input_dev
> *dev)
> --
> 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/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fixed a macro coding style issue

2012-07-24 Thread Baodong Chen
Fixed a coding style issue in driver/input/input.c

Signed-off-by: Baodong Chen 
---
 drivers/input/input.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 8921c61..c96e983 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -845,11 +845,13 @@ int input_set_keycode(struct input_dev *dev,
 EXPORT_SYMBOL(input_set_keycode);
 
 #define MATCH_BIT(bit, max) \
+   do { \
for (i = 0; i < BITS_TO_LONGS(max); i++) \
if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
break; \
-   if (i != BITS_TO_LONGS(max)) \
-   continue;
+   if (i != BITS_TO_LONGS(max)) \
+   continue; \
+   } while (0)
 
 static const struct input_device_id *input_match_device(struct input_handler 
*handler,
struct input_dev *dev)
-- 
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: [next:akpm 129/309] net/core/sock.c:274:36: error: initializer element is not constant

2012-07-24 Thread James Bottomley
On Tue, 2012-07-24 at 17:08 -0400, John David Anglin wrote:
> Removing "(atomic_t)" from the define results in a constant expression.

OK, so this is what I'll queue for fixes:

From: Mel Gorman  Date: Mon, 23 Jul 2012 12:16:19
Subject: [PATCH] [PARISC] Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the  
casts

The following build error occured during a parisc build with
swap-over-NFS patches applied.

net/core/sock.c:274:36: error: initializer element is not constant
net/core/sock.c:274:36: error: (near initialization for 'memalloc_socks')
net/core/sock.c:274:36: error: initializer element is not constant

Dave Anglin says:
> Here is the line in sock.i:
>
> struct static_key memalloc_socks = ((struct static_key) { .enabled =
> ((atomic_t) { (0) }) });

The above line contains two compound literals.  It also uses a designated
initializer to initialize the field enabled.  A compound literal is not a
constant expression.

The location of the above statement isn't fully clear, but if a compound
literal occurs outside the body of a function, the initializer list must
consist of constant expressions.

Reported-by: Fengguang Wu 
Signed-off-by: Mel Gorman 
Cc: 
Signed-off-by: James Bottomley 

diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
index 6c6defc..af9cf30 100644
--- a/arch/parisc/include/asm/atomic.h
+++ b/arch/parisc/include/asm/atomic.h
@@ -141,7 +141,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int 
a, int u)
 
 #define atomic_sub_and_test(i,v)   (atomic_sub_return((i),(v)) == 0)
 
-#define ATOMIC_INIT(i) ((atomic_t) { (i) })
+#define ATOMIC_INIT(i) { (i) }
 
 #define smp_mb__before_atomic_dec()smp_mb()
 #define smp_mb__after_atomic_dec() smp_mb()
@@ -150,7 +150,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int 
a, int u)
 
 #ifdef CONFIG_64BIT
 
-#define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
+#define ATOMIC64_INIT(i) { (i) }
 
 static __inline__ s64
 __atomic64_add_return(s64 i, atomic64_t *v)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: More irqdomain problems (Was: next/mmotm unbootable on G5: irqdomain)

2012-07-24 Thread Grant Likely
On Mon, Jul 23, 2012 at 12:32 AM, Benjamin Herrenschmidt
 wrote:
> Allright, another one Grant:
>
> unsigned int irq_find_mapping(struct irq_domain *domain,
>   irq_hw_number_t hwirq)
> {
> struct irq_data *data;
>
> /* Look for default domain if nececssary */
> if (domain == NULL)
> domain = irq_default_domain;
> if (domain == NULL)
> return 0;
>
> switch (domain->revmap_type) {
> case IRQ_DOMAIN_MAP_LEGACY:
> return irq_domain_legacy_revmap(domain, hwirq);
> case IRQ_DOMAIN_MAP_LINEAR:
> return irq_linear_revmap(domain, hwirq);
> case IRQ_DOMAIN_MAP_TREE:
> rcu_read_lock();
> data = radix_tree_lookup(&domain->revmap_data.tree, hwirq);
> rcu_read_unlock();
> if (data)
> return data->irq;
> -   break;
> +   return 0;
> case IRQ_DOMAIN_MAP_NOMAP:
>
> Please, stick a proper commit message and my s-o-b and see if you can fix
> your tree before you ask Linus to pull because that's not pretty on any
> pseries  irq_find_mapping() does get called for all interrupt the
> first time it's mapped to check if there's a pre-existing mapping, so
> the case of the thing being unpopulated is absolutely legit.
>
> the NOMAP case has a similar dubious exit case but since I'm not that
> familiar with NOMAP I haven't touched it.

I've decided to rework the patch to simply omit the WARN statement. It
isn't really needed. I've merged in Linus' tree below the eliminate
slow-path patch and remove the WARN statement. It's been pushed out to
my irqdomain/next branch, so it should show up in tomorrow's
linux-next.

You can find it here if you want to give it a spin:

git://git.secretlab.ca/git/linux-2.6 irqdomain/next

I'll give it a bit more time in linux-next before I ask Linus to pull.

g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] staging: gdm72xx: fix reference counting in gdm_wimax_event_init

2012-07-24 Thread devendra.aaru
On Tue, Jul 24, 2012 at 8:34 PM, Ben Chan  wrote:
> This patch fixes the commit "staging/gdm72xx: cleanup little at
> gdm_wimax_event_rcv" (8df858ea76b76dde9a39d4edd9aaded983582cfe),
> which mishandles the reference counting of wm_event.
>
> Signed-off-by: Ben Chan 
> ---
> Fixed the commit message as suggested by Dan Carpenter.
>
>  drivers/staging/gdm72xx/gdm_wimax.c |   16 ++--
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
> b/drivers/staging/gdm72xx/gdm_wimax.c
> index 0716efc..6cb8107 100644
> --- a/drivers/staging/gdm72xx/gdm_wimax.c
> +++ b/drivers/staging/gdm72xx/gdm_wimax.c
> @@ -258,12 +258,16 @@ static int gdm_wimax_event_init(void)
> if (!wm_event.ref_cnt) {
> wm_event.sock = netlink_init(NETLINK_WIMAX,
> gdm_wimax_event_rcv);
> -   if (wm_event.sock)
> -   wm_event.ref_cnt++;
> -   INIT_LIST_HEAD(&wm_event.evtq);
> -   INIT_LIST_HEAD(&wm_event.freeq);
> -   INIT_WORK(&wm_event.ws, __gdm_wimax_event_send);
> -   spin_lock_init(&wm_event.evt_lock);
> +   if (wm_event.sock) {
> +   INIT_LIST_HEAD(&wm_event.evtq);
> +   INIT_LIST_HEAD(&wm_event.freeq);
> +   INIT_WORK(&wm_event.ws, __gdm_wimax_event_send);
> +   spin_lock_init(&wm_event.evt_lock);
> +   }
> +   }
> +
> +   if (wm_event.sock) {
> +   wm_event.ref_cnt++;
> return 0;
> }
>
> --
> 1.7.7.3
>

Hi Ben,

I have some basic understanding about this flow of the function,

Here is my understanding of the thing i have done when i was doing
some cleanups to this driver.

The ref_cnt will be 0 at first time. if so the sock creation happens
only once, and register_wimax_device only calls this function.
so i think doing the ref_cnt++ inside the if (!wm_event.ref_cnt) is valid.

Please suggest me if i am wrong.

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


Re: [PATCH v2] leds: add new lp8788 led driver

2012-07-24 Thread Bryan Wu
On Tue, Jul 24, 2012 at 8:55 PM, Mark Brown
 wrote:
> On Tue, Jul 24, 2012 at 08:23:00AM +0800, Bryan Wu wrote:
>> On Mon, Jul 23, 2012 at 2:19 AM, Mark Brown
>
>> > If the work is flushed then the state that userspace thought was set
>> > when the driver is removed will actually be set before the driver is
>> > removed.  This is fairly minor but might be useful.
>
>> So what's kind of state you mentioned here that is cared by user
>> space. I find these 2 functions are quite confused for use right now.
>
> Any state - none of the drivers with sleeping I/O can do anything
> directly in their callbacks so they defer everything to work (we really
> should have that in the core but it was too annoying to implement last
> time I looked).
>
>> Literally, canceling normally will remove pending work item and wait
>> for running work item to finish. flushing will wait for both pending
>> and running work item to finish.
>
> Right, so if we flush it means we know that any scheduled work actually
> ran and implemented whatever change was requested.

Thanks Mark for clarifying this.

I'm going to Ack this driver and Mark will you merge this as whole patchset?

Acked-by: Bryan Wu 

Thanks,
-Bryan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kernel/watchdog.c : fix smp_processor_id() warning

2012-07-24 Thread Ming Lei
Use raw_smp_processor_id in lockup_detector_bootcpu_resume()
because it is enough when non-boot CPUs are offline.

This patch fixes the following warning when DEBUG_PREEMPT
is enabled.

[  168.259429] BUG: using smp_processor_id() in preemptible [] code: 
pm/1577
[  168.259460] caller is lockup_detector_bootcpu_resume+0x8/0x48
[  168.259490] [] (unwind_backtrace+0x0/0x11c) from [] 
(debug_smp_processor_id+0xbc/0xf0)
[  168.259521] [] (debug_smp_processor_id+0xbc/0xf0) from 
[] (lockup_detector_bootcpu_res
ume+0x8/0x48)
[  168.259552] [] (lockup_detector_bootcpu_resume+0x8/0x48) from 
[] (suspend_devices_and_
enter+0x1f8/0x358)
[  168.259552] [] (suspend_devices_and_enter+0x1f8/0x358) from 
[] (pm_suspend+0x13c/0x204
)
[  168.259582] [] (pm_suspend+0x13c/0x204) from [] 
(state_store+0xb0/0xd4)
[  168.259582] [] (state_store+0xb0/0xd4) from [] 
(kobj_attr_store+0x14/0x20)
[  168.259613] [] (kobj_attr_store+0x14/0x20) from [] 
(sysfs_write_file+0x10c/0x140)
[  168.259643] [] (sysfs_write_file+0x10c/0x140) from [] 
(vfs_write+0xb0/0x138)
[  168.259643] [] (vfs_write+0xb0/0x138) from [] 
(sys_write+0x3c/0x68)
[  168.259674] [] (sys_write+0x3c/0x68) from [] 
(ret_fast_syscall+0x0/0x48)
[  168.260375] Enabling non-boot CPUs ...

Signed-off-by: Ming Lei 
---
 kernel/watchdog.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 69add8a..7ddb11b 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -623,7 +623,7 @@ static struct notifier_block cpu_nfb = {
  */
 void lockup_detector_bootcpu_resume(void)
 {
-   void *cpu = (void *)(long)smp_processor_id();
+   void *cpu = (void *)(long)raw_smp_processor_id();
 
cpu_callback(&cpu_nfb, CPU_DEAD_FROZEN, cpu);
cpu_callback(&cpu_nfb, CPU_UP_PREPARE_FROZEN, cpu);
-- 
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 2/2 v5][resend] tmpfs: interleave the starting node of /dev/shmem

2012-07-24 Thread Hugh Dickins
Nathan, Kosaki-san,

I have, at long last, reached the point of looking at this patchset.
And I'm puzzled as to why it has grown more complicated than what you
first sent out.

I've read through the various threads, and some of the changes I like.

I'm glad Andrew took out the stable Cc: obviously the interleave policy
was never intended for a filesystem of many small files, and it could
be that some usages with larger files have actually optimized to the
current node layout, and will regress with this change.  Let's keep it
simple and assume not; but if there are complaints, then we shall have
to make the new behaviour dependent on a mount option.

And I'm glad you switched from random number to rotor: I'm probably
missing the mark by orders of magnitude, but I always think of random
numbers as a precious resource, and was unsure if this deserved them.

But other changes just seem unnecessary to me.  And I don't see how
we can accuse you of being hackish, so long as we have that horrid
business of pseudo-vma on the shmem stack.  I believe the mempolicy
work was designed around vmas, then at the last moment had shmem
grafted on, and the quick way to shoehorn it in was the pseudo-vma.
It's just a way of massaging the info into a format that mempolicy.c
expects, and the arguments about addresses and offsets mystified me.

I did set out to replace the pseudo-vma by adding an alloc_page_mpol()
three years ago; but, no surprise, I got stuck when it came to
understanding the mpol reference counting, and had to move away.
Maybe we can revisit that once Kosaki-san has the refcounting fixed.

Please, what's wrong with the patch below, to replace the current
two or three?  I don't have real NUMA myself: does it work?
If it doesn't work, can you see why not?

Nathan, I've presumptuously put in your signoff, because
you generally seemed happy to incorporate suggestions made.
Kosaki-san, I'm sorry if this version annoys you, but I've not
seen an actual explanation as to why anything more is needed.

Hugh

From: Nathan Zimmer 
Subject: tmpfs: distribute interleave better across nodes

When tmpfs has the interleave memory policy, it always starts allocating
for each file from node 0 at offset 0.  When there are many small files,
the lower nodes fill up disproportionately.

This patch spreads out node usage by starting files at nodes other than
0, by using the inode number to bias the starting node for interleave.

Signed-off-by: Nathan Zimmer 
Signed-off-by: Hugh Dickins 
Cc: Christoph Lameter 
Cc: Nick Piggin 
Cc: Lee Schermerhorn 
Cc: KOSAKI Motohiro 
Cc: Rik van Riel 
Cc: Andi Kleen 
Cc: Andrew Morton 
---

 mm/shmem.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

--- v3.5/mm/shmem.c 2012-07-21 13:58:29.0 -0700
+++ linux/mm/shmem.c2012-07-24 20:13:58.468797969 -0700
@@ -929,7 +929,8 @@ static struct page *shmem_swapin(swp_ent
 
/* Create a pseudo vma that just contains the policy */
pvma.vm_start = 0;
-   pvma.vm_pgoff = index;
+   /* Bias interleave by inode number to distribute better across nodes */
+   pvma.vm_pgoff = index + info->vfs_inode.i_ino;
pvma.vm_ops = NULL;
pvma.vm_policy = spol;
return swapin_readahead(swap, gfp, &pvma, 0);
@@ -942,7 +943,8 @@ static struct page *shmem_alloc_page(gfp
 
/* Create a pseudo vma that just contains the policy */
pvma.vm_start = 0;
-   pvma.vm_pgoff = index;
+   /* Bias interleave by inode number to distribute better across nodes */
+   pvma.vm_pgoff = index + info->vfs_inode.i_ino;
pvma.vm_ops = NULL;
pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, index);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: Tree for July 25

2012-07-24 Thread Stephen Rothwell
Hi all,

Please do not add anything to linux-next included branches/series that is
destined for v3.7 until after v3.6-rc1 is released.

Reminder: do not rebase your branches before asking Linus to pull them ...

Changes since 20120724:

The net-next tree lost its conflicts.

The mfd tree gained a conflict against Linus' tree.

The tip tree lost its conflicts.

The kvm tree lost its conflicts.

The tty tree still has its build failures for which I have disabled 2
staging drivers and applied a patch.

The arm-soc tree lost its conflicts.

I have still reverted 3 commits from the signal tree at the request of the
arm maintainer.

I removed several patches form the akpm tree that no longer apply due to
some commits being removed from the tip tree.



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" as mentioned in the FAQ on the wiki
(see below).

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log files
in the Next directory.  Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64. After the
final fixups (if any), it is also built with powerpc allnoconfig (32 and
64 bit), ppc44x_defconfig and allyesconfig (minus
CONFIG_PROFILE_ALL_BRANCHES - this fails its final link) and i386, sparc,
sparc64 and arm defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

We are up to 197 trees (counting Linus' and 26 trees of patches pending
for Linus' tree), more are welcome (even if they are currently empty).
Thanks to those who have contributed, and to those who haven't, please do.

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (f14121a Merge tag 'dt-for-3.6' of 
git://sources.calxeda.com/kernel/linux)
Merging fixes/master (9023a40 Merge tag 'mmc-fixes-for-3.5-rc4' of 
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc)
Merging kbuild-current/rc-fixes (f8f5701 Linux 3.5-rc1)
Merging arm-current/fixes (ff081e0 ARM: 7457/1: smp: Fix suspicious RCU 
originating from cpu_die())
Merging m68k-current/for-linus (1525e06 m68k/apollo: Rename "timer" to 
"apollo_timer")
Merging powerpc-merge/merge (50fb31c tty/hvc_opal: Fix debug function name)
Merging sparc/master (d55de60 sparc64: remove unused function 
straddles_64bit_va_hole())
Merging net/master (3c4cfad Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next)
Merging sound-current/for-linus (c1b623d Merge tag 'asoc-3.6' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next)
Merging pci-current/for-linus (314489b Merge tag 'fixes-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc)
Merging wireless/master (8a70e7f NFC: NCI module license 'unspecified' taints 
kernel)
Merging driver-core.current/driver-core-linus (84a1caf Linux 3.5-rc7)
Merging tty.current/tty-linus (84a1caf Linux 3.5-rc7)
Merging usb.current/usb-linus (84a1caf Linux 3.5-rc7)
Merging staging.current/staging-linus (6887a41 Linux 3.5-rc5)
Merging char-misc.current/char-misc-linus (84a1caf Linux 3.5-rc7)
Merging input-current/for-linus (e76b8ee Input: xpad - add Andamiro Pump It Up 
pad)
Merging md-current/for-linus (58e94ae md/raid1: close some possible races on 
write errors during resync)
Merging audit-current/for-linus (c158a35 audit: no leading space in 
audit_log_d_path prefix)
Merging crypto-current/master (c475c06 hwrng: atmel-rng - fix data valid check)
Merging ide/master (39a50b4 Merge branch 'hfsplus')
Merging dwmw2/master (244dc4e Merge 
git://git.infradead.org/users/dwmw2/random-2.6)
Merging sh-current/sh-fixes-for-linus (4403310 SH: Convert out[bwl] macros to 
inline functions)
Merging irqdomain-current/irqdomain/merge (15e06bf irqdomain: Fix debugfs 
formatting)
Merging devicetree-current/devicetree/merge (4e8383b of: release node fix for 
of_parse_phand

[PATCH] Make IKCONFIG an embedded option, enabled by default

2012-07-24 Thread Alexander Holler
Knowing (being sure) which configuration was used to build a (maybe running)
kernel is important for many scenarios.

It's usually much more important than saving a few kb in the size of
the kernel. Therefor turn on CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC
by default and make them visible only when CONFIG_EMBEDDED is enabled,
preventing premature optimization.

Signed-off-by: Alexander Holler 
---
 init/Kconfig |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index d07dcf9..f468b03 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -583,7 +583,8 @@ config RCU_BOOST_DELAY
 endmenu # "RCU Subsystem"
 
 config IKCONFIG
-   tristate "Kernel .config support"
+   tristate "Kernel .config support" if EMBEDDED
+   default y
---help---
  This option enables the complete Linux kernel ".config" file
  contents to be saved in the kernel. It provides documentation
@@ -595,8 +596,9 @@ config IKCONFIG
  /proc/config.gz if enabled (below).
 
 config IKCONFIG_PROC
-   bool "Enable access to .config through /proc/config.gz"
+   bool "Enable access to .config through /proc/config.gz" if EMBEDDED
depends on IKCONFIG && PROC_FS
+   default y
---help---
  This option enables access to the kernel configuration file
  through /proc/config.gz.
-- 
1.7.6.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/


linux-next: manual merge of the akpm tree with the tip tree

2012-07-24 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm tree got a conflict in mm/migrate.c
between the tip tree and commit "mm: memcg: fix compaction/migration
failing due to memcg limits" from the akpm tree.

The commit 4783af477d3d ("mm: Migrate misplaced page") was removed (among
several others) from the tip tree since yesterday (and thus linux-next)
so the above akpm tree patch no longer applies.

I have dropped this patch form the akpm tree (and the following patches
as well:
mm-memcg-fix-compaction-migration-failing-due-to-memcg-limits-checkpatch-fixes
mm: memcg: push down PageSwapCache check into uncharge entry functions
mm: memcg: only check for PageSwapCache when uncharging anon
mm: memcg: remove unneeded shmem charge type
mm: memcg: remove needless !mm fixup to init_mm when charging
)

Hopefully this doesn't cause other problems.  I guess that they will need
rebasing depending on what gets merged via the tip tree.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgp1BwBzmmcO0.pgp
Description: PGP signature


Re: [PATCH 9/9 v3] dma: shdma: convert to the shdma base library

2012-07-24 Thread Paul Mundt
On Wed, May 09, 2012 at 05:09:21PM +0200, Guennadi Liakhovetski wrote:
> The shdma base library has originally been extracted from the shdma driver,
> which now can be converted to actually use it.
> 
> Signed-off-by: Guennadi Liakhovetski 
> ---
>  drivers/dma/sh/shdma.c | 1122 
> 
>  drivers/dma/sh/shdma.h |   44 +-
>  include/linux/sh_dma.h |   33 +-
>  3 files changed, 302 insertions(+), 897 deletions(-)
> 
Now that this has hit mainline, the sh-sci with DMA enabled build is
broken:

  CC  drivers/tty/serial/sh-sci.o
drivers/tty/serial/sh-sci.c: In function 'work_fn_rx':
drivers/tty/serial/sh-sci.c:1413:67: error: dereferencing pointer to incomplete 
type
drivers/tty/serial/sh-sci.c:1413:81: warning: type defaults to 'int' in 
declaration of '__mptr'
drivers/tty/serial/sh-sci.c:1413:90: warning: initialization from incompatible 
pointer type
drivers/tty/serial/sh-sci.c:1413:161: error: invalid use of undefined type 
'struct sh_desc'
drivers/tty/serial/sh-sci.c:1419:83: error: dereferencing pointer to incomplete 
type
drivers/tty/serial/sh-sci.c:1419:101: error: dereferencing pointer to 
incomplete type
drivers/tty/serial/sh-sci.c:1423:42: error: dereferencing pointer to incomplete 
type
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: AML Parser: Fix two possible memory leaks in error path

2012-07-24 Thread Len Brown
From: Jesper Juhl 

Fixes a couple of memory leaks in the error recovery path.

Signed-off-by: Jesper Juhl 
Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/psargs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 5ac36ab..a683d66 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -618,6 +618,7 @@ static union acpi_parse_object 
*acpi_ps_get_next_field(struct acpi_parse_state
 
arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
if (!arg) {
+   acpi_ps_free_op(field);
return_PTR(NULL);
}
 
@@ -662,6 +663,7 @@ static union acpi_parse_object 
*acpi_ps_get_next_field(struct acpi_parse_state
} else {
arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
if (!arg) {
+   acpi_ps_free_op(field);
return_PTR(NULL);
}
 
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: Add support for multiple notify handlers

2012-07-24 Thread Len Brown
From: Bob Moore 

This change adds support to allow multiple notify handlers on
Device, ThermalZone, and Processor objects. Also re-worked
and restructured the entire notify support code for handler
installation, handler removal, notify event queuing, and notify
dispatch to handler.

Extends and updates original commit 3f0be67("ACPI / ACPICA: Multiple
system notify handlers per device") by Rafael Wysocki.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/acglobal.h |   3 +-
 drivers/acpi/acpica/aclocal.h  |  13 +-
 drivers/acpi/acpica/acobject.h |   9 +-
 drivers/acpi/acpica/evmisc.c   | 185 +++--
 drivers/acpi/acpica/evxface.c  | 440 ++---
 drivers/acpi/acpica/exdump.c   |  25 ++-
 drivers/acpi/acpica/utdelete.c |  24 ++-
 drivers/acpi/acpica/utglobal.c |   4 +-
 include/acpi/actypes.h |   4 +
 9 files changed, 266 insertions(+), 441 deletions(-)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 4f7d3f5..dec7994 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -278,8 +278,7 @@ ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
 
 /* Global handlers */
 
-ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
-ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
+ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2];
 ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
 ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
 ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler;
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index e3922ca..28f6778 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -600,13 +600,22 @@ acpi_status(*acpi_parse_downwards) (struct 
acpi_walk_state * walk_state,
 
 typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
 
+/* Global handlers for AML Notifies */
+
+struct acpi_global_notify_handler {
+   acpi_notify_handler handler;
+   void *context;
+};
+
 /*
  * Notify info - used to pass info to the deferred notify
  * handler/dispatcher.
  */
 struct acpi_notify_info {
-   ACPI_STATE_COMMON struct acpi_namespace_node *node;
-   union acpi_operand_object *handler_obj;
+   ACPI_STATE_COMMON u8 handler_list_id;
+   struct acpi_namespace_node *node;
+   union acpi_operand_object *handler_list_head;
+   struct acpi_global_notify_handler *global;
 };
 
 /* Generic state is union of structs above */
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index c065078..39a2b84 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -206,8 +206,7 @@ struct acpi_object_method {
  * Common fields for objects that support ASL notifications
  */
 #define ACPI_COMMON_NOTIFY_INFO \
-   union acpi_operand_object   *system_notify; /* Handler for 
system notifies */\
-   union acpi_operand_object   *device_notify; /* Handler for 
driver notifies */\
+   union acpi_operand_object   *notify_list[2];/* Handlers for 
system/device notifies */\
union acpi_operand_object   *handler;   /* Handler for Address 
space */
 
 struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, 
DEVICE, and THERMAL */
@@ -296,10 +295,10 @@ struct acpi_object_buffer_field {
 
 struct acpi_object_notify_handler {
ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* 
Parent device */
-   u32 handler_type;
-   acpi_notify_handler handler;
+   u32 handler_type;   /* Type: Device/System/Both */
+   acpi_notify_handler handler;/* Handler address */
void *context;
-   struct acpi_object_notify_handler *next;
+   union acpi_operand_object *next[2]; /* Device and System handler 
lists */
 };
 
 struct acpi_object_addr_handler {
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index 51ef9f5..381fce9 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -101,102 +101,77 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node 
* node,
 u32 notify_value)
 {
union acpi_operand_object *obj_desc;
-   union acpi_operand_object *handler_obj = NULL;
-   union acpi_generic_state *notify_info;
+   union acpi_operand_object *handler_list_head = NULL;
+   union acpi_generic_state *info;
+   u8 handler_list_id = 0;
acpi_status status = AE_OK;
 
ACPI_FUNCTION_NAME(ev_queue_notify_request);
 
-   /*
-* For value 0x03 (Ejection Request), may need to run a device method.
-* For value 0x02 (Device Wake), if _PRW exists, may need to run
-*   the _PS0 method.
-* For value 0x80 (Status Change) on the power button or sleep button,
-*   initiate soft-off or s

[PATCH 03/52] ACPICA: Lint fixes for acpi_write, no functional changes

2012-07-24 Thread Len Brown
From: Bob Moore 

acpi_write was widened to 64-bit data, this change eliminates some
lint warnings.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/hwesleep.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 29e8592..3680c45 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -117,7 +117,8 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
 
/* Clear wake status (WAK_STS) */
 
-   status = acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
+   status =
+   acpi_write((u64)ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -147,7 +148,7 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
 ACPI_X_SLEEP_TYPE_MASK);
 
-   status = acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE),
+   status = acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
&acpi_gbl_FADT.sleep_control);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -195,7 +196,7 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 
flags)
((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
 ACPI_X_SLEEP_TYPE_MASK);
 
-   (void)acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE),
+   (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
 &acpi_gbl_FADT.sleep_control);
}
 
@@ -239,7 +240,7 @@ acpi_status acpi_hw_extended_wake(u8 sleep_state, u8 flags)
 * and use it to determine whether the system is rebooting or
 * resuming. Clear WAK_STS for compatibility.
 */
-   (void)acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
+   (void)acpi_write((u64)ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
acpi_gbl_system_awake_and_running = TRUE;
 
acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: Update to version 20120420

2012-07-24 Thread Len Brown
From: Bob Moore 

Version 20120420.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 9821101..a323a7c 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20120320
+#define ACPI_CA_VERSION 0x20120420
 
 #include "acconfig.h"
 #include "actypes.h"
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 09/52] ACPICA: Remove argument of acpi_os_wait_events_complete

2012-07-24 Thread Len Brown
From: Lin Ming 

Remove the unused argument of acpi_os_wait_events_complete.

Signed-off-by: Lin Ming 
Signed-off-by: Bob Moore 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/evxface.c | 4 ++--
 drivers/acpi/osl.c| 4 ++--
 drivers/acpi/sleep.c  | 2 +-
 include/acpi/acpiosxf.h   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 90ae6d1..6a8b537 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -251,7 +251,7 @@ acpi_remove_notify_handler(acpi_handle device,
}
/* Make sure all deferred tasks are completed */
 
-   acpi_os_wait_events_complete(NULL);
+   acpi_os_wait_events_complete();
 
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
@@ -699,7 +699,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
 
/* Make sure all deferred tasks are completed */
 
-   acpi_os_wait_events_complete(NULL);
+   acpi_os_wait_events_complete();
 
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index c3881b2..9eaf708 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -891,7 +891,7 @@ static void acpi_os_execute_deferred(struct work_struct 
*work)
struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
 
if (dpc->wait)
-   acpi_os_wait_events_complete(NULL);
+   acpi_os_wait_events_complete();
 
dpc->function(dpc->context);
kfree(dpc);
@@ -987,7 +987,7 @@ acpi_status acpi_os_hotplug_execute(acpi_osd_exec_callback 
function,
return __acpi_os_execute(0, function, context, 1);
 }
 
-void acpi_os_wait_events_complete(void *context)
+void acpi_os_wait_events_complete(void)
 {
flush_workqueue(kacpid_wq);
flush_workqueue(kacpi_notify_wq);
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index eb6fd23..9a14f90 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -144,7 +144,7 @@ void __init acpi_old_suspend_ordering(void)
 static int acpi_pm_freeze(void)
 {
acpi_disable_all_gpes();
-   acpi_os_wait_events_complete(NULL);
+   acpi_os_wait_events_complete();
acpi_ec_block_transactions();
return 0;
 }
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 21a5548..f3746f7 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -205,7 +205,7 @@ acpi_os_execute(acpi_execute_type type,
 acpi_status
 acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
 
-void acpi_os_wait_events_complete(void *context);
+void acpi_os_wait_events_complete(void);
 
 void acpi_os_sleep(u64 milliseconds);
 
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] cpuidle: remove unused hrtimer_peek_ahead_timers() call

2012-07-24 Thread Len Brown
From: Sergey Senozhatsky 

  commit 9a6558371bcd01c2973b7638181db4ccc34eab4f
  Author: Arjan van de Ven 
  Date:   Sun Nov 9 12:45:10 2008 -0800

 regression: disable timer peek-ahead for 2.6.28

 It's showing up as regressions; disabling it very likely just papers
 over an underlying issue, but time is running out for 2.6.28, lets get
 back to this for 2.6.29

 Many years has passed since 2008, so it seems ok to remove whole `#if 0' block.

Signed-off-by: Sergey Senozhatsky 
Cc: Kevin Hilman 
Cc: Trinabh Gupta 
Cc: Deepthi Dharwar 
Cc: Arjan van de Ven 
Signed-off-by: Andrew Morton 
Signed-off-by: Len Brown 
---
 drivers/cpuidle/cpuidle.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 2f0083a..588b44a 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -124,15 +124,6 @@ int cpuidle_idle_call(void)
if (!dev || !dev->enabled)
return -EBUSY;
 
-#if 0
-   /* shows regressions, re-enable for 2.6.29 */
-   /*
-* run any timers that can be run now, at this point
-* before calculating the idle duration etc.
-*/
-   hrtimer_peek_ahead_timers();
-#endif
-
/* ask the governor for the next state */
next_state = cpuidle_curr_governor->select(drv, dev);
if (need_resched()) {
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: Add FADT error message for GAS BitWidth overflow

2012-07-24 Thread Len Brown
From: Bob Moore 

Error for possible overflow during conversion from 32-bit legacy
register addresses to GAS format. The GAS struct contains a
one-byte BitWidth field, meaning that the maximum length of a
register is 255 bits. ACPICA BZ 953.

https://www.acpica.org/bugzilla/show_bug.cgi?id=953

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/tbfadt.c | 32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 4c9c760..d919f40 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -49,9 +49,10 @@
 ACPI_MODULE_NAME("tbfadt")
 
 /* Local prototypes */
-static ACPI_INLINE void
+static void
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
-u8 space_id, u8 byte_width, u64 address);
+u8 space_id,
+u8 byte_width, u64 address, char *register_name);
 
 static void acpi_tb_convert_fadt(void);
 
@@ -182,10 +183,25 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
  *
  
**/
 
-static ACPI_INLINE void
+static void
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
-u8 space_id, u8 byte_width, u64 address)
+u8 space_id,
+u8 byte_width, u64 address, char *register_name)
 {
+   u8 bit_width;
+
+   /* Bit width field in the GAS is only one byte long, 255 max */
+
+   bit_width = (u8)(byte_width * 8);
+
+   if (byte_width > 31) {  /* (31*8)=248 */
+   ACPI_ERROR((AE_INFO,
+   "%s - 32-bit FADT register is too long (%u bytes, 
%u bits) "
+   "to convert to GAS struct - 255 bits max, 
truncating",
+   register_name, byte_width, (byte_width * 8)));
+
+   bit_width = 255;
+   }
 
/*
 * The 64-bit Address field is non-aligned in the byte packed
@@ -196,7 +212,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address 
*generic_address,
/* All other fields are byte-wide */
 
generic_address->space_id = space_id;
-   generic_address->bit_width = (u8)ACPI_MUL_8(byte_width);
+   generic_address->bit_width = bit_width;
generic_address->bit_offset = 0;
generic_address->access_width = 0;  /* Access width ANY */
 }
@@ -456,7 +472,8 @@ static void acpi_tb_convert_fadt(void)
   
&acpi_gbl_FADT,
   
fadt_info_table
   [i].length),
-(u64) address32);
+(u64) address32,
+fadt_info_table[i].name);
}
}
 }
@@ -670,7 +687,8 @@ static void acpi_tb_setup_fadt_registers(void)
 source64->address +
 (fadt_pm_info_table[i].
  register_num *
- pm1_register_byte_width));
+ pm1_register_byte_width),
+"PmRegisters");
}
}
 }
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPI Battery: Added capacity

2012-07-24 Thread Len Brown
From: srinivas pandruvada 

Added Capacity field, which is a pre-defined power_supply
property. Calculating capacity using current charge/energy and
full charge/energy.
Some user mode implementations are relying on capacity field to
show battery strength and power down decision.

Signed-off-by: srinivas pandruvada 
Signed-off-by: Len Brown 
---
 drivers/acpi/battery.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7dd3f9f..5662d64 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -250,6 +250,13 @@ static int acpi_battery_get_property(struct power_supply 
*psy,
else
val->intval = battery->capacity_now * 1000;
break;
+   case POWER_SUPPLY_PROP_CAPACITY:
+   if (battery->capacity_now && battery->full_charge_capacity)
+   val->intval = battery->capacity_now * 100/
+   battery->full_charge_capacity;
+   else
+   val->intval = 0;
+   break;
case POWER_SUPPLY_PROP_MODEL_NAME:
val->strval = battery->model_number;
break;
@@ -276,6 +283,7 @@ static enum power_supply_property charge_battery_props[] = {
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_CHARGE_NOW,
+   POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
@@ -292,6 +300,7 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
POWER_SUPPLY_PROP_ENERGY_FULL,
POWER_SUPPLY_PROP_ENERGY_NOW,
+   POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 17/52] cpuidle: add support for states that affect multiple cpus

2012-07-24 Thread Len Brown
From: Colin Cross 

On some ARM SMP SoCs (OMAP4460, Tegra 2, and probably more), the
cpus cannot be independently powered down, either due to
sequencing restrictions (on Tegra 2, cpu 0 must be the last to
power down), or due to HW bugs (on OMAP4460, a cpu powering up
will corrupt the gic state unless the other cpu runs a work
around).  Each cpu has a power state that it can enter without
coordinating with the other cpu (usually Wait For Interrupt, or
WFI), and one or more "coupled" power states that affect blocks
shared between the cpus (L2 cache, interrupt controller, and
sometimes the whole SoC).  Entering a coupled power state must
be tightly controlled on both cpus.

The easiest solution to implementing coupled cpu power states is
to hotplug all but one cpu whenever possible, usually using a
cpufreq governor that looks at cpu load to determine when to
enable the secondary cpus.  This causes problems, as hotplug is an
expensive operation, so the number of hotplug transitions must be
minimized, leading to very slow response to loads, often on the
order of seconds.

This file implements an alternative solution, where each cpu will
wait in the WFI state until all cpus are ready to enter a coupled
state, at which point the coupled state function will be called
on all cpus at approximately the same time.

Once all cpus are ready to enter idle, they are woken by an smp
cross call.  At this point, there is a chance that one of the
cpus will find work to do, and choose not to enter idle.  A
final pass is needed to guarantee that all cpus will call the
power state enter function at the same time.  During this pass,
each cpu will increment the ready counter, and continue once the
ready counter matches the number of online coupled cpus.  If any
cpu exits idle, the other cpus will decrement their counter and
retry.

To use coupled cpuidle states, a cpuidle driver must:

   Set struct cpuidle_device.coupled_cpus to the mask of all
   coupled cpus, usually the same as cpu_possible_mask if all cpus
   are part of the same cluster.  The coupled_cpus mask must be
   set in the struct cpuidle_device for each cpu.

   Set struct cpuidle_device.safe_state to a state that is not a
   coupled state.  This is usually WFI.

   Set CPUIDLE_FLAG_COUPLED in struct cpuidle_state.flags for each
   state that affects multiple cpus.

   Provide a struct cpuidle_state.enter function for each state
   that affects multiple cpus.  This function is guaranteed to be
   called on all cpus at approximately the same time.  The driver
   should ensure that the cpus all abort together if any cpu tries
   to abort once the function is called.

update1:

cpuidle: coupled: fix count of online cpus

online_count was never incremented on boot, and was also counting
cpus that were not part of the coupled set.  Fix both issues by
introducting a new function that counts online coupled cpus, and
call it from register as well as the hotplug notifier.

update2:

cpuidle: coupled: fix decrementing ready count

cpuidle_coupled_set_not_ready sometimes refuses to decrement the
ready count in order to prevent a race condition.  This makes it
unsuitable for use when finished with idle.  Add a new function
cpuidle_coupled_set_done that decrements both the ready count and
waiting count, and call it after idle is complete.

Cc: Amit Kucheria 
Cc: Arjan van de Ven 
Cc: Trinabh Gupta 
Cc: Deepthi Dharwar 
Reviewed-by: Santosh Shilimkar 
Tested-by: Santosh Shilimkar 
Reviewed-by: Kevin Hilman 
Tested-by: Kevin Hilman 
Signed-off-by: Colin Cross 
Acked-by: Rafael J. Wysocki 
Signed-off-by: Len Brown 
---
 drivers/cpuidle/Kconfig   |   3 +
 drivers/cpuidle/Makefile  |   1 +
 drivers/cpuidle/coupled.c | 678 ++
 drivers/cpuidle/cpuidle.c |  15 +-
 drivers/cpuidle/cpuidle.h |  30 ++
 include/linux/cpuidle.h   |   7 +
 6 files changed, 733 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpuidle/coupled.c

diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index 78a666d..a76b689 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -18,3 +18,6 @@ config CPU_IDLE_GOV_MENU
bool
depends on CPU_IDLE && NO_HZ
default y
+
+config ARCH_NEEDS_CPU_IDLE_COUPLED
+   def_bool n
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 5634f88..38c8f69 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
+obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
new file mode 100644
index 000..aab6bba
--- /dev/null
+++ b/drivers/cpuidle/coupled.c
@@ -0,0 +1,678 @@
+/*
+ * coupled.c - helper functions to enter the same idle state on multiple cpus
+ *
+ * Copyright (c) 2011 Google, Inc.
+ *
+ * Author: Colin Cross 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the

[PATCH 18/52] cpuidle: coupled: add parallel barrier function

2012-07-24 Thread Len Brown
From: Colin Cross 

Adds cpuidle_coupled_parallel_barrier, which can be used by coupled
cpuidle state enter functions to handle resynchronization after
determining if any cpu needs to abort.  The normal use case will
be:

static bool abort_flag;
static atomic_t abort_barrier;

int arch_cpuidle_enter(struct cpuidle_device *dev, ...)
{
if (arch_turn_off_irq_controller()) {
/* returns an error if an irq is pending and would be lost
   if idle continued and turned off power */
abort_flag = true;
}

cpuidle_coupled_parallel_barrier(dev, &abort_barrier);

if (abort_flag) {
/* One of the cpus didn't turn off it's irq controller */
arch_turn_on_irq_controller();
return -EINTR;
}

/* continue with idle */
...
}

This will cause all cpus to abort idle together if one of them needs
to abort.

Reviewed-by: Santosh Shilimkar 
Tested-by: Santosh Shilimkar 
Reviewed-by: Kevin Hilman 
Tested-by: Kevin Hilman 
Signed-off-by: Colin Cross 
Signed-off-by: Len Brown 
---
 drivers/cpuidle/coupled.c | 37 +
 include/linux/cpuidle.h   |  4 
 2 files changed, 41 insertions(+)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index aab6bba..2c9bf26 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -130,6 +130,43 @@ static DEFINE_PER_CPU(struct call_single_data, 
cpuidle_coupled_poke_cb);
 static cpumask_t cpuidle_coupled_poked_mask;
 
 /**
+ * cpuidle_coupled_parallel_barrier - synchronize all online coupled cpus
+ * @dev: cpuidle_device of the calling cpu
+ * @a:   atomic variable to hold the barrier
+ *
+ * No caller to this function will return from this function until all online
+ * cpus in the same coupled group have called this function.  Once any caller
+ * has returned from this function, the barrier is immediately available for
+ * reuse.
+ *
+ * The atomic variable a must be initialized to 0 before any cpu calls
+ * this function, will be reset to 0 before any cpu returns from this function.
+ *
+ * Must only be called from within a coupled idle state handler
+ * (state.enter when state.flags has CPUIDLE_FLAG_COUPLED set).
+ *
+ * Provides full smp barrier semantics before and after calling.
+ */
+void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a)
+{
+   int n = dev->coupled->online_count;
+
+   smp_mb__before_atomic_inc();
+   atomic_inc(a);
+
+   while (atomic_read(a) < n)
+   cpu_relax();
+
+   if (atomic_inc_return(a) == n * 2) {
+   atomic_set(a, 0);
+   return;
+   }
+
+   while (atomic_read(a) > n)
+   cpu_relax();
+}
+
+/**
  * cpuidle_state_is_coupled - check if a state is part of a coupled set
  * @dev: struct cpuidle_device for the current cpu
  * @drv: struct cpuidle_driver for the platform
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 6038448..5ab7183 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -183,6 +183,10 @@ static inline int cpuidle_play_dead(void) {return -ENODEV; 
}
 
 #endif
 
+#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
+void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a);
+#endif
+
 /**
  * CPUIDLE GOVERNOR INTERFACE *
  **/
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 20/52] ACPI: Add an interface to evaluate _OST

2012-07-24 Thread Len Brown
From: Toshi Kani 

Added acpi_evaluate_hotplug_opt(). All ACPI hotplug handlers must call
this function when evaluating _OST for hotplug operations. If the
platform does not support _OST, this function returns AE_NOT_FOUND and
has no effect on the platform.

ACPI_HOTPLUG_OST is defined when all relevant ACPI hotplug operations,
such as CPU, memory and container hotplug, are enabled. This assures
consistent behavior among the hotplug operations with regarding the
_OST support. When ACPI_HOTPLUG_OST is not defined, this function is
a no-op.

ACPI PCI hotplug is not enhanced to support _OST at this time since it
is a legacy method being replaced by PCIe native hotplug. _OST support
for ACPI PCI hotplug may be added in future if necessary.

Some platforms may require the OS to support _OST in order to support
ACPI hotplug operations. For example, if a platform has the management
console where user can request a hotplug operation from, this _OST
support would be required for the management console to show the result
of the hotplug request to user.

Added macro definitions of _OST source events and status codes.
Also renamed OSC_SB_CPUHP_OST_SUPPORT to OSC_SB_HOTPLUG_OST_SUPPORT
since this _OSC bit is not specific to CPU hotplug. This bit is
defined in Table 6-147 of ACPI 5.0 as follows.

  Bits:   3
  Field Name: Insertion / Ejection _OST Processing Support
  Definition: This bit is set if OSPM will evaluate the _OST
  object defined under a device when processing
  insertion and ejection source event codes.

Signed-off-by: Toshi Kani 
Signed-off-by: Len Brown 
---
 drivers/acpi/utils.c| 42 ++
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h| 40 +++-
 3 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index adbbc1c..3e87c9c 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -412,3 +412,45 @@ out:
return status;
 }
 EXPORT_SYMBOL(acpi_get_physical_device_location);
+
+/**
+ * acpi_evaluate_hotplug_ost: Evaluate _OST for hotplug operations
+ * @handle: ACPI device handle
+ * @source_event: source event code
+ * @status_code: status code
+ * @status_buf: optional detailed information (NULL if none)
+ *
+ * Evaluate _OST for hotplug operations. All ACPI hotplug handlers
+ * must call this function when evaluating _OST for hotplug operations.
+ * When the platform does not support _OST, this function has no effect.
+ */
+acpi_status
+acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
+   u32 status_code, struct acpi_buffer *status_buf)
+{
+#ifdef ACPI_HOTPLUG_OST
+   union acpi_object params[3] = {
+   {.type = ACPI_TYPE_INTEGER,},
+   {.type = ACPI_TYPE_INTEGER,},
+   {.type = ACPI_TYPE_BUFFER,}
+   };
+   struct acpi_object_list arg_list = {3, params};
+   acpi_status status;
+
+   params[0].integer.value = source_event;
+   params[1].integer.value = status_code;
+   if (status_buf != NULL) {
+   params[2].buffer.pointer = status_buf->pointer;
+   params[2].buffer.length = status_buf->length;
+   } else {
+   params[2].buffer.pointer = NULL;
+   params[2].buffer.length = 0;
+   }
+
+   status = acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
+   return status;
+#else
+   return AE_OK;
+#endif
+}
+EXPORT_SYMBOL(acpi_evaluate_hotplug_ost);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index b0d6282..1139f3a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -50,6 +50,9 @@ acpi_evaluate_reference(acpi_handle handle,
acpi_string pathname,
struct acpi_object_list *arguments,
struct acpi_handle_list *list);
+acpi_status
+acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
+   u32 status_code, struct acpi_buffer *status_buf);
 
 struct acpi_pld {
unsigned int revision:7; /* 0 */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index f421dd8..b2b4d2a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -277,7 +277,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct 
acpi_osc_context *context);
 #define OSC_SB_PAD_SUPPORT 1
 #define OSC_SB_PPC_OST_SUPPORT 2
 #define OSC_SB_PR3_SUPPORT 4
-#define OSC_SB_CPUHP_OST_SUPPORT   8
+#define OSC_SB_HOTPLUG_OST_SUPPORT 8
 #define OSC_SB_APEI_SUPPORT16
 
 extern bool osc_sb_apei_support_acked;
@@ -309,6 +309,44 @@ extern bool osc_sb_apei_support_acked;
 
 extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
 u32 *mask, u32 req);
+
+/* Enable _OST when all relevant hotplug operations are enabled */
+#if defined(CONFIG_ACPI_HOTPLUG_CPU) &&

[PATCH 22/52] ACPI: Add _OST support for ACPI CPU hotplug

2012-07-24 Thread Len Brown
From: Toshi Kani 

Changed acpi_processor_hotplug_notify() to call ACPI _OST method
when ACPI CPU hotplug operation has completed.

Signed-off-by: Toshi Kani 
Signed-off-by: Len Brown 
---
 drivers/acpi/processor_driver.c | 28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 0734086..971c454 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -701,9 +701,9 @@ static void acpi_processor_hotplug_notify(acpi_handle 
handle,
 {
struct acpi_processor *pr;
struct acpi_device *device = NULL;
+   u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
int result;
 
-
switch (event) {
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
@@ -715,14 +715,18 @@ static void acpi_processor_hotplug_notify(acpi_handle 
handle,
if (!is_processor_present(handle))
break;
 
-   if (acpi_bus_get_device(handle, &device)) {
-   result = acpi_processor_device_add(handle, &device);
-   if (result)
-   printk(KERN_ERR PREFIX
-   "Unable to add the device\n");
+   if (!acpi_bus_get_device(handle, &device))
+   break;
+
+   result = acpi_processor_device_add(handle, &device);
+   if (result) {
+   printk(KERN_ERR PREFIX "Unable to add the device\n");
break;
}
+
+   ost_code = ACPI_OST_SC_SUCCESS;
break;
+
case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  "received ACPI_NOTIFY_EJECT_REQUEST\n"));
@@ -736,15 +740,23 @@ static void acpi_processor_hotplug_notify(acpi_handle 
handle,
if (!pr) {
printk(KERN_ERR PREFIX
"Driver data is NULL, dropping EJECT\n");
-   return;
+   break;
}
+
+   /* REVISIT: update when eject is supported */
+   ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
break;
+
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  "Unsupported event [0x%x]\n", event));
-   break;
+
+   /* non-hotplug event; possibly handled by other handler */
+   return;
}
 
+   /* Inform firmware that the hotplug operation has completed */
+   (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
return;
 }
 
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 26/52] ACPI, PM, Specify lowest allowed state for device sleep state

2012-07-24 Thread Len Brown
From: Huang Ying 

Lower device sleep state can save more power, but has more exit
latency too.  Sometimes, to satisfy some power QoS and other
requirement, we need to constrain the lowest device sleep state.

In this patch, a parameter to specify lowest allowed state for
acpi_pm_device_sleep_state is added.  So that the caller can enforce
the constraint via the parameter.

This is needed by PCIe D3cold support, where the lowest power state
allowed may be D3_HOT instead of default D3_COLD.

Changelog:

v2:
- Minor change per Rafeal's comments

Signed-off-by: Huang Ying 
Signed-off-by: Len Brown 
---
 drivers/acpi/sleep.c   | 24 +++-
 drivers/pci/pci-acpi.c |  3 ++-
 drivers/pnp/pnpacpi/core.c |  4 ++--
 include/acpi/acpi_bus.h|  6 +++---
 4 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 74ee4ab..6f3f34c 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -675,8 +675,9 @@ int acpi_suspend(u32 acpi_state)
  * @dev: device to examine; its driver model wakeup flags control
  * whether it should be able to wake up the system
  * @d_min_p: used to store the upper limit of allowed states range
- * Return value: preferred power state of the device on success, -ENODEV on
- * failure (ie. if there's no 'struct acpi_device' for @dev)
+ * @d_max_in: specify the lowest allowed states
+ * Return value: preferred power state of the device on success, -ENODEV
+ * (ie. if there's no 'struct acpi_device' for @dev) or -EINVAL on failure
  *
  * Find the lowest power (highest number) ACPI device power state that
  * device @dev can be in while the system is in the sleep state represented
@@ -691,13 +692,15 @@ int acpi_suspend(u32 acpi_state)
  * via @wake.
  */
 
-int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
+int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in)
 {
acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
struct acpi_device *adev;
char acpi_method[] = "_SxD";
unsigned long long d_min, d_max;
 
+   if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3)
+   return -EINVAL;
if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
printk(KERN_DEBUG "ACPI handle has no context!\n");
return -ENODEV;
@@ -705,8 +708,10 @@ int acpi_pm_device_sleep_state(struct device *dev, int 
*d_min_p)
 
acpi_method[2] = '0' + acpi_target_sleep_state;
/*
-* If the sleep state is S0, we will return D3, but if the device has
-* _S0W, we will use the value from _S0W
+* If the sleep state is S0, the lowest limit from ACPI is D3,
+* but if the device has _S0W, we will use the value from _S0W
+* as the lowest limit from ACPI.  Finally, we will constrain
+* the lowest limit with the specified one.
 */
d_min = ACPI_STATE_D0;
d_max = ACPI_STATE_D3;
@@ -750,8 +755,17 @@ int acpi_pm_device_sleep_state(struct device *dev, int 
*d_min_p)
}
}
 
+   if (d_max_in < d_min)
+   return -EINVAL;
if (d_min_p)
*d_min_p = d_min;
+   /* constrain d_max with specified lowest limit (max number) */
+   if (d_max > d_max_in) {
+   for (d_max = d_max_in; d_max > d_min; d_max--) {
+   if (adev->power.states[d_max].flags.valid)
+   break;
+   }
+   }
return d_max;
 }
 #endif /* CONFIG_PM */
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 61e2fef..a9efebc 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -189,7 +189,8 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev 
*pdev)
 {
int acpi_state;
 
-   acpi_state = acpi_pm_device_sleep_state(&pdev->dev, NULL);
+   acpi_state = acpi_pm_device_sleep_state(&pdev->dev, NULL,
+   ACPI_STATE_D3);
if (acpi_state < 0)
return PCI_POWER_ERROR;
 
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index d21e8f5..507a8e2 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -170,8 +170,8 @@ static int pnpacpi_suspend(struct pnp_dev *dev, 
pm_message_t state)
}
 
if (acpi_bus_power_manageable(handle)) {
-   int power_state = acpi_pm_device_sleep_state(&dev->dev, NULL);
-
+   int power_state = acpi_pm_device_sleep_state(&dev->dev, NULL,
+ACPI_STATE_D3);
if (power_state < 0)
power_state = (state.event == PM_EVENT_ON) ?
ACPI_STATE_D0 : ACPI_STATE_D3;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index b0d6282..0545df4 100644
--- a/inclu

[PATCH 27/52] intel_idle: initial IVB support

2012-07-24 Thread Len Brown
From: Len Brown 

>From an OS point of view, IVB looks like SNB, but quicker.

Signed-off-by: Len Brown 
---
 drivers/idle/intel_idle.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index d0f59c3..a759a4c 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -169,6 +169,38 @@ static struct cpuidle_state 
snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
.enter = &intel_idle },
 };
 
+static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
+   { /* MWAIT C0 */ },
+   { /* MWAIT C1 */
+   .name = "C1-IVB",
+   .desc = "MWAIT 0x00",
+   .flags = CPUIDLE_FLAG_TIME_VALID,
+   .exit_latency = 1,
+   .target_residency = 1,
+   .enter = &intel_idle },
+   { /* MWAIT C2 */
+   .name = "C3-IVB",
+   .desc = "MWAIT 0x10",
+   .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
+   .exit_latency = 59,
+   .target_residency = 156,
+   .enter = &intel_idle },
+   { /* MWAIT C3 */
+   .name = "C6-IVB",
+   .desc = "MWAIT 0x20",
+   .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
+   .exit_latency = 80,
+   .target_residency = 300,
+   .enter = &intel_idle },
+   { /* MWAIT C4 */
+   .name = "C7-IVB",
+   .desc = "MWAIT 0x30",
+   .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
+   .exit_latency = 87,
+   .target_residency = 300,
+   .enter = &intel_idle },
+};
+
 static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
{ /* MWAIT C0 */ },
{ /* MWAIT C1 */
@@ -347,6 +379,10 @@ static const struct idle_cpu idle_cpu_snb = {
.state_table = snb_cstates,
 };
 
+static const struct idle_cpu idle_cpu_ivb = {
+   .state_table = ivb_cstates,
+};
+
 #define ICPU(model, cpu) \
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu }
 
@@ -362,6 +398,7 @@ static const struct x86_cpu_id intel_idle_ids[] = {
ICPU(0x2f, idle_cpu_nehalem),
ICPU(0x2a, idle_cpu_snb),
ICPU(0x2d, idle_cpu_snb),
+   ICPU(0x3a, idle_cpu_ivb),
{}
 };
 MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 28/52] ACPI: remove acpi_pad MAINTAINERS entry

2012-07-24 Thread Len Brown
From: Len Brown 

As Shaohua is no longer in this neck of the woods,
and thus treat the acpi_pad driver as just another
part of drivers/acpi/

Signed-off-by: Len Brown 
---
 MAINTAINERS | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 14bc707..508a935 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -242,13 +242,6 @@ W: http://www.lesswatts.org/projects/acpi/
 S: Supported
 F: drivers/acpi/fan.c
 
-ACPI PROCESSOR AGGREGATOR DRIVER
-M: Shaohua Li 
-L: linux-a...@vger.kernel.org
-W: http://www.lesswatts.org/projects/acpi/
-S: Supported
-F: drivers/acpi/acpi_pad.c
-
 ACPI THERMAL DRIVER
 M: Zhang Rui 
 L: linux-a...@vger.kernel.org
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 32/52] ACPICA: Utilities: conditionally compile backslash removal function

2012-07-24 Thread Len Brown
From: Bob Moore 

Only used for iASL and AcpiExec.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/utmisc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index e86f897..577a44e 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -50,6 +50,7 @@
 #define _COMPONENT  ACPI_UTILITIES
 ACPI_MODULE_NAME("utmisc")
 
+#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
 
/***
  *
  * FUNCTION:ut_convert_backslashes
@@ -77,6 +78,7 @@ void ut_convert_backslashes(char *pathname)
pathname++;
}
 }
+#endif
 
 
/***
  *
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 33/52] ACPICA: Update comments; no functional change

2012-07-24 Thread Len Brown
From: Bob Moore 

Cleanup a couple of comments.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/acpredef.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index bbb34c9..c8e5756 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -511,14 +511,14 @@ static const union acpi_predefined_info 
predefined_names[] =
{{"_TMP", 0, ACPI_RTYPE_INTEGER}},
{{"_TPC", 0, ACPI_RTYPE_INTEGER}},
{{"_TPT", 1, 0}},
-   {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 
2_ref/6_int */
+   {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 
Ref/6 Int */
  {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, 
ACPI_RTYPE_INTEGER}, 6, 0}},
 
-   {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int 
with count */
+   {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int 
with count */
  {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
 
{{"_TSP", 0, ACPI_RTYPE_INTEGER}},
-   {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int 
*/
+   {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int 
*/
  {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
 
{{"_TST", 0, ACPI_RTYPE_INTEGER}},
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 34/52] ACPICA: Add support for implicit notify on multiple devices

2012-07-24 Thread Len Brown
From: Bob Moore 

Adds basic support to allow multiple devices to be implicitly
notified.

This change is partially derived from original commit 981858b("ACPI /
ACPICA: Implicit notify for multiple devices") by Rafael.

Signed-off-by: Bob Moore 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Jung-uk Kim 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/aclocal.h   |  11 -
 drivers/acpi/acpica/evgpe.c |  22 -
 drivers/acpi/acpica/evgpeutil.c |  20 
 drivers/acpi/acpica/evxfgpe.c   | 106 ++--
 4 files changed, 109 insertions(+), 50 deletions(-)

diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index af7330f..6b225e8 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -404,6 +404,13 @@ struct acpi_gpe_handler_info {
u8 originally_enabled;  /* True if GPE was originally enabled */
 };
 
+/* Notify info for implicit notify, multiple device objects */
+
+struct acpi_gpe_notify_info {
+   struct acpi_namespace_node *device_node;/* Device to be 
notified */
+   struct acpi_gpe_notify_info *next;
+};
+
 struct acpi_gpe_notify_object {
struct acpi_namespace_node *node;
struct acpi_gpe_notify_object *next;
@@ -412,7 +419,7 @@ struct acpi_gpe_notify_object {
 union acpi_gpe_dispatch_info {
struct acpi_namespace_node *method_node;/* Method node for this 
GPE level */
struct acpi_gpe_handler_info *handler;  /* Installed GPE handler */
-   struct acpi_gpe_notify_object device;   /* List of _PRW devices for 
implicit notify */
+   struct acpi_gpe_notify_info *notify_list;   /* List of _PRW devices 
for implicit notifies */
 };
 
 /*
@@ -420,7 +427,7 @@ union acpi_gpe_dispatch_info {
  * NOTE: Important to keep this struct as small as possible.
  */
 struct acpi_gpe_event_info {
-   union acpi_gpe_dispatch_info dispatch;  /* Either Method or Handler */
+   union acpi_gpe_dispatch_info dispatch;  /* Either Method, Handler, or 
notify_list */
struct acpi_gpe_register_info *register_info;   /* Backpointer to 
register info */
u8 flags;   /* Misc info about this GPE */
u8 gpe_number;  /* This GPE */
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 8ba0e5f..afbd5cb 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -466,7 +466,7 @@ static void ACPI_SYSTEM_XFACE 
acpi_ev_asynch_execute_gpe_method(void *context)
acpi_status status;
struct acpi_gpe_event_info *local_gpe_event_info;
struct acpi_evaluate_info *info;
-   struct acpi_gpe_notify_object *notify_object;
+   struct acpi_gpe_notify_info *notify;
 
ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
 
@@ -517,17 +517,17 @@ static void ACPI_SYSTEM_XFACE 
acpi_ev_asynch_execute_gpe_method(void *context)
 * completes. The notify handlers are NOT invoked synchronously
 * from this thread -- because handlers may in turn run other
 * control methods.
+*
+* June 2012: Expand implicit notify mechanism to support
+* notifies on multiple device objects.
 */
-   status = acpi_ev_queue_notify_request(
-   local_gpe_event_info->dispatch.device.node,
-   ACPI_NOTIFY_DEVICE_WAKE);
-
-   notify_object = local_gpe_event_info->dispatch.device.next;
-   while (ACPI_SUCCESS(status) && notify_object) {
-   status = acpi_ev_queue_notify_request(
-   notify_object->node,
-   ACPI_NOTIFY_DEVICE_WAKE);
-   notify_object = notify_object->next;
+   notify = local_gpe_event_info->dispatch.notify_list;
+   while (ACPI_SUCCESS(status) && notify) {
+   status =
+   acpi_ev_queue_notify_request(notify->device_node,
+
ACPI_NOTIFY_DEVICE_WAKE);
+
+   notify = notify->next;
}
 
break;
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 3c43796..0c33c62 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -347,6 +347,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info 
*gpe_xrupt_info,
void *context)
 {
struct acpi_gpe_event_info *gpe_event_info;
+   struct acpi_gpe_notify_info *notify;
+   struct acpi_gpe_notify_info *next;
u32 i;
u32 j;
 
@@ -365,10 +367,28 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info 
*gpe_xrupt_info,
 
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
 

[PATCH 38/52] ACPICA: Add new interfaces for BIOS(firmware) errors and warnings

2012-07-24 Thread Len Brown
From: Bob Moore 

These new interfaces will be deployed across ACPICA in order to
point a finger directly at any detected BIOS issues -- such as
issues with ACPI tables, etc.

https://www.acpica.org/bugzilla/show_bug.cgi?id=843

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/utxferror.c | 68 +
 include/acpi/acoutput.h |  4 +++
 include/acpi/acpixf.h   |  8 +
 3 files changed, 80 insertions(+)

diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 52b568a..87aaddf 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -82,6 +82,8 @@ extern FILE *acpi_gbl_output_file;
 #define ACPI_MSG_EXCEPTION  "ACPI Exception: "
 #define ACPI_MSG_WARNING"ACPI Warning: "
 #define ACPI_MSG_INFO   "ACPI: "
+#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: "
+#define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Bug: Warning: "
 /*
  * Common message suffix
  */
@@ -218,6 +220,72 @@ acpi_info(const char *module_name, u32 line_number, const 
char *format, ...)
 
 ACPI_EXPORT_SYMBOL(acpi_info)
 
+/***
+ *
+ * FUNCTION:acpi_bios_error
+ *
+ * PARAMETERS:  module_name - Caller's module name (for error output)
+ *  line_number - Caller's line number (for error output)
+ *  format  - Printf format string + additional args
+ *
+ * RETURN:  None
+ *
+ * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
+ *  info
+ *
+ 
**/
+void ACPI_INTERNAL_VAR_XFACE
+acpi_bios_error(const char *module_name,
+   u32 line_number, const char *format, ...)
+{
+   va_list arg_list;
+
+   ACPI_MSG_REDIRECT_BEGIN;
+   acpi_os_printf(ACPI_MSG_BIOS_ERROR);
+
+   va_start(arg_list, format);
+   acpi_os_vprintf(format, arg_list);
+   ACPI_MSG_SUFFIX;
+   va_end(arg_list);
+
+   ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL(acpi_bios_error)
+
+/***
+ *
+ * FUNCTION:acpi_bios_warning
+ *
+ * PARAMETERS:  module_name - Caller's module name (for error output)
+ *  line_number - Caller's line number (for error output)
+ *  format  - Printf format string + additional args
+ *
+ * RETURN:  None
+ *
+ * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
+ *  info
+ *
+ 
**/
+void ACPI_INTERNAL_VAR_XFACE
+acpi_bios_warning(const char *module_name,
+ u32 line_number, const char *format, ...)
+{
+   va_list arg_list;
+
+   ACPI_MSG_REDIRECT_BEGIN;
+   acpi_os_printf(ACPI_MSG_BIOS_WARNING);
+
+   va_start(arg_list, format);
+   acpi_os_vprintf(format, arg_list);
+   ACPI_MSG_SUFFIX;
+   va_end(arg_list);
+
+   ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL(acpi_bios_warning)
+
 /*
  * The remainder of this module contains internal error functions that may
  * be configured out.
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index d7bd661..f1cb332 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -213,6 +213,8 @@
 #define ACPI_WARNING(plist) acpi_warning plist
 #define ACPI_EXCEPTION(plist)   acpi_exception plist
 #define ACPI_ERROR(plist)   acpi_error plist
+#define ACPI_BIOS_WARNING(plist)acpi_bios_warning plist
+#define ACPI_BIOS_ERROR(plist)  acpi_bios_error plist
 #define ACPI_DEBUG_OBJECT(obj,l,i)  acpi_ex_do_debug_object(obj,l,i)
 
 #else
@@ -223,6 +225,8 @@
 #define ACPI_WARNING(plist)
 #define ACPI_EXCEPTION(plist)
 #define ACPI_ERROR(plist)
+#define ACPI_BIOS_WARNING(plist)
+#define ACPI_BIOS_ERROR(plist)
 #define ACPI_DEBUG_OBJECT(obj,l,i)
 
 #endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 18f023a..8f83f95 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -529,6 +529,14 @@ void ACPI_INTERNAL_VAR_XFACE
 acpi_info(const char *module_name,
  u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
 
+void ACPI_INTERNAL_VAR_XFACE
+acpi_bios_error(const char *module_name,
+   u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_bios_warning(const char *module_name,
+ u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
+
 /*
  * Debug output
  */
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://v

[PATCH 24/52] ACPI: Add _OST support for ACPI container hotplug

2012-07-24 Thread Len Brown
From: Toshi Kani 

Changed container_notify_cb() to call ACPI _OST method when ACPI
container hotplug operation has completed. Slightly restructured
the code with the same logic. The function sets eject_pending bit
for an eject request since it does not initiate hot-remove operation.
This bit is checked by the sysfs eject handler to determine if the
request is originated from an ACPI eject notification.

Signed-off-by: Toshi Kani 
Signed-off-by: Len Brown 
---
 drivers/acpi/container.c | 43 ---
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 45cd03b..1f9f7d7 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -158,9 +158,7 @@ static void container_notify_cb(acpi_handle handle, u32 
type, void *context)
int result;
int present;
acpi_status status;
-
-
-   present = is_device_present(handle);
+   u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
 
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
@@ -169,32 +167,47 @@ static void container_notify_cb(acpi_handle handle, u32 
type, void *context)
printk(KERN_WARNING "Container driver received %s event\n",
   (type == ACPI_NOTIFY_BUS_CHECK) ?
   "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
+
+   present = is_device_present(handle);
status = acpi_bus_get_device(handle, &device);
-   if (present) {
-   if (ACPI_FAILURE(status) || !device) {
-   result = container_device_add(&device, handle);
-   if (!result)
-   kobject_uevent(&device->dev.kobj,
-  KOBJ_ONLINE);
-   else
-   printk(KERN_WARNING
-  "Failed to add container\n");
-   }
-   } else {
+   if (!present) {
if (ACPI_SUCCESS(status)) {
/* device exist and this is a remove request */
+   device->flags.eject_pending = 1;
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
+   return;
}
+   break;
+   }
+
+   if (!ACPI_FAILURE(status) || device)
+   break;
+
+   result = container_device_add(&device, handle);
+   if (result) {
+   printk(KERN_WARNING "Failed to add container\n");
+   break;
}
+
+   kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
+   ost_code = ACPI_OST_SC_SUCCESS;
break;
+
case ACPI_NOTIFY_EJECT_REQUEST:
if (!acpi_bus_get_device(handle, &device) && device) {
+   device->flags.eject_pending = 1;
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
+   return;
}
break;
+
default:
-   break;
+   /* non-hotplug event; possibly handled by other handler */
+   return;
}
+
+   /* Inform firmware that the hotplug operation has completed */
+   (void) acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL);
return;
 }
 
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 23/52] ACPI: Add _OST support for ACPI memory hotplug

2012-07-24 Thread Len Brown
From: Toshi Kani 

Changed acpi_memory_device_notify() to call ACPI _OST method
when ACPI memory hotplug operation has completed.

Signed-off-by: Toshi Kani 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpi_memhotplug.c | 43 +++---
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d985713..24c807f 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -341,7 +341,7 @@ static void acpi_memory_device_notify(acpi_handle handle, 
u32 event, void *data)
 {
struct acpi_memory_device *mem_device;
struct acpi_device *device;
-
+   u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
 
switch (event) {
case ACPI_NOTIFY_BUS_CHECK:
@@ -354,15 +354,20 @@ static void acpi_memory_device_notify(acpi_handle handle, 
u32 event, void *data)
  "\nReceived DEVICE CHECK notification 
for device\n"));
if (acpi_memory_get_device(handle, &mem_device)) {
printk(KERN_ERR PREFIX "Cannot find driver data\n");
-   return;
+   break;
}
 
-   if (!acpi_memory_check_device(mem_device)) {
-   if (acpi_memory_enable_device(mem_device))
-   printk(KERN_ERR PREFIX
-   "Cannot enable memory device\n");
+   if (acpi_memory_check_device(mem_device))
+   break;
+
+   if (acpi_memory_enable_device(mem_device)) {
+   printk(KERN_ERR PREFIX "Cannot enable memory device\n");
+   break;
}
+
+   ost_code = ACPI_OST_SC_SUCCESS;
break;
+
case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  "\nReceived EJECT REQUEST notification for 
device\n"));
@@ -383,19 +388,35 @@ static void acpi_memory_device_notify(acpi_handle handle, 
u32 event, void *data)
 * TBD: Can also be disabled by Callback registration
 *  with generic sysfs driver
 */
-   if (acpi_memory_disable_device(mem_device))
-   printk(KERN_ERR PREFIX
-   "Disable memory device\n");
+   if (acpi_memory_disable_device(mem_device)) {
+   printk(KERN_ERR PREFIX "Disable memory device\n");
+   /*
+* If _EJ0 was called but failed, _OST is not
+* necessary.
+*/
+   if (mem_device->state == MEMORY_INVALID_STATE)
+   return;
+
+   break;
+   }
+
/*
 * TBD: Invoke acpi_bus_remove to cleanup data structures
 */
-   break;
+
+   /* _EJ0 succeeded; _OST is not necessary */
+   return;
+
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  "Unsupported event [0x%x]\n", event));
-   break;
+
+   /* non-hotplug event; possibly handled by other handler */
+   return;
}
 
+   /* Inform firmware that the hotplug operation has completed */
+   (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
return;
 }
 
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 19/52] drivers/thermal/spear_thermal.c: add Device Tree probing capability

2012-07-24 Thread Len Brown
From: Viresh Kumar 

SPEAr platforms now support DT and so must convert all drivers to support
DT.  This patch adds DT probing support for SPEAr thermal sensor driver
and updates its documentation too.

Also, as SPEAr is the only user of this driver and is only available with
DT, make this an only DT driver.  So, platform_data is completely removed
and passed via DT now.

Signed-off-by: Viresh Kumar 
Cc: Dan Carpenter 
Reviewed-by: Vincenzo Frascino 
Signed-off-by: Andrew Morton 
Signed-off-by: Len Brown 
---
 .../devicetree/bindings/thermal/spear-thermal.txt  | 14 
 drivers/thermal/Kconfig|  1 +
 drivers/thermal/spear_thermal.c| 26 +-
 include/linux/platform_data/spear_thermal.h| 26 --
 4 files changed, 31 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/spear-thermal.txt
 delete mode 100644 include/linux/platform_data/spear_thermal.h

diff --git a/Documentation/devicetree/bindings/thermal/spear-thermal.txt 
b/Documentation/devicetree/bindings/thermal/spear-thermal.txt
new file mode 100644
index 000..93e3b67
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/spear-thermal.txt
@@ -0,0 +1,14 @@
+* SPEAr Thermal
+
+Required properties:
+- compatible : "st,thermal-spear1340"
+- reg : Address range of the thermal registers
+- st,thermal-flags: flags used to enable thermal sensor
+
+Example:
+
+   thermal@fc00 {
+   compatible = "st,thermal-spear1340";
+   reg = <0xfc00 0x1000>;
+   st,thermal-flags = <0x7000>;
+   };
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 514a691..3ab2bd5 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -23,6 +23,7 @@ config SPEAR_THERMAL
bool "SPEAr thermal sensor driver"
depends on THERMAL
depends on PLAT_SPEAR
+   depends on OF
help
  Enable this to plug the SPEAr thermal sensor driver into the Linux
  thermal framework
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index c2e32df..ca40d36 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -20,9 +20,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 #include 
 
 #define MD_FACTOR  1000
@@ -103,21 +103,20 @@ static int spear_thermal_probe(struct platform_device 
*pdev)
 {
struct thermal_zone_device *spear_thermal = NULL;
struct spear_thermal_dev *stdev;
-   struct spear_thermal_pdata *pdata;
-   int ret = 0;
+   struct device_node *np = pdev->dev.of_node;
struct resource *stres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   int ret = 0, val;
+
+   if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
+   dev_err(&pdev->dev, "Failed: DT Pdata not passed\n");
+   return -EINVAL;
+   }
 
if (!stres) {
dev_err(&pdev->dev, "memory resource missing\n");
return -ENODEV;
}
 
-   pdata = dev_get_platdata(&pdev->dev);
-   if (!pdata) {
-   dev_err(&pdev->dev, "platform data is NULL\n");
-   return -EINVAL;
-   }
-
stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL);
if (!stdev) {
dev_err(&pdev->dev, "kzalloc fail\n");
@@ -144,7 +143,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
goto put_clk;
}
 
-   stdev->flags = pdata->thermal_flags;
+   stdev->flags = val;
writel_relaxed(stdev->flags, stdev->thermal_base);
 
spear_thermal = thermal_zone_device_register("spear_thermal", 0,
@@ -189,6 +188,12 @@ static int spear_thermal_exit(struct platform_device *pdev)
return 0;
 }
 
+static const struct of_device_id spear_thermal_id_table[] = {
+   { .compatible = "st,thermal-spear1340" },
+   {}
+};
+MODULE_DEVICE_TABLE(of, spear_thermal_id_table);
+
 static struct platform_driver spear_thermal_driver = {
.probe = spear_thermal_probe,
.remove = spear_thermal_exit,
@@ -196,6 +201,7 @@ static struct platform_driver spear_thermal_driver = {
.name = "spear_thermal",
.owner = THIS_MODULE,
.pm = &spear_thermal_pm_ops,
+   .of_match_table = of_match_ptr(spear_thermal_id_table),
},
 };
 
diff --git a/include/linux/platform_data/spear_thermal.h 
b/include/linux/platform_data/spear_thermal.h
deleted file mode 100644
index 724f2e1..000
--- a/include/linux/platform_data/spear_thermal.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SPEAr thermal driver platform data.
- *
- * Copyright (C) 2011-2012 ST Microelectronics
- * Author: Vincenzo Frascino 
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundati

[PATCH 15/52] cpuidle: refactor out cpuidle_enter_state

2012-07-24 Thread Len Brown
From: Colin Cross 

Split the code to enter a state and update the stats into a helper
function, cpuidle_enter_state, and export it.  This function will
be called by the coupled state code to handle entering the safe
state and the final coupled state.

Reviewed-by: Santosh Shilimkar 
Tested-by: Santosh Shilimkar 
Reviewed-by: Kevin Hilman 
Tested-by: Kevin Hilman 
Signed-off-by: Colin Cross 
Reviewed-by: Rafael J. Wysocki 
Signed-off-by: Len Brown 
---
 drivers/cpuidle/cpuidle.c | 42 +-
 drivers/cpuidle/cpuidle.h |  2 ++
 2 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 2f0083a..3e3e3e4 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -103,6 +103,34 @@ int cpuidle_play_dead(void)
 }
 
 /**
+ * cpuidle_enter_state - enter the state and update stats
+ * @dev: cpuidle device for this cpu
+ * @drv: cpuidle driver for this cpu
+ * @next_state: index into drv->states of the state to enter
+ */
+int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
+   int next_state)
+{
+   int entered_state;
+
+   entered_state = cpuidle_enter_ops(dev, drv, next_state);
+
+   if (entered_state >= 0) {
+   /* Update cpuidle counters */
+   /* This can be moved to within driver enter routine
+* but that results in multiple copies of same code.
+*/
+   dev->states_usage[entered_state].time +=
+   (unsigned long long)dev->last_residency;
+   dev->states_usage[entered_state].usage++;
+   } else {
+   dev->last_residency = 0;
+   }
+
+   return entered_state;
+}
+
+/**
  * cpuidle_idle_call - the main idle loop
  *
  * NOTE: no locks or semaphores should be used here
@@ -143,23 +171,11 @@ int cpuidle_idle_call(void)
trace_power_start_rcuidle(POWER_CSTATE, next_state, dev->cpu);
trace_cpu_idle_rcuidle(next_state, dev->cpu);
 
-   entered_state = cpuidle_enter_ops(dev, drv, next_state);
+   entered_state = cpuidle_enter_state(dev, drv, next_state);
 
trace_power_end_rcuidle(dev->cpu);
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
 
-   if (entered_state >= 0) {
-   /* Update cpuidle counters */
-   /* This can be moved to within driver enter routine
-* but that results in multiple copies of same code.
-*/
-   dev->states_usage[entered_state].time +=
-   (unsigned long long)dev->last_residency;
-   dev->states_usage[entered_state].usage++;
-   } else {
-   dev->last_residency = 0;
-   }
-
/* give the governor an opportunity to reflect on the outcome */
if (cpuidle_curr_governor->reflect)
cpuidle_curr_governor->reflect(dev, entered_state);
diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
index 7db1866..d8a3ccc 100644
--- a/drivers/cpuidle/cpuidle.h
+++ b/drivers/cpuidle/cpuidle.h
@@ -14,6 +14,8 @@ extern struct list_head cpuidle_detected_devices;
 extern struct mutex cpuidle_lock;
 extern spinlock_t cpuidle_driver_lock;
 extern int cpuidle_disabled(void);
+extern int cpuidle_enter_state(struct cpuidle_device *dev,
+   struct cpuidle_driver *drv, int next_state);
 
 /* idle loop */
 extern void cpuidle_install_idle_handler(void);
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 16/52] cpuidle: fix error handling in __cpuidle_register_device

2012-07-24 Thread Len Brown
From: Colin Cross 

Fix the error handling in __cpuidle_register_device to include
the missing list_del.  Move it to a label, which will simplify
the error handling when coupled states are added.

Reviewed-by: Santosh Shilimkar 
Tested-by: Santosh Shilimkar 
Reviewed-by: Kevin Hilman 
Tested-by: Kevin Hilman 
Signed-off-by: Colin Cross 
Reviewed-by: Rafael J. Wysocki 
Signed-off-by: Len Brown 
---
 drivers/cpuidle/cpuidle.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 3e3e3e4..4540672 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -403,13 +403,18 @@ static int __cpuidle_register_device(struct 
cpuidle_device *dev)
 
per_cpu(cpuidle_devices, dev->cpu) = dev;
list_add(&dev->device_list, &cpuidle_detected_devices);
-   if ((ret = cpuidle_add_sysfs(cpu_dev))) {
-   module_put(cpuidle_driver->owner);
-   return ret;
-   }
+   ret = cpuidle_add_sysfs(cpu_dev);
+   if (ret)
+   goto err_sysfs;
 
dev->registered = 1;
return 0;
+
+err_sysfs:
+   list_del(&dev->device_list);
+   per_cpu(cpuidle_devices, dev->cpu) = NULL;
+   module_put(cpuidle_driver->owner);
+   return ret;
 }
 
 /**
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: iASL: Improved pathname support

2012-07-24 Thread Len Brown
From: Bob Moore 

For include files, merge the prefix pathname with the file
pathname.  Convert backslashes in all pathnames to forward
slashes, for readability.  Include file pathname changes affect
both #include and Include() type operators.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/acutils.h |  2 ++
 drivers/acpi/acpica/utmisc.c  | 29 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 925ccf2..5035327 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -460,6 +460,8 @@ acpi_ut_short_divide(u64 in_dividend,
 /*
  * utmisc
  */
+void ut_convert_backslashes(char *pathname);
+
 const char *acpi_ut_validate_exception(acpi_status status);
 
 u8 acpi_ut_is_pci_root_bridge(char *id);
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 86f19db..e86f897 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -52,6 +52,34 @@ ACPI_MODULE_NAME("utmisc")
 
 
/***
  *
+ * FUNCTION:ut_convert_backslashes
+ *
+ * PARAMETERS:  Pathname- File pathname string to be converted
+ *
+ * RETURN:  Modifies the input Pathname
+ *
+ * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within
+ *  the entire input file pathname string.
+ *
+ 
**/
+void ut_convert_backslashes(char *pathname)
+{
+
+   if (!pathname) {
+   return;
+   }
+
+   while (*pathname) {
+   if (*pathname == '\\') {
+   *pathname = '/';
+   }
+
+   pathname++;
+   }
+}
+
+/***
+ *
  * FUNCTION:acpi_ut_validate_exception
  *
  * PARAMETERS:  Status   - The acpi_status code to be formatted
@@ -63,6 +91,7 @@ ACPI_MODULE_NAME("utmisc")
  *  an ASCII string.
  *
  
**/
+
 const char *acpi_ut_validate_exception(acpi_status status)
 {
u32 sub_status;
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: ACPI 5/iASL: Add support for PCC keyword

2012-07-24 Thread Len Brown
From: Bob Moore 

Adds support for the PCC keyword for the Register() resource
descriptor macro.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 include/acpi/actypes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 0339a2d..376c9ed 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -728,8 +728,9 @@ typedef u8 acpi_adr_space_type;
 #define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
 #define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8
 #define ACPI_ADR_SPACE_GSBUS(acpi_adr_space_type) 9
+#define ACPI_ADR_SPACE_PLATFORM_COMM(acpi_adr_space_type) 10
 
-#define ACPI_NUM_PREDEFINED_REGIONS 10
+#define ACPI_NUM_PREDEFINED_REGIONS 11
 
 /*
  * Special Address Spaces
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: Disassembler: Add support for Operation Region externals

2012-07-24 Thread Len Brown
From: Bob Moore 

Adds missing support for operation regions defined in another
table, but referenced via a Field or BankField operator. Generate
the correct External statement.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/dsfield.c | 81 +++
 1 file changed, 81 insertions(+)

diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index cd243cf..8098439 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -53,11 +53,79 @@
 ACPI_MODULE_NAME("dsfield")
 
 /* Local prototypes */
+#ifdef ACPI_ASL_COMPILER
+#include "acdisasm.h"
+static acpi_status
+acpi_ds_create_external_region(acpi_status lookup_status,
+  union acpi_parse_object *op,
+  char *path,
+  struct acpi_walk_state *walk_state,
+  struct acpi_namespace_node **node);
+#endif
+
 static acpi_status
 acpi_ds_get_field_names(struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg);
 
+#ifdef ACPI_ASL_COMPILER
+/***
+ *
+ * FUNCTION:acpi_ds_create_external_region (i_aSL Disassembler only)
+ *
+ * PARAMETERS:  lookup_status   - Status from ns_lookup operation
+ *  Op  - Op containing the Field definition and args
+ *  Path- Pathname of the region
+ *  `   walk_state  - Current method state
+ *  Node- Where the new region node is returned
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
+ *  region node/object.
+ *
+ 
**/
+
+static acpi_status
+acpi_ds_create_external_region(acpi_status lookup_status,
+  union acpi_parse_object *op,
+  char *path,
+  struct acpi_walk_state *walk_state,
+  struct acpi_namespace_node **node)
+{
+   acpi_status status;
+   union acpi_operand_object *obj_desc;
+
+   if (lookup_status != AE_NOT_FOUND) {
+   return (lookup_status);
+   }
+
+   /*
+* Table disassembly:
+* operation_region not found. Generate an External for it, and
+* insert the name into the namespace.
+*/
+   acpi_dm_add_to_external_list(op, path, ACPI_TYPE_REGION, 0);
+   status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION,
+   ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
+   walk_state, node);
+   if (ACPI_FAILURE(status)) {
+   return (status);
+   }
+
+   /* Must create and install a region object for the new node */
+
+   obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
+   if (!obj_desc) {
+   return (AE_NO_MEMORY);
+   }
+
+   obj_desc->region.node = *node;
+   status = acpi_ns_attach_object(*node, obj_desc, ACPI_TYPE_REGION);
+   return (status);
+}
+#endif
+
 
/***
  *
  * FUNCTION:acpi_ds_create_buffer_field
@@ -413,12 +481,19 @@ acpi_ds_create_field(union acpi_parse_object *op,
/* First arg is the name of the parent op_region (must already exist) */
 
arg = op->common.value.arg;
+
if (!region_node) {
status =
acpi_ns_lookup(walk_state->scope_info,
   arg->common.value.name, ACPI_TYPE_REGION,
   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
   walk_state, ®ion_node);
+#ifdef ACPI_ASL_COMPILER
+   status = acpi_ds_create_external_region(status, arg,
+   arg->common.value.name,
+   walk_state,
+   ®ion_node);
+#endif
if (ACPI_FAILURE(status)) {
ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
return_ACPI_STATUS(status);
@@ -591,6 +666,12 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
   arg->common.value.name, ACPI_TYPE_REGION,
   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
   walk_state, ®ion_node);
+#ifdef ACPI_ASL_COMPILER
+   status = acpi_ds_create_external_region(status, arg,
+   arg->common.value.name,
+

[PATCH 39/52] ACPICA: Table manager: deploy new firmware error/warning interfaces

2012-07-24 Thread Len Brown
From: Bob Moore 

Emit firmware error/warning messages where appropriate for table
and FADT errors.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/tbfadt.c   | 102 +
 drivers/acpi/acpica/tbinstal.c |  15 +++---
 drivers/acpi/acpica/tbutils.c  |  34 --
 drivers/acpi/acpica/tbxfroot.c |   2 +-
 4 files changed, 80 insertions(+), 73 deletions(-)

diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index d919f40..b3e3fd03 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -303,11 +303,11 @@ void acpi_tb_create_local_fadt(struct acpi_table_header 
*table, u32 length)
 * a warning.
 */
if (length > sizeof(struct acpi_table_fadt)) {
-   ACPI_WARNING((AE_INFO,
- "FADT (revision %u) is longer than ACPI 5.0 
version, "
- "truncating length %u to %u",
- table->revision, length,
- (u32)sizeof(struct acpi_table_fadt)));
+   ACPI_BIOS_WARNING((AE_INFO,
+  "FADT (revision %u) is longer than ACPI 5.0 
version, "
+  "truncating length %u to %u",
+  table->revision, length,
+  (u32)sizeof(struct acpi_table_fadt)));
}
 
/* Clear the entire local FADT */
@@ -452,11 +452,13 @@ static void acpi_tb_convert_fadt(void)
 * they must match.
 */
if (address64->address && address32 &&
-   (address64->address != (u64) address32)) {
-   ACPI_ERROR((AE_INFO,
-   "32/64X address mismatch in %s: 
0x%8.8X/0x%8.8X%8.8X, using 32",
-   fadt_info_table[i].name, address32,
-   ACPI_FORMAT_UINT64(address64->address)));
+   (address64->address != (u64)address32)) {
+   ACPI_BIOS_ERROR((AE_INFO,
+"32/64X address mismatch in FADT/%s: "
+"0x%8.8X/0x%8.8X%8.8X, using 32",
+fadt_info_table[i].name, address32,
+ACPI_FORMAT_UINT64(address64->
+   address)));
}
 
/* Always use 32-bit address if it is valid (non-null) */
@@ -511,25 +513,25 @@ static void acpi_tb_validate_fadt(void)
 * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT 
tables.
 */
if (acpi_gbl_FADT.facs &&
-   (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) {
-   ACPI_WARNING((AE_INFO,
- "32/64X FACS address mismatch in FADT - "
- "0x%8.8X/0x%8.8X%8.8X, using 32",
- acpi_gbl_FADT.facs,
- ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs)));
-
-   acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs;
+   (acpi_gbl_FADT.Xfacs != (u64)acpi_gbl_FADT.facs)) {
+   ACPI_BIOS_WARNING((AE_INFO,
+  "32/64X FACS address mismatch in FADT - "
+  "0x%8.8X/0x%8.8X%8.8X, using 32",
+  acpi_gbl_FADT.facs,
+  ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs)));
+
+   acpi_gbl_FADT.Xfacs = (u64)acpi_gbl_FADT.facs;
}
 
if (acpi_gbl_FADT.dsdt &&
-   (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) {
-   ACPI_WARNING((AE_INFO,
- "32/64X DSDT address mismatch in FADT - "
- "0x%8.8X/0x%8.8X%8.8X, using 32",
- acpi_gbl_FADT.dsdt,
- ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt)));
-
-   acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt;
+   (acpi_gbl_FADT.Xdsdt != (u64)acpi_gbl_FADT.dsdt)) {
+   ACPI_BIOS_WARNING((AE_INFO,
+  "32/64X DSDT address mismatch in FADT - "
+  "0x%8.8X/0x%8.8X%8.8X, using 32",
+  acpi_gbl_FADT.dsdt,
+  ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt)));
+
+   acpi_gbl_FADT.Xdsdt = (u64)acpi_gbl_FADT.dsdt;
}
 
/* If Hardware Reduced flag is set, we are all done */
@@ -559,10 +561,10 @@ static void acpi_tb_validate_fadt(void)
 */
if (address64->address &&
(address64->bit_width != ACPI_MUL_8(length))) {
-   ACPI_WARNING((AE_INFO,
- "32/64X length mism

[PATCH 40/52] ACPICA: Fix some comment fields

2012-07-24 Thread Len Brown
From: Bob Moore 

No functional change. Fixes some typos and linux divergences.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/acmacros.h | 4 ++--
 drivers/acpi/acpica/acobject.h | 4 ++--
 drivers/acpi/acpica/exprep.c   | 4 ++--
 drivers/acpi/acpica/exresolv.c | 2 +-
 drivers/acpi/acpica/exstore.c  | 4 ++--
 drivers/acpi/acpica/exutils.c  | 2 +-
 drivers/acpi/acpica/rscreate.c | 6 +++---
 drivers/acpi/acpica/utglobal.c | 5 +++--
 drivers/acpi/acpica/utobject.c | 6 +++---
 9 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index f119f47..087b466 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -283,8 +283,8 @@
 #define ACPI_INSERT_BITS(target, mask, source)  target = ((target & 
(~(mask))) | (source & mask))
 
 /*
- * A struct acpi_namespace_node can appear in some contexts
- * where a pointer to a union acpi_operand_object can also
+ * An object of type struct acpi_namespace_node can appear in some contexts
+ * where a pointer to an object of type union acpi_operand_object can also
  * appear. This macro is used to distinguish them.
  *
  * The "Descriptor" field is the first field in both structures.
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 39a2b84..b85802d 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -113,8 +113,8 @@ struct acpi_object_integer {
 };
 
 /*
- * Note: The String and Buffer object must be identical through the Pointer
- * and length elements.  There is code that depends on this.
+ * Note: The String and Buffer object must be identical through the
+ * pointer and length elements. There is code that depends on this.
  *
  * Fields common to both Strings and Buffers
  */
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 30157f5..ae62038 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -395,8 +395,8 @@ acpi_ex_prep_common_field_object(union acpi_operand_object 
*obj_desc,
  *
  * RETURN:  Status
  *
- * DESCRIPTION: Construct a union acpi_operand_object of type def_field and
- *  connect it to the parent Node.
+ * DESCRIPTION: Construct an object of type union acpi_operand_object with a
+ *  subtype of def_field and connect it to the parent Node.
  *
  
**/
 
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index 6e335dc..c6f0ad4 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -147,7 +147,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object 
**stack_ptr,
 
stack_desc = *stack_ptr;
 
-   /* This is a union acpi_operand_object*/
+   /* This is an object of type union acpi_operand_object */
 
switch (stack_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE:
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index c6cf843..38c5048 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -62,8 +62,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object 
*val_desc,
  * FUNCTION:acpi_ex_store
  *
  * PARAMETERS:  *source_desc- Value to be stored
- *  *dest_desc  - Where to store it.  Must be an NS node
- *or a union acpi_operand_object of type
+ *  *dest_desc  - Where to store it. Must be an NS node
+ *or union acpi_operand_object of type
  *Reference;
  *  walk_state  - Current walk state
  *
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index eb6798b..7482400 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -109,7 +109,7 @@ void acpi_ex_enter_interpreter(void)
  *
  * DESCRIPTION: Reacquire the interpreter execution region from within the
  *  interpreter code. Failure to enter the interpreter region is a
- *  fatal system error. Used in  conjunction with
+ *  fatal system error. Used in conjunction with
  *  relinquish_interpreter
  *
  
**/
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 46d6eb3..311cbc4 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -190,8 +190,8 @@ acpi_rs_create_resource_list(union acpi_operand_object 
*aml_buffer,
  *
  * FUNCTION:acpi_rs_create_pci_routing_table
  *
- * PARAMETERS:  package_object  - Pointer to a union 
acpi_operand_object
- *package
+ * PARAMETERS:  package_object  - Pointer to a package contain

[PATCH 41/52] ACPICA: Add PCC address space to space ID decode function

2012-07-24 Thread Len Brown
From: Bob Moore 

ACPI 5.0 added PCC space ID.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/utdecode.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index c8c130c..28134ae 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -129,16 +129,17 @@ char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
 /* Region type decoding */
 
 const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
-   "SystemMemory",
-   "SystemIO",
-   "PCI_Config",
-   "EmbeddedControl",
-   "SMBus",
-   "SystemCMOS",
-   "PCIBARTarget",
-   "IPMI",
-   "GeneralPurposeIo",
-   "GenericSerialBus"
+   "SystemMemory", /* 0x00 */
+   "SystemIO", /* 0x01 */
+   "PCI_Config",   /* 0x02 */
+   "EmbeddedControl",  /* 0x03 */
+   "SMBus",/* 0x04 */
+   "SystemCMOS",   /* 0x05 */
+   "PCIBARTarget", /* 0x06 */
+   "IPMI", /* 0x07 */
+   "GeneralPurposeIo", /* 0x08 */
+   "GenericSerialBus", /* 0x09 */
+   "PCC"   /* 0x0A */
 };
 
 char *acpi_ut_get_region_name(u8 space_id)
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 42/52] ACPICA: Split file: tbxface.c -> tbxfload.c

2012-07-24 Thread Len Brown
From: Bob Moore 

Split out the table load functions in preparation for addition
of new interfaces.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/Makefile   |   1 +
 drivers/acpi/acpica/tbxface.c  | 165 +---
 drivers/acpi/acpica/tbxfload.c | 211 +
 3 files changed, 213 insertions(+), 164 deletions(-)
 create mode 100644 drivers/acpi/acpica/tbxfload.c

diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index fa9a7d5..0a1b343 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -134,6 +134,7 @@ acpi-y +=   \
tbinstal.o  \
tbutils.o   \
tbxface.o   \
+   tbxfload.o  \
tbxfroot.o
 
 acpi-y +=  \
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index abcc641..472a91c 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -1,7 +1,6 @@
 /**
  *
- * Module Name: tbxface - Public interfaces to the ACPI subsystem
- * ACPI table oriented interfaces
+ * Module Name: tbxface - ACPI table oriented external interfaces
  *
  */
 
@@ -51,11 +50,6 @@
 #define _COMPONENT  ACPI_TABLES
 ACPI_MODULE_NAME("tbxface")
 
-/* Local prototypes */
-static acpi_status acpi_tb_load_namespace(void);
-
-static int no_auto_ssdt;
-
 
/***
  *
  * FUNCTION:acpi_allocate_root_table
@@ -69,7 +63,6 @@ static int no_auto_ssdt;
  *  acpi_initialize_tables.
  *
  
**/
-
 acpi_status acpi_allocate_root_table(u32 initial_table_count)
 {
 
@@ -502,150 +495,6 @@ acpi_get_table_by_index(u32 table_index, struct 
acpi_table_header **table)
 
 ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)
 
-/***
- *
- * FUNCTION:acpi_tb_load_namespace
- *
- * PARAMETERS:  None
- *
- * RETURN:  Status
- *
- * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
- *  the RSDT/XSDT.
- *
- 
**/
-static acpi_status acpi_tb_load_namespace(void)
-{
-   acpi_status status;
-   u32 i;
-   struct acpi_table_header *new_dsdt;
-
-   ACPI_FUNCTION_TRACE(tb_load_namespace);
-
-   (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
-
-   /*
-* Load the namespace. The DSDT is required, but any SSDT and
-* PSDT tables are optional. Verify the DSDT.
-*/
-   if (!acpi_gbl_root_table_list.current_table_count ||
-   !ACPI_COMPARE_NAME(&
-  (acpi_gbl_root_table_list.
-   tables[ACPI_TABLE_INDEX_DSDT].signature),
-  ACPI_SIG_DSDT)
-   ||
-   ACPI_FAILURE(acpi_tb_verify_table
-(&acpi_gbl_root_table_list.
- tables[ACPI_TABLE_INDEX_DSDT]))) {
-   status = AE_NO_ACPI_TABLES;
-   goto unlock_and_exit;
-   }
-
-   /*
-* Save the DSDT pointer for simple access. This is the mapped memory
-* address. We must take care here because the address of the .Tables
-* array can change dynamically as tables are loaded at run-time. Note:
-* .Pointer field is not validated until after call to 
acpi_tb_verify_table.
-*/
-   acpi_gbl_DSDT =
-   acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer;
-
-   /*
-* Optionally copy the entire DSDT to local memory (instead of simply
-* mapping it.) There are some BIOSs that corrupt or replace the 
original
-* DSDT, creating the need for this option. Default is FALSE, do not 
copy
-* the DSDT.
-*/
-   if (acpi_gbl_copy_dsdt_locally) {
-   new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT);
-   if (new_dsdt) {
-   acpi_gbl_DSDT = new_dsdt;
-   }
-   }
-
-   /*
-* Save the original DSDT header for detection of table corruption
-* and/or replacement of the DSDT from outside the OS.
-*/
-   ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
-   sizeof(struct acpi_table_header));
-
-   (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
-
-   /* Load and parse tables */
-
-   status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node);
-   if (ACPI_FAILURE(status)) {
-   return_ACPI_STATUS(status);
-   }
-
-   /* Load any SSDT or PSDT tables. Note: Loop leaves

Re: [PATCH 0/4] ACPI: hotplug messages improvement

2012-07-24 Thread Yasuaki Ishimatsu
Hi Toshi,

2012/07/19 5:40, Toshi Kani wrote:
> This patchset improves logging messages for ACPI CPU, Memory, and
> Container hotplug notify handlers.  The patchset introduces a set of
> new macro interfaces, acpi_pr_(), and updates the notify
> handlers to use them.  acpi_pr_() appends "ACPI" prefix and
> ACPI object path to the messages.  This improves diagnostics in
> hotplug operations since it identifies an object that caused an
> issue in a log file.
>

The log message looks good to me.
But I could not understand when to use it instead of pr_{warn, info, ...}
or ACPI_{WARNING, INFO, ...}. Do you have the policy?

> ---
> This patchset applies on top of the patch below.
> 
> [PATCH] ACPI: Add ACPI CPU hot-remove support
> http://marc.info/?l=linux-acpi&m=134098193327362&w=2
> 
> ---
> Toshi Kani (4):
>   ACPI: Add acpi_pr_() interfaces
>   ACPI: Update CPU hotplug messages
>   ACPI: Update Memory hotplug messages
>   ACPI: Update Container hotplug messages

I think you need update other component, which are driver/acpi/{acpi_pad.c,
battery.c, button.c}. Do you have the plan to update them?

Thanks,
Yasuaki Ishimatsu

> ---
>   drivers/acpi/acpi_memhotplug.c  |   24 
>   drivers/acpi/container.c|6 +++---
>   drivers/acpi/processor_driver.c |   36 +---
>   drivers/acpi/utils.c|   32 
>   include/acpi/acpi_bus.h |   18 ++
>   5 files changed, 86 insertions(+), 30 deletions(-)
> 


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


[PATCH 46/52] ACPICA: Update to version 20120711

2012-07-24 Thread Len Brown
From: Bob Moore 

Version 20120711.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 9877432..2c744c7 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20120620
+#define ACPI_CA_VERSION 0x20120711
 
 #include "acconfig.h"
 #include "actypes.h"
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 47/52] tools/power: turbostat v2 - re-write for efficiency

2012-07-24 Thread Len Brown
From: Len Brown 

Measuring large profoundly-idle configurations
requires turbostat to be more lightweight.
Otherwise, the operation of turbostat itself
can interfere with the measurements.

This re-write makes turbostat topology aware.
Hardware is accessed in "topology order".
Redundant hardware accesses are deleted.
Redundant output is deleted.
Also, output is buffered and
local RDTSC use replaces remote MSR access for TSC.

>From a feature point of view, the output
looks different since redundant figures are absent.
Also, there are now -c and -p options -- to restrict
output to the 1st thread in each core, and the 1st
thread in each package, respectively.  This is helpful
to reduce output on big systems, where more detail
than the "-s" system summary is desired.
Finally, periodic mode output is now on stdout, not stderr.

Turbostat v2 is also slightly more robust in
handling run-time CPU online/offline events,
as it now checks the actual map of on-line cpus rather
than just the total number of on-line cpus.

Signed-off-by: Len Brown 
---
 tools/power/x86/turbostat/Makefile|1 +
 tools/power/x86/turbostat/turbostat.8 |   77 +-
 tools/power/x86/turbostat/turbostat.c | 1329 -
 3 files changed, 868 insertions(+), 539 deletions(-)

diff --git a/tools/power/x86/turbostat/Makefile 
b/tools/power/x86/turbostat/Makefile
index fd8e1f1..f856495 100644
--- a/tools/power/x86/turbostat/Makefile
+++ b/tools/power/x86/turbostat/Makefile
@@ -1,4 +1,5 @@
 turbostat : turbostat.c
+CFLAGS +=  -Wall
 
 clean :
rm -f turbostat
diff --git a/tools/power/x86/turbostat/turbostat.8 
b/tools/power/x86/turbostat/turbostat.8
index adf175f..74e4450 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -27,7 +27,11 @@ supports an "invariant" TSC, plus the APERF and MPERF MSRs.
 on processors that additionally support C-state residency counters.
 
 .SS Options
-The \fB-s\fP option prints only a 1-line summary for each sample interval.
+The \fB-s\fP option limits output to a 1-line system summary for each interval.
+.PP
+The \fB-c\fP option limits output to the 1st thread in each core.
+.PP
+The \fB-p\fP option limits output to the 1st thread in each package.
 .PP
 The \fB-v\fP option increases verbosity.
 .PP
@@ -65,19 +69,19 @@ Subsequent rows show per-CPU statistics.
 .nf
 [root@x980]# ./turbostat
 cor CPU%c0  GHz  TSC%c1%c3%c6   %pc3   %pc6
-  0.60 1.63 3.38   2.91   0.00  96.49   0.00  76.64
-  0   0   0.59 1.62 3.38   4.51   0.00  94.90   0.00  76.64
-  0   6   1.13 1.64 3.38   3.97   0.00  94.90   0.00  76.64
-  1   2   0.08 1.62 3.38   0.07   0.00  99.85   0.00  76.64
-  1   8   0.03 1.62 3.38   0.12   0.00  99.85   0.00  76.64
-  2   4   0.01 1.62 3.38   0.06   0.00  99.93   0.00  76.64
-  2  10   0.04 1.62 3.38   0.02   0.00  99.93   0.00  76.64
-  8   1   2.85 1.62 3.38  11.71   0.00  85.44   0.00  76.64
-  8   7   1.98 1.62 3.38  12.58   0.00  85.44   0.00  76.64
-  9   3   0.36 1.62 3.38   0.71   0.00  98.93   0.00  76.64
-  9   9   0.09 1.62 3.38   0.98   0.00  98.93   0.00  76.64
- 10   5   0.03 1.62 3.38   0.09   0.00  99.87   0.00  76.64
- 10  11   0.07 1.62 3.38   0.06   0.00  99.87   0.00  76.64
+  0.09 1.62 3.38   1.83   0.32  97.76   1.26  83.61
+  0   0   0.15 1.62 3.38  10.23   0.05  89.56   1.26  83.61
+  0   6   0.05 1.62 3.38  10.34
+  1   2   0.03 1.62 3.38   0.07   0.05  99.86
+  1   8   0.03 1.62 3.38   0.06
+  2   4   0.21 1.62 3.38   0.10   1.49  98.21
+  2  10   0.02 1.62 3.38   0.29
+  8   1   0.04 1.62 3.38   0.04   0.08  99.84
+  8   7   0.01 1.62 3.38   0.06
+  9   3   0.53 1.62 3.38   0.10   0.20  99.17
+  9   9   0.02 1.62 3.38   0.60
+ 10   5   0.01 1.62 3.38   0.02   0.04  99.92
+ 10  11   0.02 1.62 3.38   0.02
 .fi
 .SH SUMMARY EXAMPLE
 The "-s" option prints the column headers just once,
@@ -86,9 +90,10 @@ and then the one line system summary for each sample 
interval.
 .nf
 [root@x980]# ./turbostat -s
%c0  GHz  TSC%c1%c3%c6   %pc3   %pc6
-  0.61 1.89 3.38   5.95   0.00  93.44   0.00  66.33
-  0.52 1.62 3.38   6.83   0.00  92.65   0.00  61.11
-  0.62 1.92 3.38   5.47   0.00  93.91   0.00  67.31
+  0.23 1.67 3.38   2.00   0.30  97.47   1.07  82.12
+  0.10 1.62 3.38   1.87   2.25  95.77  12.02  72.60
+  0.20 1.64 3.38   1.98   0.11  97.72   0.30  83.36
+  0.11 1.70 3.38   1.86   1.81  96.22   9.71  74.90
 .fi
 .SH VERBOSE EXAMPLE
 The "-v" option adds verbosity to the output:
@@ -120,30 +125,28 @@ until ^C while the other CPUs are mostly idle:
 [root@x980 lenb]# ./turbostat cat /dev/zero > /dev/null
 ^C
 cor CPU%c0  GHz  TSC%c1%c3%c6   %pc3   %pc6
-  8.63 3.64 3.38  14.46   0.49  76.42   0.00   0.00
-  0   0   0.34 3.36 3.38  99.66   0.00   0.00   0.00   0.00
-  0   6  99.96 3.64 3.38   0.04   0.00   0.00   0.00   0.00
-  1   2   0.14 3.50 3.38   1.75   2.04  96.07   0.00   0.00
-  1   8   0.38 3.57 3.38   1.51   2.04  96.07   0.00  

[PATCH 52/52] Thermal: Documentation update

2012-07-24 Thread Len Brown
From: Zhang Rui 

With commit 6503e5df08008b9a47022b5e9ebba658c8fa69af,
the value of /sys/class/thermal/thermal_zoneX/mode has been changed
from user/kernel to enabled/disabled.
Update the documentation so that users won't be confused.

Signed-off-by: Zhang Rui 
Signed-off-by: Len Brown 
---
 Documentation/thermal/sysfs-api.txt | 20 ++--
 drivers/acpi/thermal.c  |  6 ++
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/Documentation/thermal/sysfs-api.txt 
b/Documentation/thermal/sysfs-api.txt
index 2ba4c9b..c087dbc 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -47,11 +47,11 @@ temperature) and throttle appropriate devices.
.bind: bind the thermal zone device with a thermal cooling device.
.unbind: unbind the thermal zone device with a thermal cooling device.
.get_temp: get the current temperature of the thermal zone.
-   .get_mode: get the current mode (user/kernel) of the thermal zone.
-   - "kernel" means thermal management is done in kernel.
-   - "user" will prevent kernel thermal driver actions upon trip points
+   .get_mode: get the current mode (enabled/disabled) of the thermal zone.
+   - "enabled" means the kernel thermal management is enabled.
+   - "disabled" will prevent kernel thermal driver action upon trip 
points
  so that user applications can take charge of thermal management.
-   .set_mode: set the mode (user/kernel) of the thermal zone.
+   .set_mode: set the mode (enabled/disabled) of the thermal zone.
.get_trip_type: get the type of certain trip point.
.get_trip_temp: get the temperature above which the certain trip point
will be fired.
@@ -170,14 +170,14 @@ temp
RO, Required
 
 mode
-   One of the predefined values in [kernel, user].
+   One of the predefined values in [enabled, disabled].
This file gives information about the algorithm that is currently
managing the thermal zone. It can be either default kernel based
algorithm or user space application.
-   kernel  = Thermal management in kernel thermal zone driver.
-   user= Preventing kernel thermal zone driver actions upon
- trip points so that user application can take full
- charge of the thermal management.
+   enabled = enable Kernel Thermal management.
+   disabled= Preventing kernel thermal zone driver actions upon
+ trip points so that user application can take full
+ charge of the thermal management.
RW, Optional
 
 trip_point_[0-*]_temp
@@ -256,7 +256,7 @@ method, the sys I/F structure will be built like this:
 |thermal_zone1:
 |---type:  acpitz
 |---temp:  37000
-|---mode:  kernel
+|---mode:  enabled
 |---trip_point_0_temp: 10
 |---trip_point_0_type: critical
 |---trip_point_1_temp: 8
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 2107d1b..8275e7b 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -550,8 +550,6 @@ static int thermal_get_temp(struct thermal_zone_device 
*thermal,
return 0;
 }
 
-static const char enabled[] = "kernel";
-static const char disabled[] = "user";
 static int thermal_get_mode(struct thermal_zone_device *thermal,
enum thermal_device_mode *mode)
 {
@@ -588,8 +586,8 @@ static int thermal_set_mode(struct thermal_zone_device 
*thermal,
if (enable != tz->tz_enabled) {
tz->tz_enabled = enable;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-   "%s ACPI thermal control\n",
-   tz->tz_enabled ? enabled : disabled));
+   "%s kernel ACPI thermal control\n",
+   tz->tz_enabled ? "Enable" : "Disable"));
acpi_thermal_check(tz);
}
return 0;
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 51/52] Thermal: Add Hysteresis attributes

2012-07-24 Thread Len Brown
From: Durgadoss R 

The Linux Thermal Framework does not support hysteresis
attributes. Most thermal sensors, today, have a
hysteresis value associated with trip points.

This patch adds hysteresis attributes on a per-trip-point
basis, to the Thermal Framework. These attributes are
optionally writable.

Signed-off-by: Durgadoss R 
Signed-off-by: Zhang Rui 
Signed-off-by: Len Brown 
---
 Documentation/thermal/sysfs-api.txt |  6 +++
 drivers/thermal/thermal_sys.c   | 88 ++---
 include/linux/thermal.h |  5 +++
 3 files changed, 94 insertions(+), 5 deletions(-)

diff --git a/Documentation/thermal/sysfs-api.txt 
b/Documentation/thermal/sysfs-api.txt
index 4c10593..2ba4c9b 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -121,6 +121,7 @@ Thermal zone device sys I/F, created once it's registered:
 |---mode:  Working mode of the thermal zone
 |---trip_point_[0-*]_temp: Trip point temperature
 |---trip_point_[0-*]_type: Trip point type
+|---trip_point_[0-*]_hyst: Hysteresis value for this trip point
 
 Thermal cooling device sys I/F, created once it's registered:
 /sys/class/thermal/cooling_device[0-*]:
@@ -190,6 +191,11 @@ trip_point_[0-*]_type
thermal zone.
RO, Optional
 
+trip_point_[0-*]_hyst
+   The hysteresis value for a trip point, represented as an integer
+   Unit: Celsius
+   RW, Optional
+
 cdev[0-*]
Sysfs link to the thermal cooling device node where the sys I/F
for cooling device throttling control represents.
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 5feb335..2d7a9fe 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -240,6 +240,52 @@ trip_point_temp_show(struct device *dev, struct 
device_attribute *attr,
 }
 
 static ssize_t
+trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   struct thermal_zone_device *tz = to_thermal_zone(dev);
+   int trip, ret;
+   unsigned long temperature;
+
+   if (!tz->ops->set_trip_hyst)
+   return -EPERM;
+
+   if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
+   return -EINVAL;
+
+   if (kstrtoul(buf, 10, &temperature))
+   return -EINVAL;
+
+   /*
+* We are not doing any check on the 'temperature' value
+* here. The driver implementing 'set_trip_hyst' has to
+* take care of this.
+*/
+   ret = tz->ops->set_trip_hyst(tz, trip, temperature);
+
+   return ret ? ret : count;
+}
+
+static ssize_t
+trip_point_hyst_show(struct device *dev, struct device_attribute *attr,
+   char *buf)
+{
+   struct thermal_zone_device *tz = to_thermal_zone(dev);
+   int trip, ret;
+   unsigned long temperature;
+
+   if (!tz->ops->get_trip_hyst)
+   return -EPERM;
+
+   if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
+   return -EINVAL;
+
+   ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
+
+   return ret ? ret : sprintf(buf, "%ld\n", temperature);
+}
+
+static ssize_t
 passive_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
 {
@@ -1091,21 +1137,29 @@ EXPORT_SYMBOL(thermal_zone_device_update);
 static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
 {
int indx;
+   int size = sizeof(struct thermal_attr) * tz->trips;
 
-   tz->trip_type_attrs =
-   kzalloc(sizeof(struct thermal_attr) * tz->trips, GFP_KERNEL);
+   tz->trip_type_attrs = kzalloc(size, GFP_KERNEL);
if (!tz->trip_type_attrs)
return -ENOMEM;
 
-   tz->trip_temp_attrs =
-   kzalloc(sizeof(struct thermal_attr) * tz->trips, GFP_KERNEL);
+   tz->trip_temp_attrs = kzalloc(size, GFP_KERNEL);
if (!tz->trip_temp_attrs) {
kfree(tz->trip_type_attrs);
return -ENOMEM;
}
 
-   for (indx = 0; indx < tz->trips; indx++) {
+   if (tz->ops->get_trip_hyst) {
+   tz->trip_hyst_attrs = kzalloc(size, GFP_KERNEL);
+   if (!tz->trip_hyst_attrs) {
+   kfree(tz->trip_type_attrs);
+   kfree(tz->trip_temp_attrs);
+   return -ENOMEM;
+   }
+   }
 
+
+   for (indx = 0; indx < tz->trips; indx++) {
/* create trip type attribute */
snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH,
 "trip_point_%d_type", indx);
@@ -1136,6 +1190,26 @@ static int create_trip_attrs(struct thermal_zone_device 
*tz, int mask)
 
device_create_file(&tz->device,
   &tz->trip_temp_attrs[indx].attr);
+
+   /* create Optional trip hyst attribute *

[PATCH 48/52] tools/power: turbostat: fix large c1% issue

2012-07-24 Thread Len Brown
From: Len Brown 

Under some conditions, c1% was displayed as very large number,
much higher than 100%.

c1% is not measured, it is derived as "that, which is left over"
from other counters.  However, the other counters are not collected
atomically, and so it is possible for c1% to be calaculagted as
a small negative number -- displayed as very large positive.

There was a check for mperf vs tsc for this already,
but it needed to also include the other counters
that are used to calculate c1.

Signed-off-by: Len Brown 
---
 tools/power/x86/turbostat/turbostat.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/power/x86/turbostat/turbostat.c 
b/tools/power/x86/turbostat/turbostat.c
index b815a12..861d771 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -444,6 +444,9 @@ delta_core(struct core_data *new, struct core_data *old)
old->c7 = new->c7 - old->c7;
 }
 
+/*
+ * old = new - old
+ */
 void
 delta_thread(struct thread_data *new, struct thread_data *old,
struct core_data *core_delta)
@@ -482,19 +485,20 @@ delta_thread(struct thread_data *new, struct thread_data 
*old,
 
 
/*
-* As mperf and tsc collection are not atomic,
-* it is possible for mperf's non-halted cycles
+* As counter collection is not atomic,
+* it is possible for mperf's non-halted cycles + idle states
 * to exceed TSC's all cycles: show c1 = 0% in that case.
 */
-   if (old->mperf > old->tsc)
+   if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > 
old->tsc)
old->c1 = 0;
else {
/* normal case, derive c1 */
old->c1 = old->tsc - old->mperf - core_delta->c3
- core_delta->c6 - core_delta->c7;
}
+
if (old->mperf == 0) {
-   if (verbose) fprintf(stderr, "cpu%d MPERF 0!\n", old->cpu_id);
+   if (verbose > 1) fprintf(stderr, "cpu%d MPERF 0!\n", 
old->cpu_id);
old->mperf = 1; /* divide by 0 protection */
}
 
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 49/52] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check

2012-07-24 Thread Len Brown
From: Lan Tianyu 

In the ac.c, power_supply_register()'s return value is not checked.

As a result, the driver's add() ops may return success
even though the device failed to initialize.

For example, some BIOS may describe two ACADs in the same DSDT.
The second ACAD device will fail to register,
but ACPI driver's add() ops returns sucessfully.
The ACPI device will receive ACPI notification and cause OOPS.

https://bugzilla.redhat.com/show_bug.cgi?id=772730

Signed-off-by: Lan Tianyu 
Cc: sta...@vger.kernel.org
Signed-off-by: Len Brown 
---
 drivers/acpi/ac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 6512b20..d1fcbc0 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_device *device)
ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property;
-   power_supply_register(&ac->device->dev, &ac->charger);
+   result = power_supply_register(&ac->device->dev, &ac->charger);
+   if (result)
+   goto end;
 
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
   acpi_device_name(device), acpi_device_bid(device),
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 50/52] Thermal: Make Thermal trip points writeable

2012-07-24 Thread Len Brown
From: Durgadoss R 

Some of the thermal drivers using the Generic Thermal Framework
require (all/some) trip points to be writeable. This patch makes
the trip point temperatures writeable on a per-trip point basis,
and modifies the required function call in thermal.c. This patch
also updates the Documentation to reflect the new change.

Signed-off-by: Durgadoss R 
Signed-off-by: Zhang Rui 
Signed-off-by: Len Brown 
---
 Documentation/thermal/sysfs-api.txt  |   4 +-
 drivers/acpi/thermal.c   |   4 +-
 drivers/platform/x86/acerhdf.c   |   2 +-
 drivers/platform/x86/intel_mid_thermal.c |   2 +-
 drivers/thermal/spear_thermal.c  |   2 +-
 drivers/thermal/thermal_sys.c| 145 +--
 include/linux/thermal.h  |  15 +++-
 7 files changed, 121 insertions(+), 53 deletions(-)

diff --git a/Documentation/thermal/sysfs-api.txt 
b/Documentation/thermal/sysfs-api.txt
index 1733ab9..4c10593 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -32,7 +32,8 @@ temperature) and throttle appropriate devices.
 
 1.1 thermal zone device interface
 1.1.1 struct thermal_zone_device *thermal_zone_device_register(char *name,
-   int trips, void *devdata, struct thermal_zone_device_ops *ops)
+   int trips, int mask, void *devdata,
+   struct thermal_zone_device_ops *ops)
 
 This interface function adds a new thermal zone device (sensor) to
 /sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the
@@ -40,6 +41,7 @@ temperature) and throttle appropriate devices.
 
 name: the thermal zone name.
 trips: the total number of trip points this thermal zone supports.
+mask: Bit string: If 'n'th bit is set, then trip point 'n' is writeable.
 devdata: device private data
 ops: thermal zone device call-backs.
.bind: bind the thermal zone device with a thermal cooling device.
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea..2107d1b 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -845,7 +845,7 @@ static int acpi_thermal_register_thermal_zone(struct 
acpi_thermal *tz)
 
if (tz->trips.passive.flags.valid)
tz->thermal_zone =
-   thermal_zone_device_register("acpitz", trips, tz,
+   thermal_zone_device_register("acpitz", trips, 0, tz,
 &acpi_thermal_zone_ops,
 tz->trips.passive.tc1,
 tz->trips.passive.tc2,
@@ -853,7 +853,7 @@ static int acpi_thermal_register_thermal_zone(struct 
acpi_thermal *tz)
 tz->polling_frequency*100);
else
tz->thermal_zone =
-   thermal_zone_device_register("acpitz", trips, tz,
+   thermal_zone_device_register("acpitz", trips, 0, tz,
 &acpi_thermal_zone_ops,
 0, 0, 0,
 tz->polling_frequency*100);
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 2fd9d36..39abb15 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -660,7 +660,7 @@ static int acerhdf_register_thermal(void)
if (IS_ERR(cl_dev))
return -EINVAL;
 
-   thz_dev = thermal_zone_device_register("acerhdf", 1, NULL,
+   thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
  &acerhdf_dev_ops, 0, 0, 0,
  (kernelmode) ? interval*1000 : 0);
if (IS_ERR(thz_dev))
diff --git a/drivers/platform/x86/intel_mid_thermal.c 
b/drivers/platform/x86/intel_mid_thermal.c
index 5ae9cd9..2b2c212 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -499,7 +499,7 @@ static int mid_thermal_probe(struct platform_device *pdev)
goto err;
}
pinfo->tzd[i] = thermal_zone_device_register(name[i],
-   0, td_info, &tzd_ops, 0, 0, 0, 0);
+   0, 0, td_info, &tzd_ops, 0, 0, 0, 0);
if (IS_ERR(pinfo->tzd[i])) {
kfree(td_info);
ret = PTR_ERR(pinfo->tzd[i]);
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index c2e32df..69a55d4 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -147,7 +147,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
stdev->flags = pdata->thermal_flags;
writel_relaxed(stdev->flags, stdev->thermal_base);
 
-   spear_thermal = ther

[PATCH 44/52] ACPICA: Update header files copyrights to 2012

2012-07-24 Thread Len Brown
From: Bob Moore 

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 include/acpi/acexcep.h  | 2 +-
 include/acpi/acnames.h  | 2 +-
 include/acpi/acoutput.h | 2 +-
 include/acpi/acpi.h | 2 +-
 include/acpi/acpiosxf.h | 2 +-
 include/acpi/acpixf.h   | 2 +-
 include/acpi/acrestyp.h | 2 +-
 include/acpi/actbl.h| 2 +-
 include/acpi/actbl1.h   | 2 +-
 include/acpi/actbl2.h   | 2 +-
 include/acpi/actbl3.h   | 2 +-
 include/acpi/actypes.h  | 2 +-
 include/acpi/platform/acenv.h   | 2 +-
 include/acpi/platform/acgcc.h   | 2 +-
 include/acpi/platform/aclinux.h | 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 0b5dcb6..1950344 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 38f5088..ef24d82 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index f1cb332..2457ac8 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index de39915..c433d5e 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index f3746f7..0650f5f 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -8,7 +8,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 079bb90..9877432 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 3506e39..2504091 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 8dea546..a629a01 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 71e747b..9ac26b4 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 58bdd05..34198bf2 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 201

[PATCH 37/52] ACPICA: Split exception code utilities to a new file, utexcep.c

2012-07-24 Thread Len Brown
From: Bob Moore 

Simplifies sharing of these functions.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/Makefile   |   1 +
 drivers/acpi/acpica/acglobal.h |   8 ---
 drivers/acpi/acpica/utdecode.c |  35 --
 drivers/acpi/acpica/utexcep.c  | 153 +
 drivers/acpi/acpica/utmisc.c   |  69 ---
 include/acpi/acexcep.h |   5 +-
 6 files changed, 157 insertions(+), 114 deletions(-)
 create mode 100644 drivers/acpi/acpica/utexcep.c

diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 793b8cc..fa9a7d5 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -140,6 +140,7 @@ acpi-y +=   \
utaddress.o \
utalloc.o   \
utcopy.o\
+   utexcep.o   \
utdebug.o   \
utdecode.o  \
utdelete.o  \
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 92fab6a..ce79100 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -326,14 +326,6 @@ extern const char 
*acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
 
 #endif
 
-/* Exception codes */
-
-extern char const *acpi_gbl_exception_names_env[];
-extern char const *acpi_gbl_exception_names_pgm[];
-extern char const *acpi_gbl_exception_names_tbl[];
-extern char const *acpi_gbl_exception_names_aml[];
-extern char const *acpi_gbl_exception_names_ctrl[];
-
 /*
  *
  * Namespace globals
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 6848499..c8c130c 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -49,41 +49,6 @@
 #define _COMPONENT  ACPI_UTILITIES
 ACPI_MODULE_NAME("utdecode")
 
-/***
- *
- * FUNCTION:acpi_format_exception
- *
- * PARAMETERS:  Status   - The acpi_status code to be formatted
- *
- * RETURN:  A string containing the exception text. A valid pointer is
- *  always returned.
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string
- *  It is here instead of utxface.c so it is always present.
- *
- 
**/
-const char *acpi_format_exception(acpi_status status)
-{
-   const char *exception = NULL;
-
-   ACPI_FUNCTION_ENTRY();
-
-   exception = acpi_ut_validate_exception(status);
-   if (!exception) {
-
-   /* Exception code was not recognized */
-
-   ACPI_ERROR((AE_INFO,
-   "Unknown exception code: 0x%8.8X", status));
-
-   exception = "UNKNOWN_STATUS_CODE";
-   }
-
-   return (ACPI_CAST_PTR(const char, exception));
-}
-
-ACPI_EXPORT_SYMBOL(acpi_format_exception)
-
 /*
  * Properties of the ACPI Object Types, both internal and external.
  * The table is indexed by values of acpi_object_type
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c
new file mode 100644
index 000..23b9894
--- /dev/null
+++ b/drivers/acpi/acpica/utexcep.c
@@ -0,0 +1,153 @@
+/***
+ *
+ * Module Name: utexcep - Exception code support
+ *
+ 
**/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions, and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *substantially similar to the "NO WARRANTY" disclaimer below
+ *("Disclaimer") and any redistribution must be conditioned upon
+ *including a substantially similar Disclaimer requirement for further
+ *binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *of any contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER

[PATCH 36/52] ACPI: acpi_pad: tune round_robin_time

2012-07-24 Thread Len Brown
From: Len Brown 

In an effort to be fair to bound processes,
acpi_pad periodically moves its forced-idle threads.

The default interval for moving the threads is 10 seconds.
Measurements show that reducing this to 1 second has no
power or performance impact, so reduce default to 1 second.

Signed-off-by: Len Brown 
---
 drivers/acpi/acpi_pad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 1c09e1b..f3e959f 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -144,7 +144,7 @@ static void exit_round_robin(unsigned int tsk_index)
 }
 
 static unsigned int idle_pct = 5; /* percentage */
-static unsigned int round_robin_time = 10; /* second */
+static unsigned int round_robin_time = 1; /* second */
 static int power_saving_thread(void *data)
 {
struct sched_param param = {.sched_priority = 1};
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 43/52] ACPICA: Add new ACPI table load/unload external interfaces

2012-07-24 Thread Len Brown
From: Bob Moore 

Add acpi_load_table and acpi_unload_parent_table to support
host-directed dynamic table load/unload. Intended to support
hotplug addition and removal of SSDTs.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/tbxface.c  |  42 --
 drivers/acpi/acpica/tbxfload.c | 178 +
 include/acpi/acpixf.h  |  13 ++-
 3 files changed, 187 insertions(+), 46 deletions(-)

diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 472a91c..9bf34f7 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -215,48 +215,6 @@ acpi_status acpi_reallocate_root_table(void)
 
 
/***
  *
- * FUNCTION:acpi_load_table
- *
- * PARAMETERS:  table_ptr   - pointer to a buffer containing the entire
- *table to be loaded
- *
- * RETURN:  Status
- *
- * DESCRIPTION: This function is called to load a table from the caller's
- *  buffer. The buffer must contain an entire ACPI Table including
- *  a valid header. The header fields will be verified, and if it
- *  is determined that the table is invalid, the call will fail.
- *
- 
**/
-acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
-{
-   acpi_status status;
-   u32 table_index;
-   struct acpi_table_desc table_desc;
-
-   if (!table_ptr)
-   return AE_BAD_PARAMETER;
-
-   ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
-   table_desc.pointer = table_ptr;
-   table_desc.length = table_ptr->length;
-   table_desc.flags = ACPI_TABLE_ORIGIN_UNKNOWN;
-
-   /*
-* Install the new table into the local data structures
-*/
-   status = acpi_tb_add_table(&table_desc, &table_index);
-   if (ACPI_FAILURE(status)) {
-   return status;
-   }
-   status = acpi_ns_load_table(table_index, acpi_gbl_root_node);
-   return status;
-}
-
-ACPI_EXPORT_SYMBOL(acpi_load_table)
-
-/***
- *
  * FUNCTION:acpi_get_table_header
  *
  * PARAMETERS:  Signature   - ACPI signature of needed table
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index 54a01ae..f87cc63 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -199,6 +199,184 @@ static acpi_status acpi_tb_load_namespace(void)
return_ACPI_STATUS(status);
 }
 
+/***
+ *
+ * FUNCTION:acpi_load_table
+ *
+ * PARAMETERS:  table   - Pointer to a buffer containing the ACPI
+ *table to be loaded.
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
+ *  be a valid ACPI table with a valid ACPI table header.
+ *  Note1: Mainly intended to support hotplug addition of SSDTs.
+ *  Note2: Does not copy the incoming table. User is reponsible
+ *  to ensure that the table is not deleted or unmapped.
+ *
+ 
**/
+
+acpi_status acpi_load_table(struct acpi_table_header *table)
+{
+   acpi_status status;
+   struct acpi_table_desc table_desc;
+   u32 table_index;
+
+   ACPI_FUNCTION_TRACE(acpi_load_table);
+
+   /* Parameter validation */
+
+   if (!table) {
+   return_ACPI_STATUS(AE_BAD_PARAMETER);
+   }
+
+   /* Init local table descriptor */
+
+   ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
+   table_desc.address = ACPI_PTR_TO_PHYSADDR(table);
+   table_desc.pointer = table;
+   table_desc.length = table->length;
+   table_desc.flags = ACPI_TABLE_ORIGIN_UNKNOWN;
+
+   /* Must acquire the interpreter lock during this operation */
+
+   status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
+   if (ACPI_FAILURE(status)) {
+   return_ACPI_STATUS(status);
+   }
+
+   /* Install the table and load it into the namespace */
+
+   ACPI_INFO((AE_INFO, "Host-directed Dynamic ACPI Table Load:"));
+   status = acpi_tb_add_table(&table_desc, &table_index);
+   if (ACPI_FAILURE(status)) {
+   goto unlock_and_exit;
+   }
+
+   status = acpi_ns_load_table(table_index, acpi_gbl_root_node);
+
+   /* Invoke table handler if present */
+
+   if (acpi_gbl_table_handler) {
+   (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table,
+acpi_gbl_table_handler_context);
+   }
+
+  unlock_and_exit:
+   (void)acpi_ut_re

[PATCH 35/52] ACPICA: Update to version 20120620

2012-07-24 Thread Len Brown
From: Bob Moore 

Version 20120620.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 381c940..18f023a 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20120518
+#define ACPI_CA_VERSION 0x20120620
 
 #include "acconfig.h"
 #include "actypes.h"
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 31/52] ACPICA: Disassembler: Emit descriptions for ACPI predefined names

2012-07-24 Thread Len Brown
From: Bob Moore 

For each predefined name, emit a short description within
a comment.

https://www.acpica.org/bugzilla/show_bug.cgi?id=959

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/acglobal.h |  8 
 drivers/acpi/acpica/aclocal.h  | 15 +++
 2 files changed, 23 insertions(+)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index dec7994..92fab6a 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -462,4 +462,12 @@ ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
 
 #endif /* ACPI_DEBUGGER */
 
+/*
+ *
+ * Info/help support
+ *
+ /
+
+extern const struct ah_predefined_name asl_predefined_info[];
+
 #endif /* __ACGLOBAL_H__ */
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 28f6778..af7330f 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -796,6 +796,7 @@ struct acpi_parse_state {
 #define ACPI_PARSEOP_IGNORE 0x01
 #define ACPI_PARSEOP_PARAMLIST  0x02
 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
+#define ACPI_PARSEOP_PREDEF_CHECKED 0x08
 #define ACPI_PARSEOP_SPECIAL0x10
 
 /*
@@ -1084,4 +1085,18 @@ struct acpi_debug_mem_block {
 #define ACPI_MEM_LIST_MAX   1
 #define ACPI_NUM_MEM_LISTS  2
 
+/*
+ *
+ * Info/help support
+ *
+ /
+
+struct ah_predefined_name {
+   char *name;
+   char *description;
+#ifndef ACPI_ASL_COMPILER
+   char *action;
+#endif
+};
+
 #endif /* __ACLOCAL_H__ */
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 29/52] ACPI: acpi_pad: rename "power_saving" thread to "acpi_pad" thread

2012-07-24 Thread Len Brown
From: Len Brown 

"acpi_pad/%d" is a better thread name than
generic "power_saving/%d" because users who see
these threads will know the name of the driver
that caused them.

Signed-off-by: Len Brown 
---
 drivers/acpi/acpi_pad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index a43fa1a..1c09e1b 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -234,7 +234,7 @@ static int create_power_saving_task(void)
 
ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
(void *)(unsigned long)ps_tsk_num,
-   "power_saving/%d", ps_tsk_num);
+   "acpi_pad/%d", ps_tsk_num);
rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0;
if (!rc)
ps_tsk_num++;
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 25/52] ACPI: Set hotplug _OST support bit to _OSC

2012-07-24 Thread Len Brown
From: Toshi Kani 

When ACPI_HOTPLUG_OST is defined, set hotplug _OST support bit
OSC_SB_HOTPLUG_OST_SUPPORT to indicate that the OS supports hotplug
_OST by calling the platform-wide ACPI Operating System Capabilities
(_OSC).

Signed-off-by: Toshi Kani 
Signed-off-by: Len Brown 
---
 drivers/acpi/bus.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 3188da3..3d4fc7a 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -548,6 +548,10 @@ static void acpi_bus_osc_support(void)
capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT;
 #endif
 
+#ifdef ACPI_HOTPLUG_OST
+   capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_HOTPLUG_OST_SUPPORT;
+#endif
+
if (!ghes_disable)
capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_APEI_SUPPORT;
if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 21/52] ACPI: Add _OST support for sysfs eject

2012-07-24 Thread Len Brown
From: Toshi Kani 

Changed acpi_bus_hot_remove_device() to support _OST. This function is
also changed to global so that it can be called from hotplug notify
handlers to perform hot-remove operation.

Changed acpi_eject_store(), which is the sysfs eject handler. It checks
eject_pending to see if the request was originated from ACPI eject
notification. If not, it calls _OST(0x103,84,) per Figure 6-37 in ACPI
5.0 spec.

Added eject_pending bit to acpi_device_flags. This bit is set when the
kernel has received an ACPI eject notification, but does not initiate
its hot-remove operation by itself.

Added struct acpi_eject_event. This structure is used to pass extended
information to acpi_bus_hot_remove_device(), which has a single argument
to support asynchronous call

Signed-off-by: Toshi Kani 
Signed-off-by: Len Brown 
---
 drivers/acpi/scan.c | 58 +
 include/acpi/acpi_bus.h |  9 +++-
 2 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 85cbfdc..bea3ab6 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -83,19 +83,29 @@ acpi_device_modalias_show(struct device *dev, struct 
device_attribute *attr, cha
 }
 static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
 
-static void acpi_bus_hot_remove_device(void *context)
+/**
+ * acpi_bus_hot_remove_device: hot-remove a device and its children
+ * @context: struct acpi_eject_event pointer (freed in this func)
+ *
+ * Hot-remove a device and its children. This function frees up the
+ * memory space passed by arg context, so that the caller may call
+ * this function asynchronously through acpi_os_hotplug_execute().
+ */
+void acpi_bus_hot_remove_device(void *context)
 {
+   struct acpi_eject_event *ej_event = (struct acpi_eject_event *) context;
struct acpi_device *device;
-   acpi_handle handle = context;
+   acpi_handle handle = ej_event->handle;
struct acpi_object_list arg_list;
union acpi_object arg;
acpi_status status = AE_OK;
+   u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
 
if (acpi_bus_get_device(handle, &device))
-   return;
+   goto err_out;
 
if (!device)
-   return;
+   goto err_out;
 
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Hot-removing device %s...\n", dev_name(&device->dev)));
@@ -103,7 +113,7 @@ static void acpi_bus_hot_remove_device(void *context)
if (acpi_bus_trim(device, 1)) {
printk(KERN_ERR PREFIX
"Removing device failed\n");
-   return;
+   goto err_out;
}
 
/* power off device */
@@ -129,10 +139,21 @@ static void acpi_bus_hot_remove_device(void *context)
 * TBD: _EJD support.
 */
status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
-   if (ACPI_FAILURE(status))
-   printk(KERN_WARNING PREFIX
-   "Eject device failed\n");
+   if (ACPI_FAILURE(status)) {
+   if (status != AE_NOT_FOUND)
+   printk(KERN_WARNING PREFIX
+   "Eject device failed\n");
+   goto err_out;
+   }
+
+   kfree(context);
+   return;
 
+err_out:
+   /* Inform firmware the hot-remove operation has completed w/ error */
+   (void) acpi_evaluate_hotplug_ost(handle,
+   ej_event->event, ost_code, NULL);
+   kfree(context);
return;
 }
 
@@ -144,6 +165,7 @@ acpi_eject_store(struct device *d, struct device_attribute 
*attr,
acpi_status status;
acpi_object_type type = 0;
struct acpi_device *acpi_device = to_acpi_device(d);
+   struct acpi_eject_event *ej_event;
 
if ((!count) || (buf[0] != '1')) {
return -EINVAL;
@@ -160,7 +182,25 @@ acpi_eject_store(struct device *d, struct device_attribute 
*attr,
goto err;
}
 
-   acpi_os_hotplug_execute(acpi_bus_hot_remove_device, 
acpi_device->handle);
+   ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
+   if (!ej_event) {
+   ret = -ENOMEM;
+   goto err;
+   }
+
+   ej_event->handle = acpi_device->handle;
+   if (acpi_device->flags.eject_pending) {
+   /* event originated from ACPI eject notification */
+   ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
+   acpi_device->flags.eject_pending = 0;
+   } else {
+   /* event originated from user */
+   ej_event->event = ACPI_OST_EC_OSPM_EJECT;
+   (void) acpi_evaluate_hotplug_ost(ej_event->handle,
+   ej_event->event, ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
+   }
+
+   acpi_os_hotplug_execute(acpi_bus_hot_remove_device, (void *)ej_event);
 err:
return ret;
 }
diff --git a/i

[PATCH 13/52] cpuidle: add checks to avoid NULL pointer dereference

2012-07-24 Thread Len Brown
From: "Srivatsa S. Bhat" 

The existing check for dev == NULL in __cpuidle_register_device() is
rendered useless because dev is dereferenced before the check itself.
Moreover, correctly speaking, it is the job of the callers of this
function, i.e., cpuidle_register_device() & cpuidle_enable_device() (which
also happen to be exported functions) to ensure that
__cpuidle_register_device() is called with a non-NULL dev.

So add the necessary dev == NULL checks in the two callers and remove the
(useless) check from __cpuidle_register_device().

Signed-off-by: Srivatsa S. Bhat 
Acked-by: Daniel Lezcano 
Signed-off-by: Andrew Morton 
Signed-off-by: Len Brown 
---
 drivers/cpuidle/cpuidle.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 588b44a..8ffef26 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -285,6 +285,9 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
int ret, i;
struct cpuidle_driver *drv = cpuidle_get_driver();
 
+   if (!dev)
+   return -EINVAL;
+
if (dev->enabled)
return 0;
if (!drv || !cpuidle_curr_governor)
@@ -369,8 +372,6 @@ static int __cpuidle_register_device(struct cpuidle_device 
*dev)
struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
 
-   if (!dev)
-   return -EINVAL;
if (!try_module_get(cpuidle_driver->owner))
return -EINVAL;
 
@@ -395,6 +396,9 @@ int cpuidle_register_device(struct cpuidle_device *dev)
 {
int ret;
 
+   if (!dev)
+   return -EINVAL;
+
mutex_lock(&cpuidle_lock);
 
if ((ret = __cpuidle_register_device(dev))) {
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: Update to version 20120518

2012-07-24 Thread Len Brown
From: Bob Moore 

Version string 20120518.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index a323a7c..381c940 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
 
 /* Current ACPICA subsystem version in MMDD format */
 
-#define ACPI_CA_VERSION 0x20120420
+#define ACPI_CA_VERSION 0x20120518
 
 #include "acconfig.h"
 #include "actypes.h"
-- 
1.7.12.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/52] ACPICA: Object dump routines: Use common function for string output

2012-07-24 Thread Len Brown
From: Bob Moore 

For ACPI string objects, always use the common string dump
function, acpi_ut_print_string. This function surrounds the string
with quotes and handles allowed escape sequences.

Signed-off-by: Bob Moore 
Signed-off-by: Lin Ming 
Signed-off-by: Len Brown 
---
 drivers/acpi/acpica/exdump.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 2a6ac0a..836fe76 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -926,9 +926,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object 
*obj_desc,
case ACPI_TYPE_STRING:
 
acpi_os_printf("[String] Value: ");
-   for (i = 0; i < obj_desc->string.length; i++) {
-   acpi_os_printf("%c", obj_desc->string.pointer[i]);
-   }
+   acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf("\n");
break;
 
-- 
1.7.12.rc0

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


ACPI & Power Management Patches for Linux-3.6-merge - part 1

2012-07-24 Thread Len Brown
Here is my initial queue of patches for Linux 3.6.
Please let me know if you see troubles with any of them.

thanks,
Len Brown, Intel Open Source Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 07/10] random: add new get_random_bytes_arch() function

2012-07-24 Thread H. Peter Anvin
For those who have read the Google+ thread[1] it is pretty clear that 
there are varying opinions on the idea of removing the RDRAND bypass.


I have gathered some performance numbers to make the debate more 
concrete: RDRAND is between 12 and 15 times faster than the current 
random pool system (for large and small blocks, respectively.)  Both the 
pool system and RDRAND scale perfectly with frequency, so the ratio is 
independent of P-states.


Given the discrepancy in performance (and presumably, in terms of power) 
I still very much believe it is a mistake to unconditionally disallow 
users the option for using RDRAND directly, but what I *do* believe we 
can all agree on is that security is paramount.  Dropping RDRAND is not 
just a performance loss but is likely a security loss since it will 
produce substantially less entropy.


As a compromise I offer the following patch; in terms of performance it 
is "the worst of both worlds" but it should provide the combined 
security of either; even if RDRAND is completely compromised by the NSA, 
Microsoft and the Illuminati all at once it will do no worse than the 
existing code, and (since RDRAND is so much faster than the existing 
code) it has only a modest performance cost.  More realistically, it 
will let many more users take advantage of a high entropy 
quick-reseeding random number generator, thus ending up with a major 
gain in security.


It is worth noting that although RDRAND by itself is adequate for any 
in-kernel users (and the 3.4-3.5 kernels use them as such unless you 
specify "nordrand"), this is not true for /dev/random; nor, due to 
abuse, /dev/urandom; the recently disclosed[2] RDSEED instruction, on 
the other hand, is defined to be fully entropic and can be used for any 
purpose; that one will be introduced in a later processor.


Note that the attached patch is way more conservative than it needs to 
be: every byte is mixed with RDRAND data twice on its way through (and 
an additional 1.2 byte is lost), as I moved the mixing to extract_buf(), 
but even so the overhead is modest, and mixing in extract_buf() makes 
the code quite a bit simpler.


This patch is on top of random.git.


[1] https://plus.google.com/115124063126128475540/posts/KbAEJKMsAfq

[2] http://software.intel.com/file/45207

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

>From b36c22b00c6bf8e91a758d3167e912b0ac4f0d0c Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" 
Date: Tue, 24 Jul 2012 14:48:56 -0700
Subject: [PATCH] random: mix in architectural randomness in extract_buf()

RDRAND is so much faster than the Linux pool system that we can
always just mix in architectural randomness.

Doing this in extract_buf() lets us do this in one convenient
place, unfortunately the output size (10 bytes) is maximally
awkward.  That, plus the fact that every output byte will have
passed through extract_buf() twice means we are not being very
efficient with the RDRAND use.

Measurements show that RDRAND is 12-15 times faster than the Linux
pool system.  Doing the math shows this corresponds to about an
11.5% slowdown which is confirmed by measurements.

Users who are very performance- or power-sensitive could definitely
still benefit from being allowed to use RDRAND directly, but I
believe this version should satisfy even the most hyper-paranoid
crowd.

Signed-off-by: H. Peter Anvin 
Cc: DJ Johnson 
---
 drivers/char/random.c |   56 -
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 9793b40..a4a24e4 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -277,6 +277,8 @@
 #define SEC_XFER_SIZE 512
 #define EXTRACT_SIZE 10
 
+#define LONGS(x) (((x) + sizeof(unsigned long) - 1)/sizeof(unsigned long))
+
 /*
  * The minimum number of bits of entropy before we wake up a read on
  * /dev/random.  Should be enough to do a significant reseed.
@@ -813,11 +815,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
  */
 static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
 {
-	union {
-		__u32	tmp[OUTPUT_POOL_WORDS];
-		long	hwrand[4];
-	} u;
-	int	i;
+	__u32	tmp[OUTPUT_POOL_WORDS];
 
 	if (r->pull && r->entropy_count < nbytes * 8 &&
 	r->entropy_count < r->poolinfo->POOLBITS) {
@@ -828,23 +826,17 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
 		/* pull at least as many as BYTES as wakeup BITS */
 		bytes = max_t(int, bytes, random_read_wakeup_thresh / 8);
 		/* but never more than the buffer size */
-		bytes = min_t(int, bytes, sizeof(u.tmp));
+		bytes = min_t(int, bytes, sizeof(tmp));
 
 		DEBUG_ENT("going to reseed %s with %d bits "
 			  "(%d of %d requested)\n",
 			  r->name, bytes * 8, nbytes * 8, r->entropy_count);
 
-		bytes = extract_entropy(r->pull, u.tmp, bytes,
+		bytes = extract_entropy(r->pull, tmp, bytes,
 	random_read_wak

Re: [RFC 0/2] virtio: provide a way for host to monitor critical events in the device

2012-07-24 Thread Rusty Russell
On Tue, 24 Jul 2012 15:01:59 +0200, Sasha Levin  wrote:
> virtio on it's own was introduced to help solve the fragmentation
> around virtualized devices, so I don't think that the main purpose of
> doing virtio drivers is due to any performance benefits virtio may
> provide.

There's one argument in your favor (with my Linaro hat on): ARM wants a
virtio reboot button, which would look remarkably similar.  There's no
standard ARM hardware for this.

So a more generalized virtio-event device might make sense.  But there
are almost an infinite number of guest events we might want: panics,
oom, low memory, stuck devices, deadlock, etc, etc.  I'm concerned about
trying to standardize them.  If we include a unspecified free-form
string, people will end up relying on the contents.  If we add a feature
bit for every new event, we'll end up running out of feature bits :)

CC'ing Amit for opinion over how much of this should be done via
virtio-serial.

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] virtio-blk: allow toggling host cache between writeback and writethrough

2012-07-24 Thread Rusty Russell
On Thu, 05 Jul 2012 09:02:23 +0200, Sasha Levin  wrote:
> On Thu, 2012-07-05 at 08:47 +0200, Paolo Bonzini wrote:
> > Il 04/07/2012 23:11, Sasha Levin ha scritto:
> > > There are two things going on here:
> > >  1. Rename VIRTIO_BLK_F_FLUSH to VIRTIO_BLK_F_WCE
> > >  2. Add a new VIRTIO_BLK_F_CONFIG_WCE
> > > 
> > > I'm concerned that the first change is going to break compilation for
> > > any code that included linux/virtio-blk.h and used VIRTIO_BLK_F_FLUSH.
> > 
> > That would be nlkt, right? :)
> 
> nlkt, lguest, and probably others.
> 
> linux/virtio_blk.h is a public kernel header, which is supposed to be
> used from userspace - so I assume many others who implemented virtio-blk
> for any reason took advantage of that header.

BTW, I have patched this myself now:

From: Rusty Russell 
Subject: virtio-blk: return VIRTIO_BLK_F_FLUSH to header.

This got renamed and clarified, but let's not break any userspace out there.

Signed-off-by: Rusty Russell 
---
 include/linux/virtio_blk.h |5 +
 1 file changed, 5 insertions(+)

diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -41,6 +41,11 @@
 #define VIRTIO_BLK_F_TOPOLOGY  10  /* Topology information is available */
 #define VIRTIO_BLK_F_CONFIG_WCE11  /* Writeback mode available in 
config */
 
+#ifndef __KERNEL__
+/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */
+#define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE
+#endif
+
 #define VIRTIO_BLK_ID_BYTES20  /* ID string length */
 
 struct virtio_blk_config {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/panel: fix checkpatch warnings

2012-07-24 Thread Toshiaki Yamane
Now checkpatch clean.

$ find drivers/staging/panel -name "*.[ch]"|xargs ./scripts/checkpatch.pl \
-f --terse --nosummary|cut -f3- -d":"|sort |uniq -c|sort -n

2  WARNING: Single statement macros should not use a do {} while (0) loop

Signed-off-by: Toshiaki Yamane 
---
 drivers/staging/panel/panel.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 39f9982..d9fec5b 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -137,8 +137,8 @@
 #define r_ctr(x)(parport_read_control((x)->port))
 #define r_dtr(x)(parport_read_data((x)->port))
 #define r_str(x)(parport_read_status((x)->port))
-#define w_ctr(x, y) do { parport_write_control((x)->port, (y)); } while (0)
-#define w_dtr(x, y) do { parport_write_data((x)->port, (y)); } while (0)
+#define w_ctr(x, y) (parport_write_control((x)->port, (y)))
+#define w_dtr(x, y) (parport_write_data((x)->port, (y)))
 
 /* this defines which bits are to be used and which ones to be ignored */
 /* logical or of the output bits involved in the scan matrix */
-- 
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: [Ilw] Re: 3.4-rc2, ilwagn still most of the time completely unusable

2012-07-24 Thread Norbert Preining
Hi Johannes,

Sorry for the late reply, I was travelling around the world ...
I have now tested the =2 and =4 settings at home, with the following
outcome:

On Do, 12 Jul 2012, Johannes Berg wrote:
> With the latest, I've extended 11n_disable to have more bits.
> 
> 11n_disable=1 will disable HT completely
> 11n_disable=2 will disable TX aggregation
> 11n_disable=4 will disable RX aggregation

11n_disabled=2:
lots of messages
  Open BA session requested for 00:0a:79:eb:56:10 tid 0
  BA request denied - HW unavailable for tid 0
and
  Rx BA session stop requested for 00:0a:79:eb:56:10 tid 0 inititator reason: 0
  Rx A-MPDU request on tid 0 result 0

Connection is stable for quite some time, but after 1-2 hours I got
a bad hang, grinding to a halt. pings to kernel.org gives 26% 
packet loss, but the rest of the packets are fast 130ms 

(Isn't that a strange thing - 25+% packet loss and all others are fast?)
I assume the packaet loss is related to the above messages.


11n_disabled=4:

lots of messages
  Rx A-MPDU request on tid 0 result -22
and at some point ping timeouts of 80+ secs (!) and then total hang
(as far as I remember)

Best wishes

Norbert

Norbert Preiningpreining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan TeX Live & Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094

PERRANZABULOE (n.)
One of those spray things used to wet ironing with.
--- Douglas Adams, The Meaning of Liff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] drivers/mmc/host: Add realtek sdmmc interface driver

2012-07-24 Thread wei_wang
From: Wei WANG 

Realtek SD/MMC card interface driver is used to access
SD/MMC card, with the help of Realtek card reader adapter driver.

Signed-off-by: Wei WANG 
---
 drivers/mmc/host/Kconfig  |7 +
 drivers/mmc/host/Makefile |2 +
 drivers/mmc/host/rtsx_sdmmc.c |  350 +
 3 files changed, 359 insertions(+)
 create mode 100644 drivers/mmc/host/rtsx_sdmmc.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index aa131b3..d9942e6 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -612,3 +612,10 @@ config MMC_USHC
 
  Note: These controllers only support SDIO cards and do not
  support MMC or SD memory cards.
+
+config MMC_REALTEK
+   tristate "Realtek SD/MMC Card Interface Driver"
+   depends on REALTEK_CR_CORE
+   help
+ Say Y here to include driver code to support the Realtek
+ SD/MMC card interface.
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 8922b06..a4cd15a 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -45,6 +45,8 @@ obj-$(CONFIG_MMC_JZ4740)  += jz4740_mmc.o
 obj-$(CONFIG_MMC_VUB300)   += vub300.o
 obj-$(CONFIG_MMC_USHC) += ushc.o
 
+obj-$(CONFIG_MMC_REALTEK)  += rtsx_sdmmc.o
+
 obj-$(CONFIG_MMC_SDHCI_PLTFM)  += sdhci-pltfm.o
 obj-$(CONFIG_MMC_SDHCI_CNS3XXX)+= sdhci-cns3xxx.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)  += sdhci-esdhc-imx.o
diff --git a/drivers/mmc/host/rtsx_sdmmc.c b/drivers/mmc/host/rtsx_sdmmc.c
new file mode 100644
index 000..3b587fc
--- /dev/null
+++ b/drivers/mmc/host/rtsx_sdmmc.c
@@ -0,0 +1,350 @@
+/* Realtek SD/MMC Card Interface driver
+ *
+ * Copyright(c) 2009 Realtek Semiconductor Corp. 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 as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see .
+ *
+ * Author:
+ *   Wei WANG 
+ *   No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define DRV_NAME   "rtsx_sdmmc"
+
+#define MAX_RW_REG_CNT 1024
+
+#define RTSX_MAX_BLOCK_COUNT   65536
+#define RTSX_MAX_BLOCK_LENGTH  2048
+
+struct realtek_sdmmc {
+   struct rtsx_dev *dev;
+   struct mmc_host *mmc;
+   struct mmc_request  *mrq;
+
+   struct mutexhost_mutex;
+
+   int eject;
+};
+
+static struct rtsx_device_id realtek_sdmmc_ids[] = {
+   {RTSX_TYPE_SD},
+   {}
+};
+
+MODULE_DEVICE_TABLE(rtsx, realtek_sdmmc_ids);
+
+static void sd_send_cmd_get_rsp(struct realtek_sdmmc *host,
+   struct mmc_command *cmd)
+{
+   cmd->error = rtsx_sdmmc_send_cmd_get_rsp(host->dev, (u8)cmd->opcode,
+   cmd->arg, mmc_resp_type(cmd), cmd->resp);
+}
+
+static int sd_rw_multi(struct realtek_sdmmc *host, struct mmc_request *mrq)
+{
+   struct mmc_host *mmc = host->mmc;
+   struct mmc_card *card = mmc->card;
+   struct mmc_data *data = mrq->data;
+   int uhs = mmc_sd_card_uhs(card);
+   int read = (data->flags & MMC_DATA_READ) ? 1 : 0;
+
+   return rtsx_sdmmc_rw_multi(host->dev, data->sg, data->blksz,
+   data->blocks, data->sg_len, read, uhs);
+}
+
+static void sd_normal_rw(struct realtek_sdmmc *host, struct mmc_request *mrq)
+{
+   struct mmc_command *cmd = mrq->cmd;
+   struct mmc_data *data = mrq->data;
+   u8 _cmd[5], *buf;
+
+   _cmd[0] = 0x40 | (u8)cmd->opcode;
+   put_unaligned_be32(cmd->arg, (u32 *)(&_cmd[1]));
+
+   buf = kzalloc(data->blksz, GFP_NOIO);
+   if (!buf) {
+   cmd->error = -ENOMEM;
+   return;
+   }
+
+   if (data->flags & MMC_DATA_READ) {
+   cmd->error = rtsx_sdmmc_read_data(host->dev, _cmd,
+   (u16)data->blksz, buf, data->blksz, 200);
+   sg_copy_from_buffer(data->sg, data->sg_len, buf, data->blksz);
+   } else {
+   sg_copy_to_buffer(data->sg, data->sg_len, buf, data->blksz);
+   cmd->error = rtsx_sdmmc_write_data(host->dev, _cmd,
+   (u16)data->blksz, buf, data->blksz, 200);
+   }
+
+   kfree(buf);
+}
+
+static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
+{
+   struct realtek_sdmmc *host = mmc_pr

[PATCH 1/3] drivers/misc: Add realtek card reader core driver

2012-07-24 Thread wei_wang
From: Wei WANG 

Realtek card reader core driver is the bus driver for Realtek
driver-based card reader, which supplies adapter layer to
be used by lower-level pci/usb card reader and upper-level
sdmmc/memstick host driver.

Signed-off-by: Wei WANG 
---
 Documentation/misc-devices/realtek_cr.txt |   27 ++
 drivers/misc/Kconfig  |1 +
 drivers/misc/Makefile |1 +
 drivers/misc/realtek_cr/Kconfig   |   26 ++
 drivers/misc/realtek_cr/Makefile  |7 +
 drivers/misc/realtek_cr/core/Kconfig  |6 +
 drivers/misc/realtek_cr/core/Makefile |1 +
 drivers/misc/realtek_cr/core/rtsx_core.c  |  492 +
 include/linux/rtsx_core.h |  180 +++
 9 files changed, 741 insertions(+)
 create mode 100644 Documentation/misc-devices/realtek_cr.txt
 create mode 100644 drivers/misc/realtek_cr/Kconfig
 create mode 100644 drivers/misc/realtek_cr/Makefile
 create mode 100644 drivers/misc/realtek_cr/core/Kconfig
 create mode 100644 drivers/misc/realtek_cr/core/Makefile
 create mode 100644 drivers/misc/realtek_cr/core/rtsx_core.c
 create mode 100644 include/linux/rtsx_core.h

diff --git a/Documentation/misc-devices/realtek_cr.txt 
b/Documentation/misc-devices/realtek_cr.txt
new file mode 100644
index 000..b4e6fbe
--- /dev/null
+++ b/Documentation/misc-devices/realtek_cr.txt
@@ -0,0 +1,27 @@
+Realtek Driver-based Card Reader
+
+
+Supported chips:
+RTS5209
+RTS5229
+
+Contact Email:
+pc_sw_li...@realsil.com.cn
+
+
+Description
+---
+
+Realtek driver-based card reader supports access to many types of memory cards,
+such as Memory Stick, Memory Stick Pro, Secure Digital and MultiMediaCard.
+
+
+udev rules
+--
+
+In order to modprobe Realtek SD/MMC interface driver automatically, the 
following rule
+should be added to the udev rules file:
+
+SUBSYSTEM=="rtsx_cr", ENV{RTSX_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv 
rtsx_sdmmc"
+
+Typically, we may edit /lib/udev/rules.d/80-drivers.rules and copy the rule 
into it in Ubuntu.
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 2661f6e..09ce905 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -517,4 +517,5 @@ source "drivers/misc/lis3lv02d/Kconfig"
 source "drivers/misc/carma/Kconfig"
 source "drivers/misc/altera-stapl/Kconfig"
 source "drivers/misc/mei/Kconfig"
+source "drivers/misc/realtek_cr/Kconfig"
 endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 456972f..c09f147 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -51,3 +51,4 @@ obj-y += carma/
 obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
 obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/
 obj-$(CONFIG_INTEL_MEI)+= mei/
+obj-$(CONFIG_REALTEK_CR_SUPPORT) += realtek_cr/
diff --git a/drivers/misc/realtek_cr/Kconfig b/drivers/misc/realtek_cr/Kconfig
new file mode 100644
index 000..303d98a
--- /dev/null
+++ b/drivers/misc/realtek_cr/Kconfig
@@ -0,0 +1,26 @@
+#
+# Realtek driver-based card reader
+#
+
+menuconfig REALTEK_CR_SUPPORT
+   tristate "Realtek driver-based card reader"
+   help
+ Realtek driver-based card reader supports access to many types of
+ memory cards, such as Memory Stick, Memory Stick Pro, Secure Digital
+ and MultiMediaCard.
+
+ If you want to use Realtek driver-based card reader, enable this
+ option and other options below.
+
+config REALTEK_CR_DEBUG
+   bool "Realtek driver-based card reader debugging"
+   depends on REALTEK_CR_SUPPORT != n
+   help
+ This is an option for use by developers; most people should
+ say N here.  This enables Realtek card reader driver debugging.
+
+if REALTEK_CR_SUPPORT
+
+source "drivers/misc/realtek_cr/core/Kconfig"
+
+endif
diff --git a/drivers/misc/realtek_cr/Makefile b/drivers/misc/realtek_cr/Makefile
new file mode 100644
index 000..f4e16ba
--- /dev/null
+++ b/drivers/misc/realtek_cr/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for Realtek driver-based card reader.
+#
+
+subdir-ccflags-$(CONFIG_REALTEK_CR_DEBUG) := -DDEBUG
+
+obj-$(CONFIG_REALTEK_CR_SUPPORT)   += core/
diff --git a/drivers/misc/realtek_cr/core/Kconfig 
b/drivers/misc/realtek_cr/core/Kconfig
new file mode 100644
index 000..5e9f14e
--- /dev/null
+++ b/drivers/misc/realtek_cr/core/Kconfig
@@ -0,0 +1,6 @@
+config REALTEK_CR_CORE
+   tristate "RealTek Card Reader Core Driver"
+   help
+ Say Y here to include driver code to support the Realtek
+ driver-based card reader.
+
diff --git a/drivers/misc/realtek_cr/core/Makefile 
b/drivers/misc/realtek_cr/core/Makefile
new file mode 100644
index 000..010055e
--- /dev/null
+++ b/drivers/misc/realtek_cr/core/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_REALTEK_CR_CORE)  += rtsx_core.o
diff --git a/drivers/misc/realtek_cr/core/rtsx_core.c 
b/drivers/misc/realtek_cr/core/rtsx_core.c
new file mode

  1   2   3   4   5   6   >