Re: [PATCH v2 1/6] staging: ft1000: spaces required around that '=', '<' and '=='

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:55:01AM +0530, Sudip Mukherjee wrote:
> On Fri, Oct 31, 2014 at 10:14:30PM -0700, Joe Perches wrote:
> > On Sat, 2014-11-01 at 10:35 +0530, Sudip Mukherjee wrote:
> > > On Sat, Nov 01, 2014 at 10:47:22AM +0800, Chen Weixiang wrote:
> > > > Remove following code style errors from ft1000/ft1000-usb/ft1000_debug.c
> > > > and ft1000/ft1000-pcmcia/ft1000_hw.c:
> > > > ERROR: spaces required around that '=' (ctx:VxV)
> > > > ERROR: spaces required around that '<' (ctx:VxV)
> > > > ERROR: spaces required around that '==' (ctx:VxV)
> > > > 
> > > 
> > > many whitespace errors in the patch.
> > > checkpatch gives total: 8 errors, 23 warnings, 125 lines checked
> > 
> > When fixing one thing (like spacing), it's pretty
> > expected to have more checkpatch errors.
> > 
> > It's a process, don't worry about most intermediate
> > warnings when doing checkpatch cleanups.
> > 
> > Adding trailing spaces is not good, nearly every
> > other type of message can be ignored.
> > 
> ok, just to verify, i thought of trying to generate a similar patch which 
> will not give checkpatch errors.
> but this patch is not applying to next-20141031.
> 
> thanks
> sudip
hi joe,
i did the similar cleanup and generated a patch, and like you said, it was 
giving error.
the original file has used spaces (instead of tabs) to indent the code, now to 
maintain similar indention
we have to introduce similar errors, or correct the indention of the full file.

looks like i have many things to learn from you, and your experience. few days 
back you told me about that printk thing,
now this one. thanks .. :)

sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 6/8] regulator: max77686: Add external GPIO control

2014-10-31 Thread Alexandre Courbot
On Fri, Oct 31, 2014 at 4:51 PM, Krzysztof Kozlowski
 wrote:
> On pią, 2014-10-31 at 12:31 +0900, Alexandre Courbot wrote:
>> On Fri, Oct 31, 2014 at 12:03 AM, Krzysztof Kozlowski
>>  wrote:
>> > On czw, 2014-10-30 at 22:56 +0900, Alexandre Courbot wrote:
>> >> Hi, and thanks for bringing this issue to us!
>> >>
>> >> On Wed, Oct 29, 2014 at 7:49 PM, Javier Martinez Canillas
>> >>  wrote:
>> >> > [adding Linus and Alexandre to the cc list]
>> >> >
>> >> > Hello Krzysztof,
>> >> >
>> >> > On 10/29/2014 11:42 AM, Krzysztof Kozlowski wrote:
>> >> >> On wto, 2014-10-28 at 13:11 +0100, Krzysztof Kozlowski wrote:
>> >> >>> On wto, 2014-10-28 at 09:52 +0100, Krzysztof Kozlowski wrote:
>> >> >>> > On pon, 2014-10-27 at 21:03 +0100, Javier Martinez Canillas wrote:
>> >> >>> > > Hello Krzysztof,
>> >> >>> > >
>> >> >>> > > On 10/27/2014 04:03 PM, Krzysztof Kozlowski wrote:
>> >> >>> > > > @@ -85,6 +91,9 @@ struct max77686_data {
>> >> >>> > > >struct max77686_regulator_data *regulators;
>> >> >>> > > >int num_regulators;
>> >> >>> > > >
>> >> >>> > > > +  /* Array of size num_regulators with GPIOs for external 
>> >> >>> > > > control. */
>> >> >>> > > > +  int *ext_control_gpio;
>> >> >>> > > > +
>> >> >>> > >
>> >> >>> > > The integer-based GPIO API is deprecated in favor of the 
>> >> >>> > > descriptor-based GPIO
>> >> >>> > > interface (Documentation/gpio/consumer.txt). Could you please use 
>> >> >>> > > the later?
>> >> >>> >
>> >> >>> > Sure, I can. Please have in mind that regulator core still accepts 
>> >> >>> > old
>> >> >>> > GPIO so I will have to use desc_to_gpio(). That should work... and
>> >> >>> > should be future-ready.
>> >> >>>
>> >> >>> It seems I was too hasty... I think usage of the new gpiod API implies
>> >> >>> completely different bindings.
>> >> >>>
>> >> >>> The gpiod_get() gets GPIO from a device level, not from given sub-node
>> >> >>> pointer. This means that you cannot have DTS like this:
>> >> >>> ldo21_reg: ldo21 {
>> >> >>>  regulator-compatible = "LDO21";
>> >> >>>  regulator-name = "VTF_2.8V";
>> >> >>>  regulator-min-microvolt = <280>;
>> >> >>>  regulator-max-microvolt = <280>;
>> >> >>>  ec-gpio = < 0 0>;
>> >> >>> };
>> >> >>>
>> >> >>> ldo22_reg: ldo22 {
>> >> >>>  regulator-compatible = "LDO22";
>> >> >>>  regulator-name = "VMEM_VDD_2.8V";
>> >> >>>  regulator-min-microvolt = <280>;
>> >> >>>  regulator-max-microvolt = <280>;
>> >> >>>  ec-gpio = < 2 0>;
>> >> >>> };
>> >> >>>
>> >> >>>
>> >> >>> I could put GPIOs in device node:
>> >> >>>
>> >> >>> max77686_pmic@09 {
>> >> >>>  compatible = "maxim,max77686";
>> >> >>>  interrupt-parent = <>;
>> >> >>>  interrupts = <7 0>;
>> >> >>>  reg = <0x09>;
>> >> >>>  #clock-cells = <1>;
>> >> >>>  ldo21-gpio = < 0 0>;
>> >> >>>  ldo22-gpio = < 2 0>;
>> >> >>>
>> >> >>>  ldo21_reg: ldo21 {
>> >> >>>  regulator-compatible = "LDO21";
>> >> >>>  regulator-name = "VTF_2.8V";
>> >> >>>  regulator-min-microvolt = <280>;
>> >> >>>  regulator-max-microvolt = <280>;
>> >> >>>  };
>> >> >>>
>> >> >>>  ldo22_reg: ldo22 {
>> >> >>>  regulator-compatible = "LDO22";
>> >> >>>  regulator-name = "VMEM_VDD_2.8V";
>> >> >>>  regulator-min-microvolt = <280>;
>> >> >>>  regulator-max-microvolt = <280>;
>> >> >>>  };
>> >> >>>
>> >> >>> This would work but I don't like it. The properties of a regulator are
>> >> >>> above the node configuring that regulator.
>> >> >>>
>> >> >>> Any ideas?
>> >> >>>
>> >> >>
>> >> >> Continuing talking to myself... I found another problem - GPIO cannot 
>> >> >> be
>> >> >> requested more than once (-EBUSY). In case of this driver (and board:
>> >> >> Trats2) one GPIO is connected to regulators. The legacy GPIO API and
>> >> >> regulator core handle this.
>> >> >>
>> >> >> With new GPIO API I would have to implement some additional steps in
>> >> >> such case...
>> >> >>
>> >> >> So there are 2 issues:
>> >> >> 1. Cannot put GPIO property in regulator node.
>> >>
>> >> For this problem you will probably want to use the
>> >> dev(m)_get_named_gpiod_from_child() function from the following patch:
>> >>
>> >> https://lkml.org/lkml/2014/10/6/529
>> >>
>> >> It should reach -next soon now.
>> >
>> > Thanks! Probably I would switch to "top" level gpios property anyway
>> > (other reasons) but it would be valuable in some cases to specify them
>> > per child node.
>>
>> Mmm, but doesn't it make more sense to have them in the child nodes?
>
> Yes, it makes more sense. Using old way of parsing regulators from DT it
> was straightforward.
>
> However new DT style parsing (regulator_of_get_init_data()) does the
> basic parsing stuff and this removes a lot of code from driver. The
> driver no longer parses all regulaotrs but the regulator core does it.
> Unfortunately regulator core does not parse 

[PATCH] soc: ti: knav_qmss_queue: Use list_for_each_entry_safe to prevent use after free

2014-10-31 Thread Axel Lin
list_for_each_entry_safe() is necessary if list objects are deleted from
the list while traversing it.

Signed-off-by: Axel Lin 
---
 drivers/soc/ti/knav_qmss_queue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 6f22d56..9b8dd67 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -1306,14 +1306,14 @@ static void knav_free_queue_ranges(struct knav_device 
*kdev)
 static void knav_queue_free_regions(struct knav_device *kdev)
 {
struct knav_region *region;
-   struct knav_pool *pool;
+   struct knav_pool *pool, *tmp;
unsigned size;
 
for (;;) {
region = first_region(kdev);
if (!region)
break;
-   list_for_each_entry(pool, >pools, region_inst)
+   list_for_each_entry_safe(pool, tmp, >pools, region_inst)
knav_pool_destroy(pool);
 
size = region->virt_end - region->virt_start;
-- 
1.9.1



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


Re: [PATCH v2 1/6] staging: ft1000: spaces required around that '=', '<' and '=='

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:55:01AM +0530, Sudip Mukherjee wrote:
> On Fri, Oct 31, 2014 at 10:14:30PM -0700, Joe Perches wrote:
> > On Sat, 2014-11-01 at 10:35 +0530, Sudip Mukherjee wrote:
> > > On Sat, Nov 01, 2014 at 10:47:22AM +0800, Chen Weixiang wrote:
> > > > Remove following code style errors from ft1000/ft1000-usb/ft1000_debug.c
> > > > and ft1000/ft1000-pcmcia/ft1000_hw.c:
> > > > ERROR: spaces required around that '=' (ctx:VxV)
> > > > ERROR: spaces required around that '<' (ctx:VxV)
> > > > ERROR: spaces required around that '==' (ctx:VxV)
> > > > 
> > > 
> > > many whitespace errors in the patch.
> > > checkpatch gives total: 8 errors, 23 warnings, 125 lines checked
> > 
> > When fixing one thing (like spacing), it's pretty
> > expected to have more checkpatch errors.
> > 
> > It's a process, don't worry about most intermediate
> > warnings when doing checkpatch cleanups.
> > 
> > Adding trailing spaces is not good, nearly every
> > other type of message can be ignored.
> > 
> ok, just to verify, i thought of trying to generate a similar patch which 
> will not give checkpatch errors.
> but this patch is not applying to next-20141031.
> 
> thanks
> sudip

looks like Nicky Chorley has already done part of this cleanup and it was also 
applied on 26/10/2014.

thanks
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [RFD] perf syscall error handling

2014-10-31 Thread Vince Weaver
On Fri, 31 Oct 2014, Stephane Eranian wrote:

> On Fri, Oct 31, 2014 at 1:28 PM, Matt Fleming  wrote:
> >
> > I guess we'd run into a problem if userspace doesn't want to just print
> > the kernel string but instead wants to parse it in some fashion.

If the string interface went in it would be a help when debugging 
perf_event_open().

Support would probably get added to PAPI, but PAPI has its own error 
reporting issues and it's not always easy to pass a string the whole way 
back to the user.

Also with PAPI many of the users reporting obscure perf_event_open() 
problems are often running 2.6.32-vendor-patched kernels, so sadly it will 
be years before any improved error handling filters down to many of the 
users.

This proposal also doesn't help with other weird failure modes in the 
interface, the most annoying of which is the watchdog stealing a counter 
so event groups perf_event_open() and start just fine but fail at read 
time.

> > That may or may not be a problem in practice, Vince can probably comment
> > on that. I'm just thinking along the lines of making the perf syscall
> > interface as useful as possible for tools other than tools/perf.
> >
> Maybe I missed something in the earlier thread, but I am trying to understand
> why perf_event_open() would need such extended error retrieval system when
> no other syscall does.

well perf_event_open() is so complex, with it's 40+ different parameters.  
Having a wrong value in any one of those (or one of the combinations of 
those) can trigger EINVAL and it's not clear where the issue is.  
I think other system calls tend to have slighly more straightforward 
interfaces.

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


Re: [PATCH v2 1/6] staging: ft1000: spaces required around that '=', '<' and '=='

2014-10-31 Thread Sudip Mukherjee
On Fri, Oct 31, 2014 at 10:14:30PM -0700, Joe Perches wrote:
> On Sat, 2014-11-01 at 10:35 +0530, Sudip Mukherjee wrote:
> > On Sat, Nov 01, 2014 at 10:47:22AM +0800, Chen Weixiang wrote:
> > > Remove following code style errors from ft1000/ft1000-usb/ft1000_debug.c
> > > and ft1000/ft1000-pcmcia/ft1000_hw.c:
> > > ERROR: spaces required around that '=' (ctx:VxV)
> > > ERROR: spaces required around that '<' (ctx:VxV)
> > > ERROR: spaces required around that '==' (ctx:VxV)
> > > 
> > 
> > many whitespace errors in the patch.
> > checkpatch gives total: 8 errors, 23 warnings, 125 lines checked
> 
> When fixing one thing (like spacing), it's pretty
> expected to have more checkpatch errors.
> 
> It's a process, don't worry about most intermediate
> warnings when doing checkpatch cleanups.
> 
> Adding trailing spaces is not good, nearly every
> other type of message can be ignored.
> 
ok, just to verify, i thought of trying to generate a similar patch which will 
not give checkpatch errors.
but this patch is not applying to next-20141031.

thanks
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 6/6] staging: ft1000: space required after that ','

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:47:27AM +0800, Chen Weixiang wrote:
> Remove following code style error from ft1000/ft1000-usb/ft1000_debug.c:
> ERROR: space required after that ',' (ctx:VxV)
> 
from checkpatch:
total: 11 errors, 15 warnings, 46 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
  scripts/cleanfile

  patch has style problems, please review.

thanks
sudip

> Signed-off-by: Chen Weixiang 
> ---
>  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 22 +-
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
> b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> index 7bc05fe..5e290e9 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> @@ -301,7 +301,7 @@ static int ft1000_open(struct inode *inode, struct file 
> *file)
>  {
>   struct ft1000_info *info;
>   struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
> -int i,num;
> +int i, num;
>  
>  DEBUG("%s called\n", __func__);
>  num = (MINOR(inode->i_rdev) & 0xf);
> @@ -419,12 +419,16 @@ static long ft1000_ioctl(struct file *file, unsigned 
> int command,
>  struct timeval tv;
>   struct IOCTL_GET_VER get_ver_data;
>   struct IOCTL_GET_DSP_STAT get_stat_data;
> -u8 ConnectionMsg[] = 
> {0x00,0x44,0x10,0x20,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x93,0x64,
> -  
> 0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0a,
> -  
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> -  
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> -  
> 0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00,
> -  0x00,0x01,0x00,0x00};
> +u8 ConnectionMsg[] = {0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 
> 0x00,
> +  0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64, 0x00, 
> 0x00,
> +  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
> 0x00,
> +  0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 
> 0x00,
> +  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 
> 0x00,
> +  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
> 0x00,
> +  0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
> 0x00,
> +  0x00, 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 
> 0x08,
> +  0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00, 
> 0x00,
> +  0x01, 0x00, 0x00};
>  
>  unsigned short ledStat = 0;
>  unsigned short conStat = 0;
> @@ -475,7 +479,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>  break;
>  }
>  
> -DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned 
> int)get_ver_data.drv_ver);
> +DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n", (unsigned 
> int)get_ver_data.drv_ver);
>  
>  break;
>  case IOCTL_CONNECT:
> @@ -652,7 +656,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>  }
>  pmsg++;
>   ppseudo_hdr = (struct pseudo_hdr *)pmsg;
> -   result = card_send_command(ft1000dev,(unsigned 
> short *)dpram_data,total_len+2);
> +   result = card_send_command(ft1000dev, (unsigned 
> short *)dpram_data, total_len+2);
>  
>  
>  ft1000dev->app_info[app_index].nTxMsg++;
> -- 
> 2.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/6] staging: ft1000: spaces required around that '=', '<' and '=='

2014-10-31 Thread Joe Perches
On Sat, 2014-11-01 at 10:35 +0530, Sudip Mukherjee wrote:
> On Sat, Nov 01, 2014 at 10:47:22AM +0800, Chen Weixiang wrote:
> > Remove following code style errors from ft1000/ft1000-usb/ft1000_debug.c
> > and ft1000/ft1000-pcmcia/ft1000_hw.c:
> > ERROR: spaces required around that '=' (ctx:VxV)
> > ERROR: spaces required around that '<' (ctx:VxV)
> > ERROR: spaces required around that '==' (ctx:VxV)
> > 
> 
> many whitespace errors in the patch.
> checkpatch gives total: 8 errors, 23 warnings, 125 lines checked

When fixing one thing (like spacing), it's pretty
expected to have more checkpatch errors.

It's a process, don't worry about most intermediate
warnings when doing checkpatch cleanups.

Adding trailing spaces is not good, nearly every
other type of message can be ignored.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 5/6] staging: ft1000: else should follow close brace '}'

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:47:26AM +0800, Chen Weixiang wrote:
> Remove code style error from ft1000/ft1000-pcmcia/ft1000_hw.c:
> ERROR: else should follow close brace '}'
> 
from checkpatch:

total: 1 errors, 2 warnings, 44 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
  scripts/cleanfile

  patch has style problems, please review.

thanks
sudip

> Signed-off-by: Chen Weixiang 
> ---
>  drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 15 +--
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> index db194bc..48c1ef2 100644
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> @@ -595,8 +595,7 @@ static void ft1000_hbchk(u_long data)
>   if (tempword != ho) {
>   if (info->AsicID == ELECTRABUZZ_ID) {
>   tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
> - }
> - else {
> + } else {
>   tempword = ntohs(ft1000_read_dpram_mag_16(dev, 
> FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX));
>   }
>   }
> @@ -715,15 +714,13 @@ static void ft1000_hbchk(u_long data)
>   if (tempword != hi) {
>   if (info->AsicID == ELECTRABUZZ_ID) {
>   ft1000_write_dpram(dev, FT1000_HI_HO, hi);
> - }
> - else {
> + } else {
>   ft1000_write_dpram_mag_16(dev, 
> FT1000_MAG_HI_HO, hi_mag, FT1000_MAG_HI_HO_INDX);
>   }
>  
>   if (info->AsicID == ELECTRABUZZ_ID) {
>   tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
> - }
> - else {
> + } else {
>   tempword = ntohs(ft1000_read_dpram_mag_16(dev, 
> FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX));
>   }
>  
> @@ -994,8 +991,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>  
>  if (info->AsicID == ELECTRABUZZ_ID) {
>  tempword = FT1000_DPRAM_RX_BASE+2;
> -}
> -else {
> +} else {
>  tempword = FT1000_DPRAM_MAG_RX_BASE;
>  }
>  if (ft1000_receive_cmd(dev, [0], MAX_CMD_SQSIZE, )) {
> @@ -1075,8 +1071,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>   info->ConTm = 0;
>   }
>   }
> -}
> -else {
> +} else {
>  DEBUG(1, "Media is down\n");
>  if (info->mediastate == 1) {
>  info->mediastate = 0;
> -- 
> 2.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 3/6] staging: ft1000: "(foo*)" should be "(foo *)"

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:47:24AM +0800, Chen Weixiang wrote:
> Remove following code style error from ft1000/ft1000-usb/ft1000_debug.c:
> ERROR: "(foo*)" should be "(foo *)"
> 
again checkpatch gives total: 4 errors, 3 warnings, 16 lines checked.
this includes whitespace errors.

thanks
sudip

> Signed-off-by: Chen Weixiang 
> ---
>  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
> b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> index 02bfb3e..7bc05fe 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> @@ -447,7 +447,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>  switch (cmd) {
>  case IOCTL_REGISTER_CMD:
>  DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
> -result = get_user(tempword, (__u16 __user*)argp);
> +result = get_user(tempword, (__u16 __user *)argp);
>  if (result) {
>  DEBUG("result = %d failed to get_user\n", result);
>  break;
> @@ -652,7 +652,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>  }
>  pmsg++;
>   ppseudo_hdr = (struct pseudo_hdr *)pmsg;
> -   result = card_send_command(ft1000dev,(unsigned 
> short*)dpram_data,total_len+2);
> +   result = card_send_command(ft1000dev,(unsigned 
> short *)dpram_data,total_len+2);
>  
>  
>  ft1000dev->app_info[app_index].nTxMsg++;
> -- 
> 2.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 2/6] staging: ft1000: space prohibited after '(', '&' and before ')'

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:47:23AM +0800, Chen Weixiang wrote:
> Remove following code style errors from ft1000/ft1000-pcmcia/ft1000_hw.c:
> ERROR: space prohibited after that open parenthesis '('
> ERROR: space prohibited before that close parenthesis ')'
> ERROR: space prohibited after that '&' (ctx:WxW)
> 
> Signed-off-by: Chen Weixiang 
> ---
>  drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 32 
> 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> index fc28dee..9ef7817 100644
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> @@ -888,7 +888,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, 
> u16 *pbuffer,
>   unsigned long flags;
>  
>   if (info->AsicID == ELECTRABUZZ_ID) {
> - size = ( ft1000_read_dpram(dev, *pnxtph) ) + sizeof(struct 
> pseudo_hdr);
> + size = (ft1000_read_dpram(dev, *pnxtph)) + sizeof(struct 
> pseudo_hdr);

line over 80 char.

>   } else {
>   size =
>   ntohs(ft1000_read_dpram_mag_16
> @@ -998,10 +998,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>  else {
>  tempword = FT1000_DPRAM_MAG_RX_BASE;
>  }
> -if ( ft1000_receive_cmd(dev, [0], MAX_CMD_SQSIZE, ) ) 
> {
> +if (ft1000_receive_cmd(dev, [0], MAX_CMD_SQSIZE, )) {

whitespace at the beginning of the line.

thanks
sudip

>  
>   /* Get the message type which is total_len + PSEUDO header + 
> msgtype + message body */
> - pdrvmsg = (struct drv_msg *) & cmdbuffer[0];
> + pdrvmsg = (struct drv_msg *) [0];
>   msgtype = ntohs(pdrvmsg->type);
>   DEBUG(1, "Command message type = 0x%x\n", msgtype);
>   switch (msgtype) {
> @@ -1055,7 +1055,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>   info->CardReady = 1;
>   break;
>   case MEDIA_STATE:
> - pmediamsg = (struct media_msg *) & cmdbuffer[0];
> + pmediamsg = (struct media_msg *) [0];
>   if (info->ProgConStat != 0xFF) {
>   if (pmediamsg->state) {
>   DEBUG(1, "Media is up\n");
> @@ -1087,7 +1087,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>  }
>   break;
>   case DSP_INIT_MSG:
> - pdspinitmsg = (struct dsp_init_msg *) & cmdbuffer[0];
> + pdspinitmsg = (struct dsp_init_msg *) [0];
>   memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ);
>   DEBUG(1, "DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n",
> info->DspVer[0], info->DspVer[1], 
> info->DspVer[2],
> @@ -1121,7 +1121,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>   tempword = ntohs(pdrvmsg->length);
>   info->DSPInfoBlklen = tempword;
>   if (tempword < (MAX_DSP_SESS_REC - 4)) {
> - pmsg = (u16 *) & pdrvmsg->data[0];
> + pmsg = (u16 *) >data[0];
>   for (i = 0; i < ((tempword + 1) / 2); i++) {
>   DEBUG(1,
> "FT1000:drivermsg:dsp info 
> data = 0x%x\n",
> @@ -1203,7 +1203,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>* Put message into Slow Queue
>* Form Pseudo header
>*/
> - pmsg = (u16 *) & tempbuffer[0];
> + pmsg = (u16 *) [0];
>   ppseudo_hdr = (struct pseudo_hdr *) pmsg;
>   ppseudo_hdr->length = htons(0x0012);
>   ppseudo_hdr->source = 0x10;
> @@ -1224,7 +1224,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>  for (i = 1; i < 7; i++) {
>  ppseudo_hdr->checksum ^= *pmsg++;
>  }
> - pmsg = (u16 *) & tempbuffer[16];
> + pmsg = (u16 *) [16];
>   *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
>   *pmsg++ = htons(0x000e);
>   *pmsg++ = htons(info->DSP_TIME[0]);
> @@ -1880,22 +1880,22 @@ static int ft1000_copy_down_pkt(struct net_device 
> *dev, u16 * packet, u16 len)
> i + 8, htons(*packet));
>   }
>   } else {
> - outl(*(u32 *) & pseudo.buff[0],
> + outl(*(u32 *) [0],
>dev->base_addr + FT1000_REG_MAG_UFDR);
>   

Re: [PATCH v2 1/6] staging: ft1000: spaces required around that '=', '<' and '=='

2014-10-31 Thread Sudip Mukherjee
On Sat, Nov 01, 2014 at 10:47:22AM +0800, Chen Weixiang wrote:
> Remove following code style errors from ft1000/ft1000-usb/ft1000_debug.c
> and ft1000/ft1000-pcmcia/ft1000_hw.c:
> ERROR: spaces required around that '=' (ctx:VxV)
> ERROR: spaces required around that '<' (ctx:VxV)
> ERROR: spaces required around that '==' (ctx:VxV)
> 

many whitespace errors in the patch.
checkpatch gives total: 8 errors, 23 warnings, 125 lines checked

thanks
sudip

> Signed-off-by: Chen Weixiang 
> ---
>  drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |  6 ++---
>  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 28 
> 
>  2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> index 44575c7..fc28dee 100644
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
> @@ -812,11 +812,11 @@ static void ft1000_send_cmd (struct net_device *dev, 
> u16 *ptempbuffer, int size,
>  
>  /* Make sure SLOWQ doorbell is clear */
>  tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
> -i=0;
> +i = 0;
>  while (tempword & FT1000_DB_DPRAM_TX) {
>  mdelay(10);
>  i++;
> -if (i==10) {
> +if (i == 10) {
>  spin_unlock_irqrestore(>dpram_lock, flags);
>  return;
>  }
> @@ -1221,7 +1221,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
>   ppseudo_hdr->portsrc = 0;
>   /* Calculate new checksum */
>  ppseudo_hdr->checksum = *pmsg++;
> -for (i=1; i<7; i++) {
> +for (i = 1; i < 7; i++) {
>  ppseudo_hdr->checksum ^= *pmsg++;
>  }
>   pmsg = (u16 *) & tempbuffer[16];
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
> b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> index 0f347ab..02bfb3e 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> @@ -193,7 +193,7 @@ int ft1000_create_dev(struct ft1000_usb *dev)
>  
>  /* initialize application information */
>  dev->appcnt = 0;
> -for (i=0; i +for (i = 0; i < MAX_NUM_APP; i++) {
>  dev->app_info[i].nTxMsg = 0;
>  dev->app_info[i].nRxMsg = 0;
>  dev->app_info[i].nTxMsgReject = 0;
> @@ -260,7 +260,7 @@ void ft1000_destroy_dev(struct net_device *netdev)
>  dev->DeviceName);
>  
>  /* Make sure we free any memory reserve for slow Queue */
> -for (i=0; i +for (i = 0; i < MAX_NUM_APP; i++) {
>  while (list_empty(>app_info[i].app_sqlist) == 0) {
>  pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, 
> struct dpram_blk, list);
>  list_del(_blk->list);
> @@ -318,7 +318,7 @@ static int ft1000_open(struct inode *inode, struct file 
> *file)
>  }
>  
>  /* Search for available application info block */
> -for (i=0; i +for (i = 0; i < MAX_NUM_APP; i++) {
>  if ((dev->app_info[i].fileobject == NULL)) {
>  break;
>  }
> @@ -369,7 +369,7 @@ static unsigned int ft1000_poll_dev(struct file *file, 
> poll_table *wait)
>  }
>  
>  /* Search for matching file object */
> -for (i=0; i +for (i = 0; i < MAX_NUM_APP; i++) {
>  if (dev->app_info[i].fileobject == >f_owner) {
>  /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", 
> dev->app_info[i].app_id); */
>  break;
> @@ -411,7 +411,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>  void __user *argp = (void __user *)argument;
>   struct ft1000_info *info;
>  struct ft1000_usb *ft1000dev;
> -int result=0;
> +int result = 0;
>  int cmd;
>  int i;
>  u16 tempword;
> @@ -426,8 +426,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>
> 0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00,
>0x00,0x01,0x00,0x00};
>  
> -unsigned short ledStat=0;
> -unsigned short conStat=0;
> +unsigned short ledStat = 0;
> +unsigned short conStat = 0;
>  
>  /* DEBUG("ft1000_ioctl called\n"); */
>  
> @@ -454,7 +454,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
> command,
>  }
>  if (tempword == DSPBCMSGID) {
>  /* Search for matching file object */
> -for (i=0; i +for (i = 0; i < MAX_NUM_APP; i++) {
>  if (ft1000dev->app_info[i].fileobject == >f_owner) 
> {
>  ft1000dev->app_info[i].DspBCMsgFlag = 1;
>  DEBUG("FT1000:ft1000_ioctl:Registered for broadcast 
> 

Re: 3.17.2. issue?

2014-10-31 Thread Udo van den Heuvel
All,

On 2014-11-01 05:51, Udo van den Heuvel wrote:
> I'll test this today, I hope.

Works!


Kind regards,
Udo

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


Re: [PATCH v3] staging: panel: Remove outdated TODO tasks

2014-10-31 Thread Sudip Mukherjee
On Fri, Oct 31, 2014 at 11:08:34PM +0100, Konrad Zapalowicz wrote:
> On 10/31, Mariusz Gorski wrote:
> > Remove Lindent and checkpatch.pl tasks from TODO file as the first one
> > is obsolete and the other one is already done.
> > 

when i checked panel.c with checkpatch and with --strict option, i got 20 
checks.
(sent the same reply to v1 patch also).

thanks
sudip

> > Signed-off-by: Mariusz Gorski 
> > ---
> > v3: Fixed commit summary
> 
> Great. Thanks.
> 
> regards,
> konrad
>  
> >  drivers/staging/panel/TODO | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/staging/panel/TODO b/drivers/staging/panel/TODO
> > index a4be749..c8040c1 100644
> > --- a/drivers/staging/panel/TODO
> > +++ b/drivers/staging/panel/TODO
> > @@ -1,6 +1,4 @@
> >  TODO:
> > -   - checkpatch.pl cleanups
> > -   - Lindent
> > - review major/minor usages
> > - review userspace api
> > - see if all of this could be easier done in userspace instead.
> > -- 
> > 2.1.3
> > 
> > ___
> > devel mailing list
> > de...@linuxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 3.17.2. issue?

2014-10-31 Thread Udo van den Heuvel
Hello,

On 2014-10-31 18:47, Hans Verkuil wrote:
> Fixed by this patch: https://patchwork.linuxtv.org/patch/26302/

I'll test this today, I hope.

Thanks!!

Kind regards,
Udo

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Remove outdated TODO tasks

2014-10-31 Thread Sudip Mukherjee
On Fri, Oct 31, 2014 at 10:06:46PM +0100, Mariusz Gorski wrote:
> Remove Lindent and checkpatch.pl tasks from TODO file as the first one
> is obsolete and the other one is already done.

when i checked panel.c with checkpatch and with --strict option, i got 20 
checks.

thanks
sudip

> 
> Signed-off-by: Mariusz Gorski 
> ---
>  drivers/staging/panel/TODO | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/panel/TODO b/drivers/staging/panel/TODO
> index a4be749..c8040c1 100644
> --- a/drivers/staging/panel/TODO
> +++ b/drivers/staging/panel/TODO
> @@ -1,6 +1,4 @@
>  TODO:
> - - checkpatch.pl cleanups
> - - Lindent
>   - review major/minor usages
>   - review userspace api
>   - see if all of this could be easier done in userspace instead.
> -- 
> 2.1.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] iio: adc: exynos_adc: Add support for exynos7

2014-10-31 Thread Abhilash Kesavan
The ADC on exynos7 is quite similar to ADCv2. The differences are as
follows:
- exynos7-adc has 8 input channels (as against 10 in ADCv2).
- exynos7 does not include an ADC PHY control register.
- Some ADC_CON2 register bits being used in ADCv2 are listed as
  reserved in exynos7-adc. This results in a different init_hw
  function for exynos7.

Signed-off-by: Abhilash Kesavan 
---
- Based on Naveen's "iio: exynos-adc: use syscon instead of ioremap" patchset
http://comments.gmane.org/gmane.linux.kernel.iio/13943

 .../devicetree/bindings/arm/samsung/exynos-adc.txt |  2 ++
 drivers/iio/adc/exynos_adc.c   | 32 ++
 2 files changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt 
b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
index c368210..f46ca9a 100644
--- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
@@ -16,6 +16,8 @@ Required properties:
future controllers.
Must be "samsung,exynos3250-adc" for
controllers compatible with ADC of Exynos3250.
+   Must be "samsung,exynos7-adc" for
+   the ADC in Exynos7 and compatibles
Must be "samsung,s3c2410-adc" for
the ADC in s3c2410 and compatibles
Must be "samsung,s3c2416-adc" for
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index fe03177..3a2dbb3 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -390,6 +390,35 @@ static const struct exynos_adc_data exynos3250_adc_data = {
.start_conv = exynos_adc_v2_start_conv,
 };
 
+static void exynos_adc_exynos7_init_hw(struct exynos_adc *info)
+{
+   u32 con1, con2;
+
+   if (info->data->needs_adc_phy)
+   regmap_write(info->pmu_map, info->data->phy_offset, 1);
+
+   con1 = ADC_V2_CON1_SOFT_RESET;
+   writel(con1, ADC_V2_CON1(info->regs));
+
+   con2 = readl(ADC_V2_CON2(info->regs));
+   con2 &= ~ADC_V2_CON2_C_TIME(7);
+   con2 |= ADC_V2_CON2_C_TIME(0);
+   writel(con2, ADC_V2_CON2(info->regs));
+
+   /* Enable interrupts */
+   writel(1, ADC_V2_INT_EN(info->regs));
+}
+
+static const struct exynos_adc_data exynos7_adc_data = {
+   .num_channels   = MAX_ADC_V1_CHANNELS,
+   .mask   = ADC_DATX_MASK, /* 12 bit ADC resolution */
+
+   .init_hw= exynos_adc_exynos7_init_hw,
+   .exit_hw= exynos_adc_v2_exit_hw,
+   .clear_irq  = exynos_adc_v2_clear_irq,
+   .start_conv = exynos_adc_v2_start_conv,
+};
+
 static const struct of_device_id exynos_adc_match[] = {
{
.compatible = "samsung,s3c2410-adc",
@@ -415,6 +444,9 @@ static const struct of_device_id exynos_adc_match[] = {
}, {
.compatible = "samsung,exynos3250-adc",
.data = _adc_data,
+   }, {
+   .compatible = "samsung,exynos7-adc",
+   .data = _adc_data,
},
{},
 };
-- 
2.1.0

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


Re: [PATCH] iio: adc: exynos_adc: Add support for ADCv3 on exynos7

2014-10-31 Thread Abhilash Kesavan
Hi Chanwoo,

On Fri, Oct 31, 2014 at 9:44 PM, Chanwoo Choi  wrote:
> Hi Abhilash,
>
> On Fri, Oct 31, 2014 at 11:01 PM, Abhilash Kesavan
>  wrote:
>> Hi Chanwoo,
>>
>> Thanks for the quick response.
>>
>> On Fri, Oct 31, 2014 at 6:17 PM, Chanwoo Choi  wrote:
>>> Hi Abhilash,
>>>
>>> On 10/31/2014 09:38 PM, Abhilash Kesavan wrote:
 The ADC on exynos7 is quite similar to ADCv2. The differences are as
 follows:
   - v3 has 8 input channels (10 in v2).
   - v3 does not include an ADC PHY control register.
   - Some ADC_CON2 register bits being used in v2 are listed as
 reserved in v3. This results in a different init_hw function
 for v3.

 Signed-off-by: Abhilash Kesavan 
 ---
 - Based on Naveen's "iio: exynos-adc: use syscon instead of ioremap" 
 patchset
 http://comments.gmane.org/gmane.linux.kernel.iio/13943

  .../devicetree/bindings/arm/samsung/exynos-adc.txt |2 ++
  drivers/iio/adc/exynos_adc.c   |   32 
 
  2 files changed, 34 insertions(+)

 diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt 
 b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
 index c368210..a11e32c 100644
 --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
 +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
 @@ -14,6 +14,8 @@ Required properties:
   for exynos4412/5250 and s5pv210 controllers.
   Must be "samsung,exynos-adc-v2" for
   future controllers.
 + Must be "samsung,exynos-adc-v3" for
 + the ADC in Exynos7 and compatibles
>>>
>>> I prefer to use 'exynos7-adc' instead of 'exynos-adc-v3'.
>>> Exynos7 has little different from existing ADCv2.
>>
>> Sure, I'll change it. The reason for my choosing v3 was that reading
>> the version register (0x20 offset) showed a value of 0x8009 in
>> Exynos7 as against 0x8008 in both 5420 and 3250.
>>>
>>> Also, If you want to use 'exynos-adc-v3' compatible,
>>> Exynos7's TRM have to include the correct version(v3) infromation.
>>
>> I could not see any mention of the ADC controller version in the
>> Exynos7 UM other than the version register. Does that mean it is v2 ?
>
> So am I. I don't see any version number of ADC in Exynos TRM.
OK, considering the small differences between ADCv2 and this
controller, I will change the compatible to exynos7-adc.
Patch will be posted in a bit.
>
> Additionally,
> I have a question about Exynos7. If you possible,
> did you tell me about full name of Exynos7 SoC (e.g., Exynos5433, Exynos52..)?
The soc name is Exynos7 and it has 4 A57 cores.
>
> Best Regards,
> Chanwoo Choi
>
>>
>> Regards,
>> Abhilash
>>>
>>> Thanks,
>>> Chanwoo Choi
>>>
>>>
>>>
   Must be "samsung,exynos3250-adc" for
   controllers compatible with ADC of 
 Exynos3250.
   Must be "samsung,s3c2410-adc" for
 diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
 index fe03177..74d0a9d 100644
 --- a/drivers/iio/adc/exynos_adc.c
 +++ b/drivers/iio/adc/exynos_adc.c
 @@ -390,6 +390,35 @@ static const struct exynos_adc_data 
 exynos3250_adc_data = {
   .start_conv = exynos_adc_v2_start_conv,
  };

 +static void exynos_adc_v3_init_hw(struct exynos_adc *info)
 +{
 + u32 con1, con2;
 +
 + if (info->data->needs_adc_phy)
 + regmap_write(info->pmu_map, info->data->phy_offset, 1);
 +
 + con1 = ADC_V2_CON1_SOFT_RESET;
 + writel(con1, ADC_V2_CON1(info->regs));
 +
 + con2 = readl(ADC_V2_CON2(info->regs));
 + con2 &= ~ADC_V2_CON2_C_TIME(7);
 + con2 |= ADC_V2_CON2_C_TIME(0);
 + writel(con2, ADC_V2_CON2(info->regs));
 +
 + /* Enable interrupts */
 + writel(1, ADC_V2_INT_EN(info->regs));
 +}
 +
 +static const struct exynos_adc_data exynos_adc_v3_data = {
 + .num_channels   = MAX_ADC_V1_CHANNELS,
 + .mask   = ADC_DATX_MASK, /* 12 bit ADC resolution */
 +
 + .init_hw= exynos_adc_v3_init_hw,
 + .exit_hw= exynos_adc_v2_exit_hw,
 + .clear_irq  = exynos_adc_v2_clear_irq,
 + .start_conv = exynos_adc_v2_start_conv,
 +};
 +
  static const struct of_device_id exynos_adc_match[] = {
   {
   .compatible = "samsung,s3c2410-adc",
 @@ -413,6 +442,9 @@ static const struct of_device_id exynos_adc_match[] = {
   .compatible = "samsung,exynos-adc-v2",
   .data = _adc_v2_data,
   }, {
 + .compatible = "samsung,exynos-adc-v3",
 + .data = _adc_v3_data,
 + }, {
   

Re: [PATCH] drivers: net: ethernet: xilinx: xilinx_emaclite: Compatible with 'xlnx,xps-ethernetlite-2.00.b' for QEMU using

2014-10-31 Thread Chen Gang
On 11/1/14 11:08, Chen Gang wrote:
> When use current latest upstream qemu (current version: 2.1.2), need let
> driver compatible with 'xlnx,xps-ethernetlite-2.00.b', or can not find
> net device in microblaze qemu. Related QEMU commands under fedora 20:
> 
>   yum install libvirt
>   yum install tunctl
>   tunctl -b
>   ip link set tap0 up
>   brctl addif virbr0 tap0
>   ./microblaze-softmmu/qemu-system-microblaze -M petalogix-s3adsp1800 \
> -kernel ../linux-stable.microblaze/arch/microblaze/boot/linux.bin \
> -no-reboot -append "console=ttyUL0,115200 doreboot" -nographic \
> -net nic,vlan=0,model=xlnx.xps-ethernetlite,macaddr=00:16:35:AF:94:00 \
> -net tap,vlan=0,ifname=tap0,script=no,downscript=no
> 
>   in microblaze qemu bash (guest machine):
> 
> ifconfig eth0 add 192.168.122.1 netmask 255.255.255.0

Oh, sorry, it is 192.168.122.2 (192.168.122.1 is the router address).

Thanks.

> ifconfig eth0 up
> 
> After add this patch, can find the device, and can be used by 'telnetd'
> (need cross-build busybox with glibc for it), then outside can telnet to
> it without password.
> 
> Signed-off-by: Chen Gang 
> ---
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
> b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 28dbbdc..298fad3 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1236,6 +1236,7 @@ static struct of_device_id xemaclite_of_match[] = {
>   { .compatible = "xlnx,opb-ethernetlite-1.01.b", },
>   { .compatible = "xlnx,xps-ethernetlite-1.00.a", },
>   { .compatible = "xlnx,xps-ethernetlite-2.00.a", },
> + { .compatible = "xlnx,xps-ethernetlite-2.00.b", },
>   { .compatible = "xlnx,xps-ethernetlite-2.01.a", },
>   { .compatible = "xlnx,xps-ethernetlite-3.00.a", },
>   { /* end of list */ },
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] regulator: of: Add support for parsing microvolts for suspend state

2014-10-31 Thread Doug Anderson
Leverage all the work that was done in (40e20d6 regulator: of: Add
support for parsing regulator_state for suspend state) and throw in
the ability to set suspend microvolts from the device tree.

Signed-off-by: Doug Anderson 
---
 drivers/regulator/of_regulator.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index f0d19fc..7fe93c5 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -107,6 +107,10 @@ static void of_get_regulation_constraints(struct 
device_node *np,
"regulator-off-in-suspend"))
suspend_state->disabled = true;
 
+   if (!of_property_read_u32(suspend_np,
+   "regulator-suspend-microvolt", ))
+   suspend_state->uV = pval;
+
of_node_put(suspend_np);
suspend_state = NULL;
suspend_np = NULL;
-- 
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] regulator: Document binding for regulator suspend voltage

2014-10-31 Thread Doug Anderson
This patch builds upon (291d761 regulator: Document binding for
regulator suspend state for PM state) to allow setting the uV in
addition to the state at suspend time.

Signed-off-by: Doug Anderson 
---
 Documentation/devicetree/bindings/regulator/regulator.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt 
b/Documentation/devicetree/bindings/regulator/regulator.txt
index aaad615..4e7ed76 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -28,6 +28,8 @@ Optional properties:
 - regulator-state-[mem/disk] node has following common properties:
- regulator-on-in-suspend: regulator should be on in suspend state.
- regulator-off-in-suspend: regulator should be off in suspend state.
+   - regulator-suspend-microvolt: regulator should be set to this voltage
+ in suspend.
 
 Deprecated properties:
 - regulator-compatible: If a regulator chip contains multiple
-- 
2.1.0.rc2.206.gedb03e5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [PATCHv2 7/7] cgroup: mount cgroupns-root when inside non-init cgroupns

2014-10-31 Thread Andy Lutomirski
On Fri, Oct 31, 2014 at 7:59 PM, Eric W. Biederman
 wrote:
> Andy Lutomirski  writes:
>>> @@ -1862,6 +1904,7 @@ static struct file_system_type cgroup_fs_type = {
>>> .name = "cgroup",
>>> .mount = cgroup_mount,
>>> .kill_sb = cgroup_kill_sb,
>>> +   .fs_flags = FS_USERNS_MOUNT,
>>
>> Aargh, another one!  Eric, can you either ack or nack my patch?
>> Because if my patch goes in, then this line may need to change.  Or
>> not, but if a stable release with cgroupfs and without my patch
>> happens, then we'll have an ABI break.
>
> cgroupfs has no device nodes.  So as long as we are consistent in any
> given release what happens here is orthogonal.
>
> I don't remember if we have managed to get the original problem fixed
> with the trivial backportable solution.  I think so.

I don't remember.  I think the problem is still there, since I think
my patch still applies, and my patch conflicts with your fix.  It's
been long enough that I'm not sure it's worth applying your patch as
an interim fix.

>
> My apologies for not getting to that I haven't even had time to shepherd
> through the regression associated regression fix.  I probably just lock
> track of them but I haven't found the Tested-By's for it yet.

No worries.  I've tested it, but it's my patch, so there's a big grain
of salt there.  I think Serge tested it, too.

>
> Nor have I had time to dig through and figure out how to safely deal
> with umount -l aka MOUNT_DETACH.

If you're talking about the do_remount_sb thing, that's already in Linus' tree.

>
> Along with the question about what to do with nodev, there is also
> your patch about nosuid.

The nosuid patch has a couple versions, and I'm not sure which version
I prefer.  It's certainly debatable.

>
> Starting in about 5 minutes I am going to be mostly offline until
> sometime in the 3rd week in November as I haul all of my stuff accross
> the country to someplace that actually has winter and my allergies don't
> kill me.

Have fun!

--Andy

>
> I am going to have to review and merge a lot of code as soon as I am
> back to being a programmer full time again.  There is a lot of
> interesting stuff coming in right now.
>
> Eric



-- 
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ASoC: simple-card: add "invert" property for detect GPIOs

2014-10-31 Thread Jianqun
Since hardware may invert detect GPIO of headphone or mic, add one
property to support software invert.

Signed-off-by: Jianqun 
---
 sound/soc/generic/simple-card.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index d1b7293..f1bb537 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -29,7 +29,9 @@ struct simple_card_data {
} *dai_props;
unsigned int mclk_fs;
int gpio_hp_det;
+   int gpio_hp_det_invert;
int gpio_mic_det;
+   int gpio_mic_det_invert;
struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
 };
 
@@ -148,6 +150,7 @@ static int asoc_simple_card_dai_init(struct 
snd_soc_pcm_runtime *rtd)
  simple_card_hp_jack_pins);
 
simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
+   simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
snd_soc_jack_add_gpios(_card_hp_jack, 1,
   _card_hp_jack_gpio);
}
@@ -159,6 +162,7 @@ static int asoc_simple_card_dai_init(struct 
snd_soc_pcm_runtime *rtd)
  ARRAY_SIZE(simple_card_mic_jack_pins),
  simple_card_mic_jack_pins);
simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
+   simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
snd_soc_jack_add_gpios(_card_mic_jack, 1,
   _card_mic_jack_gpio);
}
@@ -381,6 +385,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
 struct simple_card_data *priv)
 {
struct device *dev = simple_priv_to_dev(priv);
+   enum of_gpio_flags flags;
u32 val;
int ret;
 
@@ -436,13 +441,15 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
return ret;
}
 
-   priv->gpio_hp_det = of_get_named_gpio(node,
-   "simple-audio-card,hp-det-gpio", 0);
+   priv->gpio_hp_det = of_get_named_gpio_flags(node,
+   "simple-audio-card,hp-det-gpio", 0, );
+   priv->gpio_hp_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
if (priv->gpio_hp_det == -EPROBE_DEFER)
return -EPROBE_DEFER;
 
-   priv->gpio_mic_det = of_get_named_gpio(node,
-   "simple-audio-card,mic-det-gpio", 0);
+   priv->gpio_mic_det = of_get_named_gpio_flags(node,
+   "simple-audio-card,mic-det-gpio", 0, );
+   priv->gpio_mic_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
if (priv->gpio_mic_det == -EPROBE_DEFER)
return -EPROBE_DEFER;
 
-- 
1.9.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] drivers: net: ethernet: xilinx: xilinx_emaclite: Compatible with 'xlnx,xps-ethernetlite-2.00.b' for QEMU using

2014-10-31 Thread Chen Gang
When use current latest upstream qemu (current version: 2.1.2), need let
driver compatible with 'xlnx,xps-ethernetlite-2.00.b', or can not find
net device in microblaze qemu. Related QEMU commands under fedora 20:

  yum install libvirt
  yum install tunctl
  tunctl -b
  ip link set tap0 up
  brctl addif virbr0 tap0
  ./microblaze-softmmu/qemu-system-microblaze -M petalogix-s3adsp1800 \
-kernel ../linux-stable.microblaze/arch/microblaze/boot/linux.bin \
-no-reboot -append "console=ttyUL0,115200 doreboot" -nographic \
-net nic,vlan=0,model=xlnx.xps-ethernetlite,macaddr=00:16:35:AF:94:00 \
-net tap,vlan=0,ifname=tap0,script=no,downscript=no

  in microblaze qemu bash (guest machine):

ifconfig eth0 add 192.168.122.1 netmask 255.255.255.0
ifconfig eth0 up

After add this patch, can find the device, and can be used by 'telnetd'
(need cross-build busybox with glibc for it), then outside can telnet to
it without password.

Signed-off-by: Chen Gang 
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 28dbbdc..298fad3 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1236,6 +1236,7 @@ static struct of_device_id xemaclite_of_match[] = {
{ .compatible = "xlnx,opb-ethernetlite-1.01.b", },
{ .compatible = "xlnx,xps-ethernetlite-1.00.a", },
{ .compatible = "xlnx,xps-ethernetlite-2.00.a", },
+   { .compatible = "xlnx,xps-ethernetlite-2.00.b", },
{ .compatible = "xlnx,xps-ethernetlite-2.01.a", },
{ .compatible = "xlnx,xps-ethernetlite-3.00.a", },
{ /* end of list */ },
-- 
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 7/7] cgroup: mount cgroupns-root when inside non-init cgroupns

2014-10-31 Thread Eric W. Biederman
Andy Lutomirski  writes:
>> @@ -1862,6 +1904,7 @@ static struct file_system_type cgroup_fs_type = {
>> .name = "cgroup",
>> .mount = cgroup_mount,
>> .kill_sb = cgroup_kill_sb,
>> +   .fs_flags = FS_USERNS_MOUNT,
>
> Aargh, another one!  Eric, can you either ack or nack my patch?
> Because if my patch goes in, then this line may need to change.  Or
> not, but if a stable release with cgroupfs and without my patch
> happens, then we'll have an ABI break.

cgroupfs has no device nodes.  So as long as we are consistent in any
given release what happens here is orthogonal.

I don't remember if we have managed to get the original problem fixed
with the trivial backportable solution.  I think so.

My apologies for not getting to that I haven't even had time to shepherd
through the regression associated regression fix.  I probably just lock
track of them but I haven't found the Tested-By's for it yet.

Nor have I had time to dig through and figure out how to safely deal
with umount -l aka MOUNT_DETACH.

Along with the question about what to do with nodev, there is also
your patch about nosuid.

Starting in about 5 minutes I am going to be mostly offline until
sometime in the 3rd week in November as I haul all of my stuff accross
the country to someplace that actually has winter and my allergies don't
kill me.

I am going to have to review and merge a lot of code as soon as I am
back to being a programmer full time again.  There is a lot of
interesting stuff coming in right now.

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


[PATCH v2] ASoC: rockchip: i2s: add text after tristate for SND_SOC_ROCKCHIP_I2S

2014-10-31 Thread Jianqun
For SND_SOC_ROCKCHIP_I2S, adding some text after the
tristate to make this directly user selectable.

Signed-off-by: Jianqun 
---
changes since v1:
-to make this directlyuser selectable by adding some text after
the tristate as well as the rest, suggested by Mark
-to use the existing MAX98090 entry, not duplicate it, so remove
related codes, suggested by Mark

 sound/soc/rockchip/Kconfig | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index 78fc159..b1fc0ca 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -8,4 +8,9 @@ config SND_SOC_ROCKCHIP
  select the audio interfaces to support below.
 
 config SND_SOC_ROCKCHIP_I2S
-   tristate
+   tristate "Rockchip I2S Device Driver"
+   depends on CLKDEV_LOOKUP
+   help
+ Say Y or M if you want to add support for I2S driver for
+ Rockchip I2S device. The device supports upto maximum of
+ 8 channels each for play and record.
-- 
1.9.1


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


Re: [PATCH v2] Input: i8042 - add mux quirk for HP EliteBook

2014-10-31 Thread Dmitry Torokhov
On Tue, Oct 28, 2014 at 04:08:41PM -0700, Dmitry Torokhov wrote:
> On Tue, Oct 28, 2014 at 10:27:12PM +, Luis Henriques wrote:
> > This laptop requires active multiplexing to be enabled in order to be able
> > to separate the PS/2 mouse and the touchpad.
> > 
> > Signed-off-by: Luis Henriques 
> 
> Applied, thank you.

Actually I am reverting the nomux patch, so unapplied ;)

-- 
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 v17 0/5] Rockchip soc thermal driver

2014-10-31 Thread Caesar Wang
This series patchs tested on rk3288 SDK board and pinky-v1,v2 board.
I believe the driver can be used on the rk3288-evb board.

Add this driver, The system will shutdown when
the thermal temperture over 100C.If for some reason we are unable to
shut it down in orderly fashion (kernel is stuck holding a lock or similar)
then hardware will reset it.

Changes in v17:
* address comments from Heiko Stubner and .
- rename the tshut property
- the critiacal temperature only indeed 100C when add the cooling map,
  it's for the more secure,fix the temperature from 120C to 100C.

Changes in v16:
* address comments from Dmitry Torokhov.
- add thermal->chip->control(thermal->regs, false) in remove()
- adjust TSHUT in resume().

Changes in v15:
* address comments from Dmitry Torokhov.
- enable TSHUT move into rk_tsadcv2_tshut_temp().
- drop the id argument in rk_tsadcv2_control().

Changes in v14:
* address comments from Dmitry Torokhov.
- adjust-alarm-rate-depending-on-clock.
- 0001-rockchip-thermal-do-not-register-cpufreq-cooling-dev.

Changes in v13:
- add cooling-maps for cpu-thermal.
- put tshut polarity in device tree.

Changes in v12:
* address comments from Dmitry Torokhov and Vladimir Zapolskiy.
- split-sensor-handling.
- rename-rockchip_tsadc_platform_data.

Changes in v11:
* address comments from Vladimir Zapolskiy.
- fix cpufreq_cooling_unregister() to put in correct position.
- fix "data->chn",at least can get valid Tsensor temp.

Changes in v10:
* address comments from Doug Anderson.
- fix TSHUT polarity,ensure support TSHUT.
- add the decription for rk_tsadcv2_initialize().

Changes in v9:
* address comments from Dmitry Torokhov.
- fix some style be defined
- remove some unused code.
- clk_disable_unprepare->clk_disable in suspend()

Changes in v8:
* address comments from Dmitry Torokhov and Doug Anderson.
- add three Teperture Sensors.
- support CRU and GPIO reset chip.
- rename rk3xxx-cpu-thermal.dtsi as rk3288-thermal.dtsi
- alarm-temp via set_trips() callback
- remove "reset-gpios"

Changes in v7:
- fix get data->clk=0 when in probe() function.
- fix some style code.
- modify dts,main add rk3xxx-cpu-thermal.dtsi

Changes in v6:
* address comments from Tomeu Vizoso.
- use thermal's generic framework.

Changes in v5:
* address comments from Eduardo Valentin,rui.zhang and Heiko Stubner:
- with BIT() macro
- manage clocks in suspend/resume.
- license is fixed as GPLv2.
- #include "thermal_core.h"->#include 
- use the generic trip-points.the hw-shut-temp isn't generic 
trip-points.
- The method of binding and unbinding be fixed.
- The pin-name tsadc->otp_out

Changes in v4:
* address comments from Jonathan Cameron,huangtao and zhaoyifeng:
- this series thermal driver still be put in driver/thermal/
- modify the thermal driver description.

Changes in v3:(add dts configure)
* address comments from Dmitry Torokhov and Arnd Bergmann:
- fix clock-names in rockchip-thermal.txt
- remove rockchip_thermal_control() in rockchip_set_mode()
- fix some code style.
- add dts configure.

Changes in v2:
* address comments from Heiko Stubner:
- fix dt-bindings in rockchip-thermal.txt
- remove Author mark
- rename TSADC_XXX->TSADCV2_XXX,it eill ready to merge compatible other 
SoCs.
- fix a identation
- remove clk_set_rate(),it's no necessary.
- fix the SIMPLE_DEV_PM_OPS() function  style.

Caesar Wang (5):
  thermal: rockchip: add driver for thermal
  dt-bindings: document Rockchip thermal
  ARM: dts: add RK3288 Thermal data
  ARM: dts: add main Thermal info to rk3288
  ARM: dts: enable Thermal on rk3288-evb board

 .../bindings/thermal/rockchip-thermal.txt  |  45 ++
 arch/arm/boot/dts/rk3288-evb.dtsi  |   5 +
 arch/arm/boot/dts/rk3288-thermal.dtsi  |  58 ++
 arch/arm/boot/dts/rk3288.dtsi  |  23 +
 drivers/thermal/Kconfig|   9 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/rockchip_thermal.c | 628 +
 7 files changed, 769 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
 create mode 100644 arch/arm/boot/dts/rk3288-thermal.dtsi
 create mode 100644 drivers/thermal/rockchip_thermal.c

-- 
1.9.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 v17 4/5] ARM: dts: add main Thermal info to rk3288

2014-10-31 Thread Caesar Wang
This patch is depend on rk3288-thermal.dtsi,or
it will compile error.

If for some reason we are unable to shut it down
in orderly fashion (kernel is stuck holding a lock or
similar), then hardware TSHUT will reset it.

If the temperature over a period of time High,over 105C
the resulting TSHUT gave CRU module,let it reset
the entire chip,or via GPIO give PMIC.

Signed-off-by: Caesar Wang 
Reviewed-by: Dmitry Torokhov 
---
 arch/arm/boot/dts/rk3288.dtsi | 25 +
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index cb18bb4..85855a6 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "skeleton.dtsi"
 
 / {
@@ -66,6 +67,7 @@
 216000  90
 126000  90
>;
+   #cooling-cells = <2>; /* min followed by max */
clock-latency = <4>;
clocks = < ARMCLK>;
};
@@ -346,6 +348,23 @@
status = "disabled";
};
 
+   thermal-zones {
+   #include "rk3288-thermal.dtsi"
+   };
+
+   tsadc: tsadc@ff28 {
+   compatible = "rockchip,rk3288-tsadc";
+   reg = <0xff28 0x100>;
+   interrupts = ;
+   clocks = < SCLK_TSADC>, < PCLK_TSADC>;
+   clock-names = "tsadc", "apb_pclk";
+   pinctrl-names = "default";
+   pinctrl-0 = <_out>;
+   #thermal-sensor-cells = <1>;
+   rockchip,hw-tshut-temp = <105000>;
+   status = "disabled";
+   };
+
usb_host0_ehci: usb@ff50 {
compatible = "generic-ehci";
reg = <0xff50 0x100>;
@@ -965,6 +984,12 @@
};
};
 
+   tsadc {
+   otp_out: otp-out {
+   rockchip,pins = <0 10 RK_FUNC_1 
_pull_none>;
+   };
+   };
+
pwm0 {
pwm0_pin: pwm0-pin {
rockchip,pins = <7 0 RK_FUNC_1 _pull_none>;
-- 
1.9.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 v17 5/5] ARM: dts: enable Thermal on rk3288-evb board

2014-10-31 Thread Caesar Wang
when a thermal temperature over TSHUT.Default to via
CRU reset the entire chip on rk3288-evb Board,
TSHUT is low active on rk3288-evb board.

Signed-off-by: Caesar Wang 
Reviewed-by: Dmitry Torokhov 
---
 arch/arm/boot/dts/rk3288-evb.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi 
b/arch/arm/boot/dts/rk3288-evb.dtsi
index cb83cea..3e067dd 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -148,6 +148,12 @@
status = "okay";
 };
 
+ {
+   rockchip,hw-tshut-mode = <0>; /* tshut mode 0:CRU 1:GPIO */
+   rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
+   status = "okay";
+};
+
  {
backlight {
bl_en: bl-en {
-- 
1.9.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 v17 2/5] dt-bindings: document Rockchip thermal

2014-10-31 Thread Caesar Wang
This add the necessary binding documentation for the thermal
found on Rockchip SoCs

Signed-off-by: zhaoyifeng 
Signed-off-by: Caesar Wang 
Reviewed-by: Dmitry Torokhov 
---
 .../bindings/thermal/rockchip-thermal.txt  | 63 ++
 1 file changed, 63 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt

diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt 
b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
new file mode 100644
index 000..353d746ba
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
@@ -0,0 +1,63 @@
+* Temperature Sensor ADC (TSADC) on rockchip SoCs
+
+Required properties:
+- compatible : "rockchip,rk3288-tsadc"
+- reg : physical base address of the controller and length of memory mapped
+   region.
+- interrupts : The interrupt number to the cpu. The interrupt specifier format
+  depends on the interrupt controller.
+- clocks : Must contain an entry for each entry in clock-names.
+- clock-names : Shall be "tsadc" for the converter-clock, and "apb_pclk" for
+   the peripheral clock.
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+- rockchip,hw-tshut-temp : The hardware-controlled shutdown temperature value.
+- rockchip,hw-tshut-mode : The hardware-controlled shutdown mode 0:CRU 1:GPIO.
+- rockchip,hw-tshut-polarity : The hardware-controlled active polarity 0:LOW
+  1:HIGH.
+
+Exiample:
+tsadc: tsadc@ff28 {
+   compatible = "rockchip,rk3288-tsadc";
+   reg = <0xff28 0x100>;
+   interrupts = ;
+   clocks = < SCLK_TSADC>, < PCLK_TSADC>;
+   clock-names = "tsadc", "apb_pclk";
+   pinctrl-names = "default";
+   pinctrl-0 = <_out>;
+   #thermal-sensor-cells = <1>;
+   rockchip,hw-tshut-temp = <105000>;
+   rockchip,hw-tshut-mode = <0>;
+   rockchip,hw-tshut-polarity = <0>;
+};
+
+Example: referring to thermal sensors:
+thermal-zones {
+   cpu_thermal: cpu_thermal {
+   polling-delay-passive = <1000>; /* milliseconds */
+   polling-delay = <5000>; /* milliseconds */
+
+   /* sensor   ID */
+   thermal-sensors = <   1>;
+
+   trips {
+   cpu_alert0: cpu_alert {
+   temperature = <8>; /* millicelsius */
+   hysteresis = <2000>; /* millicelsius */
+   type = "passive";
+   };
+   cpu_crit: cpu_crit {
+   temperature = <10>; /* millicelsius */
+   hysteresis = <2000>; /* millicelsius */
+   type = "critical";
+   };
+   };
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device =
+   < THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+   };
+   };
+   };
+};
-- 
1.9.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 v17 3/5] ARM: dts: add RK3288 Thermal data

2014-10-31 Thread Caesar Wang
This patch changes a dtsi file to contain the thermal data
on RK3288 and later SoCs. This data will
enable a thermal shutdown over 100C.

Signed-off-by: Caesar Wang 
Reviewed-by: Dmitry Torokhov 
---
 arch/arm/boot/dts/rk3288-thermal.dtsi | 78 +++
 1 file changed, 78 insertions(+)
 create mode 100644 arch/arm/boot/dts/rk3288-thermal.dtsi

diff --git a/arch/arm/boot/dts/rk3288-thermal.dtsi 
b/arch/arm/boot/dts/rk3288-thermal.dtsi
new file mode 100644
index 000..fca82b0
--- /dev/null
+++ b/arch/arm/boot/dts/rk3288-thermal.dtsi
@@ -0,0 +1,78 @@
+/*
+ * Device Tree Source for RK3288 SoC thermal
+ *
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include 
+
+reserve_thermal: reserve_thermal {
+   polling-delay-passive = <1000>; /* milliseconds */
+   polling-delay = <5000>; /* milliseconds */
+
+   /* sensor   ID */
+   thermal-sensors = <   0>;
+
+};
+
+cpu_thermal: cpu_thermal {
+   polling-delay-passive = <1000>; /* milliseconds */
+   polling-delay = <5000>; /* milliseconds */
+
+   /* sensor   ID */
+   thermal-sensors = <   1>;
+
+   trips {
+   cpu_alert0: cpu_alert0 {
+   temperature = <8>; /* millicelsius */
+   hysteresis = <2000>; /* millicelsius */
+   type = "passive";
+   };
+   cpu_crit: cpu_crit {
+   temperature = <10>; /* millicelsius */
+   hysteresis = <2000>; /* millicelsius */
+   type = "critical";
+   };
+   };
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device =
+   < THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+   };
+   };
+};
+
+gpu_thermal: gpu_thermal {
+   polling-delay-passive = <1000>; /* milliseconds */
+   polling-delay = <5000>; /* milliseconds */
+
+   /* sensor   ID */
+   thermal-sensors = <   2>;
+
+   trips {
+   gpu_alert0: gpu_alert0 {
+   temperature = <8>; /* millicelsius */
+   hysteresis = <2000>; /* millicelsius */
+   type = "passive";
+   };
+   gpu_crit: gpu_crit {
+   temperature = <10>; /* millicelsius */
+   hysteresis = <2000>; /* millicelsius */
+   type = "critical";
+   };
+   };
+
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device =
+   < THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+   };
+   };
+};
-- 
1.9.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 v17 1/5] thermal: rockchip: add driver for thermal

2014-10-31 Thread Caesar Wang
Thermal is TS-ADC Controller module supports
user-defined mode and automatic mode.

User-defined mode refers,TSADC all the control signals entirely by
software writing to register for direct control.

Automaic mode refers to the module automatically poll TSADC output,
and the results were checked.If you find that the temperature High
in a period of time,an interrupt is generated to the processor
down-measures taken;If the temperature over a period of time High,
the resulting TSHUT gave CRU module,let it reset the entire chip,
or via GPIO give PMIC.

Signed-off-by: zhaoyifeng 
Signed-off-by: Caesar Wang 
Reviewed-by: Dmitry Torokhov 
---
 drivers/thermal/Kconfig|   9 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/rockchip_thermal.c | 711 +
 3 files changed, 721 insertions(+)
 create mode 100644 drivers/thermal/rockchip_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index ef5587f..5efcf73 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -133,6 +133,15 @@ config SPEAR_THERMAL
  Enable this to plug the SPEAr thermal sensor driver into the Linux
  thermal framework.
 
+config ROCKCHIP_THERMAL
+   tristate "Rockchip thermal driver"
+   depends on ARCH_ROCKCHIP
+   help
+ Rockchip thermal driver provides support for Temperature sensor
+ ADC (TS-ADC) found on Rockchip SoCs. It supports one critical
+ trip point. Cpufreq is used as the cooling device and will throttle
+ CPUs when the Temperature crosses the passive trip point.
+
 config RCAR_THERMAL
tristate "Renesas R-Car thermal driver"
depends on ARCH_SHMOBILE || COMPILE_TEST
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 31e232f..21da0a8 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -19,6 +19,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
 
 # platform thermal drivers
 obj-$(CONFIG_SPEAR_THERMAL)+= spear_thermal.o
+obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
 obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
 obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
 obj-y  += samsung/
diff --git a/drivers/thermal/rockchip_thermal.c 
b/drivers/thermal/rockchip_thermal.c
new file mode 100644
index 000..b2c36a0
--- /dev/null
+++ b/drivers/thermal/rockchip_thermal.c
@@ -0,0 +1,711 @@
+/*
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * If the temperature over a period of time High,
+ * the resulting TSHUT gave CRU module,let it reset the entire chip,
+ * or via GPIO give PMIC.
+ */
+enum tshut_mode {
+   TSHUT_MODE_CRU = 0,
+   TSHUT_MODE_GPIO,
+};
+
+/**
+ * the system Temperature Sensors tshut(tshut) polarity
+ * the bit 8 is tshut polarity.
+ * 0: low active, 1: high active
+ */
+enum tshut_polarity {
+   TSHUT_LOW_ACTIVE = 0,
+   TSHUT_HIGH_ACTIVE,
+};
+
+/**
+ * The system has three Temperature Sensors.  channel 0 is reserved,
+ * channel 1 is for CPU, and channel 2 is for GPU.
+ */
+enum sensor_id {
+   SENSOR_CPU = 1,
+   SENSOR_GPU,
+};
+
+struct rockchip_tsadc_chip {
+   /* The hardware-controlled tshut property */
+   long tshut_temp;
+   enum tshut_mode tshut_mode;
+   enum tshut_polarity tshut_polarity;
+
+   /* Chip-wide methods */
+   void (*initialize)(void __iomem *reg, enum tshut_polarity p,
+  unsigned long clk_rate);
+   void (*irq_ack)(void __iomem *reg);
+   void (*control)(void __iomem *reg, bool on);
+
+   /* Per-sensor methods */
+   int (*get_temp)(int chn, void __iomem *reg, long *temp);
+   void (*set_alarm_temp)(int chn, void __iomem *reg, long temp);
+   void (*set_tshut_temp)(int chn, void __iomem *reg, long temp);
+   void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
+};
+
+struct rockchip_thermal_sensor {
+   struct rockchip_thermal_data *thermal;
+   struct thermal_zone_device *tzd;
+   enum sensor_id id;
+};
+
+#define NUM_SENSORS2 /* Ignore unused sensor 0 */
+
+struct rockchip_thermal_data {
+   const struct rockchip_tsadc_chip *chip;
+   struct platform_device *pdev;
+
+   struct rockchip_thermal_sensor sensors[NUM_SENSORS];
+
+   struct clk *clk;
+   struct clk *pclk;
+
+   void __iomem *regs;
+
+   

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li

Hi Paolo,
On 14/10/31 下午6:36, Paolo Bonzini wrote:


On 31/10/2014 06:30, Chen, Tiejun wrote:

@@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
  {
 struct vcpu_vmx *vmx = to_vmx(vcpu);
 struct msr_data apic_base_msr;
+   int idx;

 vmx->rmode.vm86_active = 0;

@@ -4509,7 +4510,9 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
 vmcs_write32(TPR_THRESHOLD, 0);
 }

+   idx = srcu_read_lock(>kvm->srcu);
 kvm_vcpu_reload_apic_access_page(vcpu);
+   srcu_read_unlock(>kvm->srcu, idx);

 if (vmx_vm_has_apicv(vcpu->kvm))
 memset(>pi_desc, 0, sizeof(struct pi_desc));

Not enough; you can call vcpu_enter_guest -> kvm_apic_accept_events ->
kvm_vcpu_reset -> vmx_vcpu_reset while under the SRCU lock.  The right
place to add the lock is kvm_arch_vcpu_setup.


This is also not enough. I see the warning in the below path during the 
test:


kvm_arch_vcpu_ioctl_run
-> kvm_apic_accept_events
-> kvm_vcpu_reset

I just send out the version 3 and hope it can take care all the 
situations. ;-)


Regards,
Wanpeng Li



Thanks,

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v2 4/6] staging: ft1000: "foo * bar" should be "foo *bar"

2014-10-31 Thread Chen Weixiang
Remove following code style error from ft1000/ft1000-pcmcia/ft1000_hw.c:
ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Chen Weixiang 
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 9ef7817..db194bc 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -1758,7 +1758,7 @@ static int ft1000_copy_up_pkt(struct net_device *dev)
 SUCCESS
 
   -*/
-static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
+static int ft1000_copy_down_pkt(struct net_device *dev, u16 *packet, u16 len)
 {
struct ft1000_info *info = netdev_priv(dev);
struct ft1000_pcmcia *pcmcia = info->priv;
-- 
2.1.2

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


[PATCH v2 2/6] staging: ft1000: space prohibited after '(', '&' and before ')'

2014-10-31 Thread Chen Weixiang
Remove following code style errors from ft1000/ft1000-pcmcia/ft1000_hw.c:
ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
ERROR: space prohibited after that '&' (ctx:WxW)

Signed-off-by: Chen Weixiang 
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index fc28dee..9ef7817 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -888,7 +888,7 @@ static bool ft1000_receive_cmd(struct net_device *dev, u16 
*pbuffer,
unsigned long flags;
 
if (info->AsicID == ELECTRABUZZ_ID) {
-   size = ( ft1000_read_dpram(dev, *pnxtph) ) + sizeof(struct 
pseudo_hdr);
+   size = (ft1000_read_dpram(dev, *pnxtph)) + sizeof(struct 
pseudo_hdr);
} else {
size =
ntohs(ft1000_read_dpram_mag_16
@@ -998,10 +998,10 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
 else {
 tempword = FT1000_DPRAM_MAG_RX_BASE;
 }
-if ( ft1000_receive_cmd(dev, [0], MAX_CMD_SQSIZE, ) ) {
+if (ft1000_receive_cmd(dev, [0], MAX_CMD_SQSIZE, )) {
 
/* Get the message type which is total_len + PSEUDO header + 
msgtype + message body */
-   pdrvmsg = (struct drv_msg *) & cmdbuffer[0];
+   pdrvmsg = (struct drv_msg *) [0];
msgtype = ntohs(pdrvmsg->type);
DEBUG(1, "Command message type = 0x%x\n", msgtype);
switch (msgtype) {
@@ -1055,7 +1055,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
info->CardReady = 1;
break;
case MEDIA_STATE:
-   pmediamsg = (struct media_msg *) & cmdbuffer[0];
+   pmediamsg = (struct media_msg *) [0];
if (info->ProgConStat != 0xFF) {
if (pmediamsg->state) {
DEBUG(1, "Media is up\n");
@@ -1087,7 +1087,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
 }
break;
case DSP_INIT_MSG:
-   pdspinitmsg = (struct dsp_init_msg *) & cmdbuffer[0];
+   pdspinitmsg = (struct dsp_init_msg *) [0];
memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ);
DEBUG(1, "DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n",
  info->DspVer[0], info->DspVer[1], 
info->DspVer[2],
@@ -1121,7 +1121,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
tempword = ntohs(pdrvmsg->length);
info->DSPInfoBlklen = tempword;
if (tempword < (MAX_DSP_SESS_REC - 4)) {
-   pmsg = (u16 *) & pdrvmsg->data[0];
+   pmsg = (u16 *) >data[0];
for (i = 0; i < ((tempword + 1) / 2); i++) {
DEBUG(1,
  "FT1000:drivermsg:dsp info 
data = 0x%x\n",
@@ -1203,7 +1203,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
 * Put message into Slow Queue
 * Form Pseudo header
 */
-   pmsg = (u16 *) & tempbuffer[0];
+   pmsg = (u16 *) [0];
ppseudo_hdr = (struct pseudo_hdr *) pmsg;
ppseudo_hdr->length = htons(0x0012);
ppseudo_hdr->source = 0x10;
@@ -1224,7 +1224,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
 for (i = 1; i < 7; i++) {
 ppseudo_hdr->checksum ^= *pmsg++;
 }
-   pmsg = (u16 *) & tempbuffer[16];
+   pmsg = (u16 *) [16];
*pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
*pmsg++ = htons(0x000e);
*pmsg++ = htons(info->DSP_TIME[0]);
@@ -1880,22 +1880,22 @@ static int ft1000_copy_down_pkt(struct net_device *dev, 
u16 * packet, u16 len)
  i + 8, htons(*packet));
}
} else {
-   outl(*(u32 *) & pseudo.buff[0],
+   outl(*(u32 *) [0],
 dev->base_addr + FT1000_REG_MAG_UFDR);
DEBUG(1, "ft1000_copy_down_pkt: Pseudo = 0x%8x\n",
- *(u32 *) & pseudo.buff[0]);
-   outl(*(u32 *) & pseudo.buff[2],
+ *(u32 *) [0]);
+   outl(*(u32 *) [2],

[PATCH v2 3/6] staging: ft1000: "(foo*)" should be "(foo *)"

2014-10-31 Thread Chen Weixiang
Remove following code style error from ft1000/ft1000-usb/ft1000_debug.c:
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Chen Weixiang 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 02bfb3e..7bc05fe 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -447,7 +447,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 switch (cmd) {
 case IOCTL_REGISTER_CMD:
 DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
-result = get_user(tempword, (__u16 __user*)argp);
+result = get_user(tempword, (__u16 __user *)argp);
 if (result) {
 DEBUG("result = %d failed to get_user\n", result);
 break;
@@ -652,7 +652,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 }
 pmsg++;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
-   result = card_send_command(ft1000dev,(unsigned 
short*)dpram_data,total_len+2);
+   result = card_send_command(ft1000dev,(unsigned 
short *)dpram_data,total_len+2);
 
 
 ft1000dev->app_info[app_index].nTxMsg++;
-- 
2.1.2

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


[PATCH v2 6/6] staging: ft1000: space required after that ','

2014-10-31 Thread Chen Weixiang
Remove following code style error from ft1000/ft1000-usb/ft1000_debug.c:
ERROR: space required after that ',' (ctx:VxV)

Signed-off-by: Chen Weixiang 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 7bc05fe..5e290e9 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -301,7 +301,7 @@ static int ft1000_open(struct inode *inode, struct file 
*file)
 {
struct ft1000_info *info;
struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
-int i,num;
+int i, num;
 
 DEBUG("%s called\n", __func__);
 num = (MINOR(inode->i_rdev) & 0xf);
@@ -419,12 +419,16 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 struct timeval tv;
struct IOCTL_GET_VER get_ver_data;
struct IOCTL_GET_DSP_STAT get_stat_data;
-u8 ConnectionMsg[] = 
{0x00,0x44,0x10,0x20,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x93,0x64,
-  
0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0a,
-  
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-  
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-  
0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00,
-  0x00,0x01,0x00,0x00};
+u8 ConnectionMsg[] = {0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08,
+  0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00, 0x00,
+  0x01, 0x00, 0x00};
 
 unsigned short ledStat = 0;
 unsigned short conStat = 0;
@@ -475,7 +479,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 break;
 }
 
-DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned 
int)get_ver_data.drv_ver);
+DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n", (unsigned 
int)get_ver_data.drv_ver);
 
 break;
 case IOCTL_CONNECT:
@@ -652,7 +656,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 }
 pmsg++;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
-   result = card_send_command(ft1000dev,(unsigned 
short *)dpram_data,total_len+2);
+   result = card_send_command(ft1000dev, (unsigned 
short *)dpram_data, total_len+2);
 
 
 ft1000dev->app_info[app_index].nTxMsg++;
-- 
2.1.2

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


[PATCH v2 5/6] staging: ft1000: else should follow close brace '}'

2014-10-31 Thread Chen Weixiang
Remove code style error from ft1000/ft1000-pcmcia/ft1000_hw.c:
ERROR: else should follow close brace '}'

Signed-off-by: Chen Weixiang 
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index db194bc..48c1ef2 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -595,8 +595,7 @@ static void ft1000_hbchk(u_long data)
if (tempword != ho) {
if (info->AsicID == ELECTRABUZZ_ID) {
tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
-   }
-   else {
+   } else {
tempword = ntohs(ft1000_read_dpram_mag_16(dev, 
FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX));
}
}
@@ -715,15 +714,13 @@ static void ft1000_hbchk(u_long data)
if (tempword != hi) {
if (info->AsicID == ELECTRABUZZ_ID) {
ft1000_write_dpram(dev, FT1000_HI_HO, hi);
-   }
-   else {
+   } else {
ft1000_write_dpram_mag_16(dev, 
FT1000_MAG_HI_HO, hi_mag, FT1000_MAG_HI_HO_INDX);
}
 
if (info->AsicID == ELECTRABUZZ_ID) {
tempword = ft1000_read_dpram(dev, FT1000_HI_HO);
-   }
-   else {
+   } else {
tempword = ntohs(ft1000_read_dpram_mag_16(dev, 
FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX));
}
 
@@ -994,8 +991,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
 
 if (info->AsicID == ELECTRABUZZ_ID) {
 tempword = FT1000_DPRAM_RX_BASE+2;
-}
-else {
+} else {
 tempword = FT1000_DPRAM_MAG_RX_BASE;
 }
 if (ft1000_receive_cmd(dev, [0], MAX_CMD_SQSIZE, )) {
@@ -1075,8 +1071,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
info->ConTm = 0;
}
}
-}
-else {
+} else {
 DEBUG(1, "Media is down\n");
 if (info->mediastate == 1) {
 info->mediastate = 0;
-- 
2.1.2

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


[PATCH v2 1/6] staging: ft1000: spaces required around that '=', '<' and '=='

2014-10-31 Thread Chen Weixiang
Remove following code style errors from ft1000/ft1000-usb/ft1000_debug.c
and ft1000/ft1000-pcmcia/ft1000_hw.c:
ERROR: spaces required around that '=' (ctx:VxV)
ERROR: spaces required around that '<' (ctx:VxV)
ERROR: spaces required around that '==' (ctx:VxV)

Signed-off-by: Chen Weixiang 
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c |  6 ++---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 28 
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 44575c7..fc28dee 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -812,11 +812,11 @@ static void ft1000_send_cmd (struct net_device *dev, u16 
*ptempbuffer, int size,
 
 /* Make sure SLOWQ doorbell is clear */
 tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL);
-i=0;
+i = 0;
 while (tempword & FT1000_DB_DPRAM_TX) {
 mdelay(10);
 i++;
-if (i==10) {
+if (i == 10) {
 spin_unlock_irqrestore(>dpram_lock, flags);
 return;
 }
@@ -1221,7 +1221,7 @@ static void ft1000_proc_drvmsg(struct net_device *dev)
ppseudo_hdr->portsrc = 0;
/* Calculate new checksum */
 ppseudo_hdr->checksum = *pmsg++;
-for (i=1; i<7; i++) {
+for (i = 1; i < 7; i++) {
 ppseudo_hdr->checksum ^= *pmsg++;
 }
pmsg = (u16 *) & tempbuffer[16];
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 0f347ab..02bfb3e 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -193,7 +193,7 @@ int ft1000_create_dev(struct ft1000_usb *dev)
 
 /* initialize application information */
 dev->appcnt = 0;
-for (i=0; iapp_info[i].nTxMsg = 0;
 dev->app_info[i].nRxMsg = 0;
 dev->app_info[i].nTxMsgReject = 0;
@@ -260,7 +260,7 @@ void ft1000_destroy_dev(struct net_device *netdev)
   dev->DeviceName);
 
 /* Make sure we free any memory reserve for slow Queue */
-for (i=0; iapp_info[i].app_sqlist) == 0) {
 pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, 
struct dpram_blk, list);
 list_del(_blk->list);
@@ -318,7 +318,7 @@ static int ft1000_open(struct inode *inode, struct file 
*file)
 }
 
 /* Search for available application info block */
-for (i=0; iapp_info[i].fileobject == NULL)) {
 break;
 }
@@ -369,7 +369,7 @@ static unsigned int ft1000_poll_dev(struct file *file, 
poll_table *wait)
 }
 
 /* Search for matching file object */
-for (i=0; iapp_info[i].fileobject == >f_owner) {
 /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", 
dev->app_info[i].app_id); */
 break;
@@ -411,7 +411,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 void __user *argp = (void __user *)argument;
struct ft1000_info *info;
 struct ft1000_usb *ft1000dev;
-int result=0;
+int result = 0;
 int cmd;
 int i;
 u16 tempword;
@@ -426,8 +426,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
   
0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00,
   0x00,0x01,0x00,0x00};
 
-unsigned short ledStat=0;
-unsigned short conStat=0;
+unsigned short ledStat = 0;
+unsigned short conStat = 0;
 
 /* DEBUG("ft1000_ioctl called\n"); */
 
@@ -454,7 +454,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 }
 if (tempword == DSPBCMSGID) {
 /* Search for matching file object */
-for (i=0; iapp_info[i].fileobject == >f_owner) {
 ft1000dev->app_info[i].DspBCMsgFlag = 1;
 DEBUG("FT1000:ft1000_ioctl:Registered for broadcast 
messages\n");
@@ -581,12 +581,12 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 result = -EFAULT;
 } else {
 /* Check if this message came from a registered 
application */
-for (i=0; iapp_info[i].fileobject == 
>f_owner) {
 break;
 }
 }
-if (i==MAX_NUM_APP) {
+if (i == MAX_NUM_APP) {
 DEBUG("FT1000:No matching application fileobject\n");
 result = -EINVAL;
kfree(dpram_data);
@@ -646,7 +646,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
   

[PATCH v2 0/6] Remove checkpatch.pl errors from drivers/staging/ft1000

2014-10-31 Thread Chen Weixiang
This is the version 2 of the patch series. The following code style error is
removed from the patch because it was already merged into Greg K-H staging.tree:

ERROR: do not initialise statics to 0 or NULL

This patch series are removing following code style errors from
drivers/staging/ft1000:

ERROR: spaces required around that '=' (ctx:VxV)
ERROR: spaces required around that '<' (ctx:VxV)
ERROR: spaces required around that '==' (ctx:VxV)
ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
ERROR: space prohibited after that '&' (ctx:WxW)
ERROR: "(foo*)" should be "(foo *)"
ERROR: "foo * bar" should be "foo *bar"
ERROR: else should follow close brace '}'
ERROR: space required after that ',' (ctx:VxV)

Chen Weixiang (6):
  staging: ft1000: spaces required around that '=', '<' and '=='
  staging: ft1000: space prohibited after '(', '&' and before ')'
  staging: ft1000: "(foo*)" should be "(foo *)"
  staging: ft1000: "foo * bar" should be "foo *bar"
  staging: ft1000: else should follow close brace '}'
  staging: ft1000: space required after that ','

 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 55 +++-
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 54 ---
 2 files changed, 54 insertions(+), 55 deletions(-)

-- 
2.1.2

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


[PATCH v3] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li
The srcu read lock must be held while accessing memslots (e.g.
when using gfn_to_* functions), however, commit c24ae0dcd3e8
("kvm: x86: Unpin and remove kvm_arch->apic_access_page") call
gfn_to_page() in kvm_vcpu_reload_apic_access_page() w/o hold it in 
vmx_vcpu_reset() path which leads to suspicious rcu_dereference_check() 
usage warning. This patch fix it by holding srcu read lock in all 
kvm_vcpu_reset() call path.


[ INFO: suspicious RCU usage. ]
3.18.0-rc2-test2+ #70 Not tainted
---
include/linux/kvm_host.h:474 suspicious rcu_dereference_check() usage!

other info that might help us debug this:

rcu_scheduler_active = 1, debug_locks = 0
1 lock held by qemu-system-x86/2371:
 #0:  (>mutex){+.+...}, at: [] vcpu_load+0x20/0xd0 [kvm]

stack backtrace:
CPU: 4 PID: 2371 Comm: qemu-system-x86 Not tainted 3.18.0-rc2-test2+ #70
Hardware name: Dell Inc. OptiPlex 9010/0M9KCM, BIOS A12 01/10/2013
 0001 880209983ca8 816f514f 
 8802099b8990 880209983cd8 810bd687 000fee00
 880208a2c000 880208a1 88020ef50040 880209983d08
Call Trace:
 [] dump_stack+0x4e/0x71
 [] lockdep_rcu_suspicious+0xe7/0x120
 [] gfn_to_memslot+0xd5/0xe0 [kvm]
 [] __gfn_to_pfn+0x33/0x60 [kvm]
 [] gfn_to_page+0x25/0x90 [kvm]
 [] kvm_vcpu_reload_apic_access_page+0x3c/0x80 [kvm]
 [] vmx_vcpu_reset+0x20c/0x460 [kvm_intel]
 [] kvm_vcpu_reset+0x15e/0x1b0 [kvm]
 [] kvm_arch_vcpu_setup+0x2c/0x50 [kvm]
 [] kvm_vm_ioctl+0x1d0/0x780 [kvm]
 [] ? __lock_is_held+0x54/0x80
 [] do_vfs_ioctl+0x300/0x520
 [] ? __fget+0x5/0x250
 [] ? __fget_light+0x2a/0xe0
 [] SyS_ioctl+0x81/0xa0
 [] system_call_fastpath+0x16/0x1b

Reported-by: Takashi Iwai 
Reported-by: Alexei Starovoitov 
Signed-off-by: Wanpeng Li 
---
v2 -> v3:
 * take care all vmx_vcpu_reset call path
v1 -> v2:
 * just fix hold the srcu read lock in vmx_vcpu_reset path

 arch/x86/kvm/x86.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0033df3..701a90d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6458,7 +6458,7 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 {
-   int r;
+   int r, idx;
sigset_t sigsaved;
 
if (!tsk_used_math(current) && init_fpu(current))
@@ -6469,7 +6469,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct 
kvm_run *kvm_run)
 
if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
kvm_vcpu_block(vcpu);
+   idx = srcu_read_lock(>kvm->srcu);
kvm_apic_accept_events(vcpu);
+   srcu_read_unlock(>kvm->srcu, idx);
clear_bit(KVM_REQ_UNHALT, >requests);
r = -EAGAIN;
goto out;
@@ -6626,7 +6628,11 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
 int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
+   int idx;
+
+   idx = srcu_read_lock(>kvm->srcu);
kvm_apic_accept_events(vcpu);
+   srcu_read_unlock(>kvm->srcu, idx);
if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED &&
vcpu->arch.pv.pv_unhalted)
mp_state->mp_state = KVM_MP_STATE_RUNNABLE;
@@ -6943,13 +6949,15 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
 
 int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
-   int r;
+   int r, idx;
 
vcpu->arch.mtrr_state.have_fixed = 1;
r = vcpu_load(vcpu);
if (r)
return r;
+   idx = srcu_read_lock(>kvm->srcu);
kvm_vcpu_reset(vcpu);
+   srcu_read_unlock(>kvm->srcu, idx);
kvm_mmu_setup(vcpu);
vcpu_put(vcpu);
 
-- 
1.7.1

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


Re: [PATCH] x86_64, entry: Fix out of bounds read on sysenter

2014-10-31 Thread Rusty Russell
Andy Lutomirski  writes:
> Rusty noticed a Really Bad Bug (tm) in my NT fix.  The entry code
> reads out of bounds, causing the NT fix to be unreliable.  But, and
> this is much, much worse, if your stack is somehow just below the
> top of the direct map (or a hole), you read out of bounds and crash.
>
> Excerpt from the crash:
>
> [1.129513] RSP: 0018:88001da4bf88  EFLAGS: 00010296
>
>   2b:*f7 84 24 90 00 00 00 testl  $0x4000,0x90(%rsp)
>
> That read is deterministically above the top of the stack.  I
> thought I even single-stepped through this code when I wrote it to
> check the offset, but I clearly screwed it up.
>
> Fixes 8c7aa698baca x86_64, entry: Filter RFLAGS.NT on entry from userspace
>
> Reported-by: Rusty Russell 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Andy Lutomirski 

Tested-by: Rusty Russell 

Thanks for the fast response...
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: Machine crashes right *after* ~successful resume

2014-10-31 Thread Yinghai Lu
On Fri, Oct 31, 2014 at 5:00 PM, Wilmer van der Gaast  wrote:
> Hello,
>
> Patch #1 worked after a simple s/&&/)/. And patch #2 seems to fix the
> problem as well!

updated first #1.
---
 drivers/pci/pci.c |   18 ++
 1 file changed, 18 insertions(+)

Index: linux-2.6/drivers/pci/pci.c
===
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -1265,6 +1265,24 @@ static void pci_enable_bridge(struct pci
 	pci_set_master(dev);
 }
 
+static void pci_enable_ite(struct pci_dev *dev)
+{
+	/*
+	 * FW enable the bridge already, so call pci_enable_bridge()
+	 * to keep enable_cnt consistent, then later we can go through
+	 * pci_pm_resume/pci_pm_reenable_device to enable it again.
+	 * --- for pci bridge without driver case.
+	 */
+if (!pci_is_enabled(dev)) {
+		u16 cmd;
+
+		pci_read_config_word(dev, PCI_COMMAND, );
+		if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY))
+			pci_enable_bridge(dev);
+	}
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ITE, 0x8892, pci_enable_ite);
+
 static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
 {
 	struct pci_dev *bridge;


Re: [PATCHv2 7/7] cgroup: mount cgroupns-root when inside non-init cgroupns

2014-10-31 Thread Eric W. Biederman
Aditya Kali  writes:

> This patch enables cgroup mounting inside userns when a process
> as appropriate privileges. The cgroup filesystem mounted is
> rooted at the cgroupns-root. Thus, in a container-setup, only
> the hierarchy under the cgroupns-root is exposed inside the container.
> This allows container management tools to run inside the containers
> without depending on any global state.
> In order to support this, a new kernfs api is added to lookup the
> dentry for the cgroupns-root.

There is a misdesign in this.  Because files already exist we need the
protections that are present in proc and sysfs that only allow you to
mount the filesystem if it is already mounted.  Otherwise you can wind
up mounting this cgroupfs in a chroot jail when the global root would
not like you to see it.  cgroupfs isn't as bad as proc and sys but there
is at the very least an information leak in mounting it.

Given that we are effectively performing a bind mount in this patch, and
that we need to require cgroupfs be mounted anyway (to be safe).

I don't see the point of this change.  

If we could change the set of cgroups or visible in cgroupfs I could
probably see the point.  But as it is this change seems to be pointless.

Eric


> Signed-off-by: Aditya Kali 
> ---
>  fs/kernfs/mount.c  | 48 
>  include/linux/kernfs.h |  2 ++
>  kernel/cgroup.c| 47 +--
>  3 files changed, 95 insertions(+), 2 deletions(-)
>
> diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
> index f973ae9..e334f45 100644
> --- a/fs/kernfs/mount.c
> +++ b/fs/kernfs/mount.c
> @@ -62,6 +62,54 @@ struct kernfs_root *kernfs_root_from_sb(struct super_block 
> *sb)
>   return NULL;
>  }
>  
> +/**
> + * kernfs_make_root - create new root dentry for the given kernfs_node.
> + * @sb: the kernfs super_block
> + * @kn: kernfs_node for which a dentry is needed
> + *
> + * This can used used by callers which want to mount only a part of the 
> kernfs
> + * as root of the filesystem.
> + */
> +struct dentry *kernfs_obtain_root(struct super_block *sb,
> +   struct kernfs_node *kn)
> +{
> + struct dentry *dentry;
> + struct inode *inode;
> +
> + BUG_ON(sb->s_op != _sops);
> +
> + /* inode for the given kernfs_node should already exist. */
> + inode = ilookup(sb, kn->ino);
> + if (!inode) {
> + pr_debug("kernfs: could not get inode for '");
> + pr_cont_kernfs_path(kn);
> + pr_cont("'.\n");
> + return ERR_PTR(-EINVAL);
> + }
> +
> + /* instantiate and link root dentry */
> + dentry = d_obtain_root(inode);
> + if (!dentry) {
> + pr_debug("kernfs: could not get dentry for '");
> + pr_cont_kernfs_path(kn);
> + pr_cont("'.\n");
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + /* If this is a new dentry, set it up. We need kernfs_mutex because this
> +  * may be called by callers other than kernfs_fill_super. */
> + mutex_lock(_mutex);
> + if (!dentry->d_fsdata) {
> + kernfs_get(kn);
> + dentry->d_fsdata = kn;
> + } else {
> + WARN_ON(dentry->d_fsdata != kn);
> + }
> + mutex_unlock(_mutex);
> +
> + return dentry;
> +}
> +
>  static int kernfs_fill_super(struct super_block *sb, unsigned long magic)
>  {
>   struct kernfs_super_info *info = kernfs_info(sb);
> diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
> index 3c2be75..b9538e0 100644
> --- a/include/linux/kernfs.h
> +++ b/include/linux/kernfs.h
> @@ -274,6 +274,8 @@ void kernfs_put(struct kernfs_node *kn);
>  struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry);
>  struct kernfs_root *kernfs_root_from_sb(struct super_block *sb);
>  
> +struct dentry *kernfs_obtain_root(struct super_block *sb,
> +   struct kernfs_node *kn);
>  struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
>  unsigned int flags, void *priv);
>  void kernfs_destroy_root(struct kernfs_root *root);
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 7e5d597..250aaec 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1302,6 +1302,13 @@ static int parse_cgroupfs_options(char *data, struct 
> cgroup_sb_opts *opts)
>  
>   memset(opts, 0, sizeof(*opts));
>  
> + /* Implicitly add CGRP_ROOT_SANE_BEHAVIOR if inside a non-init cgroup
> +  * namespace.
> +  */
> + if (current->nsproxy->cgroup_ns != _cgroup_ns) {
> + opts->flags |= CGRP_ROOT_SANE_BEHAVIOR;
> + }
> +
>   while ((token = strsep(, ",")) != NULL) {
>   nr_opts++;
>  
> @@ -1391,7 +1398,7 @@ static int parse_cgroupfs_options(char *data, struct 
> cgroup_sb_opts *opts)
>  
>   if (opts->flags & CGRP_ROOT_SANE_BEHAVIOR) {
>   pr_warn("sane_behavior: this is still under 

[PATCH] x86_64, entry: Fix out of bounds read on sysenter

2014-10-31 Thread Andy Lutomirski
Rusty noticed a Really Bad Bug (tm) in my NT fix.  The entry code
reads out of bounds, causing the NT fix to be unreliable.  But, and
this is much, much worse, if your stack is somehow just below the
top of the direct map (or a hole), you read out of bounds and crash.

Excerpt from the crash:

[1.129513] RSP: 0018:88001da4bf88  EFLAGS: 00010296

  2b:*f7 84 24 90 00 00 00 testl  $0x4000,0x90(%rsp)

That read is deterministically above the top of the stack.  I
thought I even single-stepped through this code when I wrote it to
check the offset, but I clearly screwed it up.

Fixes 8c7aa698baca x86_64, entry: Filter RFLAGS.NT on entry from userspace

Reported-by: Rusty Russell 
Cc: sta...@vger.kernel.org
Signed-off-by: Andy Lutomirski 
---

Linus, etc: this should probably go in pretty quickly before it hits -stable
too hard.  Fortunately it's unlikely to be a meaningful security problem,
but it's a nasty regression.  (It *is* a security problem in -next, but we
get a free pass on that one.)

 arch/x86/ia32/ia32entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 8ffba18395c8..ffe71228fc10 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -157,7 +157,7 @@ ENTRY(ia32_sysenter_target)
 * ourselves.  To save a few cycles, we can check whether
 * NT was set instead of doing an unconditional popfq.
 */
-   testl $X86_EFLAGS_NT,EFLAGS(%rsp)   /* saved EFLAGS match cpu */
+   testl $X86_EFLAGS_NT,EFLAGS-ARGOFFSET(%rsp)
jnz sysenter_fix_flags
 sysenter_flags_fixed:
 
-- 
1.9.3

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


Re: [PATCH v8 3/5] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM

2014-10-31 Thread Russell King - ARM Linux
On Sat, Nov 01, 2014 at 12:55:14AM +, Russell King - ARM Linux wrote:
> On Sat, Nov 01, 2014 at 01:45:47AM +0100, Rafael J. Wysocki wrote:
> > On Monday, October 20, 2014 11:04:46 AM Krzysztof Kozlowski wrote:
> > > @@ -198,8 +217,10 @@ static int amba_probe(struct device *dev)
> > >   pm_runtime_enable(dev);
> > >  
> > >   ret = pcdrv->probe(pcdev, id);
> > > - if (ret == 0)
> > > + if (ret == 0) {
> > > + pcdev->irq_safe = pm_runtime_is_irq_safe(dev);
> > 
> > This looks racy.
> > 
> > Is it guaranteed that runtime PM callbacks won't be run for the device
> > after pcdrv->probe() has returned and before setting pcdev->irq_safe?
> > If not, inconsistent behavior may ensue.
> 
> You are absolutely correct.  So that knocks that idea on its head.

Actually, I think we shouldn't give up hope here.  Currently, we do this:

pm_runtime_get_noresume(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);

ret = pcdrv->probe(pcdev, id);

What we could do is:

pm_runtime_get_noresume(dev);
pm_runtime_get_noresume(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);

ret = pcdrv->probe(pcdev, id);
if (ret == 0) {
pcdev->irq_safe = pm_runtime_is_irq_safe(dev);
pm_runtime_put(dev);
break;
}

pm_runtime_disable(dev);
pm_runtime_set_suspended(dev);
pm_runtime_put_noidle(dev);
pm_runtime_put_noidle(dev);

which would ensure that we hold a usecount until after the probe function
has returned.  Would that work?

I'll give you that it's pretty horrid.

Would another possible solution be to remember the irq-safeness in the
suspend handler, and use that in the resume handler?  Resume should
/always/ undo what the suspend handler previously did wrt clk API stuff.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v4 0/2] x86_64,entry: Clear NT on entry and speed up switch_to

2014-10-31 Thread Andy Lutomirski
On Fri, Oct 31, 2014 at 5:20 PM, Rusty Russell  wrote:
> Andy Lutomirski  writes:
>> Anish Bhatt noticed that user programs can set RFLAGS.NT before
>> syscall or sysenter, and the kernel entry code doesn't filter out
>> NT.  This causes kernel C code and, depending on thread flags, the
>> exit slow path to run with NT set.
>
> OK, this causes oopsen as a guest under kvm for me.  Details below:
>
> commit 8c7aa698baca5e8f1ba9edb68081f1e7a1abf455
> Author: Andy Lutomirski 
> Date:   Wed Oct 1 11:49:04 2014 -0700
>
> x86_64, entry: Filter RFLAGS.NT on entry from userspace

Well, crap.

>
> Some dmesg:
>

> [1.126953] BUG: unable to handle kernel paging request at 88001da4c018
> [1.128482] IP: [] ia32_sysenter_target+0x4d/0x5e
> [1.129513] PGD 2d6c067 PUD 2d6d067 PMD 1fdf4067 PTE 80001da4c060
> [1.129513] Oops:  [#1] SMP DEBUG_PAGEALLOC
> [1.129513] Modules linked in:
> [1.129513] CPU: 0 PID: 69 Comm: init Not tainted 3.17.0-rc7+ #245
> [1.129513] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
> 1.7.5-20140531_171129-lamiak 04/01/2014
> [1.129513] task: 88001da08000 ti: 88001da48000 task.ti: 
> 88001da48000
> [1.129513] RIP: 0010:[]  [] 
> ia32_sysenter_target+0x4d/0x5e
> [1.129513] RSP: 0018:88001da4bf88  EFLAGS: 00010296

So we're 0x78 bytes below the page boundary...

> [1.129513] RAX: 0137 RBX: f754e730 RCX: 
> 000c
> [1.129513] RDX: f7711000 RSI:  RDI: 
> f77c3040
> [1.129513] RBP: ffca97c8 R08: 8138aa0b R09: 
> ffcaba58
> [1.129513] R10: f77a1b70 R11:  R12: 
> 
> [1.129513] R13:  R14:  R15: 
> 
> [1.129513] FS:  () GS:88001fa0(0063) 
> knlGS:f754e6c0
> [1.129513] CS:  0010 DS: 002b ES: 002b CR0: 8005003b
> [1.129513] CR2: 88001da4c018 CR3: 1da2c000 CR4: 
> 06f0
> [1.129513] Stack:
> [1.129513]    ffcaba58 
> 8138aa0b
> [1.129513]  0137 000c f7711000 
> 
> [1.129513]  f77c3040 0137 f77a1b70 
> 0023
> [1.129513] Call Trace:
> [1.129513]  [] ? trace_hardirqs_on_thunk+0x3a/0x3f
> [1.129513] Code: c0 41 52 50 fc 48 83 ec 48 48 89 7c 24 40 48 89 74 24 38 
> 48 89 54 24 30 48 89 4c 24 28 48 89 44 24 20 66 66 90 8b 6d 00 66 66 90  
> 84 24 90 00 00 00 00 40 00 00 0f 85 2f 01 00 00 83 8c 24 8c

   0:c0 41 52 50  rolb   $0x50,0x52(%rcx)
   4:fc   cld
   5:48 83 ec 48  sub$0x48,%rsp
   9:48 89 7c 24 40   mov%rdi,0x40(%rsp)
   e:48 89 74 24 38   mov%rsi,0x38(%rsp)
  13:48 89 54 24 30   mov%rdx,0x30(%rsp)
  18:48 89 4c 24 28   mov%rcx,0x28(%rsp)
  1d:48 89 44 24 20   mov%rax,0x20(%rsp)
  22:66 66 90 data32 xchg %ax,%ax
  25:8b 6d 00 mov0x0(%rbp),%ebp
  28:66 66 90 data32 xchg %ax,%ax
  2b:*f7 84 24 90 00 00 00 testl  $0x4000,0x90(%rsp)
<-- trapping instruction

This seems to be just slightly out of bounds.

[Insert large number of expletives here]  This is really bad.  It
worked when I tested it because of dumb luck.  If I read random
garbage there, there's a pretty good chance that the code will work.
But somehow you're right at the end of the entire memory map, and
you're totally screwed.

Fix coming.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [PATCHv2 5/7] cgroup: introduce cgroup namespaces

2014-10-31 Thread Eric W. Biederman
Andy Lutomirski  writes:

> On Fri, Oct 31, 2014 at 12:18 PM, Aditya Kali  wrote:



>> +static void *cgroupns_get(struct task_struct *task)
>> +{
>> +   struct cgroup_namespace *ns = NULL;
>> +   struct nsproxy *nsproxy;
>> +
>> +   rcu_read_lock();
>> +   nsproxy = task->nsproxy;
>> +   if (nsproxy) {
>> +   ns = nsproxy->cgroup_ns;
>> +   get_cgroup_ns(ns);
>> +   }
>> +   rcu_read_unlock();
>
> How is this correct?  Other namespaces do it too, so it Must Be
> Correct (tm), but I don't understand.  What is RCU protecting?

The code is not correct.  The code needs to use task_lock.

RCU used to protect nsproxy, and now task_lock protects nsproxy.
For the reasons of of all of this I refer you to the commit
that changed this, and the comment in nsproxy.h

commit 728dba3a39c66b3d8ac889ddbe38b5b1c264aec3
Author: Eric W. Biederman 
Date:   Mon Feb 3 19:13:49 2014 -0800

namespaces: Use task_lock and not rcu to protect nsproxy

The synchronous syncrhonize_rcu in switch_task_namespaces makes setns
a sufficiently expensive system call that people have complained.

Upon inspect nsproxy no longer needs rcu protection for remote reads.
remote reads are rare.  So optimize for same process reads and write
by switching using rask_lock instead.

This yields a simpler to understand lock, and a faster setns system call.

In particular this fixes a performance regression observed
by Rafael David Tinoco .

This is effectively a revert of Pavel Emelyanov's commit
cf7b708c8d1d7a27736771bcf4c457b332b0f818 Make access to task's nsproxy 
lighter
from 2007.  The race this originialy fixed no longer exists as
do_notify_parent uses task_active_pid_ns(parent) instead of
parent->nsproxy.

Signed-off-by: "Eric W. Biederman" 

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


Re: [PATCH v8 3/5] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM

2014-10-31 Thread Russell King - ARM Linux
On Sat, Nov 01, 2014 at 01:45:47AM +0100, Rafael J. Wysocki wrote:
> On Monday, October 20, 2014 11:04:46 AM Krzysztof Kozlowski wrote:
> > @@ -198,8 +217,10 @@ static int amba_probe(struct device *dev)
> > pm_runtime_enable(dev);
> >  
> > ret = pcdrv->probe(pcdev, id);
> > -   if (ret == 0)
> > +   if (ret == 0) {
> > +   pcdev->irq_safe = pm_runtime_is_irq_safe(dev);
> 
> This looks racy.
> 
> Is it guaranteed that runtime PM callbacks won't be run for the device
> after pcdrv->probe() has returned and before setting pcdev->irq_safe?
> If not, inconsistent behavior may ensue.

You are absolutely correct.  So that knocks that idea on its head.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] davinci: Use standard logging styles

2014-10-31 Thread Joe Perches
Convert printks to pr_ and pr_warning to pr_warn.

Other miscellanea:

o Coalesce formats
o Realign arguments
o Use %s, __func__ instead of embedded function names
o Add pr_fmt to mityomapl138 and mux

Signed-off-by: Joe Perches 
---
 arch/arm/mach-davinci/board-da830-evm.c| 89 +-
 arch/arm/mach-davinci/board-dm644x-evm.c   | 10 ++--
 arch/arm/mach-davinci/board-mityomapl138.c | 45 ---
 arch/arm/mach-davinci/board-neuros-osd2.c  |  5 +-
 arch/arm/mach-davinci/clock.c  |  2 +-
 arch/arm/mach-davinci/mux.c| 15 +++--
 arch/arm/mach-davinci/time.c   | 13 ++---
 7 files changed, 81 insertions(+), 98 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c 
b/arch/arm/mach-davinci/board-da830-evm.c
index 5623131..f8f62fb 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -80,8 +80,8 @@ static int da830_evm_usb_ocic_notify(da8xx_ocic_handler_t 
handler)
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"OHCI over-current indicator", NULL);
if (error)
-   printk(KERN_ERR "%s: could not request IRQ to watch "
-  "over-current indicator changes\n", __func__);
+   pr_err("%s: could not request IRQ to watch over-current 
indicator changes\n",
+  __func__);
} else
free_irq(irq, NULL);
 
@@ -145,8 +145,7 @@ static __init void da830_evm_usb_init(void)
/* USB_REFCLKIN is not used. */
ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
if (ret)
-   pr_warning("%s: USB 2.0 PinMux setup failed: %d\n",
-  __func__, ret);
+   pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
else {
/*
 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
@@ -154,37 +153,35 @@ static __init void da830_evm_usb_init(void)
 */
ret = da8xx_register_usb20(1000, 3);
if (ret)
-   pr_warning("%s: USB 2.0 registration failed: %d\n",
-  __func__, ret);
+   pr_warn("%s: USB 2.0 registration failed: %d\n",
+   __func__, ret);
}
 
ret = davinci_cfg_reg_list(da830_evm_usb11_pins);
if (ret) {
-   pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
-  __func__, ret);
+   pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret);
return;
}
 
ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV");
if (ret) {
-   printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
-  "power control: %d\n", __func__, ret);
+   pr_err("%s: failed to request GPIO for USB 1.1 port power 
control: %d\n",
+  __func__, ret);
return;
}
gpio_direction_output(ON_BD_USB_DRV, 0);
 
ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
if (ret) {
-   printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
-  "over-current indicator: %d\n", __func__, ret);
+   pr_err("%s: failed to request GPIO for USB 1.1 port 
over-current indicator: %d\n",
+  __func__, ret);
return;
}
gpio_direction_input(ON_BD_USB_OVC);
 
ret = da8xx_register_usb11(_evm_usb11_pdata);
if (ret)
-   pr_warning("%s: USB 1.1 registration failed: %d\n",
-  __func__, ret);
+   pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret);
 }
 
 static const short da830_evm_mcasp1_pins[] = {
@@ -252,31 +249,29 @@ static inline void da830_evm_init_mmc(void)
 
ret = davinci_cfg_reg_list(da830_evm_mmc_sd_pins);
if (ret) {
-   pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n",
-   ret);
+   pr_warn("%s: mmc/sd mux setup failed: %d\n", __func__, ret);
return;
}
 
ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP");
if (ret) {
-   pr_warning("da830_evm_init: can not open GPIO %d\n",
-  DA830_MMCSD_WP_PIN);
+   pr_warn("%s: can not open GPIO %d\n",
+   __func__, DA830_MMCSD_WP_PIN);
return;
}
gpio_direction_input(DA830_MMCSD_WP_PIN);
 
ret = gpio_request(DA830_MMCSD_CD_PIN, "MMC CD\n");
if (ret) {
-   pr_warning("da830_evm_init: can not open GPIO %d\n",
-  DA830_MMCSD_CD_PIN);
+   pr_warn("%s: can not open GPIO %d\n",
+   __func__, 

Re: [PATCH v4 0/2] x86_64,entry: Clear NT on entry and speed up switch_to

2014-10-31 Thread Rusty Russell
Andy Lutomirski  writes:
> Anish Bhatt noticed that user programs can set RFLAGS.NT before
> syscall or sysenter, and the kernel entry code doesn't filter out
> NT.  This causes kernel C code and, depending on thread flags, the
> exit slow path to run with NT set.

OK, this causes oopsen as a guest under kvm for me.  Details below:

commit 8c7aa698baca5e8f1ba9edb68081f1e7a1abf455
Author: Andy Lutomirski 
Date:   Wed Oct 1 11:49:04 2014 -0700

x86_64, entry: Filter RFLAGS.NT on entry from userspace

Some dmesg:

[0.820982] serio: i8042 KBD port at 0x60,0x64 irq 1
[0.822118] serio: i8042 AUX port at 0x60,0x64 irq 12
[0.824445] mousedev: PS/2 mouse device common for all mice
[0.827262] input: AT Translated Set 2 keyboard as 
/devices/platform/i8042/serio0/input/input1
[0.830249] rtc_cmos 00:00: RTC can wake from S4
[0.831830] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[0.833314] rtc_cmos 00:00: alarms up to one day, 114 bytes nvram, hpet irqs
[0.835128] device-mapper: uevent: version 1.0.3
[0.836526] device-mapper: ioctl: 4.27.0-ioctl (2013-10-30) initialised: 
dm-de...@redhat.com
[0.838566] TCP: cubic registered
[0.839891] NET: Registered protocol family 10
[0.841868] NET: Registered protocol family 17
[0.843005] Key type dns_resolver registered
[0.845481] registered taskstats version 1
[0.847120] kworker/u2:2 (48) used greatest stack depth: 14400 bytes left
[0.849147] kworker/u2:3 (50) used greatest stack depth: 14048 bytes left
[0.850779] Key type trusted registered
[0.853360] Key type encrypted registered
[0.855561] AppArmor: AppArmor sha1 policy hashing enabled
[0.856768] cryptomgr_probe (63) used greatest stack depth: 13712 bytes left
[0.858156] evm: HMAC attrs: 0x1
[0.859577]   Magic number: 2:172:455
[0.860833] rtc_cmos 00:00: setting system clock to 2014-10-31 23:26:48 UTC 
(1414798008)
[0.862465] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[0.863663] EDD information not available.
[0.964548] ata2.00: ATAPI: QEMU DVD-ROM, 2.1.0, max UDMA/100
[0.966081] ata2.00: configured for MWDMA2
[0.968174] scsi 1:0:0:0: CD-ROMQEMU QEMU DVD-ROM 2.1. 
PQ: 0 ANSI: 5
[0.977913] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[0.978861] cdrom: Uniform CD-ROM driver Revision: 3.20
[0.981138] sr 1:0:0:0: Attached scsi generic sg0 type 5
[0.982634] md: Waiting for all devices to be available before autodetect
[0.986583] md: If you don't use raid, use raid=noautodetect
[0.990236] md: Autodetecting RAID arrays.
[0.991035] md: Scanned 0 and added 0 devices.
[0.991815] md: autorun ...
[0.992215] md: ... autorun DONE.
[0.994068] EXT3-fs (vda1): error: couldn't mount because of unsupported 
optional features (240)
[0.996331] EXT4-fs (vda1): couldn't mount as ext2 due to feature 
incompatibilities
[1.003145] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: 
(null)
[1.006600] VFS: Mounted root (ext4 filesystem) readonly on device 253:1.
[1.010007] devtmpfs: mounted
[1.011632] debug: unmapping init [mem 0x81d2b000-0x81e6]
[1.012631] Write protecting the kernel read-only data: 12288k
[1.013571] debug: unmapping init [mem 0x88000170d000-0x8800017f]
[1.014639] debug: unmapping init [mem 0x880001b21000-0x880001bf]
[1.123201] random: init urandom read with 8 bits of entropy available
[1.126953] BUG: unable to handle kernel paging request at 88001da4c018
[1.128482] IP: [] ia32_sysenter_target+0x4d/0x5e
[1.129513] PGD 2d6c067 PUD 2d6d067 PMD 1fdf4067 PTE 80001da4c060
[1.129513] Oops:  [#1] SMP DEBUG_PAGEALLOC
[1.129513] Modules linked in:
[1.129513] CPU: 0 PID: 69 Comm: init Not tainted 3.17.0-rc7+ #245
[1.129513] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
1.7.5-20140531_171129-lamiak 04/01/2014
[1.129513] task: 88001da08000 ti: 88001da48000 task.ti: 
88001da48000
[1.129513] RIP: 0010:[]  [] 
ia32_sysenter_target+0x4d/0x5e
[1.129513] RSP: 0018:88001da4bf88  EFLAGS: 00010296
[1.129513] RAX: 0137 RBX: f754e730 RCX: 000c
[1.129513] RDX: f7711000 RSI:  RDI: f77c3040
[1.129513] RBP: ffca97c8 R08: 8138aa0b R09: ffcaba58
[1.129513] R10: f77a1b70 R11:  R12: 
[1.129513] R13:  R14:  R15: 
[1.129513] FS:  () GS:88001fa0(0063) 
knlGS:f754e6c0
[1.129513] CS:  0010 DS: 002b ES: 002b CR0: 8005003b
[1.129513] CR2: 88001da4c018 CR3: 1da2c000 CR4: 06f0
[1.129513] Stack:
[1.129513]    ffcaba58 
8138aa0b
[1.129513]  0137 

Re: [PATCH v8 1/5] PM / Runtime: Add getter for querying the IRQ safe option

2014-10-31 Thread Laurent Pinchart
Hi Krzysztof,

On Friday 31 October 2014 15:40:16 Krzysztof Kozlowski wrote:
> On pią, 2014-10-31 at 15:22 +0100, Pavel Machek wrote:
> > On Fri 2014-10-31 10:14:55, Krzysztof Kozlowski wrote:
> >> On pon, 2014-10-20 at 11:04 +0200, Krzysztof Kozlowski wrote:
> >>> Add a simple getter pm_runtime_is_irq_safe() for querying whether
> >>> runtime PM IRQ safe was set or not.
> >>> 
> >>> Various bus drivers implementing runtime PM may use choose to suspend
> >>> differently based on IRQ safeness status of child driver (e.g. do not
> >>> unprepare the clock if IRQ safe is not set).
> >>> 
> >>> Signed-off-by: Krzysztof Kozlowski 
> >>> Reviewed-by: Ulf Hansson 
> >> 
> >> Rafael, Len, Pavel,
> >> 
> >> Is proposed API ok? Do you have any comments?
> >> 
> >> I'll upload whole patchset to Russell's patch tracking system. However
> >> an ack from PM maintainer is probably needed.
> > 
> > I don't like the API. Having callbacks work in different context (irq
> > / noirq) based on what another function reports is ugly.
> > 
> > What is the penalty if we always decide callbacks are not IRQ safe?
> 
> Then pm_runtime_get_sync() could not be called in atomic context. The
> pl330 runtime PM would have to be completely reworked because one
> pm_runtime_get_sync() is called in device_issue_pending which cannot
> sleep (at least in non preemptible kernels). Probably this can be solved
> some way...

Many other drivers suffer from the same problem. While I won't reject your 
proposed fix, I would prefer a more generic approach.

One option that has been discussed previously was to use a work queue to delay 
starting the DMA transfer to an interruptible context where 
pm_runtime_get_sync() could be called. However, as Russell pointed out [1], 
even that won't work in all cases as the DMA slave might need the transfer to 
be started before enabling part of its hardware (OMAP audio seem to be such a 
case).

I've heard a rumor of a possible DMA engine rework to forbid calling the 
descriptor preparation API from atomic context. This could be used as a base 
to implement runtime PM, as DMA slave drivers should not prepare descriptors 
if they don't need to use them. However that's a long term plan, and we need a 
solution sooner than that.

I've been toying with the idea of adding explicit open/close (or whatever we 
would call them) operations to the DMA engine API. Those would be used by DMA 
slave drivers to signal that they will start/stop using the DMA engine.

If (1) we must start the DMA synchronously with a DMA slave call, (2) need to 
sleep to handle PM, and (3) don't want to keep the DMA engine powered for as 
long as one channel is requested, then we need to turn at least preparation as 
not callable in atomic context, or introduce a new operation.

[1] http://www.spinics.net/lists/dmaengine/msg01548.html

> >>> --- a/Documentation/power/runtime_pm.txt
> >>> +++ b/Documentation/power/runtime_pm.txt
> >>> 
> >>> @@ -468,6 +468,10 @@ drivers/base/power/runtime.c and
> >>> include/linux/pm_runtime.h:
> >>>  - set the power.irq_safe flag for the device, causing the
> >>>  runtime-PM
> >>>  
> >>>callbacks to be invoked with interrupts off
> >>> 
> >>> +  bool pm_runtime_is_irq_safe(struct device *dev);
> >>> +- return true if power.irq_safe flag was set for the device,
> >>> causing
> >>> +  the runtime-PM callbacks to be invoked with interrupts off
> >>> +
> >>> 
> >>>void pm_runtime_mark_last_busy(struct device *dev);
> >>>
> >>>  - set the power.last_busy field to the current time

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v8 3/5] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM

2014-10-31 Thread Rafael J. Wysocki
On Monday, October 20, 2014 11:04:46 AM Krzysztof Kozlowski wrote:
> The AMBA bus driver defines runtime Power Management functions which
> disable and unprepare AMBA bus clock. This is problematic for runtime PM
> because unpreparing a clock might sleep so it is not interrupt safe.
> 
> However some drivers may want to implement runtime PM functions in
> interrupt-safe way (see pm_runtime_irq_safe()). In such case the AMBA
> bus driver should only disable/enable the clock in runtime suspend and
> resume callbacks.
> 
> Detect the device driver behavior after calling its probe function and
> store it. During runtime suspend/resume deal with clocks according to
> stored value.
> 
> Signed-off-by: Krzysztof Kozlowski 
> Reviewed-by: Ulf Hansson 
> ---
>  drivers/amba/bus.c   | 29 +
>  include/linux/amba/bus.h |  1 +
>  2 files changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index 47bbdc1b5be3..474434e1b1b9 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -95,8 +95,18 @@ static int amba_pm_runtime_suspend(struct device *dev)
>   struct amba_device *pcdev = to_amba_device(dev);
>   int ret = pm_generic_runtime_suspend(dev);
>  
> - if (ret == 0 && dev->driver)
> - clk_disable_unprepare(pcdev->pclk);
> + if (ret == 0 && dev->driver) {
> + /*
> +  * Drivers should not change pm_runtime_irq_safe()
> +  * after probe.
> +  */
> + WARN_ON(pcdev->irq_safe != pm_runtime_is_irq_safe(dev));
> +
> + if (pcdev->irq_safe)
> + clk_disable(pcdev->pclk);
> + else
> + clk_disable_unprepare(pcdev->pclk);
> + }
>  
>   return ret;
>  }
> @@ -107,7 +117,16 @@ static int amba_pm_runtime_resume(struct device *dev)
>   int ret;
>  
>   if (dev->driver) {
> - ret = clk_prepare_enable(pcdev->pclk);
> + /*
> +  * Drivers should not change pm_runtime_irq_safe()
> +  * after probe.
> +  */
> + WARN_ON(pcdev->irq_safe != pm_runtime_is_irq_safe(dev));
> +
> + if (pcdev->irq_safe)
> + ret = clk_enable(pcdev->pclk);
> + else
> + ret = clk_prepare_enable(pcdev->pclk);
>   /* Failure is probably fatal to the system, but... */
>   if (ret)
>   return ret;
> @@ -198,8 +217,10 @@ static int amba_probe(struct device *dev)
>   pm_runtime_enable(dev);
>  
>   ret = pcdrv->probe(pcdev, id);
> - if (ret == 0)
> + if (ret == 0) {
> + pcdev->irq_safe = pm_runtime_is_irq_safe(dev);

This looks racy.

Is it guaranteed that runtime PM callbacks won't be run for the device
after pcdrv->probe() has returned and before setting pcdev->irq_safe?
If not, inconsistent behavior may ensue.

>   break;
> + }
>  
>   pm_runtime_disable(dev);
>   pm_runtime_set_suspended(dev);
> diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
> index ac02f9bd63dc..c4bae79851fb 100644
> --- a/include/linux/amba/bus.h
> +++ b/include/linux/amba/bus.h
> @@ -32,6 +32,7 @@ struct amba_device {
>   struct clk  *pclk;
>   unsigned intperiphid;
>   unsigned intirq[AMBA_NR_IRQS];
> + unsigned intirq_safe:1;
>  };
>  
>  struct amba_driver {
> 

-- 
I speak only for myself.
Rafael J. Wysocki, 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/


(Song) book of stamps. Lennart reigns, Linus follows.

2014-10-31 Thread John Garret
http://youtu.be/OBb488Ke6JQ

How we really feel.

A friend of mine and me laid down this track to let you all know how it really 
is that we feel,

Lyrics:
...
...
...
"why"
...
...


We want you to take this to heart Linus, and everyone who's letting this happen.
We invested our soul in this thing that we now see as ours, you let some other
guy take it. What is you?

(Copyright: standard, all rights reserved, because you fix to give us none and
take away that what we had)
(It didn't have to be this way)
(everything turns to dirt)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v8 1/5] PM / Runtime: Add getter for querying the IRQ safe option

2014-10-31 Thread Rafael J. Wysocki
On Friday, October 31, 2014 11:04:52 PM Russell King - ARM Linux wrote:
> On Sat, Nov 01, 2014 at 12:11:05AM +0100, Rafael J. Wysocki wrote:
> > [CC list trimmed + added Kevin Hilman]
> > 
> > On Monday, October 20, 2014 11:04:44 AM Krzysztof Kozlowski wrote:
> > > Add a simple getter pm_runtime_is_irq_safe() for querying whether runtime
> > > PM IRQ safe was set or not.
> > > 
> > > Various bus drivers implementing runtime PM may use choose to suspend
> > > differently based on IRQ safeness status of child driver (e.g. do not
> > > unprepare the clock if IRQ safe is not set).
> > > 
> > > Signed-off-by: Krzysztof Kozlowski 
> > > Reviewed-by: Ulf Hansson 
> > 
> > So why do we need to add the wrapper?
> > 
> > And it goes kind of against the intention which was to set irq_safe when
> > we knew that the callbacks were safe to be executed from interrupt context
> > and not when we wished that to be the case.
> 
> This was provided in the covering email - I quote:
> 
> This patchset adds runtime and system PM to the pl330 driver.
> 
> The runtime PM of pl330 driver requires interrupt safe suspend/resume
> callbacks which is in conflict with current amba bus driver.
> The latter also unprepares and prepares the AMBA bus clock which
> is not safe for atomic context.
> 
> The patchset solves this in patch 3/5 by handling clocks in different
> way if device driver set interrupt safe runtime PM.

So I'm still unsure why we need the wrapper.  IMHO this check in particular:

WARN_ON(pcdev->irq_safe != pm_runtime_is_irq_safe(dev));

(and should that be WARN_ON_ONCE(), for that matter?), looks better this way:

WARN_ON(pcdev->irq_safe != dev->power.irq_safe);

and so on, pretty much.

Besides, these special "irq safe" code paths in the bus type look
considerably ugly to me.  I'd probably use an "irq safe" PM domain for
that device and put it in there instead of doing the

pcdev->irq_safe = pm_runtime_is_irq_safe(dev);

thing in amba_probe().  But that's just me. :-)

There's one weak point in [3/5], but let me comment it in there.

Rafael

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


[PATCH v3] drivers: s390: net: ctcm: migrate variables to handle y2038 problem

2014-10-31 Thread Aya Mahfouz
This patch is concerned with migrating the time variables for the s390
network driver. The changes handle the y2038 problem where timespec will
overflow in the year 2038. timespec was replaced by unsigned long and
all time variables get their values from the jiffies global variable.
This was done for the sake of speed and efficiency.

Signed-off-by: Aya Mahfouz 
---
v1: Arnd has advised me to provide you with options for time
calculation. The first option: "accuracy" is used in this
patch. The second option: "speed" can be done through
jiffies.

v2: Moved on to the speed option. Let me know if I explicitly
need to include the jiffies header. The module compiles with
no problems on my side.

v3: Handled the error pointed out by Ursula. The current version
does not handle overflows. There are two solutions for this.
The first is to use jiffies_64 since s/390 is a 64-bit
architecture after all. The second is to use wrapper functions
like time_before and time_after. Two files were added too. 
They are: ctcm_main.c and netiucv.c. This patch could be sent
as a patchset in its final version for convenience. 

 drivers/s390/net/ctcm_fsms.c | 19 ---
 drivers/s390/net/ctcm_main.c |  5 +++--
 drivers/s390/net/ctcm_main.h |  4 +++-
 drivers/s390/net/netiucv.c   |  8 +---
 4 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c
index fb92524..86ed7bf 100644
--- a/drivers/s390/net/ctcm_fsms.c
+++ b/drivers/s390/net/ctcm_fsms.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -251,13 +252,11 @@ static void chx_txdone(fsm_instance *fi, int event, void 
*arg)
int first = 1;
int i;
unsigned long duration;
-   struct timespec done_stamp = current_kernel_time(); /* xtime */
+   unsigned long done_stamp = jiffies;
 
CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name);
 
-   duration =
-   (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 100 +
-   (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000;
+   duration =  jiffies_to_usecs(done_stamp - ch->prof.send_stamp);
if (duration > ch->prof.tx_time)
ch->prof.tx_time = duration;
 
@@ -307,7 +306,7 @@ static void chx_txdone(fsm_instance *fi, int event, void 
*arg)
spin_unlock(>collect_lock);
ch->ccw[1].count = ch->trans_skb->len;
fsm_addtimer(>timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
-   ch->prof.send_stamp = current_kernel_time(); /* xtime */
+   ch->prof.send_stamp = jiffies;
rc = ccw_device_start(ch->cdev, >ccw[0],
(unsigned long)ch, 0xff, 0);
ch->prof.doios_multi++;
@@ -1229,14 +1228,12 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int 
event, void *arg)
int rc;
struct th_header *header;
struct pdu  *p_header;
-   struct timespec done_stamp = current_kernel_time(); /* xtime */
+   unsigned long done_stamp = jiffies;
 
CTCM_PR_DEBUG("Enter %s: %s cp:%i\n",
__func__, dev->name, smp_processor_id());
 
-   duration =
-   (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 100 +
-   (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000;
+   duration =  jiffies_to_usecs(done_stamp - ch->prof.send_stamp);
if (duration > ch->prof.tx_time)
ch->prof.tx_time = duration;
 
@@ -1361,7 +1358,7 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int 
event, void *arg)
 
ch->ccw[1].count = ch->trans_skb->len;
fsm_addtimer(>timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
-   ch->prof.send_stamp = current_kernel_time(); /* xtime */
+   ch->prof.send_stamp = jiffies;
if (do_debug_ccw)
ctcmpc_dumpit((char *)>ccw[0], sizeof(struct ccw1) * 3);
rc = ccw_device_start(ch->cdev, >ccw[0],
@@ -1827,7 +1824,7 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int 
event, void *arg)
fsm_newstate(wch->fsm, CTC_STATE_TX);
 
spin_lock_irqsave(get_ccwdev_lock(wch->cdev), saveflags);
-   wch->prof.send_stamp = current_kernel_time(); /* xtime */
+   wch->prof.send_stamp = jiffies;
rc = ccw_device_start(wch->cdev, >ccw[3],
(unsigned long) wch, 0xff, 0);
spin_unlock_irqrestore(get_ccwdev_lock(wch->cdev), saveflags);
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index e056dd4..5dd68d9 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -567,7 +568,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct 
sk_buff *skb)
fsm_newstate(ch->fsm, CTC_STATE_TX);
 

Re: [PATCHv2 7/7] cgroup: mount cgroupns-root when inside non-init cgroupns

2014-10-31 Thread Andy Lutomirski
On Fri, Oct 31, 2014 at 12:19 PM, Aditya Kali  wrote:
> This patch enables cgroup mounting inside userns when a process
> as appropriate privileges. The cgroup filesystem mounted is
> rooted at the cgroupns-root. Thus, in a container-setup, only
> the hierarchy under the cgroupns-root is exposed inside the container.
> This allows container management tools to run inside the containers
> without depending on any global state.
> In order to support this, a new kernfs api is added to lookup the
> dentry for the cgroupns-root.
>
> Signed-off-by: Aditya Kali 
> ---
>  fs/kernfs/mount.c  | 48 
>  include/linux/kernfs.h |  2 ++
>  kernel/cgroup.c| 47 +--
>  3 files changed, 95 insertions(+), 2 deletions(-)
>
> diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
> index f973ae9..e334f45 100644
> --- a/fs/kernfs/mount.c
> +++ b/fs/kernfs/mount.c
> @@ -62,6 +62,54 @@ struct kernfs_root *kernfs_root_from_sb(struct super_block 
> *sb)
> return NULL;
>  }
>
> +/**
> + * kernfs_make_root - create new root dentry for the given kernfs_node.
> + * @sb: the kernfs super_block
> + * @kn: kernfs_node for which a dentry is needed
> + *
> + * This can used used by callers which want to mount only a part of the 
> kernfs
> + * as root of the filesystem.
> + */
> +struct dentry *kernfs_obtain_root(struct super_block *sb,
> + struct kernfs_node *kn)
> +{

I can't usefully review this, but kernfs_make_root and
kernfs_obtain_root aren't the same string...

> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 7e5d597..250aaec 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1302,6 +1302,13 @@ static int parse_cgroupfs_options(char *data, struct 
> cgroup_sb_opts *opts)
>
> memset(opts, 0, sizeof(*opts));
>
> +   /* Implicitly add CGRP_ROOT_SANE_BEHAVIOR if inside a non-init cgroup
> +* namespace.
> +*/
> +   if (current->nsproxy->cgroup_ns != _cgroup_ns) {
> +   opts->flags |= CGRP_ROOT_SANE_BEHAVIOR;
> +   }
> +

I don't like this implicit stuff.  Can you just return -EINVAL if sane
behavior isn't requested?

> while ((token = strsep(, ",")) != NULL) {
> nr_opts++;
>
> @@ -1391,7 +1398,7 @@ static int parse_cgroupfs_options(char *data, struct 
> cgroup_sb_opts *opts)
>
> if (opts->flags & CGRP_ROOT_SANE_BEHAVIOR) {
> pr_warn("sane_behavior: this is still under development and 
> its behaviors will change, proceed at your own risk\n");
> -   if (nr_opts != 1) {
> +   if (nr_opts > 1) {
> pr_err("sane_behavior: no other mount options 
> allowed\n");
> return -EINVAL;

This looks wrong.  But, if you make the change above, then it'll be right.

> @@ -1685,6 +1701,14 @@ static struct dentry *cgroup_mount(struct 
> file_system_type *fs_type,
> int ret;
> int i;
> bool new_sb;
> +   struct cgroup_namespace *ns =
> +   get_cgroup_ns(current->nsproxy->cgroup_ns);
> +
> +   /* Check if the caller has permission to mount. */
> +   if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN)) {
> +   put_cgroup_ns(ns);
> +   return ERR_PTR(-EPERM);
> +   }

Why is this necessary?

> @@ -1862,6 +1904,7 @@ static struct file_system_type cgroup_fs_type = {
> .name = "cgroup",
> .mount = cgroup_mount,
> .kill_sb = cgroup_kill_sb,
> +   .fs_flags = FS_USERNS_MOUNT,

Aargh, another one!  Eric, can you either ack or nack my patch?
Because if my patch goes in, then this line may need to change.  Or
not, but if a stable release with cgroupfs and without my patch
happens, then we'll have an ABI break.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] x86, boot: add hex output for debugging

2014-10-31 Thread Joe Perches
On Fri, 2014-10-31 at 16:45 -0700, Josh Triplett wrote:
> I don't think we need the full generality of printf in the decompression
> stub.  I prefer Kees' patch, though I'd still like to see __puthex made
> conditional.

Maybe use a statement expression macro instead?
Something like this could emit the right number of bits for any type

#define __puthex(val)   \
({  \
typeof(val) value = val;\
char alpha[2] = {}; \
int bits;   \
\
__putstr("0x"); \
for (bits = sizeof(value) * 8 - 4; bits >= 0; bits -= 4) {  \
int digit = (value >> bits) & 0xf;  \
\
if (digit < 10) \
alpha[0] = '0' + digit; \
else\
alpha[0] = 'a' + (digit - 10);  \
\
__putstr(alpha);\
}   \
})


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [PATCHv2 5/7] cgroup: introduce cgroup namespaces

2014-10-31 Thread Andy Lutomirski
On Fri, Oct 31, 2014 at 12:18 PM, Aditya Kali  wrote:
> Introduce the ability to create new cgroup namespace. The newly created
> cgroup namespace remembers the cgroup of the process at the point
> of creation of the cgroup namespace (referred as cgroupns-root).
> The main purpose of cgroup namespace is to virtualize the contents
> of /proc/self/cgroup file. Processes inside a cgroup namespace
> are only able to see paths relative to their namespace root
> (unless they are moved outside of their cgroupns-root, at which point
>  they will see a relative path from their cgroupns-root).
> For a correctly setup container this enables container-tools
> (like libcontainer, lxc, lmctfy, etc.) to create completely virtualized
> containers without leaking system level cgroup hierarchy to the task.
> This patch only implements the 'unshare' part of the cgroupns.
>

> +   /* Prevent cgroup changes for this task. */
> +   threadgroup_lock(current);

This could just be me being dense, but what is the lock for?

> +
> +   /* CGROUPNS only virtualizes the cgroup path on the unified hierarchy.
> +*/
> +   cgrp = get_task_cgroup(current);
> +
> +   err = -ENOMEM;
> +   new_ns = alloc_cgroup_ns();
> +   if (!new_ns)
> +   goto err_out_unlock;
> +
> +   err = proc_alloc_inum(_ns->proc_inum);
> +   if (err)
> +   goto err_out_unlock;
> +
> +   new_ns->user_ns = get_user_ns(user_ns);
> +   new_ns->root_cgrp = cgrp;
> +
> +   threadgroup_unlock(current);
> +
> +   return new_ns;
> +
> +err_out_unlock:
> +   threadgroup_unlock(current);
> +err_out:
> +   if (cgrp)
> +   cgroup_put(cgrp);
> +   kfree(new_ns);
> +   return ERR_PTR(err);
> +}
> +
> +static int cgroupns_install(struct nsproxy *nsproxy, void *ns)
> +{
> +   pr_info("setns not supported for cgroup namespace");
> +   return -EINVAL;
> +}
> +
> +static void *cgroupns_get(struct task_struct *task)
> +{
> +   struct cgroup_namespace *ns = NULL;
> +   struct nsproxy *nsproxy;
> +
> +   rcu_read_lock();
> +   nsproxy = task->nsproxy;
> +   if (nsproxy) {
> +   ns = nsproxy->cgroup_ns;
> +   get_cgroup_ns(ns);
> +   }
> +   rcu_read_unlock();

How is this correct?  Other namespaces do it too, so it Must Be
Correct (tm), but I don't understand.  What is RCU protecting?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: Machine crashes right *after* ~successful resume

2014-10-31 Thread Wilmer van der Gaast

Hello,

Patch #1 worked after a simple s/&&/)/. And patch #2 seems to fix the 
problem as well!



Wilmer v/d Gaast.

--
+ .''`. - -- ---+  +- -- ---  - --+
| wilmer : :'  :  gaast.net |  | OSS Programmer   www.bitlbee.org |
| lintux `. `~'  debian.org |  | Full-time geek  wilmer.gaast.net |
+--- -- -  ` ---+  +-- -  --- -- -+
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, boot: add hex output for debugging

2014-10-31 Thread Josh Triplett
On Fri, Oct 31, 2014 at 01:55:33PM -0700, Kees Cook wrote:
> On Fri, Oct 31, 2014 at 1:33 PM,   wrote:
> > On Fri, Oct 31, 2014 at 09:20:37AM -0700, Kees Cook wrote:
> >> This is useful for reporting various addresses or other values while
> >> debugging early boot.
> >>
> >> Signed-off-by: Kees Cook 
> >
> > You haven't provided any user of this function.  I don't think this
> > should get merged without a caller (nor should an artificial caller be
> > added).  What's your use case for adding this?
> 
> I'll fix that.

Thanks.

> > Also, while I realize __putstr already has this problem, ideally all the
> > printing functions in this file should go in some separate source file
> > that gets omitted when !CONFIG_PRINTK (or possibly
> > !CONFIG_EARLY_PRINTK).
> 
> Hm, I don't agree: we need error_putstr, not just debug_putstr, and
> early_printk is just for serial console, where as __putstr works
> against the boot block's defined video area too, IIUC.

OK, that seems like a good argument that it shouldn't go under
EARLY_PRINTK.  However, for size-constrained systems that have nowhere
for the output to go at all, it still makes sense to compile all of the
printing infrastructure out of the decompression stub, especially since
that code itself does not get compressed and thus has a higher impact
than code in vmlinux.

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


[git pull] Input updates for 3.18-rc0

2014-10-31 Thread Dmitry Torokhov
Hi Linus,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. You will get a bunch of
fixes for minor defects reported by Coverity, a few driver fixups and
revert of i8042.nomux change so that we are once again enable active MUX
mode if box claims to support it.

Changelog:
-

Alexandre Courbot (1):
  Input: soc_button_array - update calls to gpiod_get*()

Dmitry Eremin-Solenikov (1):
  Input: wm97xx - adapt parameters to tosa touchscreen.

Dmitry Torokhov (6):
  Input: opencores-kbd - fix error handling
  Input: ims-pcu - fix dead code in ims_pcu_ofn_reg_addr_store()
  Input: vsxxxaa - fix code dropping bytes from queue
  Input: psmouse - remove unneeded check in psmouse_reconnect()
  Input: max77693-haptic - fix potential overflow
  Revert "Input: i8042 - disable active multiplexing by default"

Hans de Goede (1):
  Input: i8042 - quirks for Fujitsu Lifebook A544 and Lifebook AH544

Linus Walleij (1):
  Input: stmpe-keypad - fix valid key line bitmask

Tobias Klauser (2):
  Input: altera_ps2 - write to correct register when disabling interrupts
  Input: altera_ps2 - use correct type for irq return value


Diffstat:


 Documentation/kernel-parameters.txt |   2 +-
 drivers/input/keyboard/opencores-kbd.c  |   2 +-
 drivers/input/keyboard/stmpe-keypad.c   |   2 +-
 drivers/input/misc/ims-pcu.c|   2 +-
 drivers/input/misc/max77693-haptic.c|   5 +-
 drivers/input/misc/soc_button_array.c   |   2 +-
 drivers/input/mouse/psmouse-base.c  |   7 -
 drivers/input/mouse/vsxxxaa.c   |   2 +-
 drivers/input/serio/altera_ps2.c|   4 +-
 drivers/input/serio/i8042-x86ia64io.h   | 297 +++-
 drivers/input/serio/i8042.c |   2 +-
 drivers/input/touchscreen/wm97xx-core.c |   4 +-
 12 files changed, 302 insertions(+), 29 deletions(-)

-- 
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 v2] x86, boot: add hex output for debugging

2014-10-31 Thread Josh Triplett
On Fri, Oct 31, 2014 at 04:31:32PM -0700, Yinghai Lu wrote:
> On Fri, Oct 31, 2014 at 1:58 PM, Kees Cook  wrote:
> > This is useful for reporting various addresses or other values while
> > debugging early boot. For example, when CONFIG_X86_VERBOSE_BOOTUP is set,
> > this is now visible at boot time:
> >
> > early console in setup code
> > early console in decompress_kernel
> > input_data: 0x01e1526e
> > input_len: 0x00732236
> > output: 0x0100
> > output_len: 0x01535640
> > run_size: 0x021fb000
> > KASLR using RDTSC...
> >
> > Signed-off-by: Kees Cook 
> > ---
> > Since this displays run_size, this patch depends on Junjie Mao's patch
> > "x86, kaslr: Prevent .bss from overlaping initrd"
> >
> > ---
> >  arch/x86/boot/compressed/misc.c | 24 
> >  arch/x86/boot/compressed/misc.h | 11 +++
> >  2 files changed, 35 insertions(+)
> ...
> 
> We can reuse printf.c in arch/x86/boot.
> 
> I had attached one in local tree for a while. or even sent it before
> several years ago.

I don't think we need the full generality of printf in the decompression
stub.  I prefer Kees' patch, though I'd still like to see __puthex made
conditional.

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


Re: [PATCH v2 1/1] ARM: exynos_defconfig: Enable options for display panel support

2014-10-31 Thread Javier Martinez Canillas
Hello Kukjin,

On Mon, Aug 25, 2014 at 10:45 AM, Javier Martinez Canillas
 wrote:
> Many Exynos devices have a display panel. Most of them just have
> a simple panel while others have more complex configurations that
> requires an embedded DisplayPort (eDP) to LVDS bridges.
>
> This patch enables the following features to be built in the kernel
> image to suport both setups:
>
> - Direct Rendering Manager (DRM)
> - DRM bridge registration and lookup framework
> - Parade ps8622/ps8625 eDP/LVDS bridge
> - NXP ptn3460 eDP/LVDS bridge
> - Exynos Fully Interactive Mobile Display controller (FIMD)
> - Panel registration and lookup framework
> - Simple panels
> - Backlight & LCD device support
>
> Signed-off-by: Javier Martinez Canillas 
> Tested-by: Kevin Hilman 
> ---

This patch is needed to have display working on many Exynos boards.

$subject enables the config option for the ps8622/ps8625 eDP/LVDS
bridge driver but this has not landed in mainline yet. Ajay will
re-spin a new revision of his series that adds this driver though,
after addressing some issues pointed out on a previous version.

The Kconfig symbol name (DRM_PS8622) won't change though so maybe is
not crazy to pick the patch as is since CONFIG_DRM_PS8622 will have to
be enabled later when the bridge driver lands. Or do you want me to
re-spin $subject removing that option?

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


[PATCH v2] Staging: android: ion: fix typos in comments

2014-10-31 Thread tristan
From: Tristan Lelong 

s/comming/coming/ in drivers/staging/android/ion/ion.c
s/specfic/specific/ in drivers/staging/android/ion/ion.h
s/peformance/performance/ in drivers/staging/android/ion/ion_priv.h

Signed-off-by: Tristan Lelong 
---
v2: update changelog message per Randy Dunlap suggestion.
---
 drivers/staging/android/ion/ion.c  | 2 +-
 drivers/staging/android/ion/ion.h  | 2 +-
 drivers/staging/android/ion/ion_priv.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 56604f4..9e706f3 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -250,7 +250,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap 
*heap,
   our systems the only dma_address space is physical addresses.
   Additionally, we can't afford the overhead of invalidating every
   allocation via dma_map_sg. The implicit contract here is that
-  memory comming from the heaps is ready for dma, ie if it has a
+  memory coming from the heaps is ready for dma, ie if it has a
   cached mapping that mapping has been invalidated */
for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i)
sg_dma_address(sg) = sg_phys(sg);
diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index d305bb7..443db84 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -76,7 +76,7 @@ struct ion_platform_data {
  * size
  *
  * Calls memblock reserve to set aside memory for heaps that are
- * located at specific memory addresses or of specfic sizes not
+ * located at specific memory addresses or of specific sizes not
  * managed by the kernel
  */
 void ion_reserve(struct ion_platform_data *data);
diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index c8f0175..18a5f93 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -345,7 +345,7 @@ void ion_carveout_free(struct ion_heap *heap, 
ion_phys_addr_t addr,
  * functions for creating and destroying a heap pool -- allows you
  * to keep a pool of pre allocated memory to use from your heap.  Keeping
  * a pool of memory that is ready for dma, ie any cached mapping have been
- * invalidated from the cache, provides a significant peformance benefit on
+ * invalidated from the cache, provides a significant performance benefit on
  * many systems */
 
 /**
@@ -362,7 +362,7 @@ void ion_carveout_free(struct ion_heap *heap, 
ion_phys_addr_t addr,
  *
  * Allows you to keep a pool of pre allocated pages to use from your heap.
  * Keeping a pool of pages that is ready for dma, ie any cached mapping have
- * been invalidated from the cache, provides a significant peformance benefit
+ * been invalidated from the cache, provides a significant performance benefit
  * on many systems
  */
 struct ion_page_pool {
-- 
618FE3EF

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] x86, boot: add hex output for debugging

2014-10-31 Thread Yinghai Lu
On Fri, Oct 31, 2014 at 1:58 PM, Kees Cook  wrote:
> This is useful for reporting various addresses or other values while
> debugging early boot. For example, when CONFIG_X86_VERBOSE_BOOTUP is set,
> this is now visible at boot time:
>
> early console in setup code
> early console in decompress_kernel
> input_data: 0x01e1526e
> input_len: 0x00732236
> output: 0x0100
> output_len: 0x01535640
> run_size: 0x021fb000
> KASLR using RDTSC...
>
> Signed-off-by: Kees Cook 
> ---
> Since this displays run_size, this patch depends on Junjie Mao's patch
> "x86, kaslr: Prevent .bss from overlaping initrd"
>
> ---
>  arch/x86/boot/compressed/misc.c | 24 
>  arch/x86/boot/compressed/misc.h | 11 +++
>  2 files changed, 35 insertions(+)
...

We can reuse printf.c in arch/x86/boot.

I had attached one in local tree for a while. or even sent it before
several years ago.

Thanks

Yinghai


Subject: [PATCH] x86, boot: Add printf support for early console in
compressed/misc.c

Reuse printf.c in x86 setup code.
And print out decompress_kernel input and output info.

Later decompresser code could print out more info for debug info.

Signed-off-by: Yinghai Lu 

---
 arch/x86/boot/compressed/Makefile |2 +-
 arch/x86/boot/compressed/misc.c   |8 
 arch/x86/boot/compressed/misc.h   |7 +++
 arch/x86/boot/compressed/printf.c |5 +
 4 files changed, 21 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/boot/compressed/Makefile
===
--- linux-2.6.orig/arch/x86/boot/compressed/Makefile
+++ linux-2.6/arch/x86/boot/compressed/Makefile
@@ -28,7 +28,7 @@ HOST_EXTRACFLAGS += -I$(srctree)/tools/i

 vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
 $(obj)/string.o $(obj)/cmdline.o \
-$(obj)/piggy.o $(obj)/cpuflags.o
+$(obj)/printf.o $(obj)/piggy.o $(obj)/cpuflags.o

 vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o
 vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
Index: linux-2.6/arch/x86/boot/compressed/printf.c
===
--- /dev/null
+++ linux-2.6/arch/x86/boot/compressed/printf.c
@@ -0,0 +1,5 @@
+#include "misc.h"
+
+#define puts(__x)  __putstr(__x)
+
+#include "../printf.c"
Index: linux-2.6/arch/x86/boot/compressed/misc.c
===
--- linux-2.6.orig/arch/x86/boot/compressed/misc.c
+++ linux-2.6/arch/x86/boot/compressed/misc.c
@@ -390,6 +390,14 @@ asmlinkage __visible void *decompress_ke
 output = choose_kernel_location(input_data, input_len,
 output, output_len);

+debug_putstr("decompress_kernel:\n");
+debug_printf("  input: [0x%lx-0x%lx], output: 0x%lx, heap:
[0x%lx-0x%lx]\n",
+ (unsigned long)input_data,
+ (unsigned long)input_data + input_len - 1,
+ (unsigned long)output,
+ (unsigned long)heap,
+ (unsigned long)heap + BOOT_HEAP_SIZE - 1);
+
 /* Validate memory location choices. */
 if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1))
 error("Destination address inappropriately aligned");
Index: linux-2.6/arch/x86/boot/compressed/misc.h
===
--- linux-2.6.orig/arch/x86/boot/compressed/misc.h
+++ linux-2.6/arch/x86/boot/compressed/misc.h
@@ -36,14 +36,21 @@ extern struct boot_params *real_mode;/
 void __putstr(const char *s);
 #define error_putstr(__x)  __putstr(__x)

+/* printf.c */
+int sprintf(char *buf, const char *fmt, ...);
+int printf(const char *fmt, ...);
+
 #ifdef CONFIG_X86_VERBOSE_BOOTUP

 #define debug_putstr(__x)  __putstr(__x)
+#define debug_printf printf

 #else

 static inline void debug_putstr(const char *s)
 { }
+static inline int debug_printf(const char *fmt, ...)
+{ }

 #endif
Subject: [PATCH] x86, boot: Add printf support for early console in compressed/misc.c

Reuse printf.c in x86 setup code.
And print out decompress_kernel input and output info.

Later decompresser code could print out more info for debug info.

Signed-off-by: Yinghai Lu 

---
 arch/x86/boot/compressed/Makefile |2 +-
 arch/x86/boot/compressed/misc.c   |8 
 arch/x86/boot/compressed/misc.h   |7 +++
 arch/x86/boot/compressed/printf.c |5 +
 4 files changed, 21 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/boot/compressed/Makefile
===
--- linux-2.6.orig/arch/x86/boot/compressed/Makefile
+++ linux-2.6/arch/x86/boot/compressed/Makefile
@@ -28,7 +28,7 @@ HOST_EXTRACFLAGS += -I$(srctree)/tools/i
 
 vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
 	$(obj)/string.o $(obj)/cmdline.o \
-	$(obj)/piggy.o $(obj)/cpuflags.o
+	$(obj)/printf.o $(obj)/piggy.o 

Re: [GIT PULL] ext4 bug fixes for 3.18

2014-10-31 Thread Linus Torvalds
On Fri, Oct 31, 2014 at 2:49 PM, Theodore Ts'o  wrote:
>
> Theodore Ts'o (1):
>   jbd2: use a better hash function for the revoke table

Does it really make sense to use hash_u64()? It can be quite expensive
(mainly on 32-bit targets), and since the low bits are where all the
information is anyway, I'd suggest using hash_32() here even if the
block number in theory can have a few bits above the 32-bit mark.

Anyway, pulled, but I just reacted to that small detail.

  Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] i8k: Add support for Dell Latitude E6440

2014-10-31 Thread Pali Rohár
On Friday 24 October 2014 20:44:59 Pali Rohár wrote:
> On Saturday 18 October 2014 12:40:56 Greg Kroah-Hartman wrote:
> > On Sat, Oct 18, 2014 at 12:23:39AM +0200, Pali Rohár wrote:
> > > On Friday 10 October 2014 22:56:55 Guenter Roeck wrote:
> > > > On 10/10/2014 02:12 AM, Pali Rohár wrote:
> > > > > Dell Latitude E6440 needs same settings as E6540.
> > > > > 
> > > > > Signed-off-by: Pali Rohár 
> > > > 
> > > > Acked-by: Guenter Roeck 
> > > 
> > > Greg, Arnd: PING
> > > 
> > > Can you apply also this patch for E6440? Support for E6540
> > > is already in linus tree:
> > > 06c88b0d7ad87540405aea7f91d98ef43be04c95
> > 
> > I can't apply anything to my trees until 3.18-rc1 is out,
> > but will do this after that happens.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Hi Greg!
> I want to remind you patches, because v3.18-rc1 was released.

Greg, ping.

-- 
Pali Rohár
pali.ro...@gmail.com


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


[PATCH RFC] sched/deadline: support dl task migrate during cpu hotplug

2014-10-31 Thread Wanpeng Li
Hi all,

I observe that dl task can't be migrated to other cpus during cpu hotplug, in 
addition, task may/may not be running again if cpu is added back. The root 
cause 
which I found is that dl task will be throtted and removed from dl rq after 
comsuming all budget, which leads to stop task can't pick it up from dl rq and 
migrate to other cpus during hotplug. 

So I try two methods.

- add throttled dl sched_entity to a throttled_list, the list will be traversed
  during cpu hotplug, and the dl sched_entity will be picked and enqueue, then 
  stop task will pick and migrate it. However, dl sched_entity is throttled 
again 
  before stop task running since the below path. This path will set rq->online 
0 
  which lead to set_rq_offline() won't be called in function migration_call().

Call Trace:
 [...] rq_offline_dl+0x44/0x66
 [...] set_rq_offline+0x29/0x54
 [...] rq_attach_root+0x3f/0xb7
 [...] cpu_attach_domain+0x1c7/0x354
 [...] build_sched_domains+0x295/0x304
 [...] partition_sched_domains+0x26a/0x2e6
 [...] ? emulator_write_gpr+0x27/0x27 [kvm]
 [...] cpuset_update_active_cpus+0x12/0x2c
 [...] cpuset_cpu_inactive+0x1b/0x38
 [...] notifier_call_chain+0x32/0x5e
 [...] __raw_notifier_call_chain+0x9/0xb
 [...] __cpu_notify+0x1b/0x2d
 [...] _cpu_down+0x81/0x22a
 [...] cpu_down+0x28/0x35
 [...] cpu_subsys_offline+0xf/0x11
 [...] device_offline+0x78/0xa8
 [...] online_store+0x48/0x69
 [...] ? kernfs_fop_write+0x61/0x129
 [...] dev_attr_store+0x1b/0x1d
 [...] sysfs_kf_write+0x37/0x39
 [...] kernfs_fop_write+0xe9/0x129
 [...] vfs_write+0xc6/0x19e
 [...] SyS_write+0x4b/0x8f
 [...] system_call_fastpath+0x16/0x1b


- The difference of the method two is that dl sched_entity won't be throtted
  if rq is offline, the dl sched_entity will be replenished in update_curr_dl().
  However, the echo 0 > /sys/devices/system/cpu/cpuN/online hung.

Juri, your proposal is a great welcome. ;-)

Note: This patch is just a proposal and still can't successfully migrate 
dl task during cpu hotplug.

Signed-off-by: Wanpeng Li 
---
 include/linux/sched.h   |  2 ++
 kernel/sched/deadline.c | 22 +-
 kernel/sched/sched.h|  3 +++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4400ddc..bd71f19 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1253,6 +1253,8 @@ struct sched_dl_entity {
 * own bandwidth to be enforced, thus we need one timer per task.
 */
struct hrtimer dl_timer;
+   struct list_head throttled_node;
+   int on_list;
 };
 
 union rcu_special {
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 2e31a30..d6d6b71 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -80,6 +80,7 @@ void init_dl_rq(struct dl_rq *dl_rq, struct rq *rq)
dl_rq->dl_nr_migratory = 0;
dl_rq->overloaded = 0;
dl_rq->pushable_dl_tasks_root = RB_ROOT;
+   INIT_LIST_HEAD(_rq->throttled_list);
 #else
init_dl_bw(_rq->dl_bw);
 #endif
@@ -538,6 +539,10 @@ again:
update_rq_clock(rq);
dl_se->dl_throttled = 0;
dl_se->dl_yielded = 0;
+   if (dl_se->on_list) {
+   list_del(_se->throttled_node);
+   dl_se->on_list = 0;
+   }
if (task_on_rq_queued(p)) {
enqueue_task_dl(rq, p, ENQUEUE_REPLENISH);
if (dl_task(rq->curr))
@@ -636,8 +641,12 @@ static void update_curr_dl(struct rq *rq)
dl_se->runtime -= delta_exec;
if (dl_runtime_exceeded(rq, dl_se)) {
__dequeue_task_dl(rq, curr, 0);
-   if (likely(start_dl_timer(dl_se, curr->dl.dl_boosted)))
+   if (rq->online && likely(start_dl_timer(dl_se, 
curr->dl.dl_boosted))) {
dl_se->dl_throttled = 1;
+   dl_se->on_list = 1;
+   list_add(_se->throttled_node,
+   >dl.throttled_list);
+   }
else
enqueue_task_dl(rq, curr, ENQUEUE_REPLENISH);
 
@@ -1593,9 +1602,20 @@ static void rq_online_dl(struct rq *rq)
 /* Assumes rq->lock is held */
 static void rq_offline_dl(struct rq *rq)
 {
+   struct task_struct *p, *n;
+
if (rq->dl.overloaded)
dl_clear_overload(rq);
 
+   /* Make sched_dl_entity available for pick_next_task() */
+   list_for_each_entry_safe(p, n, >dl.throttled_list, 
dl.throttled_node) {
+   p->dl.dl_throttled = 0;
+   hrtimer_cancel(>dl.dl_timer);
+   p->dl.dl_runtime = p->dl.dl_runtime;
+   if (task_on_rq_queued(p))
+   enqueue_task_dl(rq, p, ENQUEUE_REPLENISH);
+   }
+
cpudl_set(>rd->cpudl, rq->cpu, 0, 0);
 }
 
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index ec3917c..8f95036 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -482,6 +482,9 @@ struct dl_rq {
 */
   

Re: Machine crashes right *after* ~successful resume

2014-10-31 Thread Yinghai Lu
On Fri, Oct 31, 2014 at 2:22 PM, Yinghai Lu  wrote:
> On Fri, Oct 31, 2014 at 2:13 PM, Wilmer van der Gaast  
> wrote:
>> On 31-10-14 16:11, Yinghai Lu wrote:
>>>
>>>
>>> Good. Please check if attached one on top of 3.17 only would work too.
>>>
>> No luck, sadly. :-( Unsuccessful third resume.

Please try attached two patches separately on top of 3.17.
---
 drivers/pci/pci.c |   18 ++
 1 file changed, 18 insertions(+)

Index: linux-2.6/drivers/pci/pci.c
===
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -1265,6 +1265,24 @@ static void pci_enable_bridge(struct pci
 	pci_set_master(dev);
 }
 
+static void pci_enable_ite(struct pci_dev *dev)
+{
+	/*
+	 * FW enable the bridge already, so call pci_enable_bridge()
+	 * to keep enable_cnt consistent, then later we can go through
+	 * pci_pm_resume/pci_pm_reenable_device to enable it again.
+	 * --- for pci bridge without driver case.
+	 */
+if (!pci_is_enabled(dev)) {
+		u16 cmd;
+
+		pci_read_config_word(dev, PCI_COMMAND, );
+		if ((cmd & (PCI_COMMAND_IO || PCI_COMMAND_MEMORY)) &&
+			pci_enable_bridge(dev);
+	}
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ITE, 0x8892, pci_enable_ite);
+
 static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
 {
 	struct pci_dev *bridge;
---
 drivers/pci/pci-driver.c |9 +
 1 file changed, 9 insertions(+)

Index: linux-2.6/drivers/pci/pci-driver.c
===
--- linux-2.6.orig/drivers/pci/pci-driver.c
+++ linux-2.6/drivers/pci/pci-driver.c
@@ -519,8 +519,17 @@ static void pci_pm_set_unknown_state(str
  */
 static int pci_pm_reenable_device(struct pci_dev *pci_dev)
 {
+	u16 cmd;
 	int retval;
 
+	/* update enable_cnt according to cmd register */
+	pci_read_config_word(pci_dev, PCI_COMMAND, );
+	if (!pci_dev->is_busmaster && (cmd & PCI_COMMAND_MASTER))
+		pci_dev->is_busmaster = true;
+	if (!pci_is_enabled(pci_dev) &&
+	(cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)))
+		atomic_inc(_dev->enable_cnt);
+
 	/* if the device was enabled before suspend, reenable */
 	retval = pci_reenable_device(pci_dev);
 	/*


Re: [PATCH v8 1/5] PM / Runtime: Add getter for querying the IRQ safe option

2014-10-31 Thread Russell King - ARM Linux
On Sat, Nov 01, 2014 at 12:11:05AM +0100, Rafael J. Wysocki wrote:
> [CC list trimmed + added Kevin Hilman]
> 
> On Monday, October 20, 2014 11:04:44 AM Krzysztof Kozlowski wrote:
> > Add a simple getter pm_runtime_is_irq_safe() for querying whether runtime
> > PM IRQ safe was set or not.
> > 
> > Various bus drivers implementing runtime PM may use choose to suspend
> > differently based on IRQ safeness status of child driver (e.g. do not
> > unprepare the clock if IRQ safe is not set).
> > 
> > Signed-off-by: Krzysztof Kozlowski 
> > Reviewed-by: Ulf Hansson 
> 
> So why do we need to add the wrapper?
> 
> And it goes kind of against the intention which was to set irq_safe when
> we knew that the callbacks were safe to be executed from interrupt context
> and not when we wished that to be the case.

This was provided in the covering email - I quote:

This patchset adds runtime and system PM to the pl330 driver.

The runtime PM of pl330 driver requires interrupt safe suspend/resume
callbacks which is in conflict with current amba bus driver.
The latter also unprepares and prepares the AMBA bus clock which
is not safe for atomic context.

The patchset solves this in patch 3/5 by handling clocks in different
way if device driver set interrupt safe runtime PM.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] staging: comedi: split bus support into separate modules

2014-10-31 Thread Ian Abbott

On 31/10/14 22:53, Ian Abbott wrote:

I like the idea of the core comedi module being separated from all the
various buses. And other buses can be added easily without pulling extra
dependencies into the core (e.g. for platform or spi devices).


And if this get's accepted, I'd like to complete the separation by 
moving the PCI, USB and PCMCIA stuf out of the "comedidev.h" header into 
their own headers, which obviously means small edits to most of the 
low-level drivers to #include different headers. (But then, 
"comedi_pci.h" could #include  for example.)


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] clk: rockchip: disable unused clocks

2014-10-31 Thread Doug Anderson
Kever,

On Thu, Oct 30, 2014 at 10:10 PM, Kever Yang  wrote:
> The rockchip clock driver use CLK_IGNORE_UNUSED flag to make sure
> all the clocks are available like default power on state.
> We have implement the clock manage in most of rockchip drivers,
> it is time to remove it for power save.
> Instead we add CLK_IGNORE_UNUSED for some clock nodes which should
> be on during boot or no module driver in kernel will initialize it.
>
> Signed-off-by: Kever Yang 
> ---
>
> Changes in v3:
> - get CLK_DIVIDER_READ_ONLY tag back fro armcores
> - add CLK_IGNORE_UNUSED tag for cs_dbg, pclk_dgb_pre and pclk_rkpwm
>
> Changes in v2:
> - get some clock ID back
> - add CLK_IGNORE_UNUSED tag for aclk_strc and aclk_core in clk-rk3188.c
> - add CLK_IGNORE_UNUSED tag for rk3288 dwc2
>
>  drivers/clk/rockchip/clk-rk3188.c |  36 +-
>  drivers/clk/rockchip/clk-rk3288.c | 140 
> +++---
>  drivers/clk/rockchip/clk.c|   9 ---
>  3 files changed, 88 insertions(+), 97 deletions(-)

I found that I needed this in order to keep graphics from failing:

-   GATE(ACLK_VIO1_NIU, "aclk_vio1_niu", "aclk_vio1", 0,
RK3288_CLKGATE_CON(15), 12, GFLAGS),
+   GATE(ACLK_VIO1_NIU, "aclk_vio1_niu", "aclk_vio1",
CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(15), 12, GFLAGS),

Off-list Heiko suggested that maybe VIO0_NIU would be similar.

Should maybe add that as IGNORE for now until we have something
claiming that clock?

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


Re: [PATCH 0/5] staging: comedi: split bus support into separate modules

2014-10-31 Thread Ian Abbott

On 31/10/14 22:18, Hartley Sweeten wrote:

On Friday, October 31, 2014 3:09 PM, Ian Abbott wrote:

On 31/10/14 18:19, Hartley Sweeten wrote:

On Friday, October 31, 2014 10:48 AM, Ian Abbott wrote:

The Comedi core module doesn't need support for PCI, USB or PCMCIA.
Only the low-level Comedi drivers need it.  Split the support for these
bus types out of the core "comedi" module and into new modules,
"comedi_pci", "comedi_usb", and "comedi_pcmcia".

1) staging: comedi: comedidev.h: remove dummy PCI support functions
2) staging: comedi: comedidev.h: remove some #ifdefs
3) staging: comedi: split out PCMCIA support into new module
4) staging: comedi: split out USB support into new module
5) staging: comedi: split out PCI support into new module


Ian,

Is this really necessary?

The pci, usb, and pcmcia support is already conditionally compiled in.
The support does get added to the main comedi module instead of
as separate modules but that shouldn't be a problem.


Well a lot of potentially unused module space could get pulled in if
using a stock distro kernel. For example, the USB dependencies amount to
over 200k. Not so bad for the others, especially PCI where the code is
built in anyway.


But its only pulled in if the user selected the usb, pci, and/or pcmcia
comedi drivers. And if they selected any of those options they will
need the that code anyway.


Yes, if the user configured and compiled the kernel his or herself.  I 
was more concerned with using distro kernel binaries.



Splitting the bus specific code out of the comdi core module doesn't
lower the total module space used it just spreads it from one to possibly
four modules. And it increases the module dependancies for all the
usb, pci, and pcmcia comedi drivers.


Yes, you might have to load one more module to load the modules for a 
particular card, but modprobe can take care of that. It's only a pain if 
you're loading the modules individually.  On the other hand, to load the 
"comedi_test.ko" module using insmod on a desktop PC on Debian for 
example (assuming the USB modules are already loaded), you'd first have 
to load the "pcmcia_core" and "pcmcia" modules before the "comedi" and 
"comedi_test" modules. But with the PCMCIA support separated out, you'd 
just have to load the "comedi" and "comedi_test" modules.



To be clear, I'm not against this series I just want to make sure it's worth
applying.


I like the idea of the core comedi module being separated from all the 
various buses. And other buses can be added easily without pulling extra 
dependencies into the core (e.g. for platform or spi devices).


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v8 1/5] PM / Runtime: Add getter for querying the IRQ safe option

2014-10-31 Thread Rafael J. Wysocki
[CC list trimmed + added Kevin Hilman]

On Monday, October 20, 2014 11:04:44 AM Krzysztof Kozlowski wrote:
> Add a simple getter pm_runtime_is_irq_safe() for querying whether runtime
> PM IRQ safe was set or not.
> 
> Various bus drivers implementing runtime PM may use choose to suspend
> differently based on IRQ safeness status of child driver (e.g. do not
> unprepare the clock if IRQ safe is not set).
> 
> Signed-off-by: Krzysztof Kozlowski 
> Reviewed-by: Ulf Hansson 

So why do we need to add the wrapper?

And it goes kind of against the intention which was to set irq_safe when
we knew that the callbacks were safe to be executed from interrupt context
and not when we wished that to be the case.

> ---
>  Documentation/power/runtime_pm.txt | 4 
>  include/linux/pm_runtime.h | 6 ++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/power/runtime_pm.txt 
> b/Documentation/power/runtime_pm.txt
> index f32ce5419573..397b81593142 100644
> --- a/Documentation/power/runtime_pm.txt
> +++ b/Documentation/power/runtime_pm.txt
> @@ -468,6 +468,10 @@ drivers/base/power/runtime.c and 
> include/linux/pm_runtime.h:
>  - set the power.irq_safe flag for the device, causing the runtime-PM
>callbacks to be invoked with interrupts off
>  
> +  bool pm_runtime_is_irq_safe(struct device *dev);
> +- return true if power.irq_safe flag was set for the device, causing
> +  the runtime-PM callbacks to be invoked with interrupts off
> +
>void pm_runtime_mark_last_busy(struct device *dev);
>  - set the power.last_busy field to the current time
>  
> diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
> index 367f49b9a1c9..44d74f0f182e 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -128,6 +128,11 @@ static inline void pm_runtime_mark_last_busy(struct 
> device *dev)
>   ACCESS_ONCE(dev->power.last_busy) = jiffies;
>  }
>  
> +static inline bool pm_runtime_is_irq_safe(struct device *dev)
> +{
> + return dev->power.irq_safe;
> +}
> +
>  #else /* !CONFIG_PM_RUNTIME */
>  
>  static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
> @@ -167,6 +172,7 @@ static inline bool pm_runtime_enabled(struct device *dev) 
> { return false; }
>  
>  static inline void pm_runtime_no_callbacks(struct device *dev) {}
>  static inline void pm_runtime_irq_safe(struct device *dev) {}
> +static inline bool pm_runtime_is_irq_safe(struct device *dev) { return 
> false; }
>  
>  static inline bool pm_runtime_callbacks_present(struct device *dev) { return 
> false; }
>  static inline void pm_runtime_mark_last_busy(struct device *dev) {}
> 

-- 
I speak only for myself.
Rafael J. Wysocki, 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 7/7] sched: Use WARN_ONCE for the might_sleep() TASK_RUNNING test

2014-10-31 Thread Oleg Nesterov
On 10/31, Peter Zijlstra wrote:
>
> In some cases this can trigger a true flood of output.
>
> Requested-by: Ingo Molnar 
> Signed-off-by: Peter Zijlstra (Intel) 
> ---
>  kernel/sched/core.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7301,7 +7301,7 @@ void __might_sleep(const char *file, int
>* since we will exit with TASK_RUNNING make sure we enter with it,
>* otherwise we will destroy state.
>*/
> - if (WARN(current->state != TASK_RUNNING,
> + if (WARN_ONCE(current->state != TASK_RUNNING,

Agreed, but sorry for off-topic, can't resist.

Sometimes I hate WARN_ONCE() because you can't reproduce the problem
once again without reboot.

Perhaps WARN_ON_RATELIMIT() should be used more often (not sure about
this particular case). Or, perhaps, we can add a special section for
these "__warned" variables and add, say, sysctl which clears that
section ?

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] m501fb: don't return zero on failure path in sm501fb_probe()

2014-10-31 Thread Alexey Khoroshilov
If no framebuffers found, sm501fb_probe() breaks off initialization,
deallocates sm501fb_info, but returns zero. As a result, use after free
can happen in sm501fb_remove().

The patch adds -ENODEV as a return value in this case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov 
---
 drivers/video/fbdev/sm501fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index 9e74e8fbe074..8b98b011fc04 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1988,6 +1988,7 @@ static int sm501fb_probe(struct platform_device *pdev)
if (info->fb[HEAD_PANEL] == NULL &&
info->fb[HEAD_CRT] == NULL) {
dev_err(dev, "no framebuffers found\n");
+   ret = -ENODEV;
goto err_alloc;
}
 
-- 
1.9.1

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


Re: [PATCH 3/3] ACPI / processor: Rename acpi_(un)map_lsapic() to acpi_(un)map_cpu()

2014-10-31 Thread Rafael J. Wysocki
On Friday, October 31, 2014 07:49:49 AM Hanjun Guo wrote:
> On 2014年10月31日 04:12, Rafael J. Wysocki wrote:
> > On Thursday, October 30, 2014 05:53:00 PM Hanjun Guo wrote:
> >> acpi_map_lsapic() will allocate a logical CPU number and map it to
> >> physical CPU id (such as APIC id) for the hot-added CPU, it will also
> >> do some mapping for NUMA node id and etc, acpi_unmap_lsapic() will
> >> do the reverse.
> >>
> >> We can see that the name of the function is a little bit confusing and
> >> arch dependent so rename them as acpi_(un)map_map() to make arch
> >
> > That's acpi_(un)map_cpu() I guess?
> 
> ah, yes, typos, it should be acpi_(un)map_cpu(), my fault.
> should I send another version?

No, I can fix this up.

-- 
I speak only for myself.
Rafael J. Wysocki, 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 0/1] Compact interface for Device-Tree

2014-10-31 Thread Rafael J. Wysocki
On Saturday, November 01, 2014 05:13:45 AM Rob Herring wrote:
> On Fri, Oct 31, 2014 at 6:59 AM, Gilad Avidov  wrote:
> >
> > Device-Tree compact API
> > 
> >
> > Common code seen in driver’s probe reads device tree values and handling
> > erroneous return codes from all those of_property_read_xxx()  APIs. This
> > common code is factored out by the of_property_map module which allows
> > driver’s probe to replace that (often lengthy) code with a concise table:
> >
> > struct of_prop_map map[] = {
> > {"i2c",>id,OF_REQ,  OF_ID,  -1},
> > {"qcom,clk-freq-out",>clk_freq_out,OF_REQ,  OF_U32,  0},
> > {"qcom,clk-freq-in",>clk_freq_in,OF_REQ,  OF_U32,  0},
> > {"qcom,disable-dma",>disable_dma,OF_OPT,  OF_BOOL, 0},
> > {"qcom,master-id",>mstr_id,OF_SGST, OF_U32,  0},
> > {NULL,NULL,0,   0,   0},
> > };
> >
> > Then call populate to read the values into the device’s variables:
> >
> > ret = of_prop_populate(dev, dev->of_node, map);
> 
> Interesting idea. The main concern I have with this is there has been
> on-going discussions about how to generalize property handling across
> DT and ACPI to make drivers more agnostic, so I'm copying a few folks
> involved in that. That may be a bit orthogonal to what this is doing,
> but we may want some coordination here.

Agreed.

We actually have a patchset adding a unified device property API in linux-next 
(http://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=device-properties)
and I'd prefer to see the "compactization" to happen at that level, if possible,
rather that for of_ only.

Rafael

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


RE: [PATCH 0/5] staging: comedi: split bus support into separate modules

2014-10-31 Thread Hartley Sweeten
On Friday, October 31, 2014 3:09 PM, Ian Abbott wrote:
> On 31/10/14 18:19, Hartley Sweeten wrote:
>> On Friday, October 31, 2014 10:48 AM, Ian Abbott wrote:
>>> The Comedi core module doesn't need support for PCI, USB or PCMCIA.
>>> Only the low-level Comedi drivers need it.  Split the support for these
>>> bus types out of the core "comedi" module and into new modules,
>>> "comedi_pci", "comedi_usb", and "comedi_pcmcia".
>>>
>>> 1) staging: comedi: comedidev.h: remove dummy PCI support functions
>>> 2) staging: comedi: comedidev.h: remove some #ifdefs
>>> 3) staging: comedi: split out PCMCIA support into new module
>>> 4) staging: comedi: split out USB support into new module
>>> 5) staging: comedi: split out PCI support into new module
>>
>> Ian,
>>
>> Is this really necessary?
>>
>> The pci, usb, and pcmcia support is already conditionally compiled in.
>> The support does get added to the main comedi module instead of
>> as separate modules but that shouldn't be a problem.
>
> Well a lot of potentially unused module space could get pulled in if 
> using a stock distro kernel. For example, the USB dependencies amount to 
> over 200k. Not so bad for the others, especially PCI where the code is 
> built in anyway.

But its only pulled in if the user selected the usb, pci, and/or pcmcia
comedi drivers. And if they selected any of those options they will
need the that code anyway.

Splitting the bus specific code out of the comdi core module doesn't
lower the total module space used it just spreads it from one to possibly
four modules. And it increases the module dependancies for all the
usb, pci, and pcmcia comedi drivers.

To be clear, I'm not against this series I just want to make sure it's worth
applying.

Regards,
Hartley


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


Re: [PATCH 1/7] sched,wait: Fix a kthread race with wait_woken()

2014-10-31 Thread Oleg Nesterov
On 10/31, Peter Zijlstra wrote:
>
> There is a race between kthread_stop() and the new wait_woken() that
> can result in a lack of progress.

Likewise, the user of wait_woken() can miss any other event which is
not associated with wq we are going to sleep on. Please see below.

> +static inline bool is_kthread_should_stop(void)
> +{
> + return (current->flags & PF_KTHREAD) && kthread_should_stop();
> +}
>
>  /*
>   * DEFINE_WAIT_FUNC(wait, woken_wake_func);
> @@ -326,7 +331,7 @@ long wait_woken(wait_queue_t *wait, unsi
>* woken_wake_function() such that if we observe WQ_FLAG_WOKEN we must
>* also observe all state before the wakeup.
>*/
> - if (!(wait->flags & WQ_FLAG_WOKEN))
> + if (!(wait->flags & WQ_FLAG_WOKEN) && !is_kthread_should_stop())
>   timeout = schedule_timeout(timeout);

Well yes, this is more straightforward than other hacks we discussed before.
But see above, this doesn't look flexible enough.

And. This assumes that the user must also check kthread_should_stop(),
otherwise the waiting loop becomes a busy-wait loop.

So I won't argue, but I still think it would be better to allow the user to
do set_task_state() by hand if it needs to check the additional conditions.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 7/8] cdrom: cdrom: export sysctl code

2014-10-31 Thread Joe Perches
On Fri, 2014-10-31 at 22:48 +0100, Fabian Frederick wrote:
> -Move all sysctl operations to cdrom_sysctl
> -Remove static/add extern in cdrom.h for some variables
> -Rename debug to cdrom_debug
> -Fix some checkpatch warnings
> -Update cdrom makefile accordingly.
[]
> diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
[]
> +extern bool cdrom_debug;
> +extern bool autoclose;
> +extern bool autoeject;
> +extern bool lockdoor;
> +extern bool check_media_type;
> +extern bool mrw_format_restart;
> +extern struct list_head cdrom_list;
> +extern struct mutex cdrom_mutex;

I think these should be prefixed with "cdrom_"


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] x86 mpx: give bndX registers actual names

2014-10-31 Thread Thomas Gleixner
On Fri, 31 Oct 2014, Dave Hansen wrote:

> 
> Changes from V1:
>  * name it 'bndreg' instead plain 'bnd'

Peter wanted you to do s/struct bndreg_struct/struct bndreg/

Which makes a lot of sense as there is no point of having the extra
_struct. Except you are part of the 

   bndreg_struct_t *ptrStructBndregStruct_p;

universe :)

Thanks,

tglx


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


[GIT PULL] ACPI and power management fixes for 3.18-rc3

2014-10-31 Thread Rafael J. Wysocki
Hi Linus,

Please pull from

 git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \
 pm+acpi-3.18-rc3

to receive ACPI and power management fixes for v3.18-rc3 with
top-most commit 7d627280b359a965105bcdd8f08224dfa14a3961

 Merge branches 'pm-cpufreq' and 'pm-sleep'

on top of commit cac7f2429872d3733dc3f9915857b1691da2eb2f

 Linux 3.18-rc2

These are fixes received after my previous pull request plus
one that has been in the works for quite a while, but its
previous version caused problems to happen, so it's been deferred
till now.

Fixed are 2 recent regressions (MFD enumeration and cpufreq-dt),
ACPI EC regression introduced in 3.17, system suspend error code
path regression introduced in 3.15, an older bug related to
recovery from failing resume from hibernation and a cpufreq-dt
driver issue related to operation performance points.

Specifics:

 - Fix a crash on r8a7791/koelsch during resume from system suspend
   caused by a recent cpufreq-dt commit (Geert Uytterhoeven).

 - Fix an MFD enumeration problem introduced by a recent commit
   adding ACPI support to the MFD subsystem that exposed a weakness
   in the ACPI core causing ACPI enumeration to be applied to all
   devices associated with one ACPI companion object, although it
   should be used for one of them only (Mika Westerberg).

 - Fix an ACPI EC regression introduced during the 3.17 cycle
   causing some Samsung laptops to misbehave as a result of a
   workaround targeted at some Acer machines.  That includes
   a revert of a commit that went too far and a quirk for the
   Acer machines in question.  From Lv Zheng.

 - Fix a regression in the system suspend error code path introduced
   during the 3.15 cycle that causes it to fail to take errors from
   asychronous execution of "late" suspend callbacks into account
   (Imre Deak).

 - Fix a long-standing bug in the hibernation resume error code path
   that fails to roll back everything correcty on "freeze" callback
   errors and leaves some devices in a "suspended" state causing more
   breakage to happen subsequently (Imre Deak).

 - Make the cpufreq-dt driver disable operation performance points
   that are not supported by the VR connected to the CPU voltage
   plane with acceptable tolerance instead of constantly failing
   voltage scaling later on (Lucas Stach).

Thanks!


---

Geert Uytterhoeven (1):
  cpufreq: cpufreq-dt: Restore default cpumask_setall(policy->cpus)

Imre Deak (2):
  PM / Sleep: fix async suspend_late/freeze_late error handling
  PM / Sleep: fix recovery during resuming from hibernation

Lucas Stach (1):
  cpufreq: cpufreq-dt: disable unsupported OPPs

Lv Zheng (2):
  Revert "ACPI / EC: Add support to disallow QR_EC to be issued
before completing previous QR_EC"
  ACPI / EC: Fix regression due to conflicting firmware behavior
between Samsung and Acer.

Mika Westerberg (1):
  ACPI: Use ACPI companion to match only the first physical device

---

 drivers/acpi/ec.c| 31 +---
 drivers/acpi/scan.c  | 70 ++--
 drivers/base/power/main.c|  2 ++
 drivers/cpufreq/cpufreq-dt.c | 68 ++
 kernel/power/hibernate.c |  8 -
 5 files changed, 126 insertions(+), 53 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 0/5] staging: comedi: split bus support into separate modules

2014-10-31 Thread Ian Abbott

On 31/10/14 18:19, Hartley Sweeten wrote:

On Friday, October 31, 2014 10:48 AM, Ian Abbott wrote:

The Comedi core module doesn't need support for PCI, USB or PCMCIA.
Only the low-level Comedi drivers need it.  Split the support for these
bus types out of the core "comedi" module and into new modules,
"comedi_pci", "comedi_usb", and "comedi_pcmcia".

1) staging: comedi: comedidev.h: remove dummy PCI support functions
2) staging: comedi: comedidev.h: remove some #ifdefs
3) staging: comedi: split out PCMCIA support into new module
4) staging: comedi: split out USB support into new module
5) staging: comedi: split out PCI support into new module


Ian,

Is this really necessary?

The pci, usb, and pcmcia support is already conditionally compiled in.
The support does get added to the main comedi module instead of
as separate modules but that shouldn't be a problem.


Well a lot of potentially unused module space could get pulled in if 
using a stock distro kernel. For example, the USB dependencies amount to 
over 200k. Not so bad for the others, especially PCI where the code is 
built in anyway.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] staging: panel: Remove outdated TODO tasks

2014-10-31 Thread Konrad Zapalowicz
On 10/31, Mariusz Gorski wrote:
> Remove Lindent and checkpatch.pl tasks from TODO file as the first one
> is obsolete and the other one is already done.
> 
> Signed-off-by: Mariusz Gorski 
> ---
> v3: Fixed commit summary

Great. Thanks.

regards,
konrad
 
>  drivers/staging/panel/TODO | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/panel/TODO b/drivers/staging/panel/TODO
> index a4be749..c8040c1 100644
> --- a/drivers/staging/panel/TODO
> +++ b/drivers/staging/panel/TODO
> @@ -1,6 +1,4 @@
>  TODO:
> - - checkpatch.pl cleanups
> - - Lindent
>   - review major/minor usages
>   - review userspace api
>   - see if all of this could be easier done in userspace instead.
> -- 
> 2.1.3
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ftracetest: Take the first debugfs mount found

2014-10-31 Thread Steven Rostedt

Running ftracetests on a box that mounted debugfs in two locations
made the ftracetests fail. This is because the tests uses a grep
of debugfs from the /proc/mounts file to find the debugfs mount
point, and then appends "/tracing" to that string to get the tracing
directory.

If the debugfs directory is mounted twice, then that grep will return
two answers and appending "/tracing" to a string with two lines will
not work.

Use "head -1" to only take the first mount point found.

Signed-off-by: Steven Rostedt 
---
 tools/testing/selftests/ftrace/ftracetest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/ftracetest 
b/tools/testing/selftests/ftrace/ftracetest
index a8f81c782856..515247601df4 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -82,7 +82,7 @@ parse_opts() { # opts
 }
 
 # Parameters
-DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' '`
+DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
 TRACING_DIR=$DEBUGFS_DIR/tracing
 TOP_DIR=`absdir $0`
 TEST_DIR=$TOP_DIR/test.d
-- 
1.8.1.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 v3] staging: panel: Remove outdated TODO tasks

2014-10-31 Thread Mariusz Gorski
Remove Lindent and checkpatch.pl tasks from TODO file as the first one
is obsolete and the other one is already done.

Signed-off-by: Mariusz Gorski 
---
v3: Fixed commit summary

 drivers/staging/panel/TODO | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/panel/TODO b/drivers/staging/panel/TODO
index a4be749..c8040c1 100644
--- a/drivers/staging/panel/TODO
+++ b/drivers/staging/panel/TODO
@@ -1,6 +1,4 @@
 TODO:
-   - checkpatch.pl cleanups
-   - Lindent
- review major/minor usages
- review userspace api
- see if all of this could be easier done in userspace instead.
-- 
2.1.3

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


Re: [Cocci] [PATCH 1/1] btrfs: Deletion of unnecessary checks before six function calls

2014-10-31 Thread Julia Lawall


On Fri, 31 Oct 2014, SF Markus Elfring wrote:

> The following functions test whether their argument is NULL and then
> return immediately.
> * btrfs_free_path()
> * free_extent_buffer()
> * free_extent_map()
> * free_extent_state()
> * iput()
> * kfree()
> 
> Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring 
> ---
>  fs/btrfs/dev-replace.c   |  3 +--
>  fs/btrfs/extent_io.c | 12 
>  fs/btrfs/file.c  |  6 ++
>  fs/btrfs/free-space-cache.c  |  7 +++
>  fs/btrfs/inode.c |  6 ++
>  fs/btrfs/reada.c |  3 +--
>  fs/btrfs/relocation.c|  3 +--
>  fs/btrfs/tests/btrfs-tests.c |  3 +--
>  fs/btrfs/tree-defrag.c   |  3 +--
>  fs/btrfs/tree-log.c  |  6 ++
>  10 files changed, 18 insertions(+), 34 deletions(-)
> 
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 6f662b3..3465029 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -183,8 +183,7 @@ no_valid_dev_replace_entry_found:
>   }
> 
>  out:
> - if (path)
> - btrfs_free_path(path);
> + btrfs_free_path(path);

It appears to be statically apparent whether btrfs_free_path is needed or 
not.  The code could be changed both not to have the test and not to have 
the jump and call to btrfs_free_path.

This is probably the case for the other occurrences next to labels.

julia

>   return ret;
>  }
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index bf3f424..cfbf00a 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -704,8 +704,7 @@ next:
> 
>  out:
>   spin_unlock(>lock);
> - if (prealloc)
> - free_extent_state(prealloc);
> + free_extent_state(prealloc);
> 
>   return 0;
> 
> @@ -1006,8 +1005,7 @@ hit_next:
> 
>  out:
>   spin_unlock(>lock);
> - if (prealloc)
> - free_extent_state(prealloc);
> + free_extent_state(prealloc);
> 
>   return err;
> 
> @@ -1223,8 +1221,7 @@ hit_next:
> 
>  out:
>   spin_unlock(>lock);
> - if (prealloc)
> - free_extent_state(prealloc);
> + free_extent_state(prealloc);
> 
>   return err;
> 
> @@ -4146,8 +4143,7 @@ int extent_readpages(struct extent_io_tree *tree,
>   __extent_readpages(tree, pagepool, nr, get_extent, _cached,
>  , 0, _flags, READ);
> 
> - if (em_cached)
> - free_extent_map(em_cached);
> + free_extent_map(em_cached);
> 
>   BUG_ON(!list_empty(pages));
>   if (bio)
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index a18ceab..add07ce8 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -677,10 +677,8 @@ next:
>   /* once for the tree*/
>   free_extent_map(em);
>   }
> - if (split)
> - free_extent_map(split);
> - if (split2)
> - free_extent_map(split2);
> + free_extent_map(split);
> + free_extent_map(split2);
>  }
> 
>  /*
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index 3384819..11883e2 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -1943,8 +1943,7 @@ new_bitmap:
> 
>  out:
>   if (info) {
> - if (info->bitmap)
> - kfree(info->bitmap);
> + kfree(info->bitmap);
>   kmem_cache_free(btrfs_free_space_cachep, info);
>   }
> 
> @@ -3322,8 +3321,8 @@ again:
> 
>   if (info)
>   kmem_cache_free(btrfs_free_space_cachep, info);
> - if (map)
> - kfree(map);
> +
> + kfree(map);
>   return 0;
>  }
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index d23362f..7301b99 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -857,8 +857,7 @@ static u64 get_extent_allocation_hint(struct inode *inode,
> u64 start,
>   em = search_extent_mapping(em_tree, 0, 0);
>   if (em && em->block_start < EXTENT_MAP_LAST_BYTE)
>   alloc_hint = em->block_start;
> - if (em)
> - free_extent_map(em);
> + free_extent_map(em);
>   } else {
>   alloc_hint = em->block_start;
>   free_extent_map(em);
> @@ -6573,8 +6572,7 @@ out:
> 
>   trace_btrfs_get_extent(root, em);
> 
> - if (path)
> - btrfs_free_path(path);
> + btrfs_free_path(path);
>   if (trans) {
>   ret = btrfs_end_transaction(trans, root);
>   if (!err)
> diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
> index b63ae20..ec8eb49 100644
> --- a/fs/btrfs/reada.c
> +++ b/fs/btrfs/reada.c
> @@ -731,8 +731,7 @@ static int reada_start_machine_dev(struct btrfs_fs_info
> *fs_info,
>   else if (eb)
>   __readahead_hook(fs_info->extent_root, eb, eb->start, 

[PATCH] [v2] x86 mpx: give bndX registers actual names

2014-10-31 Thread Dave Hansen

Changes from V1:
 * name it 'bndreg' instead plain 'bnd'

--

From: Dave Hansen 

Consider the bndX MPX registers.  There 4 registers each
containing a 64-bit lower and a 64-bit upper bound.  That's 8*64
bits and we declare it thusly:

struct bndregs_struct {
u64 bndregs[8];
}

Let's say you want to read the upper bound from the MPX register
bnd2 out of the xsave buf.  You do:

bndregno = 2;
upper_bound = xsave_buf->bndregs.bndregs[2*bndregno+1];

That kinda sucks.  Every time you access it, you need to know:
1. Each bndX register is two entries wide in "bndregs"
2. The lower comes first followed by upper.  We do the +1 to get
   upper vs. lower.

This replaces the old definition.  You can now access them
indexed by the register number directly, and with a meaningful
name for the lower and upper bound:

bndregno = 2;
xsave_buf->bndreg[bndregno].ub;

It's now *VERY* clear that there are 4 registers.  The programmer
now doesn't have to care what order the lower and upper bounds
are in, and it's harder to get it wrong.

The naming "lb" and "ub" reflects the names found in the Intel
SDM Extensions documentation of these registers.  I'm not married
to it.

Signed-off-by: Dave Hansen 
Cc: x...@kernel.org
Cc: "H. Peter Anvin" 
Cc: Qiaowei Ren 
Cc: "Yu, Fenghua" 

---

 b/arch/x86/include/asm/processor.h |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -puN arch/x86/include/asm/processor.h~mpx-give-regsters-real-names 
arch/x86/include/asm/processor.h
--- a/arch/x86/include/asm/processor.h~mpx-give-regsters-real-names 
2014-10-31 14:53:40.237438291 -0700
+++ b/arch/x86/include/asm/processor.h  2014-10-31 14:53:40.243438554 -0700
@@ -374,8 +374,9 @@ struct lwp_struct {
u8 reserved[128];
 };
 
-struct bndregs_struct {
-   u64 bndregs[8];
+struct bndreg_struct {
+   u64 lb; /* lower bound */
+   u64 ub; /* upper bound */
 } __packed;
 
 struct bndcsr_struct {
@@ -394,7 +395,7 @@ struct xsave_struct {
struct xsave_hdr_struct xsave_hdr;
struct ymmh_struct ymmh;
struct lwp_struct lwp;
-   struct bndregs_struct bndregs;
+   struct bndreg_struct bndreg[4];
struct bndcsr_struct bndcsr;
/* new processor state extensions will go here */
 } __attribute__ ((packed, aligned (64)));
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ovl: initialize ->is_cursor

2014-10-31 Thread Al Viro
On Fri, Oct 31, 2014 at 08:02:42PM +0100, Miklos Szeredi wrote:
> From: Miklos Szeredi 
> 
> Signed-off-by: Miklos Szeredi 
> ---
> This goes on top of "ovl: fix check for cursor".

Applied
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/7] wait: Reimplement wait_event_freezable()

2014-10-31 Thread Oleg Nesterov
On 10/31, Oleg Nesterov wrote:
>
> On 10/31, Peter Zijlstra wrote:
> >
> > Provide better implementations of wait_event_freezable() APIs.
> >
> > The problem is with freezer_do_not_count(), it hides the thread from
> > the freezer, even though this thread might not actually freeze/sleep
> > at all.
>
> I agree, wait_event_freezable() is awful. But could you clarify "at all" ?
>
> Sure, the task can be preempted right after it sets, it can do a lot
> of things before it calls schedule(), it can be woken after that and
> it can run again and do something else before freezer_count() calls
> try_to_freeze(), etc.
>
> Is this what you meant?
>
>
> > +#define __wait_event_freezable(wq, condition)  
> > \
> > +   (void)___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0,\
> > +   schedule(); try_to_freeze())
>
> I don't think this can work. wait_event_freezable() should be used by
> kernel threads and thus we can't rely on TIF_SIGPENDING, freeze_task()
> simply does wake_up_state(TASK_INTERRUPTIBLE) in this case.
>
> Just for example, suppose that try_to_freeze_tasks() calls freeze_task()
> before this kthread sets current->state = TASK_INTERRUPTIBLE. In this
> case __wait_event_freezable()->schedule() will happily sleep and
> try_to_freeze_tasks() will fail.
>
> That is why I tried to suggest cmd == freezable_schedule(). Still not
> good, but at least this narrows the window and (perhaps) we can improve
> this freezable_schedule() later.
>
> But on a second thought... Probably cmd => try_to_freeze(); schedule();
> should work. Or just
>
>   #define __wait_event_freezable(wq, condition)   \
>   __wait_event_interruptible(wq, ({ try_to_freeze(); (condition); 
> }))
>
> which looks simpler.

Ah, but I forgot about another problem... can't we finally kill this ugly
"long save = current->state" code in __refrigerator() ? Nobody seem to
understand why we are doing this, and this looks just wrong.

And this doesn't allow us to do try_to_freeze() + schedule().

Oleg.

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


Re: [PATCH v3 2/7] iio: core: Introduce IIO_ACTIVITY channel

2014-10-31 Thread Hartmut Knaack
Just some typos left, maybe Jonathan can take care of them, if there are no 
issues for having a V4.
Daniel Baluta schrieb am 28.10.2014 11:19:
> This channel will be used for exposing information about
> activity composite sensors. Activities supported so far:
>   * running
>   * jogging
>   * walking
>   * still
> 
> THRESHOLD event is used to signal a change in the activity
> state.
> 
> We associate a confidence interval for each activity expressed
> as a percentage from 0 to 100.
>   * 0, means the sensor IS NOT reporting that activity.
>   * 100, means the sensor IS reporting that activity.
> 
> Users of this interface have two possibile means to gather
Typo: possible
> information about the ongoing activities.
> 
> 1. Event based, via event file descriptor
>   * sensor may report an event when ENTERING an activity or LEAVING
> an activity based on a threshold value.
>   * drivers will wake up applications waiting data on the event fd
> 
> 2. Polling, by reading the sysfs associated attribute files:
>   * /sys/bus/iio/devices/iio:device0/in_activity_running_input
> expressed as percentage confidence value from 0 to 100.
> 
> This will offer an interface for Android significant motion
> composite sensor defined here:
> http://source.android.com/devices/sensors/composite_sensors.html
> 
> Activities listed above are supported by Freescale's MMA9553 sensor:
> http://freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf
> 
> Signed-off-by: Irina Tirdea 
> Signed-off-by: Daniel Baluta 
> ---
>  Documentation/ABI/testing/sysfs-bus-iio | 44 
> +
>  drivers/iio/industrialio-core.c |  5 
>  include/linux/iio/types.h   |  7 +-
>  3 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio 
> b/Documentation/ABI/testing/sysfs-bus-iio
> index 5a7fc66..c3a1fd3 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -783,6 +783,40 @@ Description:
>   met before an event is generated. If direction is not
>   specified then this period applies to both directions.
>  
> +What:/sys/.../events/in_activity_still_thresh_rising_en
> +What:/sys/.../events/in_activity_still_thresh_falling_en
> +What:/sys/.../events/in_activity_walking_thresh_rising_en
> +What:/sys/.../events/in_activity_walking_thresh_falling_en
> +What:/sys/.../events/in_activity_jogging_thresh_rising_en
> +What:/sys/.../events/in_activity_jogging_thresh_falling_en
> +What:/sys/.../events/in_activity_running_thresh_rising_en
> +What:/sys/.../events/in_activity_running_thresh_falling_en
> +KernelVersion:   3.19
> +Contact: linux-...@vger.kernel.org
> +Description:
> + Enables or disables activitity events. Depending on direction
> + an event is generated when sensor ENTERS or LEAVES a given 
> state.
> +
> +What:/sys/.../events/in_activity_still_thresh_rising_value
> +What:/sys/.../events/in_activity_still_thresh_falling_value
> +What:/sys/.../events/in_activity_walking_thresh_rising_value
> +What:/sys/.../events/in_activity_walking_thresh_falling_value
> +What:/sys/.../events/in_activity_jogging_thresh_rising_value
> +What:/sys/.../events/in_activity_jogging_thresh_falling_value
> +What:/sys/.../events/in_activity_running_thresh_rising_value
> +What:/sys/.../events/in_activity_running_thresh_falling_value
> +KernelVersion:   3.19
> +Contact: linux-...@vger.kernel.org
> +Description:
> + Confidence value (in units as percentage) to be used
> + for deciding when an event should be generated. E.g for
> + running: If the confidence value reported by the sensor
> + is greater then in_activity_running_thresh_rising_value
Typo: greater than
> + then the sensor ENTERS running state. Conversely, if the
> + confidence value reported by the sensor is lower than
> + in_activity_running_thresh_falling_value then the sensor
> + is LEAVING running state.
> +
>  What:/sys/.../iio:deviceX/events/in_accel_mag_en
>  What:/sys/.../iio:deviceX/events/in_accel_mag_rising_en
>  What:/sys/.../iio:deviceX/events/in_accel_mag_falling_en
> @@ -949,6 +983,16 @@ Description:
>   and the relevant _type attributes to establish the data storage
>   format.
>  
> +What:/sys/.../iio:deviceX/in_activity_still_input
> +What:/sys/.../iio:deviceX/in_activity_walking_input
> +What:/sys/.../iio:deviceX/in_activity_jogging_input
> +What:

[PATCH 1/1] btrfs: Deletion of unnecessary checks before six function calls

2014-10-31 Thread SF Markus Elfring
The following functions test whether their argument is NULL and then
return immediately.
* btrfs_free_path()
* free_extent_buffer()
* free_extent_map()
* free_extent_state()
* iput()
* kfree()

Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 fs/btrfs/dev-replace.c   |  3 +--
 fs/btrfs/extent_io.c | 12 
 fs/btrfs/file.c  |  6 ++
 fs/btrfs/free-space-cache.c  |  7 +++
 fs/btrfs/inode.c |  6 ++
 fs/btrfs/reada.c |  3 +--
 fs/btrfs/relocation.c|  3 +--
 fs/btrfs/tests/btrfs-tests.c |  3 +--
 fs/btrfs/tree-defrag.c   |  3 +--
 fs/btrfs/tree-log.c  |  6 ++
 10 files changed, 18 insertions(+), 34 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 6f662b3..3465029 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -183,8 +183,7 @@ no_valid_dev_replace_entry_found:
}

 out:
-   if (path)
-   btrfs_free_path(path);
+   btrfs_free_path(path);
return ret;
 }

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index bf3f424..cfbf00a 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -704,8 +704,7 @@ next:

 out:
spin_unlock(>lock);
-   if (prealloc)
-   free_extent_state(prealloc);
+   free_extent_state(prealloc);

return 0;

@@ -1006,8 +1005,7 @@ hit_next:

 out:
spin_unlock(>lock);
-   if (prealloc)
-   free_extent_state(prealloc);
+   free_extent_state(prealloc);

return err;

@@ -1223,8 +1221,7 @@ hit_next:

 out:
spin_unlock(>lock);
-   if (prealloc)
-   free_extent_state(prealloc);
+   free_extent_state(prealloc);

return err;

@@ -4146,8 +4143,7 @@ int extent_readpages(struct extent_io_tree *tree,
__extent_readpages(tree, pagepool, nr, get_extent, _cached,
   , 0, _flags, READ);

-   if (em_cached)
-   free_extent_map(em_cached);
+   free_extent_map(em_cached);

BUG_ON(!list_empty(pages));
if (bio)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index a18ceab..add07ce8 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -677,10 +677,8 @@ next:
/* once for the tree*/
free_extent_map(em);
}
-   if (split)
-   free_extent_map(split);
-   if (split2)
-   free_extent_map(split2);
+   free_extent_map(split);
+   free_extent_map(split2);
 }

 /*
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 3384819..11883e2 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1943,8 +1943,7 @@ new_bitmap:

 out:
if (info) {
-   if (info->bitmap)
-   kfree(info->bitmap);
+   kfree(info->bitmap);
kmem_cache_free(btrfs_free_space_cachep, info);
}

@@ -3322,8 +3321,8 @@ again:

if (info)
kmem_cache_free(btrfs_free_space_cachep, info);
-   if (map)
-   kfree(map);
+
+   kfree(map);
return 0;
 }

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d23362f..7301b99 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -857,8 +857,7 @@ static u64 get_extent_allocation_hint(struct inode *inode,
u64 start,
em = search_extent_mapping(em_tree, 0, 0);
if (em && em->block_start < EXTENT_MAP_LAST_BYTE)
alloc_hint = em->block_start;
-   if (em)
-   free_extent_map(em);
+   free_extent_map(em);
} else {
alloc_hint = em->block_start;
free_extent_map(em);
@@ -6573,8 +6572,7 @@ out:

trace_btrfs_get_extent(root, em);

-   if (path)
-   btrfs_free_path(path);
+   btrfs_free_path(path);
if (trans) {
ret = btrfs_end_transaction(trans, root);
if (!err)
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index b63ae20..ec8eb49 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -731,8 +731,7 @@ static int reada_start_machine_dev(struct btrfs_fs_info
*fs_info,
else if (eb)
__readahead_hook(fs_info->extent_root, eb, eb->start, ret);

-   if (eb)
-   free_extent_buffer(eb);
+   free_extent_buffer(eb);

return 1;

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 74257d6..f87a5ee 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4158,8 +4158,7 @@ out:
btrfs_end_transaction(trans, root);
btrfs_btree_balance_dirty(root);
if (err) {
-   if (inode)
-   iput(inode);
+   iput(inode);
inode 

[PATCH 4/8] cdrom: move EXPORT_SYMBOL after functions

2014-10-31 Thread Fabian Frederick
Signed-off-by: Fabian Frederick 
---
 drivers/cdrom/cdrom.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index deda0f1..ca47919 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -638,6 +638,8 @@ int register_cdrom(struct cdrom_device_info *cdi)
mutex_unlock(_mutex);
return 0;
 }
+EXPORT_SYMBOL(register_cdrom);
+
 #undef ENSURE
 
 void unregister_cdrom(struct cdrom_device_info *cdi)
@@ -654,6 +656,7 @@ void unregister_cdrom(struct cdrom_device_info *cdi)
cdi->ops->n_minors--;
cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" unregistered\n", cdi->name);
 }
+EXPORT_SYMBOL(unregister_cdrom);
 
 int cdrom_get_media_event(struct cdrom_device_info *cdi,
  struct media_event_desc *med)
@@ -681,6 +684,7 @@ int cdrom_get_media_event(struct cdrom_device_info *cdi,
memcpy(med, [sizeof(*eh)], sizeof(*med));
return 0;
 }
+EXPORT_SYMBOL(cdrom_get_media_event);
 
 static int cdrom_get_random_writable(struct cdrom_device_info *cdi,
  struct rwrt_feature_desc *rfd)
@@ -1192,6 +1196,7 @@ err:
cdi->use_count--;
return ret;
 }
+EXPORT_SYMBOL(cdrom_open);
 
 /* This code is similar to that in open_for_data. The routine is called
whenever an audio play operation is requested.
@@ -1287,6 +1292,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t 
mode)
cdo->tray_move(cdi, 1);
}
 }
+EXPORT_SYMBOL(cdrom_release);
 
 static int cdrom_read_mech_status(struct cdrom_device_info *cdi, 
  struct cdrom_changer_info *buf)
@@ -1369,6 +1375,7 @@ int cdrom_number_of_slots(struct cdrom_device_info *cdi)
kfree(info);
return nslots;
 }
+EXPORT_SYMBOL(cdrom_number_of_slots);
 
 
 /* If SLOT < 0, unload the current slot.  Otherwise, try to load SLOT. */
@@ -1538,6 +1545,7 @@ int cdrom_media_changed(struct cdrom_device_info *cdi)
return 0;
return media_changed(cdi, 0);
 }
+EXPORT_SYMBOL(cdrom_media_changed);
 
 /* Requests to the low-level drivers will /always/ be done in the
following format convention:
@@ -1586,6 +1594,7 @@ void init_cdrom_command(struct packet_command *cgc, void 
*buf, int len,
cgc->data_direction = type;
cgc->timeout = CDROM_DEF_TIMEOUT;
 }
+EXPORT_SYMBOL(init_cdrom_command);
 
 /* DVD handling */
 
@@ -2004,6 +2013,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
cgc->data_direction = CGC_DATA_READ;
return cdo->generic_packet(cdi, cgc);
 }
+EXPORT_SYMBOL(cdrom_mode_sense);
 
 int cdrom_mode_select(struct cdrom_device_info *cdi,
  struct packet_command *cgc)
@@ -2019,6 +2029,7 @@ int cdrom_mode_select(struct cdrom_device_info *cdi,
cgc->data_direction = CGC_DATA_WRITE;
return cdo->generic_packet(cdi, cgc);
 }
+EXPORT_SYMBOL(cdrom_mode_select);
 
 static int cdrom_read_subchannel(struct cdrom_device_info *cdi,
 struct cdrom_subchnl *subchnl, int mcn)
@@ -2871,6 +2882,7 @@ use_toc:
*last_written = toc.cdte_addr.lba;
return 0;
 }
+EXPORT_SYMBOL(cdrom_get_last_written);
 
 /* return the next writable block. also for udf file system. */
 static int cdrom_get_next_writable(struct cdrom_device_info *cdi,
@@ -3392,19 +3404,7 @@ int cdrom_ioctl(struct cdrom_device_info *cdi, struct 
block_device *bdev,
 
return -ENOSYS;
 }
-
-EXPORT_SYMBOL(cdrom_get_last_written);
-EXPORT_SYMBOL(register_cdrom);
-EXPORT_SYMBOL(unregister_cdrom);
-EXPORT_SYMBOL(cdrom_open);
-EXPORT_SYMBOL(cdrom_release);
 EXPORT_SYMBOL(cdrom_ioctl);
-EXPORT_SYMBOL(cdrom_media_changed);
-EXPORT_SYMBOL(cdrom_number_of_slots);
-EXPORT_SYMBOL(cdrom_mode_select);
-EXPORT_SYMBOL(cdrom_mode_sense);
-EXPORT_SYMBOL(init_cdrom_command);
-EXPORT_SYMBOL(cdrom_get_media_event);
 
 #ifdef CONFIG_SYSCTL
 
-- 
1.9.3

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


[PATCH 3/8] cdrom: fix spaces required errors

2014-10-31 Thread Fabian Frederick
Signed-off-by: Fabian Frederick 
---
 drivers/cdrom/cdrom.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index c311e0d..deda0f1 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -286,7 +286,7 @@
 /* used to tell the module to turn on full debugging messages */
 static bool debug;
 /* default compatibility mode */
-static bool autoclose=1;
+static bool autoclose = 1;
 static bool autoeject;
 static bool lockdoor = 1;
 /* will we ever get to use this... sigh. */
@@ -535,7 +535,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
int ret;
 
ret = cdrom_get_disc_info(cdi, );
-   if (ret < 0 || ret < (int)offsetof(typeof(di),disc_type))
+   if (ret < 0 || ret < (int)offsetof(typeof(di), disc_type))
return 1;
 
ret = 0;
@@ -699,7 +699,7 @@ static int cdrom_get_random_writable(struct 
cdrom_device_info *cdi,
if ((ret = cdi->ops->generic_packet(cdi, )))
return ret;
 
-   memcpy(rfd, [sizeof(struct feature_header)], sizeof (*rfd));
+   memcpy(rfd, [sizeof(struct feature_header)], sizeof(*rfd));
return 0;
 }
 
@@ -787,7 +787,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info 
*cdi)
}
 
ret = cdrom_get_disc_info(cdi, );
-   if (ret < 0 || ret < offsetof(typeof(di),disc_type))
+   if (ret < 0 || ret < offsetof(typeof(di), disc_type))
return 1;
 
if (!di.erasable)
@@ -1048,7 +1048,7 @@ int open_for_data(struct cdrom_device_info *cdi)
if (CDROM_CAN(CDC_CLOSE_TRAY) &&
cdi->options & CDO_AUTO_CLOSE) {
cd_dbg(CD_OPEN, "trying to close the tray\n");
-   ret=cdo->tray_move(cdi,0);
+   ret = cdo->tray_move(cdi, 0);
if (ret) {
cd_dbg(CD_OPEN, "bummer. tried to close 
the tray but failed.\n");
/* Ignore the error from the low
@@ -1056,27 +1056,27 @@ int open_for_data(struct cdrom_device_info *cdi)
couldn't close the tray.  We only care 
that there is no disc in the drive, 
since that is the _REAL_ problem here.*/
-   ret=-ENOMEDIUM;
+   ret = -ENOMEDIUM;
goto clean_up_and_return;
}
} else {
cd_dbg(CD_OPEN, "bummer. this drive can't close 
the tray.\n");
-   ret=-ENOMEDIUM;
+   ret = -ENOMEDIUM;
goto clean_up_and_return;
}
/* Ok, the door should be closed now.. Check again */
ret = cdo->drive_status(cdi, CDSL_CURRENT);
-   if ((ret == CDS_NO_DISC) || (ret==CDS_TRAY_OPEN)) {
+   if ((ret == CDS_NO_DISC) || (ret == CDS_TRAY_OPEN)) {
cd_dbg(CD_OPEN, "bummer. the tray is still not 
closed.\n");
cd_dbg(CD_OPEN, "tray might not contain a 
medium\n");
-   ret=-ENOMEDIUM;
+   ret = -ENOMEDIUM;
goto clean_up_and_return;
}
cd_dbg(CD_OPEN, "the tray is now closed\n");
}
/* the door should be closed now, check for the disc */
ret = cdo->drive_status(cdi, CDSL_CURRENT);
-   if (ret!=CDS_DISC_OK) {
+   if (ret != CDS_DISC_OK) {
ret = -ENOMEDIUM;
goto clean_up_and_return;
}
@@ -1084,19 +1084,19 @@ int open_for_data(struct cdrom_device_info *cdi)
cdrom_count_tracks(cdi, );
if (tracks.error == CDS_NO_DISC) {
cd_dbg(CD_OPEN, "bummer. no disc.\n");
-   ret=-ENOMEDIUM;
+   ret = -ENOMEDIUM;
goto clean_up_and_return;
}
/* CD-Players which don't use O_NONBLOCK, workman
 * for example, need bit CDO_CHECK_TYPE cleared! */
-   if (tracks.data==0) {
+   if (tracks.data == 0) {
if (cdi->options & CDO_CHECK_TYPE) {
/* give people a warning shot, now that CDO_CHECK_TYPE
   is the default case! */
cd_dbg(CD_OPEN, "bummer. wrong media type.\n");
cd_dbg(CD_WARNING, "pid %d must open device O_NONBLOCK!\n",
   (unsigned int)task_pid_nr(current));
-   

[GIT PULL] ext4 bug fixes for 3.18

2014-10-31 Thread Theodore Ts'o
The following changes since commit cac7f2429872d3733dc3f9915857b1691da2eb2f:

  Linux 3.18-rc2 (2014-10-26 16:48:41 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git 
tags/ext4_for_linus_stable

for you to fetch changes up to ae9e9c6aeea6f91ccb4fb369d7dd8f1a8b5f6a58:

  ext4: make ext4_ext_convert_to_initialized() return proper number of blocks 
(2014-10-30 10:53:17 -0400)


A set of miscellaneous ext4 bug fixes for 3.18.


Darrick J. Wong (3):
  ext4: enable journal checksum when metadata checksum feature enabled
  ext4: disallow changing journal_csum option during remount
  ext4: remove extent status procfs files if journal load fails

Dmitry Monakhov (1):
  ext4: prevent bugon on race between write/fcntl

Jan Kara (5):
  ext4: fix overflow when updating superblock backups after resize
  ext4: fix oops when loading block bitmap failed
  ext4: bail out from make_indexed_dir() on first error
  ext4: bail early when clearing inode journal flag fails
  ext4: make ext4_ext_convert_to_initialized() return proper number of 
blocks

Theodore Ts'o (1):
  jbd2: use a better hash function for the revoke table

 fs/ext4/extents.c |  9 -
 fs/ext4/file.c|  2 +-
 fs/ext4/ialloc.c  |  4 
 fs/ext4/inode.c   |  7 ++-
 fs/ext4/namei.c   | 28 ++--
 fs/ext4/resize.c  |  2 +-
 fs/ext4/super.c   | 17 +++--
 fs/jbd2/revoke.c  | 10 ++
 8 files changed, 51 insertions(+), 28 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 2/7] wait: Reimplement wait_event_freezable()

2014-10-31 Thread Peter Zijlstra
On Fri, Oct 31, 2014 at 10:38:02PM +0100, Oleg Nesterov wrote:
> On 10/31, Peter Zijlstra wrote:
> >
> > Provide better implementations of wait_event_freezable() APIs.
> >
> > The problem is with freezer_do_not_count(), it hides the thread from
> > the freezer, even though this thread might not actually freeze/sleep
> > at all.
> 
> I agree, wait_event_freezable() is awful. But could you clarify "at all" ?
> 
> Sure, the task can be preempted right after it sets, it can do a lot
> of things before it calls schedule(), it can be woken after that and
> it can run again and do something else before freezer_count() calls
> try_to_freeze(), etc.
> 
> Is this what you meant?

Yes.

> > +#define __wait_event_freezable(wq, condition)  
> > \
> > +   (void)___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0,\
> > +   schedule(); try_to_freeze())
> 
> I don't think this can work.

Yeah, that was horribly broken. defconfig didn't seem to find a usage
site. Wu's robot offered a .config quickly enough though ;-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/8] cdrom: remove bool comparison/assignment to 0/1

2014-10-31 Thread Fabian Frederick
Fix the following coccinelle warnings:

drivers/cdrom/cdrom.c:615:5-14: WARNING: Comparison of bool to 0/1
drivers/cdrom/cdrom.c:617:5-14: WARNING: Comparison of bool to 0/1
drivers/cdrom/cdrom.c:619:5-13: WARNING: Comparison of bool to 0/1
drivers/cdrom/cdrom.c:621:5-21: WARNING: Comparison of bool to 0/1
drivers/cdrom/cdrom.c:317:28-33: WARNING: Comparison of bool to 0/1
drivers/cdrom/cdrom.c:323:33-38: WARNING: Comparison of bool to 0/1
drivers/cdrom/cdrom.c:289:12-21: WARNING: Assignment of bool to 0/1
drivers/cdrom/cdrom.c:291:12-20: WARNING: Assignment of bool to 0/1
drivers/cdrom/cdrom.c:295:12-30: WARNING: Assignment of bool to 0/1

Signed-off-by: Fabian Frederick 
---
 drivers/cdrom/cdrom.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index ca47919..a4dd382 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -286,13 +286,13 @@
 /* used to tell the module to turn on full debugging messages */
 static bool debug;
 /* default compatibility mode */
-static bool autoclose = 1;
+static bool autoclose = true;
 static bool autoeject;
-static bool lockdoor = 1;
+static bool lockdoor = true;
 /* will we ever get to use this... sigh. */
 static bool check_media_type;
 /* automatically restart mrw format */
-static bool mrw_format_restart = 1;
+static bool mrw_format_restart = true;
 module_param(debug, bool, 0);
 module_param(autoclose, bool, 0);
 module_param(autoeject, bool, 0);
@@ -314,13 +314,13 @@ static const char * const mrw_address_space[] = { "DMA", 
"GAA" };
 #if (ERRLOGMASK != CD_NOTHING)
 #define cd_dbg(type, fmt, ...) \
 do {   \
-   if ((ERRLOGMASK & type) || debug == 1)  \
+   if ((ERRLOGMASK & type) || debug)   \
pr_debug(fmt, ##__VA_ARGS__);   \
 } while (0)
 #else
 #define cd_dbg(type, fmt, ...) \
 do {   \
-   if (0 && (ERRLOGMASK & type) || debug == 1) \
+   if (0 && (ERRLOGMASK & type) || debug)  \
pr_debug(fmt, ##__VA_ARGS__);   \
 } while (0)
 #endif
@@ -612,13 +612,13 @@ int register_cdrom(struct cdrom_device_info *cdi)
cdo->n_minors = 0;
cdi->options = CDO_USE_FFLAGS;
 
-   if (autoclose == 1 && CDROM_CAN(CDC_CLOSE_TRAY))
+   if (autoclose && CDROM_CAN(CDC_CLOSE_TRAY))
cdi->options |= (int) CDO_AUTO_CLOSE;
-   if (autoeject == 1 && CDROM_CAN(CDC_OPEN_TRAY))
+   if (autoeject && CDROM_CAN(CDC_OPEN_TRAY))
cdi->options |= (int) CDO_AUTO_EJECT;
-   if (lockdoor == 1)
+   if (lockdoor)
cdi->options |= (int) CDO_LOCK;
-   if (check_media_type == 1)
+   if (check_media_type)
cdi->options |= (int) CDO_CHECK_TYPE;
 
if (CDROM_CAN(CDC_MRW_W))
-- 
1.9.3

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


  1   2   3   4   5   6   7   8   9   10   >