Re: [PATCH v2] Documentation: sunxi: Update Allwinner SoC documentation

2016-08-16 Thread Chen-Yu Tsai
On Sat, Aug 13, 2016 at 6:01 PM, Icenowy Zheng  wrote:
> Now, the A83T and A64 SoC user manuals are available.
> Update the documentation to add the links.
>
> An updated version of A83T datasheet is also included now.
>
> Signed-off-by: Icenowy Zheng 

Acked-by: Chen-Yu Tsai 


RE: [PATCH] net: macb: add phy-handle support for the macb

2016-08-16 Thread Appana Durga Kedareswara Rao
Hi David Miller,

Thanks for the review...

> 
> From: Kedareswara rao Appana 
> Date: Sat, 13 Aug 2016 15:31:49 +0530
> 
> > @@ -445,7 +445,13 @@ static int macb_mii_init(struct macb *bp)
> > dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
> >
> > np = bp->pdev->dev.of_node;
> > -   if (np) {
> > +   np1 = of_get_parent(bp->phy_node);
> > +   if (np1) {
> > +   of_node_put(np1);
> > +   err = of_mdiobus_register(bp->mii_bus, np1);
> > +   if (err)
> > +   goto err_out_unregister_bus;
> > +   } else if (np) {
> 
> I don't know about this, all OF nodes other than the root have a parent node
> which is non-NULL.  This parent node can be anything.
> 
> Just blinding assuming that any parent node of the phy_node is what we are
> looking for, without any other supplementary checks at all, seems to be asking
> for trouble at the very least.

Agree with you my intention is if there is a MDIO bus on the device-tree
The MAC driver should create PHY/MDIO devices using of_mdiobus_register().

How about below code...

-   struct device_node *np;
+   struct device_node *np, *np1;
int err = -ENXIO, i;
 
/* Enable management port */
@@ -445,7 +445,14 @@ static int macb_mii_init(struct macb *bp)
dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
 
np = bp->pdev->dev.of_node;
-   if (np) {
+   np1 = of_get_child_by_name(np, "mdio");
+   if (np1) {
+   of_node_put(np1);
+   err = of_mdiobus_register(bp->mii_bus, np1);
+   if (err)
+   goto err_out_unregister_bus;
+   } else if (np) {
/* try dt phy registration */
err = of_mdiobus_register(bp->mii_bus, np);

If you are ok with the above code please let me know will post it as v2...

Regards,
Kedar.


Re: [RFC 5/7] Bluetooth: hci_nokia: Introduce new driver

2016-08-16 Thread Marcel Holtmann
Hi Sebastian,

> This driver adds support for Nokia H4+ procotol used
> for example by Nokia's internet tablets (N770 - N950).
> ---
> drivers/bluetooth/Kconfig |  10 +
> drivers/bluetooth/Makefile|   1 +
> drivers/bluetooth/hci_ldisc.c |   6 +
> drivers/bluetooth/hci_nokia.c | 734 ++
> drivers/bluetooth/hci_nokia.h | 140 
> drivers/bluetooth/hci_uart.h  |   8 +-
> 6 files changed, 898 insertions(+), 1 deletion(-)
> create mode 100644 drivers/bluetooth/hci_nokia.c
> create mode 100644 drivers/bluetooth/hci_nokia.h
> 
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index cf50fd2e96df..c32d9d5ad1d2 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -86,6 +86,16 @@ config BT_HCIUART_H4
> 
> Say Y here to compile support for HCI UART (H4) protocol.
> 
> +config BT_HCIUART_NOKIA
> + bool "UART Nokia H4+ protocol support"
> + depends on BT_HCIUART
> + help
> +   Nokia H4+ is serial protocol for communication between Bluetooth
> +   device and host. This protocol is required for Bluetooth devices
> +   with UART interface in Nokia devices.
> +
> +   Say Y here to compile support for Nokia's H4+ protocol.
> +
> config BT_HCIUART_BCSP
>   bool "BCSP protocol support"
>   depends on BT_HCIUART
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index 9c18939fc5c9..f7951646ee14 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -37,6 +37,7 @@ hci_uart-$(CONFIG_BT_HCIUART_INTEL) += hci_intel.o
> hci_uart-$(CONFIG_BT_HCIUART_BCM) += hci_bcm.o
> hci_uart-$(CONFIG_BT_HCIUART_QCA) += hci_qca.o
> hci_uart-$(CONFIG_BT_HCIUART_AG6XX)   += hci_ag6xx.o
> +hci_uart-$(CONFIG_BT_HCIUART_NOKIA)  += hci_nokia.o
> hci_uart-objs := $(hci_uart-y)
> 
> ccflags-y += -D__CHECK_ENDIAN__
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index dda97398c59a..83d0de94bf35 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -810,6 +810,9 @@ static int __init hci_uart_init(void)
> #ifdef CONFIG_BT_HCIUART_AG6XX
>   ag6xx_init();
> #endif
> +#ifdef CONFIG_BT_HCIUART_NOKIA
> + nokia_init();
> +#endif
> 
>   return 0;
> }
> @@ -845,6 +848,9 @@ static void __exit hci_uart_exit(void)
> #ifdef CONFIG_BT_HCIUART_AG6XX
>   ag6xx_deinit();
> #endif
> +#ifdef CONFIG_BT_HCIUART_NOKIA
> + nokia_deinit();
> +#endif
> 
>   /* Release tty registration of line discipline */
>   err = tty_unregister_ldisc(N_HCI);
> diff --git a/drivers/bluetooth/hci_nokia.c b/drivers/bluetooth/hci_nokia.c
> new file mode 100644
> index ..efd4dd320838
> --- /dev/null
> +++ b/drivers/bluetooth/hci_nokia.c
> @@ -0,0 +1,734 @@
> +/*
> + *
> + *  Bluetooth HCI UART H4 driver with Nokia Extensions
> + *
> + *  Copyright (C) 2015 Marcel Holtmann 
> + *  Copyright (C) 2016 Sebastian Reichel 
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + */
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 

are you sure all these includes are needed?

> +#include 
> +#include 
> +
> +#include "hci_uart.h"
> +#include "hci_nokia.h"
> +
> +struct nokia_uart_dev {
> + struct device *dev;
> + struct tty_port *port;
> + struct gpio_desc *reset;
> + struct gpio_desc *wakeup_host;
> + struct gpio_desc *wakeup_bt;
> + unsigned long sysclk_speed;
> +};
> +
> +struct nokia_bt_dev {
> + struct hci_uart *hu;
> + struct nokia_uart_dev *btdata;
> + int wake_irq;
> + bool wake_state;
> + struct sk_buff *rx_skb;
> + struct sk_buff_head txq;
> + bdaddr_t bdaddr;
> +
> + int init_error;
> + struct completion init_completion;
> +
> + uint8_t man_id;
> + uint8_t ver_id;
> +};
> +
> +static char *nokia_get_fw_name(struct nokia_bt_dev *btdev)
> +{
> + switch (btdev->man_id) {
> + case NOKIA_ID_CSR:
> + return FIRMWARE_CSR;
> + case NOKIA_ID_BCM2048:
> + return FIRMWARE_BCM2048;
> + case NOKIA_ID_TI1271:
> + return FIRMWARE_TI1271;
> + default:
> + return NULL;
> + }
> +}
> +
> +static int hci_uart_wait_for_cts(struc

Re: [RFC PATCH] Introduce a 'recovery' command line option

2016-08-16 Thread Richard Weinberger
Hi!

On Tue, Aug 16, 2016 at 8:36 AM, Janne Karhunen
 wrote:
> Recovery option can be used to define a secondary rootfs
> in case mounting of the primary root fails. This allows
> the kernel to automatically switch to a recovery
> filesystem without the initrd or the bootloader support
> for the switch.

Why are you moving this feature into the kernel?
To support such advanced features we have the initramfs.

dracut has already rootfallback=.

-- 
Thanks,
//richard


Re: [RFC 4/7] Bluetooth: hci_uart: Add support for word alignment

2016-08-16 Thread Marcel Holtmann
Hi Sebatian,

> This will be used by Nokia's H4+ protocol, which
> adds padding to packets to reach word alignment.
> ---
> drivers/bluetooth/hci_h4.c   | 10 ++
> drivers/bluetooth/hci_uart.h |  1 +
> 2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
> index 635597b6e168..a934e4eb692b 100644
> --- a/drivers/bluetooth/hci_h4.c
> +++ b/drivers/bluetooth/hci_h4.c
> @@ -253,11 +253,21 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, 
> struct sk_buff *skb,
>   }
> 
>   if (!dlen) {
> + if ((&pkts[i])->wordaligned && !(skb->len % 2)) 
> {
> + buffer++;
> + count--;
> + }
> +
>   /* No more data, complete frame */
>   (&pkts[i])->recv(hdev, skb);
>   skb = NULL;
>   }
>   } else {
> + if ((&pkts[i])->wordaligned && !(skb->len % 2)) {
> + buffer++;
> + count--;
> + }
> +
>   /* Complete frame */
>   (&pkts[i])->recv(hdev, skb);
>   skb = NULL;
> diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
> index 839bad1d8152..a7d67aec3632 100644
> --- a/drivers/bluetooth/hci_uart.h
> +++ b/drivers/bluetooth/hci_uart.h
> @@ -121,6 +121,7 @@ struct h4_recv_pkt {
>   u8  loff;   /* Data length offset in header */
>   u8  lsize;  /* Data length field size */
>   u16 maxlen; /* Max overall packet length */
> + bool wordaligned;   /* packets are word aligned */

I wonder if not a u8 align would be a way better choice here. We set it to 1 
for all existing packet types. And the Nokia driver can use 2 here.

>   int (*recv)(struct hci_dev *hdev, struct sk_buff *skb);

Regards

Marcel



[PATCH] extcon: Use the extcon_set_state_sync() instead of deprecated functions

2016-08-16 Thread Chanwoo Choi
This patch alters the renamed extcon API to set the state of the external
connectors instead of deprecated extcon_set_cable_state_().

Because the patch[1] modifies the function name to maintain the function
naming pattern.
- extcon_set_cable_state_() -> extcon_set_state_sync()
- extcon_get_cable_state_() -> extcon_get_state()

[1] https://lkml.org/lkml/2016/8/4/729
- extcon: Rename the extcon_set/get_state() to maintain the function naming 
pattern

Cc: Krzysztof Kozlowski 
Cc: Roger Quadros 
Cc: Charles Keepax 
Cc: Chen-Yu Tsai 
Cc: Ramakrishna Pallala 
Cc: Kishon Vijay Abraham I 
Signed-off-by: Chanwoo Choi 
---
 drivers/extcon/extcon-adc-jack.c |  4 ++--
 drivers/extcon/extcon-arizona.c  | 16 +++---
 drivers/extcon/extcon-axp288.c   |  2 +-
 drivers/extcon/extcon-gpio.c |  2 +-
 drivers/extcon/extcon-max14577.c | 14 ++--
 drivers/extcon/extcon-max3355.c  |  8 +++
 drivers/extcon/extcon-max77693.c | 46 
 drivers/extcon/extcon-max77843.c | 22 +--
 drivers/extcon/extcon-max8997.c  | 20 -
 drivers/extcon/extcon-palmas.c   | 16 +++---
 drivers/extcon/extcon-rt8973a.c  |  4 ++--
 drivers/extcon/extcon-sm5502.c   |  4 ++--
 drivers/extcon/extcon-usb-gpio.c |  8 +++
 13 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index e62e6cd7e00a..bc538708c753 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -75,7 +75,7 @@ static void adc_jack_handler(struct work_struct *work)
for (i = 0; i < data->num_conditions; i++) {
def = &data->adc_conditions[i];
if (def->min_adc <= adc_val && def->max_adc >= adc_val) {
-   extcon_set_cable_state_(data->edev, def->id, true);
+   extcon_set_state_sync(data->edev, def->id, true);
return;
}
}
@@ -83,7 +83,7 @@ static void adc_jack_handler(struct work_struct *work)
/* Set the detached state if adc value is not included in the range */
for (i = 0; i < data->num_conditions; i++) {
def = &data->adc_conditions[i];
-   extcon_set_cable_state_(data->edev, def->id, false);
+   extcon_set_state_sync(data->edev, def->id, false);
}
 }
 
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 493bd9fe5f67..56e6c4c7c60d 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -614,7 +614,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
}
 
/* If the cable was removed while measuring ignore the result */
-   ret = extcon_get_cable_state_(info->edev, EXTCON_MECHANICAL);
+   ret = extcon_get_state(info->edev, EXTCON_MECHANICAL);
if (ret < 0) {
dev_err(arizona->dev, "Failed to check cable state: %d\n",
ret);
@@ -649,7 +649,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
else
report = EXTCON_JACK_HEADPHONE;
 
-   ret = extcon_set_cable_state_(info->edev, report, true);
+   ret = extcon_set_state_sync(info->edev, report, true);
if (ret != 0)
dev_err(arizona->dev, "Failed to report HP/line: %d\n",
ret);
@@ -732,7 +732,7 @@ err:
   ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
 
/* Just report headphone */
-   ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true);
+   ret = extcon_set_state_sync(info->edev, EXTCON_JACK_HEADPHONE, true);
if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
 
@@ -789,7 +789,7 @@ err:
   ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
 
/* Just report headphone */
-   ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true);
+   ret = extcon_set_state_sync(info->edev, EXTCON_JACK_HEADPHONE, true);
if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
 
@@ -829,7 +829,7 @@ static void arizona_micd_detect(struct work_struct *work)
mutex_lock(&info->lock);
 
/* If the cable was removed while measuring ignore the result */
-   ret = extcon_get_cable_state_(info->edev, EXTCON_MECHANICAL);
+   ret = extcon_get_state(info->edev, EXTCON_MECHANICAL);
if (ret < 0) {
dev_err(arizona->dev, "Failed to check cable state: %d\n",
ret);
@@ -914,7 +914,7 @@ static void arizona_micd_detect(struct work_struct *work)
 
arizona_identify_headphone(info);
 
-   ret = extcon_set_cable_state_(info->edev,
+   ret = extcon_set_state_sync(info->edev,
  EXTCON_JACK_MICROPHONE, true

Re: musb: am3358: having problem with high-speed on usb1 at peripheral

2016-08-16 Thread Felipe Balbi

Hi,

ayaka  writes:
> On 08/13/2016 01:44 AM, Greg KH wrote:
>> On Sat, Aug 13, 2016 at 12:38:46AM +0800, ayaka wrote:
>>>
>>> On 08/12/2016 03:40 PM, Greg KH wrote:
 On Fri, Aug 12, 2016 at 10:23:15AM +0800, ayaka wrote:
> Hello all:
> I recently add a support for customize am3358 board using the branch
> processor-sdk-linux-03.00.00 from Ti git. But I meet a problem with musb
> at the peripheral mode.
 Then you are going to have to get support from TI for this, nothing we
 can do here about random vendor kernel trees, sorry.

 If you can use the 4.7 tree, or better yet, the 4.8-rc tree, then we
>>> I have tried the 4.8-rc1, I meet the same problem.
>> What problem is that exactly?
> Sorry, the USB1 can't work at high speed gadget mode and have DMA problem.
> musb-hdrc musb-hdrc.0.auto: Failed to request rx1.
> musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517

-517 is EPROBE_DEFER. Most likely DMA hasn't probed and MUSB is
 deferring to try later. This does _NOT_ MUSB can't work with
 DMA. Perhaps you didn't enable support for MUSB's DMA engine.

-- 
balbi


signature.asc
Description: PGP signature


Re: [RFC 0/7] Nokia N9xx bluetooth driver

2016-08-16 Thread Marcel Holtmann
Hi Sebastian,

> This series (based von 4.8-rc1) adds support for bluetooth on the Nokia
> N9xx devices. It has been tested on the Nokia N950, where it works
> correctly. On Nokia N900 it currently fails during negotiation
> (probably related to slightly incorrect serial settings/timings).
> The N900's bcm2048 correctly answeres to alive check even before
> negotiation (on N950 it does not work before negotiation), but replies
> with an Hardware error event to the negotiation packet.
> 
> Apart from N900 support there are still two "features" missing in the
> driver:
> 
> 1. To save energy the bluetooth module can be put into sleep mode via a
>   GPIO. This gpio should be enabled before sending data via UART and
>   disabled once the transmission is done. I currently just keep the
>   GPIO always enabled.
> 2. It would be nice to have a bluetooth device exposed by the kernel
>   automatically without having to setup the tty disector first for
>   proper configurationless out of the box support. I could not find
>   a nice way to do this from the kernel, though.

currently using the HCI line discipline is the only way to attach a Bluetooth 
device to a serial line / UART.

However I have been advocating for a serial bus or UART bus for a long time 
now. It is needed especially for Bluetooth devices which have no business in 
being exposed as TTYs in the first place.

This is true for the ACPI and DT world actually. Some UARTs should not be 
exposed as TTY and just be stuck on a bus that can be enumerated and matched by 
a driver that knows how to handle it.

This goes along with the weird fetish to expose certain Bluetooth GPIOs as 
RFKILL switches. They are not that either since they just power the UART. They 
have nothing to do with a radio RFKILL switch. We fixed the Intel and Broadcom 
ones to be mapped into the driver. Having a proper bus would make this one also 
a lot easier.

Regards

Marcel



Re: [PACTH v2 0/3] Implement /proc//totmaps

2016-08-16 Thread Michal Hocko
On Mon 15-08-16 12:25:10, Robert Foss wrote:
> 
> 
> On 2016-08-15 09:42 AM, Michal Hocko wrote:
[...]
> > The use case is to speed up monitoring of
> > memory consumption in environments where RSS isn't precise.
> >
> > For example Chrome tends to many processes which have hundreds of VMAs
> > with a substantial amount of shared memory, and the error of using
> > RSS rather than PSS tends to be very large when looking at overall
> > memory consumption.  PSS isn't kept as a single number that's exported
> > like RSS, so to calculate PSS means having to parse a very large smaps
> > file.
> >
> > This process is slow and has to be repeated for many processes, and we
> > found that the just act of doing the parsing was taking up a
> > significant amount of CPU time, so this patch is an attempt to make
> > that process cheaper.

Well, this is slow because it requires the pte walk otherwise you cannot
know how many ptes map the particular shared page. Your patch
(totmaps_proc_show) does the very same page table walk because in fact
it is unavoidable. So what exactly is the difference except for the
userspace parsing which is quite trivial e.g. my currently running Firefox
has
$ awk '/^[0-9a-f]/{print}' /proc/4950/smaps | wc -l
984

quite some VMAs, yet parsing it spends basically all the time in the kernel...

$ /usr/bin/time -v awk '/^Rss/{rss+=$2} /^Pss/{pss+=$2} END {printf "rss:%d 
pss:%d\n", rss, pss}' /proc/4950/smaps 
rss:1112288 pss:1096435
Command being timed: "awk /^Rss/{rss+=$2} /^Pss/{pss+=$2} END {printf 
"rss:%d pss:%d\n", rss, pss} /proc/4950/smaps"
User time (seconds): 0.00
System time (seconds): 0.02
Percent of CPU this job got: 91%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.02

So I am not really sure I see the performance benefit.
-- 
Michal Hocko
SUSE Labs


Re: [PATCH] usb: dwc3: gadget: don't rely on jiffies while holding spinlock

2016-08-16 Thread Felipe Balbi

Hi,

Nicolas Saenz Julienne  writes:
> __dwc3_gadget_wakeup() is called while holding a spinlock, then depends on
> jiffies in order to timeout while polling the USB core for a link state
> update. In the case the wakeup failed, the timeout will never happen and
> will also cause the cpu to stall until rcu_preempt kicks in.
>
> This switches to a "decrement variable and wait" timeout scheme.
>
> Signed-off-by: Nicolas Saenz Julienne 
> ---
>  drivers/usb/dwc3/gadget.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 8f8c215..d0c711f 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1433,7 +1433,7 @@ static int dwc3_gadget_get_frame(struct usb_gadget *g)
>  
>  static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
>  {
> - unsigned long   timeout;
> + int retries;
>  
>   int ret;
>   u32 reg;
> @@ -1484,14 +1484,16 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
>   }
>  
>   /* poll until Link State changes to ON */
> - timeout = jiffies + msecs_to_jiffies(100);
> + retries = 2;
>  
> - while (!time_after(jiffies, timeout)) {
> + while (retries--) {
>   reg = dwc3_readl(dwc->regs, DWC3_DSTS);
>  
>   /* in HS, means ON */
>   if (DWC3_DSTS_USBLNKST(reg) == DWC3_LINK_STATE_U0)
>   break;
> +
> + udelay(5);

let's just drop this udelay() here. It's very likely this will switch
the link state much quicker than 100ms anyway. Other than that, nice
catch :-)

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v10 5/5] usb: dwc3: add rockchip specific glue layer

2016-08-16 Thread Felipe Balbi

Hi,

William Wu  writes:
> Add rockchip specific glue layer to support USB3 Peripheral mode
> and Host mode on rockchip platforms (e.g. rk3399).
>
> The DesignWare USB3 integrated in rockchip SoCs is a configurable
> IP Core which can be instantiated as Dual-Role Device (DRD), Host
> Only (XHCI) and Peripheral Only configurations.
>
> We use extcon notifier to manage usb cable detection and mode switch.
> Enable DWC3 PM runtime auto suspend to allow core enter runtime_suspend
> if USB cable is dettached. For host mode, it requires to keep whole
> DWC3 controller in reset state to hold pipe power state in P2 before
> initializing PHY. And it need to reconfigure USB PHY interface of DWC3
> core after deassert DWC3 controller reset.
>
> The current driver supports Host only and Peripheral Only well, for
> now, we will add support for OTG after we have it all stabilized.
>
> Signed-off-by: William Wu 
> ---
> Changes in v10:
> - fix building error
>
> Changes in v9:
> - Add a new dwc3-rockchip.c driver for rk3399, rather than use 
> dwc3-of-simple.c
>
>  drivers/usb/dwc3/Kconfig |   9 +
>  drivers/usb/dwc3/Makefile|   1 +
>  drivers/usb/dwc3/core.c  |   2 +-
>  drivers/usb/dwc3/core.h  |   1 +
>  drivers/usb/dwc3/dwc3-rockchip.c | 441 
> +++

William, if you need to touch core dwc3 to introduce a glue layer,
you're doing it wrong.

> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index e887b38..3da6215 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -405,7 +405,7 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
>   * initialized. The PHY interfaces and the PHYs get initialized together with
>   * the core in dwc3_core_init.
>   */
> -static int dwc3_phy_setup(struct dwc3 *dwc)
> +int dwc3_phy_setup(struct dwc3 *dwc)

there's no way I'll let this slip through the cracks :-)

> diff --git a/drivers/usb/dwc3/dwc3-rockchip.c 
> b/drivers/usb/dwc3/dwc3-rockchip.c
> new file mode 100644
> index 000..eeae1a9
> --- /dev/null
> +++ b/drivers/usb/dwc3/dwc3-rockchip.c
> @@ -0,0 +1,441 @@

[...]

> +static int dwc3_rockchip_probe(struct platform_device *pdev)
> +{
> + struct dwc3_rockchip*rockchip;
> + struct device   *dev = &pdev->dev;
> + struct device_node  *np = dev->of_node, *child;
> + struct platform_device  *child_pdev;
> +
> + unsigned intcount;
> + int ret;
> + int i;
> +
> + rockchip = devm_kzalloc(dev, sizeof(*rockchip), GFP_KERNEL);
> +
> + if (!rockchip)
> + return -ENOMEM;
> +
> + count = of_clk_get_parent_count(np);
> + if (!count)
> + return -ENOENT;
> +
> + rockchip->num_clocks = count;
> +
> + rockchip->clks = devm_kcalloc(dev, rockchip->num_clocks,
> +   sizeof(struct clk *), GFP_KERNEL);
> + if (!rockchip->clks)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, rockchip);
> +
> + rockchip->dev = dev;
> + rockchip->edev = NULL;
> +
> + pm_runtime_set_active(dev);
> + pm_runtime_enable(dev);
> + ret = pm_runtime_get_sync(dev);
> + if (ret < 0) {
> + dev_err(dev, "get_sync failed with err %d\n", ret);
> + goto err1;
> + }
> +
> + for (i = 0; i < rockchip->num_clocks; i++) {
> + struct clk  *clk;
> +
> + clk = of_clk_get(np, i);
> + if (IS_ERR(clk)) {
> + while (--i >= 0)
> + clk_put(rockchip->clks[i]);
> + ret = PTR_ERR(clk);
> +
> + goto err1;
> + }
> +
> + ret = clk_prepare_enable(clk);
> + if (ret < 0) {
> + while (--i >= 0) {
> + clk_disable_unprepare(rockchip->clks[i]);
> + clk_put(rockchip->clks[i]);
> + }
> + clk_put(clk);
> +
> + goto err1;
> + }
> +
> + rockchip->clks[i] = clk;
> + }
> +
> + rockchip->otg_rst = devm_reset_control_get(dev, "usb3-otg");
> + if (IS_ERR(rockchip->otg_rst)) {
> + dev_err(dev, "could not get reset controller\n");
> + ret = PTR_ERR(rockchip->otg_rst);
> + goto err2;
> + }
> +
> + ret = dwc3_rockchip_extcon_register(rockchip);
> + if (ret < 0)
> + goto err2;
> +
> + child = of_get_child_by_name(np, "dwc3");
> + if (!child) {
> + dev_err(dev, "failed to find dwc3 core node\n");
> + ret = -ENODEV;
> + goto err3;
> + }
> +
> + /* Allocate and initialize the core */
> + ret = of_platform_populate(np, NULL, NULL, dev);
> + if (ret) {
> + dev_err(dev, "failed to create dwc3 core\n");
> + goto err3;
> + }
> +
> + child_pdev =

[PATCH v4] hwmon: (max6650.c) Add devicetree support

2016-08-16 Thread Mike Looijmans
Parse devicetree parameters for voltage and prescaler setting. This allows
using multiple max6550 devices with varying settings, and also makes it
possible to instantiate and configure the device using devicetree.

Signed-off-by: Mike Looijmans 
---
v4: Vendor prefix "maxim," for devicetree properties and compatible string
Split documentation into separate patch
v3: Resubmit because wrong mailing lists used
Fix style errors as reported by checkpatch.pl
Fix bug in DT parsing of fan-prescale
v2: Add devicetree binding documentation
Code changes as suggested by Guenter
Reduce log info, output only a single line 
 drivers/hwmon/max6650.c | 47 ---
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 162a520..6beb62c 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Insmod parameters
@@ -48,7 +49,7 @@
 static int fan_voltage;
 /* prescaler: Possible values are 1, 2, 4, 8, 16 or 0 for don't change */
 static int prescaler;
-/* clock: The clock frequency of the chip the driver should assume */
+/* clock: The clock frequency of the chip (max6651 can be clocked externally) 
*/
 static int clock = 254000;
 
 module_param(fan_voltage, int, S_IRUGO);
@@ -133,6 +134,19 @@ static const u8 tach_reg[] = {
MAX6650_REG_TACH3,
 };
 
+static const struct of_device_id max6650_dt_match[] = {
+   {
+   .compatible = "maxim,max6650",
+   .data = (void *)1
+   },
+   {
+   .compatible = "maxim,max6651",
+   .data = (void *)4
+   },
+   { },
+};
+MODULE_DEVICE_TABLE(of, max6650_dt_match);
+
 static struct max6650_data *max6650_update_device(struct device *dev)
 {
struct max6650_data *data = dev_get_drvdata(dev);
@@ -566,6 +580,17 @@ static int max6650_init_client(struct max6650_data *data,
struct device *dev = &client->dev;
int config;
int err = -EIO;
+   u32 voltage;
+   u32 prescale;
+
+   if (of_property_read_u32(dev->of_node, "maxim,fan-microvolt",
+&voltage))
+   voltage = fan_voltage;
+   else
+   voltage = voltage > 550 ? 12 : 5;
+   if (of_property_read_u32(dev->of_node, "maxim,fan-prescale",
+&prescale))
+   prescale = prescaler;
 
config = i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG);
 
@@ -574,7 +599,7 @@ static int max6650_init_client(struct max6650_data *data,
return err;
}
 
-   switch (fan_voltage) {
+   switch (voltage) {
case 0:
break;
case 5:
@@ -584,14 +609,10 @@ static int max6650_init_client(struct max6650_data *data,
config |= MAX6650_CFG_V12;
break;
default:
-   dev_err(dev, "illegal value for fan_voltage (%d)\n",
-   fan_voltage);
+   dev_err(dev, "illegal value for fan_voltage (%d)\n", voltage);
}
 
-   dev_info(dev, "Fan voltage is set to %dV.\n",
-(config & MAX6650_CFG_V12) ? 12 : 5);
-
-   switch (prescaler) {
+   switch (prescale) {
case 0:
break;
case 1:
@@ -614,10 +635,11 @@ static int max6650_init_client(struct max6650_data *data,
 | MAX6650_CFG_PRESCALER_16;
break;
default:
-   dev_err(dev, "illegal value for prescaler (%d)\n", prescaler);
+   dev_err(dev, "illegal value for prescaler (%d)\n", prescale);
}
 
-   dev_info(dev, "Prescaler is set to %d.\n",
+   dev_info(dev, "Fan voltage: %dV, prescaler: %d.\n",
+(config & MAX6650_CFG_V12) ? 12 : 5,
 1 << (config & MAX6650_CFG_PRESCALER_MASK));
 
/*
@@ -651,6 +673,8 @@ static int max6650_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
struct device *dev = &client->dev;
+   const struct of_device_id *of_id =
+   of_match_device(of_match_ptr(max6650_dt_match), dev);
struct max6650_data *data;
struct device *hwmon_dev;
int err;
@@ -661,7 +685,7 @@ static int max6650_probe(struct i2c_client *client,
 
data->client = client;
mutex_init(&data->update_lock);
-   data->nr_fans = id->driver_data;
+   data->nr_fans = of_id ? (int)(uintptr_t)of_id->data : id->driver_data;
 
/*
 * Initialize the max6650 chip
@@ -691,6 +715,7 @@ MODULE_DEVICE_TABLE(i2c, max6650_id);
 static struct i2c_driver max6650_driver = {
.driver = {
.name   = "max6650",
+   .of_match_table = of_match_ptr(max6650_dt_match),
},
.probe  = max6650_probe,
.id_table   = max6650_id,
-- 
1.9.1



Re: [PATCH v5 7/7] ARM: dts: sun9i: Switch to the AC100 RTC clock outputs for osc32k

2016-08-16 Thread Chen-Yu Tsai
On Tue, Jul 12, 2016 at 10:02 AM, Chen-Yu Tsai  wrote:
> On Mon, Jul 11, 2016 at 2:50 PM, Maxime Ripard
>  wrote:
>> Hi,
>>
>> On Fri, Jul 08, 2016 at 10:33:42PM +0800, Chen-Yu Tsai wrote:
>>> The 32.768 kHz clock inside the A80 SoC is fed from an external source,
>>> typically the AC100 RTC module.
>>>
>>> Make the osc32k placeholder a fixed-factor clock so board dts files can
>>> specify its source.
>>>
>>> Signed-off-by: Chen-Yu Tsai 
>>> ---
>>> Changes since v4: none
>>> Changes since v3: none
>>> Changes since v2: none
>>> Changes since v1: none
>>> ---
>>>  arch/arm/boot/dts/sun9i-a80-cubieboard4.dts | 5 +
>>>  arch/arm/boot/dts/sun9i-a80-optimus.dts | 5 +
>>>  arch/arm/boot/dts/sun9i-a80.dtsi| 9 +++--
>>>  3 files changed, 13 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts 
>>> b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
>>> index cf2f4b72a841..04b014603659 100644
>>> --- a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
>>> +++ b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
>>> @@ -103,6 +103,11 @@
>>>   allwinner,drive = ;
>>>  };
>>>
>>> +&osc32k {
>>> + /* osc32k input is from AC100 */
>>> + clocks = <&ac100_rtc 0>;
>>> +};
>>> +
>>
>> I'm guessing that an unresolved dependency when the driver has not
>> loaded yet, or is not even compiled ?
>>
>> How is it working then?
>
> I assume the clk framework will leave it unresolved and unusable.
> Also it seems that none of existing clks use it as a parent by
> default. I will need to check the remaining unimplemented ones
> though.

On the latest sunxi-next kernel, one clock is clocked from osc32k, which
becomes an orphaned clock:

   clock enable_cnt  prepare_cntrate
accuracy   phase

 osc24M   662400
   0 0
r_ir  11 800
   0 0
 r_1wire  00   0
   0 0

r_ir is clocked from osc32k by default, but the clk_set_rate call in the
IR driver seems to forces it to reparent to the working osc24M clock.

So I think we're good here. Can you merge the 3 remaining dts patches?

Thanks
ChenYu


Re: [PATCH v2 3/6] mm/page_owner: move page_owner specific function to page_owner.c

2016-08-16 Thread Vlastimil Babka

On 08/16/2016 04:51 AM, js1...@gmail.com wrote:

From: Joonsoo Kim 

There is no reason that page_owner specific function resides on vmstat.c.

Reviewed-by: Sergey Senozhatsky 
Signed-off-by: Joonsoo Kim 


Acked-by: Vlastimil Babka 



Re: [PATCH v2 4/6] mm/page_ext: rename offset to index

2016-08-16 Thread Vlastimil Babka

On 08/16/2016 04:51 AM, js1...@gmail.com wrote:

From: Joonsoo Kim 

Here, 'offset' means entry index in page_ext array. Following patch
will use 'offset' for field offset in each entry so rename current
'offset' to prevent confusion.

Signed-off-by: Joonsoo Kim 


Acked-by: Vlastimil Babka 



[PATCH] hwmon: (max6650.c) Add devicetree support documentation

2016-08-16 Thread Mike Looijmans
This adds the devicetree binding documentation for the max6650 fan
controller.

Signed-off-by: Mike Looijmans 
---
Associated code changes sent as a separate patch as requested.

 .../devicetree/bindings/hwmon/max6650.txt  | 23 ++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/max6650.txt

diff --git a/Documentation/devicetree/bindings/hwmon/max6650.txt 
b/Documentation/devicetree/bindings/hwmon/max6650.txt
new file mode 100644
index 000..2e46e69
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/max6650.txt
@@ -0,0 +1,23 @@
+Bindings for MAX6651 and MAX6650 I2C fan controllers
+
+Reference:
+[1]https://datasheets.maximintegrated.com/en/ds/MAX6650-MAX6651.pdf
+
+Required properties:
+- compatible : One of "maxim,max6650" or "maxim,max6651"
+- reg: I2C address, one of 0x1b, 0x1f, 0x4b, 0x48.
+
+Optional properties, default is to retain the chip's current setting:
+- maxim,fan-microvolt : The supply voltage of the fan, sets the ADC range to
+   either 5V or 12V. Max value 1350.
+- maxim,fan-prescale  : Pre-scaling value, as per datasheet [1]. Lower values
+   allow more fine-grained control of slower fans.
+   Valid: 1, 2, 4, 8, 16.
+
+Example:
+   fan-max6650: max6650@1b {
+   reg = <0x1b>;
+   compatible = "maxim,max6650";
+   maxim,fan-microvolt = <1200>;
+   maxim,fan-prescale = <4>;
+   };
-- 
1.9.1



Re: [PATCH] block: Fix secure erase

2016-08-16 Thread Adrian Hunter
On 15/08/16 21:14, Christoph Hellwig wrote:
> On Mon, Aug 15, 2016 at 11:43:12AM -0500, Shaun Tancheff wrote:
>> Hmm ... Since REQ_SECURE implied REQ_DISCARD doesn't this
>> mean that we should include REQ_OP_SECURE_ERASE checking
>> wherever REQ_OP_DISCARD is being checked now in drivers/scsi/sd.c ?
>>
>> (It's only in 3 spots so it's a quickie patch)
> 
> SCSI doesn't support secure erase operations.  Only MMC really
> supports it, plus the usual cargo culting in Xen blkfront that's
> probably never been tested..
> 

I left SCSI out because support does not exist at the moment.
However there is UFS which is seen as the replacement for eMMC.
And there is a patch to add support for BLKSECDISCARD:

http://marc.info/?l=linux-scsi&m=146953519016056

So SCSI will need updating if that is to go in.



Re: [PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

2016-08-16 Thread zijun_hu
On 08/16/2016 02:50 PM, Stephen Rothwell wrote:
> Hi,
> 
> On Tue, 16 Aug 2016 14:27:04 +0800 zijun_hu  wrote:
>>
>> From: zijun_hu 
>>
>> move out get_count_order[_long]() definitions from scope limited
>> by macro __KERNEL__
> 
> Why do you need to do this?  You say why in the commit message.
> 
1, it make both functions available in wider region regardless of
   whether macro __KERNEL__ is defined
2, get_count_order() locates out off region limited by macro __KERNEL__
   before the recent commit c513b4cd2fe9
   ("mm-vmalloc-fix-align-value-calculation-error-v2-fix-fix")
   it maybe more perfect to keep its original region and place its counterpart
   get_count_order_long() nearly

thanks for your reply



Re: [PATCH v2 5/6] mm/page_ext: support extra space allocation by page_ext user

2016-08-16 Thread Vlastimil Babka

On 08/16/2016 04:51 AM, js1...@gmail.com wrote:

From: Joonsoo Kim 

Until now, if some page_ext users want to use it's own field on page_ext,
it should be defined in struct page_ext by hard-coding. It has a problem
that wastes memory in following situation.

struct page_ext {
 #ifdef CONFIG_A
int a;
 #endif
 #ifdef CONFIG_B
int b;
 #endif
};

Assume that kernel is built with both CONFIG_A and CONFIG_B.
Even if we enable feature A and doesn't enable feature B at runtime,
each entry of struct page_ext takes two int rather than one int.
It's undesirable result so this patch tries to fix it.

To solve above problem, this patch implements to support extra space
allocation at runtime. When need() callback returns true, it's extra
memory requirement is summed to entry size of page_ext. Also, offset
for each user's extra memory space is returned. With this offset,
user can use this extra space and there is no need to define needed
field on page_ext by hard-coding.

This patch only implements an infrastructure. Following patch will use it
for page_owner which is only user having it's own fields on page_ext.

Signed-off-by: Joonsoo Kim 


Acked-by: Vlastimil Babka 



[PATCH 1/2] clk: qcom: gdsc: Add the missing BIMC gdsc for msm8996

2016-08-16 Thread Rajendra Nayak
Add BIMC gdsc data found in MMCC part of msm8996 family of devices.

Signed-off-by: Rajendra Nayak 
---
 drivers/clk/qcom/mmcc-msm8996.c   | 9 +
 include/dt-bindings/clock/qcom,mmcc-msm8996.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/clk/qcom/mmcc-msm8996.c b/drivers/clk/qcom/mmcc-msm8996.c
index 847dd9d..1822045 100644
--- a/drivers/clk/qcom/mmcc-msm8996.c
+++ b/drivers/clk/qcom/mmcc-msm8996.c
@@ -2888,6 +2888,14 @@ static struct clk_hw *mmcc_msm8996_hws[] = {
&gpll0_div.hw,
 };
 
+static struct gdsc mmagic_bimc_gdsc = {
+   .gdscr = 0x529c,
+   .pd = {
+   .name = "mmagic_bimc",
+   },
+   .pwrsts = PWRSTS_OFF_ON,
+};
+
 static struct gdsc mmagic_video_gdsc = {
.gdscr = 0x119c,
.gds_hw_ctrl = 0x120c,
@@ -3201,6 +3209,7 @@ static struct clk_regmap *mmcc_msm8996_clocks[] = {
 };
 
 static struct gdsc *mmcc_msm8996_gdscs[] = {
+   [MMAGIC_BIMC_GDSC] = &mmagic_bimc_gdsc,
[MMAGIC_VIDEO_GDSC] = &mmagic_video_gdsc,
[MMAGIC_MDSS_GDSC] = &mmagic_mdss_gdsc,
[MMAGIC_CAMSS_GDSC] = &mmagic_camss_gdsc,
diff --git a/include/dt-bindings/clock/qcom,mmcc-msm8996.h 
b/include/dt-bindings/clock/qcom,mmcc-msm8996.h
index 7d3a7fa..5abc445 100644
--- a/include/dt-bindings/clock/qcom,mmcc-msm8996.h
+++ b/include/dt-bindings/clock/qcom,mmcc-msm8996.h
@@ -298,5 +298,6 @@
 #define FD_GDSC12
 #define MDSS_GDSC  13
 #define GPU_GX_GDSC14
+#define MMAGIC_BIMC_GDSC   15
 
 #endif
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation



[PATCH 2/2] clk: qcom: gdsc: Add support for gdscs with RETENTION power state

2016-08-16 Thread Rajendra Nayak
Some gdscs can support an intermediate RETENTION state apart from
the ON and OFF states. The RETENTION state can further be configured
to either retain all memory, or just some part of it (periperal or
core).
This patch adds support so gdscs can support the additional RET state
which the client drivers can then choose based on acceptable
latency.

Signed-off-by: Rajendra Nayak 
---
 drivers/clk/qcom/gdsc.c | 81 ++---
 drivers/clk/qcom/gdsc.h | 22 +-
 2 files changed, 85 insertions(+), 18 deletions(-)

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index f12d7b2..e0859df 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -38,6 +38,7 @@
 
 #define RETAIN_MEM BIT(14)
 #define RETAIN_PERIPH  BIT(13)
+#define OFF_PERIPH BIT(12)
 
 #define TIMEOUT_US 100
 
@@ -122,24 +123,56 @@ static inline int gdsc_assert_reset(struct gdsc *sc)
return 0;
 }
 
-static inline void gdsc_force_mem_on(struct gdsc *sc)
+static inline void gdsc_force_mem_core_on(struct gdsc *sc)
 {
int i;
-   u32 mask = RETAIN_MEM | RETAIN_PERIPH;
+   u32 mask = RETAIN_MEM;
 
for (i = 0; i < sc->cxc_count; i++)
regmap_update_bits(sc->regmap, sc->cxcs[i], mask, mask);
 }
 
-static inline void gdsc_clear_mem_on(struct gdsc *sc)
+static inline void gdsc_force_mem_periph_on(struct gdsc *sc)
 {
int i;
-   u32 mask = RETAIN_MEM | RETAIN_PERIPH;
+   u32 mask = RETAIN_PERIPH | OFF_PERIPH;
+   u32 val = RETAIN_PERIPH;
+
+   for (i = 0; i < sc->cxc_count; i++)
+   regmap_update_bits(sc->regmap, sc->cxcs[i], mask, val);
+}
+
+static inline void gdsc_force_mem_on(struct gdsc *sc)
+{
+   gdsc_force_mem_core_on(sc);
+   gdsc_force_mem_periph_on(sc);
+}
+
+static inline void gdsc_clear_mem_core_on(struct gdsc *sc)
+{
+   int i;
+   u32 mask = RETAIN_MEM;
 
for (i = 0; i < sc->cxc_count; i++)
regmap_update_bits(sc->regmap, sc->cxcs[i], mask, 0);
 }
 
+static inline void gdsc_clear_mem_periph_on(struct gdsc *sc)
+{
+   int i;
+   u32 mask = RETAIN_PERIPH | OFF_PERIPH;
+   u32 val = OFF_PERIPH;
+
+   for (i = 0; i < sc->cxc_count; i++)
+   regmap_update_bits(sc->regmap, sc->cxcs[i], mask, val);
+}
+
+static inline void gdsc_clear_mem_on(struct gdsc *sc)
+{
+   gdsc_clear_mem_core_on(sc);
+   gdsc_clear_mem_periph_on(sc);
+}
+
 static int gdsc_enable(struct generic_pm_domain *domain)
 {
struct gdsc *sc = domain_to_gdsc(domain);
@@ -152,8 +185,7 @@ static int gdsc_enable(struct generic_pm_domain *domain)
if (ret)
return ret;
 
-   if (sc->pwrsts & PWRSTS_OFF)
-   gdsc_force_mem_on(sc);
+   gdsc_force_mem_on(sc);
 
/*
 * If clocks to this power domain were already on, they will take an
@@ -170,12 +202,35 @@ static int gdsc_enable(struct generic_pm_domain *domain)
 static int gdsc_disable(struct generic_pm_domain *domain)
 {
struct gdsc *sc = domain_to_gdsc(domain);
+   u8 pwrst;
 
if (sc->pwrsts == PWRSTS_ON)
return gdsc_assert_reset(sc);
 
-   if (sc->pwrsts & PWRSTS_OFF)
+   if (domain->state_count > 1)
+   pwrst = 1 << domain->state_idx;
+   else if (sc->pwrsts & PWRSTS_OFF)
+   pwrst = PWRSTS_OFF;
+   else
+   pwrst = PWRSTS_RET;
+
+   switch (pwrst) {
+   case PWRSTS_OFF:
gdsc_clear_mem_on(sc);
+   break;
+   case PWRSTS_RET:
+   if (sc->pwrsts_ret == PWRSTS_RET_ALL)
+   gdsc_force_mem_on(sc);
+   else if (sc->pwrsts_ret == PWRSTS_RET_MEM)
+   gdsc_force_mem_core_on(sc);
+   else if (sc->pwrsts_ret == PWRSTS_RET_PERIPH)
+   gdsc_force_mem_periph_on(sc);
+   else
+   return -EINVAL;
+   break;
+   default:
+   return -EINVAL;
+   };
 
return gdsc_toggle_logic(sc, false);
 }
@@ -198,6 +253,9 @@ static int gdsc_init(struct gdsc *sc)
if (ret)
return ret;
 
+   if (!sc->pwrsts)
+   return -EINVAL;
+
/* Force gdsc ON if only ON state is supported */
if (sc->pwrsts == PWRSTS_ON) {
ret = gdsc_toggle_logic(sc, true);
@@ -217,14 +275,15 @@ static int gdsc_init(struct gdsc *sc)
if ((sc->flags & VOTABLE) && on)
gdsc_enable(&sc->pd);
 
-   if (on || (sc->pwrsts & PWRSTS_RET))
+   if (on)
gdsc_force_mem_on(sc);
-   else
-   gdsc_clear_mem_on(sc);
 
sc->pd.power_off = gdsc_disable;
sc->pd.power_on = gdsc_enable;
-   pm_genpd_init(&sc->pd, NULL, !on);
+   if (sc->pd.state_count)
+   pm_genpd_init(&sc->pd, &simple_qos_governor, !on);
+   else
+   pm_ge

Re: [PATCH 1/3] befs: fix typos in datastream.c

2016-08-16 Thread Salah Triki
On Sat, Aug 13, 2016 at 06:11:19PM +0100, Luis de Bethencourt wrote:
> Signed-off-by: Luis de Bethencourt 
> ---
> 
> Hi,
> 
> This is a series of patches fixing small issues in datastream.c.
> 
> On the process of doing the same for the rest of files. To finish cleanup
> and start adding documentation and new features.
> 
> Thanks,
> Luis
> 
>  fs/befs/datastream.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
> index 6889644..b2eb5b5 100644
> --- a/fs/befs/datastream.c
> +++ b/fs/befs/datastream.c
> @@ -37,7 +37,7 @@ static int befs_find_brun_dblindirect(struct super_block 
> *sb,
>  /**
>   * befs_read_datastream - get buffer_head containing data, starting from pos.
>   * @sb: Filesystem superblock
> - * @ds: datastrem to find data with
> + * @ds: datastream to find data with
>   * @pos: start of data
>   * @off: offset of data in buffer_head->b_data
>   *
> @@ -115,7 +115,7 @@ befs_fblock2brun(struct super_block *sb, const 
> befs_data_stream *data,
>  /**
>   * befs_read_lsmylink - read long symlink from datastream.
>   * @sb: Filesystem superblock 
> - * @ds: Datastrem to read from
> + * @ds: Datastream to read from
>   * @buff: Buffer in which to place long symlink data
>   * @len: Length of the long symlink in bytes
>   *
> @@ -183,7 +183,7 @@ befs_count_blocks(struct super_block *sb, const 
> befs_data_stream *ds)
>   metablocks += ds->indirect.len;
>  
>   /*
> -Double indir block, plus all the indirect blocks it mapps
> +Double indir block, plus all the indirect blocks it maps.
>  In the double-indirect range, all block runs of data are
>  BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know 
>  how many data block runs are in the double-indirect region,
> @@ -397,7 +397,7 @@ befs_find_brun_indirect(struct super_block *sb,
>   though the double-indirect run may be several blocks long, 
>   we can calculate which of those blocks will contain the index
>   we are after and only read that one. We then follow it to 
> - the indirect block and perform a  similar process to find
> + the indirect block and perform a similar process to find
>   the actual block run that maps the data block we are interested
>   in.
>   
> -- 
> 2.5.1
> 

Signed-off-by: Salah Triki 

Thanks,
Salah


[PATCH] clk: gcc-ipq4019: Delete unnecessary assignment for the field "owner"

2016-08-16 Thread SF Markus Elfring
From: Markus Elfring 
Date: Tue, 16 Aug 2016 08:53:10 +0200

The field "owner" is set by the core.
Thus delete an unneeded initialisation.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
Signed-off-by: Markus Elfring 
---
 drivers/clk/qcom/gcc-ipq4019.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-ipq4019.c b/drivers/clk/qcom/gcc-ipq4019.c
index 3cd1af0..b593065 100644
--- a/drivers/clk/qcom/gcc-ipq4019.c
+++ b/drivers/clk/qcom/gcc-ipq4019.c
@@ -1332,7 +1332,6 @@ static struct platform_driver gcc_ipq4019_driver = {
.probe  = gcc_ipq4019_probe,
.driver = {
.name   = "qcom,gcc-ipq4019",
-   .owner  = THIS_MODULE,
.of_match_table = gcc_ipq4019_match_table,
},
 };
-- 
2.9.2



Re: [PATCH] usb: remove redundant dependency on USB_SUPPORT

2016-08-16 Thread Felipe Balbi

Hi,

Masahiro Yamada  writes:
> The whole Kconfig entries of the USB subsystem are surrounded with
> "if USB_SUPPORT" ... "endif", so CONFIG_USB_SUPPORT=y is surely met
> when these two Kconfig options are visible.
>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  drivers/usb/core/Kconfig | 1 -
>  drivers/usb/dwc3/Kconfig | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
> index dd28010..253aac7 100644
> --- a/drivers/usb/core/Kconfig
> +++ b/drivers/usb/core/Kconfig
> @@ -85,7 +85,6 @@ config USB_OTG_FSM
>  
>  config USB_ULPI_BUS
>   tristate "USB ULPI PHY interface support"
> - depends on USB_SUPPORT
>   help
> UTMI+ Low Pin Interface (ULPI) is specification for a commonly used
> USB 2.0 PHY interface. The ULPI specification defines a standard set
> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
> index 11864e4..3c6213c 100644
> --- a/drivers/usb/dwc3/Kconfig
> +++ b/drivers/usb/dwc3/Kconfig
> @@ -1,7 +1,7 @@
>  config USB_DWC3
>   tristate "DesignWare USB3 DRD Core Support"
>   depends on (USB || USB_GADGET) && HAS_DMA
> - select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
> + select USB_XHCI_PLATFORM if USB_XHCI_HCD
>   help
> Say Y or M here if your system has a Dual Role SuperSpeed
> USB controller based on the DesignWare USB3 IP Core.

let's split this patch in two so different maintainers can pick the
relevant pieces. Thanks

-- 
balbi


signature.asc
Description: PGP signature


[PATCH v10 2/9] clk: mediatek: Refine the makefile to support multiple clock drivers

2016-08-16 Thread Erin Lo
From: James Liao 

Add a Kconfig to define clock configuration for each SoC, and
modify the Makefile to build drivers that only selected in config.

Signed-off-by: Shunli Wang 
Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
Tested-by: John Crispin 
Reviewed-by: Matthias Brugger 
---
 drivers/clk/Kconfig   |  1 +
 drivers/clk/mediatek/Kconfig  | 23 +++
 drivers/clk/mediatek/Makefile |  6 +++---
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 drivers/clk/mediatek/Kconfig

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index e2d9bd7..4265471 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -210,6 +210,7 @@ config COMMON_CLK_OXNAS
 
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
+source "drivers/clk/mediatek/Kconfig"
 source "drivers/clk/meson/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/qcom/Kconfig"
diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
new file mode 100644
index 000..dc224e6
--- /dev/null
+++ b/drivers/clk/mediatek/Kconfig
@@ -0,0 +1,23 @@
+#
+# MediaTek SoC drivers
+#
+config COMMON_CLK_MEDIATEK
+   bool
+   ---help---
+ Mediatek SoCs' clock support.
+
+config COMMON_CLK_MT8135
+   bool "Clock driver for Mediatek MT8135"
+   depends on COMMON_CLK
+   select COMMON_CLK_MEDIATEK
+   default ARCH_MEDIATEK
+   ---help---
+ This driver supports Mediatek MT8135 clocks.
+
+config COMMON_CLK_MT8173
+   bool "Clock driver for Mediatek MT8173"
+   depends on COMMON_CLK
+   select COMMON_CLK_MEDIATEK
+   default ARCH_MEDIATEK
+   ---help---
+ This driver supports Mediatek MT8173 clocks.
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index 95fdfac..32e7222 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -1,4 +1,4 @@
-obj-y += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o
+obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o 
clk-apmixed.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
-obj-y += clk-mt8135.o
-obj-y += clk-mt8173.o
+obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o
+obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
-- 
1.9.1



[PATCH v10 4/9] clk: mediatek: Add dt-bindings for MT2701 clocks

2016-08-16 Thread Erin Lo
From: Shunli Wang 

Add MT2701 clock dt-bindings, include topckgen, apmixedsys,
infracfg, pericfg and subsystem clocks.

Signed-off-by: Shunli Wang 
Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
Tested-by: John Crispin 
Reviewed-by: Matthias Brugger 
---
 include/dt-bindings/clock/mt2701-clk.h | 486 +
 1 file changed, 486 insertions(+)
 create mode 100644 include/dt-bindings/clock/mt2701-clk.h

diff --git a/include/dt-bindings/clock/mt2701-clk.h 
b/include/dt-bindings/clock/mt2701-clk.h
new file mode 100644
index 000..2062c67
--- /dev/null
+++ b/include/dt-bindings/clock/mt2701-clk.h
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: Shunli Wang 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_CLK_MT2701_H
+#define _DT_BINDINGS_CLK_MT2701_H
+
+/* TOPCKGEN */
+#define CLK_TOP_SYSPLL 1
+#define CLK_TOP_SYSPLL_D2  2
+#define CLK_TOP_SYSPLL_D3  3
+#define CLK_TOP_SYSPLL_D5  4
+#define CLK_TOP_SYSPLL_D7  5
+#define CLK_TOP_SYSPLL1_D2 6
+#define CLK_TOP_SYSPLL1_D4 7
+#define CLK_TOP_SYSPLL1_D8 8
+#define CLK_TOP_SYSPLL1_D169
+#define CLK_TOP_SYSPLL2_D2 10
+#define CLK_TOP_SYSPLL2_D4 11
+#define CLK_TOP_SYSPLL2_D8 12
+#define CLK_TOP_SYSPLL3_D2 13
+#define CLK_TOP_SYSPLL3_D4 14
+#define CLK_TOP_SYSPLL4_D2 15
+#define CLK_TOP_SYSPLL4_D4 16
+#define CLK_TOP_UNIVPLL17
+#define CLK_TOP_UNIVPLL_D2 18
+#define CLK_TOP_UNIVPLL_D3 19
+#define CLK_TOP_UNIVPLL_D5 20
+#define CLK_TOP_UNIVPLL_D7 21
+#define CLK_TOP_UNIVPLL_D2622
+#define CLK_TOP_UNIVPLL_D5223
+#define CLK_TOP_UNIVPLL_D108   24
+#define CLK_TOP_USB_PHY48M 25
+#define CLK_TOP_UNIVPLL1_D226
+#define CLK_TOP_UNIVPLL1_D427
+#define CLK_TOP_UNIVPLL1_D828
+#define CLK_TOP_UNIVPLL2_D229
+#define CLK_TOP_UNIVPLL2_D430
+#define CLK_TOP_UNIVPLL2_D831
+#define CLK_TOP_UNIVPLL2_D16   32
+#define CLK_TOP_UNIVPLL2_D32   33
+#define CLK_TOP_UNIVPLL3_D234
+#define CLK_TOP_UNIVPLL3_D435
+#define CLK_TOP_UNIVPLL3_D836
+#define CLK_TOP_MSDCPLL37
+#define CLK_TOP_MSDCPLL_D2 38
+#define CLK_TOP_MSDCPLL_D4 39
+#define CLK_TOP_MSDCPLL_D8 40
+#define CLK_TOP_MMPLL  41
+#define CLK_TOP_MMPLL_D2   42
+#define CLK_TOP_DMPLL  43
+#define CLK_TOP_DMPLL_D2   44
+#define CLK_TOP_DMPLL_D4   45
+#define CLK_TOP_DMPLL_X2   46
+#define CLK_TOP_TVDPLL 47
+#define CLK_TOP_TVDPLL_D2  48
+#define CLK_TOP_TVDPLL_D4  49
+#define CLK_TOP_TVD2PLL50
+#define CLK_TOP_TVD2PLL_D2 51
+#define CLK_TOP_HADDS2PLL_98M  52
+#define CLK_TOP_HADDS2PLL_294M 53
+#define CLK_TOP_HADDS2_FB  54
+#define CLK_TOP_MIPIPLL_D2 55
+#define CLK_TOP_MIPIPLL_D4 56
+#define CLK_TOP_HDMIPLL57
+#define CLK_TOP_HDMIPLL_D2 58
+#define CLK_TOP_HDMIPLL_D3 59
+#define CLK_TOP_HDMI_SCL_RX60
+#define CLK_TOP_HDMI_0_PIX340M 61
+#define CLK_TOP_HDMI_0_DEEP340M62
+#define CLK_TOP_HDMI_0_PLL340M 63
+#define CLK_TOP_AUD1PLL_98M64
+#define CLK_TOP_AUD2PLL_90M65
+#define CLK_TOP_AUDPLL 66
+#define CLK_TOP_AUDPLL_D4  67
+#define CLK_TOP_AUDPLL_D8  68
+#define CLK_TOP_AUDPLL_D16 69
+#define CLK_TOP_AUDPLL_D24 70
+#define CLK_TOP_ETHPLL_500M71
+#define CLK_TOP_VDECPLL72
+#define CLK_TOP_VENCPLL 

[PATCH v10 0/9] Add clock support for Mediatek MT2701

2016-08-16 Thread Erin Lo
This series is based on v4.8-rc1, add clock and reset controller support
for Mediatek MT2701.

This series also refined makefile and Kconfig to support configurable
multiple SoC clock support.

changes since v9:
- Rebase to v4.8-rc1.
- Drop a fix patch of parent clock initial state. It will be replaced by a new
  patch from Mike/Stephen.
- Replace clk.h with clk-provider.h.
- Correct register settings of clocks.

changes since v8:
- Rebase to v4.7-rc1.
- Include mt2701-resets.h in mt2701.dtsi.
- Remove an unused property from apmixedsys DT node.

changes since v7:
- Rebase to clk-next.
- Implement subsystem clocks in seperated files.
- Replace critical clock enabling with CLK_IS_CRITICAL flag.
- Reduce most clock registrations in CLK_OF_DECLARE().
- Remove __init and __initconst from most init fucntions and data,
  and replace driver registration with platform_driver_register().
- Replace some common function or variable names with unique names.
- Use real clock for UARTs.

changes since v6:
- Rebase to v4.6-rc1.
- Register subsystem clocks in probe() instead of CLK_OF_DECLARE().
- Add clocks that referred by subsystem clocks.
- Fix clk_data size of apmixedsys.
- Add config options for each subsystem clock provider.

changes since v5:
- Rebase to v4.5-rc1 and [1].
- Enable critical clocks for MT2701
- Refine dt-binding documents, add reset controller support for hifsys.

changes since v4:
- Rebase to v4.5-rc1.
- Remove CLK_SET_RATE_PARENT from divider flags.
- Add img_jpgdec_smi clock.
- Move clk/mediatek/Kconfig into menu section in clk/Kconfig.

changes since v3:
- Change the parent of mm_mdp_bls_26m from clk26m to pwm_sel.

changes since v2:
- Fix ethsys definition.
- Replace read-modify-write with regmap_update_bits() in clock operations.
- Move mt2701-resets.h to include/dt-bindings/reset/.
- Add hifsys reset patch from John Crispin.

changes since v1:
- Document MT2701 compatible strings.

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

Erin Lo (1):
  arm: dts: mt2701: Use real clock for UARTs

James Liao (4):
  clk: mediatek: remove __init from clk registration functions
  clk: mediatek: Refine the makefile to support multiple clock drivers
  dt-bindings: ARM: Mediatek: Document bindings for MT2701
  arm: dts: mt2701: Add clock controller device nodes

Shunli Wang (4):
  clk: mediatek: Add dt-bindings for MT2701 clocks
  clk: mediatek: Add MT2701 clock support
  reset: mediatek: Add MT2701 reset controller dt-binding file
  reset: mediatek: Add MT2701 reset driver

 .../bindings/arm/mediatek/mediatek,apmixedsys.txt  |3 +-
 .../bindings/arm/mediatek/mediatek,bdpsys.txt  |   22 +
 .../bindings/arm/mediatek/mediatek,ethsys.txt  |   22 +
 .../bindings/arm/mediatek/mediatek,hifsys.txt  |   24 +
 .../bindings/arm/mediatek/mediatek,imgsys.txt  |3 +-
 .../bindings/arm/mediatek/mediatek,infracfg.txt|3 +-
 .../bindings/arm/mediatek/mediatek,mmsys.txt   |3 +-
 .../bindings/arm/mediatek/mediatek,pericfg.txt |3 +-
 .../bindings/arm/mediatek/mediatek,topckgen.txt|3 +-
 .../bindings/arm/mediatek/mediatek,vdecsys.txt |3 +-
 arch/arm/boot/dts/mt2701.dtsi  |   50 +-
 drivers/clk/Kconfig|1 +
 drivers/clk/mediatek/Kconfig   |   73 ++
 drivers/clk/mediatek/Makefile  |   13 +-
 drivers/clk/mediatek/clk-gate.c|   54 +-
 drivers/clk/mediatek/clk-gate.h|2 +
 drivers/clk/mediatek/clk-mt2701-bdp.c  |  140 +++
 drivers/clk/mediatek/clk-mt2701-eth.c  |   82 ++
 drivers/clk/mediatek/clk-mt2701-hif.c  |   81 ++
 drivers/clk/mediatek/clk-mt2701-img.c  |   82 ++
 drivers/clk/mediatek/clk-mt2701-mm.c   |  125 +++
 drivers/clk/mediatek/clk-mt2701-vdec.c |   93 ++
 drivers/clk/mediatek/clk-mt2701.c  | 1037 
 drivers/clk/mediatek/clk-mtk.c |   52 +-
 drivers/clk/mediatek/clk-mtk.h |   41 +-
 drivers/clk/mediatek/clk-pll.c |3 +-
 include/dt-bindings/clock/mt2701-clk.h |  486 +
 include/dt-bindings/reset/mt2701-resets.h  |   83 ++
 28 files changed, 2559 insertions(+), 28 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt
 create mode 100644 drivers/clk/mediatek/Kconfig
 create mode 100644 drivers/clk/mediatek/clk-mt2701-bdp.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-eth.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-hif.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-img.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-mm.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-vdec.c
 create

[PATCH v10 1/9] clk: mediatek: remove __init from clk registration functions

2016-08-16 Thread Erin Lo
From: James Liao 

Remove __init from functions that will be used by init functions
that support probe deferral.

Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
---
 drivers/clk/mediatek/clk-gate.c |  2 +-
 drivers/clk/mediatek/clk-mtk.c  | 12 ++--
 drivers/clk/mediatek/clk-pll.c  |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c
index 2a76901..d8787bf 100644
--- a/drivers/clk/mediatek/clk-gate.c
+++ b/drivers/clk/mediatek/clk-gate.c
@@ -97,7 +97,7 @@ const struct clk_ops mtk_clk_gate_ops_setclr_inv = {
.disable= mtk_cg_disable_inv,
 };
 
-struct clk * __init mtk_clk_register_gate(
+struct clk *mtk_clk_register_gate(
const char *name,
const char *parent_name,
struct regmap *regmap,
diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c
index 5ada644..bb30f70 100644
--- a/drivers/clk/mediatek/clk-mtk.c
+++ b/drivers/clk/mediatek/clk-mtk.c
@@ -24,7 +24,7 @@
 #include "clk-mtk.h"
 #include "clk-gate.h"
 
-struct clk_onecell_data * __init mtk_alloc_clk_data(unsigned int clk_num)
+struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num)
 {
int i;
struct clk_onecell_data *clk_data;
@@ -49,7 +49,7 @@ err_out:
return NULL;
 }
 
-void __init mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks,
+void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks,
int num, struct clk_onecell_data *clk_data)
 {
int i;
@@ -72,7 +72,7 @@ void __init mtk_clk_register_fixed_clks(const struct 
mtk_fixed_clk *clks,
}
 }
 
-void __init mtk_clk_register_factors(const struct mtk_fixed_factor *clks,
+void mtk_clk_register_factors(const struct mtk_fixed_factor *clks,
int num, struct clk_onecell_data *clk_data)
 {
int i;
@@ -95,7 +95,7 @@ void __init mtk_clk_register_factors(const struct 
mtk_fixed_factor *clks,
}
 }
 
-int __init mtk_clk_register_gates(struct device_node *node,
+int mtk_clk_register_gates(struct device_node *node,
const struct mtk_gate *clks,
int num, struct clk_onecell_data *clk_data)
 {
@@ -135,7 +135,7 @@ int __init mtk_clk_register_gates(struct device_node *node,
return 0;
 }
 
-struct clk * __init mtk_clk_register_composite(const struct mtk_composite *mc,
+struct clk *mtk_clk_register_composite(const struct mtk_composite *mc,
void __iomem *base, spinlock_t *lock)
 {
struct clk *clk;
@@ -222,7 +222,7 @@ err_out:
return ERR_PTR(ret);
 }
 
-void __init mtk_clk_register_composites(const struct mtk_composite *mcs,
+void mtk_clk_register_composites(const struct mtk_composite *mcs,
int num, void __iomem *base, spinlock_t *lock,
struct clk_onecell_data *clk_data)
 {
diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c
index 966cab1..0c2deac 100644
--- a/drivers/clk/mediatek/clk-pll.c
+++ b/drivers/clk/mediatek/clk-pll.c
@@ -313,7 +313,7 @@ static struct clk *mtk_clk_register_pll(const struct 
mtk_pll_data *data,
return clk;
 }
 
-void __init mtk_clk_register_plls(struct device_node *node,
+void mtk_clk_register_plls(struct device_node *node,
const struct mtk_pll_data *plls, int num_plls, struct 
clk_onecell_data *clk_data)
 {
void __iomem *base;
-- 
1.9.1



[PATCH v10 3/9] dt-bindings: ARM: Mediatek: Document bindings for MT2701

2016-08-16 Thread Erin Lo
From: James Liao 

This patch adds the binding documentation for apmixedsys, bdpsys,
ethsys, hifsys, imgsys, infracfg, mmsys, pericfg, topckgen and
vdecsys for Mediatek MT2701.

Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
Tested-by: John Crispin 
Acked-by: Rob Herring 
---
 .../bindings/arm/mediatek/mediatek,apmixedsys.txt  |  3 ++-
 .../bindings/arm/mediatek/mediatek,bdpsys.txt  | 22 
 .../bindings/arm/mediatek/mediatek,ethsys.txt  | 22 
 .../bindings/arm/mediatek/mediatek,hifsys.txt  | 24 ++
 .../bindings/arm/mediatek/mediatek,imgsys.txt  |  3 ++-
 .../bindings/arm/mediatek/mediatek,infracfg.txt|  3 ++-
 .../bindings/arm/mediatek/mediatek,mmsys.txt   |  3 ++-
 .../bindings/arm/mediatek/mediatek,pericfg.txt |  3 ++-
 .../bindings/arm/mediatek/mediatek,topckgen.txt|  3 ++-
 .../bindings/arm/mediatek/mediatek,vdecsys.txt |  3 ++-
 10 files changed, 82 insertions(+), 7 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt

diff --git 
a/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
index 936166f..cb0054a 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
@@ -5,7 +5,8 @@ The Mediatek apmixedsys controller provides the PLLs to the 
system.
 
 Required Properties:
 
-- compatible: Should be:
+- compatible: Should be one of:
+   - "mediatek,mt2701-apmixedsys"
- "mediatek,mt8135-apmixedsys"
- "mediatek,mt8173-apmixedsys"
 - #clock-cells: Must be 1
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt
new file mode 100644
index 000..4137196
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt
@@ -0,0 +1,22 @@
+Mediatek bdpsys controller
+
+
+The Mediatek bdpsys controller provides various clocks to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt2701-bdpsys", "syscon"
+- #clock-cells: Must be 1
+
+The bdpsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+bdpsys: clock-controller@1c00 {
+   compatible = "mediatek,mt2701-bdpsys", "syscon";
+   reg = <0 0x1c00 0 0x1000>;
+   #clock-cells = <1>;
+};
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt
new file mode 100644
index 000..768f3a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt
@@ -0,0 +1,22 @@
+Mediatek ethsys controller
+
+
+The Mediatek ethsys controller provides various clocks to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt2701-ethsys", "syscon"
+- #clock-cells: Must be 1
+
+The ethsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+ethsys: clock-controller@1b00 {
+   compatible = "mediatek,mt2701-ethsys", "syscon";
+   reg = <0 0x1b00 0 0x1000>;
+   #clock-cells = <1>;
+};
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt
new file mode 100644
index 000..beed7b5
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt
@@ -0,0 +1,24 @@
+Mediatek hifsys controller
+
+
+The Mediatek hifsys controller provides various clocks and reset
+outputs to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt2701-hifsys", "syscon"
+- #clock-cells: Must be 1
+
+The hifsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+hifsys: clock-controller@1a00 {
+   compatible = "mediatek,mt2701-hifsys", "syscon";
+   reg = <0 0x1a00 0 0x1000>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+};
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,imgsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,imgsys.txt
index b1f2ce1..f6a9166 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,imgsys.txt
+++ b/Documentation/devicetree/bi

Re: [RFC PATCH] Introduce a 'recovery' command line option

2016-08-16 Thread Janne Karhunen
On Tue, Aug 16, 2016 at 10:04 AM, Richard Weinberger
 wrote:

> Why are you moving this feature into the kernel?
> To support such advanced features we have the initramfs.
>
> dracut has already rootfallback=.

For saving some precious boot-up time (my systems run without initrd)
and to unify the solutions. If kernel does this bootloaders and
initrds don't have to care.


--
Janne


Re: [PATCH] UBIFS: fix assertion in layout_in_gaps()

2016-08-16 Thread Vincent Stehlé
On Sun, Aug 14, 2016 at 11:00:33AM +0200, Richard Weinberger wrote:
..
> Good catch! Did you hit this assertion or was it found by review?
> I bet the latter since it is here since ever and given the wrongness
> it is unlikely to trigger.

Dear Richard,

It was found with a static checker and later review to confirm.

Best regards,

Vincent.


[PATCH v10 8/9] arm: dts: mt2701: Add clock controller device nodes

2016-08-16 Thread Erin Lo
From: James Liao 

Add clock controller nodes for MT2701, include topckgen, infracfg,
pericfg, apmixedsys, mmsys, imgsys, vdecsys, hifsys, ethsys and
bdpsys. This patch also add two oscillators that provide clocks for
MT2701.

Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
---
 arch/arm/boot/dts/mt2701.dtsi | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index 18596a2..c9a8dbf 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -12,8 +12,10 @@
  * GNU General Public License for more details.
  */
 
+#include 
 #include 
 #include 
+#include 
 #include "skeleton64.dtsi"
 #include "mt2701-pinfunc.h"
 
@@ -77,6 +79,20 @@
#clock-cells = <0>;
};
 
+   clk26m: oscillator@0 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2600>;
+   clock-output-names = "clk26m";
+   };
+
+   rtc32k: oscillator@1 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <32000>;
+   clock-output-names = "rtc32k";
+   };
+
timer {
compatible = "arm,armv7-timer";
interrupt-parent = <&gic>;
@@ -104,6 +120,26 @@
reg = <0 0x10005000 0 0x1000>;
};
 
+   topckgen: syscon@1000 {
+   compatible = "mediatek,mt2701-topckgen", "syscon";
+   reg = <0 0x1000 0 0x1000>;
+   #clock-cells = <1>;
+   };
+
+   infracfg: syscon@10001000 {
+   compatible = "mediatek,mt2701-infracfg", "syscon";
+   reg = <0 0x10001000 0 0x1000>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   };
+
+   pericfg: syscon@10003000 {
+   compatible = "mediatek,mt2701-pericfg", "syscon";
+   reg = <0 0x10003000 0 0x1000>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   };
+
watchdog: watchdog@10007000 {
compatible = "mediatek,mt2701-wdt",
 "mediatek,mt6589-wdt";
@@ -128,6 +164,12 @@
reg = <0 0x10200100 0 0x1c>;
};
 
+   apmixedsys: syscon@10209000 {
+   compatible = "mediatek,mt2701-apmixedsys", "syscon";
+   reg = <0 0x10209000 0 0x1000>;
+   #clock-cells = <1>;
+   };
+
gic: interrupt-controller@10211000 {
compatible = "arm,cortex-a7-gic";
interrupt-controller;
-- 
1.9.1



Re: [PATCH 2/3] befs: improve documentation in datastream.c

2016-08-16 Thread Salah Triki
On Sat, Aug 13, 2016 at 06:11:20PM +0100, Luis de Bethencourt wrote:
> Convert function descriptions to kernel-doc style.
> 
> Signed-off-by: Luis de Bethencourt 
> ---
>  fs/befs/datastream.c | 193 
> ++-
>  1 file changed, 98 insertions(+), 95 deletions(-)
> 
> diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
> index b2eb5b5..5ce85cf 100644
> --- a/fs/befs/datastream.c
> +++ b/fs/befs/datastream.c
> @@ -75,7 +75,13 @@ befs_read_datastream(struct super_block *sb, const 
> befs_data_stream *ds,
>   return bh;
>  }
>  
> -/*
> +/**
> + * befs_fblock2brun - give back block run for fblock
> + * @sb: the superblock
> + * @data: datastream to read from
> + * @fblock: the blocknumber with the file position to find
> + * @run: The found run is passed back through this pointer
> + *
>   * Takes a file position and gives back a brun who's starting block
>   * is block number fblock of the file.
>   * 
> @@ -212,36 +218,35 @@ befs_count_blocks(struct super_block *sb, const 
> befs_data_stream *ds)
>   return blocks;
>  }
>  
> -/*
> - Finds the block run that starts at file block number blockno
> - in the file represented by the datastream data, if that 
> - blockno is in the direct region of the datastream.
> - 
> - sb: the superblock
> - data: the datastream
> - blockno: the blocknumber to find
> - run: The found run is passed back through this pointer
> - 
> - Return value is BEFS_OK if the blockrun is found, BEFS_ERR
> - otherwise.
> - 
> - Algorithm:
> - Linear search. Checks each element of array[] to see if it
> - contains the blockno-th filesystem block. This is necessary
> - because the block runs map variable amounts of data. Simply
> - keeps a count of the number of blocks searched so far (sum),
> - incrementing this by the length of each block run as we come
> - across it. Adds sum to *count before returning (this is so
> - you can search multiple arrays that are logicaly one array,
> - as in the indirect region code).
> - 
> - When/if blockno is found, if blockno is inside of a block 
> - run as stored on disk, we offset the start and length members
> - of the block run, so that blockno is the start and len is
> - still valid (the run ends in the same place).
> - 
> - 2001-11-15 Will Dyson
> -*/
> +/**
> + * befs_find_brun_direct - find a direct block run in the datastream
> + * @sb: the superblock
> + * @data: the datastream
> + * @blockno: the blocknumber to find
> + * @run: The found run is passed back through this pointer
> + *
> + * Finds the block run that starts at file block number blockno
> + * in the file represented by the datastream data, if that
> + * blockno is in the direct region of the datastream.
> + *
> + * Return value is BEFS_OK if the blockrun is found, BEFS_ERR
> + * otherwise.
> + *
> + * Algorithm:
> + * Linear search. Checks each element of array[] to see if it
> + * contains the blockno-th filesystem block. This is necessary
> + * because the block runs map variable amounts of data. Simply
> + * keeps a count of the number of blocks searched so far (sum),
> + * incrementing this by the length of each block run as we come
> + * across it. Adds sum to *count before returning (this is so
> + * you can search multiple arrays that are logicaly one array,
> + * as in the indirect region code).
> + *
> + * When/if blockno is found, if blockno is inside of a block
> + * run as stored on disk, we offset the start and length members
> + * of the block run, so that blockno is the start and len is
> + * still valid (the run ends in the same place).
> + */
>  static int
>  befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
> befs_blocknr_t blockno, befs_block_run * run)
> @@ -273,29 +278,28 @@ befs_find_brun_direct(struct super_block *sb, const 
> befs_data_stream *data,
>   return BEFS_ERR;
>  }
>  
> -/*
> - Finds the block run that starts at file block number blockno
> - in the file represented by the datastream data, if that 
> - blockno is in the indirect region of the datastream.
> - 
> - sb: the superblock
> - data: the datastream
> - blockno: the blocknumber to find
> - run: The found run is passed back through this pointer
> - 
> - Return value is BEFS_OK if the blockrun is found, BEFS_ERR
> - otherwise.
> - 
> - Algorithm:
> - For each block in the indirect run of the datastream, read
> - it in and search through it for search_blk.
> - 
> - XXX:
> - Really should check to make sure blockno is inside indirect
> - region.
> - 
> - 2001-11-15 Will Dyson
> -*/
> +/**
> + * befs_find_brun_indirect - find a block run in the datastream
> + * @sb: the superblock
> + * @data: the datastream
> + * @blockno: the blocknumber to find
> + * @run: The found run is passed back through this po

[PATCH v10 9/9] arm: dts: mt2701: Use real clock for UARTs

2016-08-16 Thread Erin Lo
We used to use a fixed rate clock for the UARTs. Now that we have clock
support we can associate the correct clocks to the UARTs and drop the
26MHz fixed rate UART clock.

Change-Id: Icd44282b859a344b86eccdf4840e9ffb7cee7ec5
Signed-off-by: Erin Lo 
---
 arch/arm/boot/dts/mt2701.dtsi | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index c9a8dbf..7eab6f4 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -73,12 +73,6 @@
#clock-cells = <0>;
};
 
-   uart_clk: dummy26m {
-   compatible = "fixed-clock";
-   clock-frequency = <2600>;
-   #clock-cells = <0>;
-   };
-
clk26m: oscillator@0 {
compatible = "fixed-clock";
#clock-cells = <0>;
@@ -186,7 +180,8 @@
 "mediatek,mt6577-uart";
reg = <0 0x11002000 0 0x400>;
interrupts = ;
-   clocks = <&uart_clk>;
+   clocks = <&pericfg CLK_PERI_UART0_SEL>, <&pericfg 
CLK_PERI_UART0>;
+   clock-names = "baud", "bus";
status = "disabled";
};
 
@@ -195,7 +190,8 @@
 "mediatek,mt6577-uart";
reg = <0 0x11003000 0 0x400>;
interrupts = ;
-   clocks = <&uart_clk>;
+   clocks = <&pericfg CLK_PERI_UART1_SEL>, <&pericfg 
CLK_PERI_UART1>;
+   clock-names = "baud", "bus";
status = "disabled";
};
 
@@ -204,7 +200,8 @@
 "mediatek,mt6577-uart";
reg = <0 0x11004000 0 0x400>;
interrupts = ;
-   clocks = <&uart_clk>;
+   clocks = <&pericfg CLK_PERI_UART2_SEL>, <&pericfg 
CLK_PERI_UART2>;
+   clock-names = "baud", "bus";
status = "disabled";
};
 
@@ -213,7 +210,8 @@
 "mediatek,mt6577-uart";
reg = <0 0x11005000 0 0x400>;
interrupts = ;
-   clocks = <&uart_clk>;
+   clocks = <&pericfg CLK_PERI_UART3_SEL>, <&pericfg 
CLK_PERI_UART3>;
+   clock-names = "baud", "bus";
status = "disabled";
};
 };
-- 
1.9.1



[PATCH v10 5/9] clk: mediatek: Add MT2701 clock support

2016-08-16 Thread Erin Lo
From: Shunli Wang 

Add MT2701 clock support, include topckgen, apmixedsys,
infracfg, pericfg and subsystem clocks.

Signed-off-by: Shunli Wang 
Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
Tested-by: John Crispin 
---
 drivers/clk/mediatek/Kconfig   |   50 ++
 drivers/clk/mediatek/Makefile  |7 +
 drivers/clk/mediatek/clk-gate.c|   52 ++
 drivers/clk/mediatek/clk-gate.h|2 +
 drivers/clk/mediatek/clk-mt2701-bdp.c  |  140 +
 drivers/clk/mediatek/clk-mt2701-eth.c  |   82 +++
 drivers/clk/mediatek/clk-mt2701-hif.c  |   79 +++
 drivers/clk/mediatek/clk-mt2701-img.c  |   82 +++
 drivers/clk/mediatek/clk-mt2701-mm.c   |  125 
 drivers/clk/mediatek/clk-mt2701-vdec.c |   93 +++
 drivers/clk/mediatek/clk-mt2701.c  | 1033 
 drivers/clk/mediatek/clk-mtk.c |   40 ++
 drivers/clk/mediatek/clk-mtk.h |   41 +-
 drivers/clk/mediatek/clk-pll.c |1 +
 14 files changed, 1822 insertions(+), 5 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-bdp.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-eth.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-hif.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-img.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-mm.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701-vdec.c
 create mode 100644 drivers/clk/mediatek/clk-mt2701.c

diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index dc224e6..5aa6204 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -6,6 +6,56 @@ config COMMON_CLK_MEDIATEK
---help---
  Mediatek SoCs' clock support.
 
+config COMMON_CLK_MT2701
+   bool "Clock driver for Mediatek MT2701"
+   depends on COMMON_CLK
+   select COMMON_CLK_MEDIATEK
+   default ARCH_MEDIATEK
+   ---help---
+ This driver supports Mediatek MT2701 basic clocks.
+
+config COMMON_CLK_MT2701_MMSYS
+   bool "Clock driver for Mediatek MT2701 mmsys"
+   depends on COMMON_CLK
+   select COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 mmsys clocks.
+
+config COMMON_CLK_MT2701_IMGSYS
+   bool "Clock driver for Mediatek MT2701 imgsys"
+   depends on COMMON_CLK
+   select COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 imgsys clocks.
+
+config COMMON_CLK_MT2701_VDECSYS
+   bool "Clock driver for Mediatek MT2701 vdecsys"
+   depends on COMMON_CLK
+   select COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 vdecsys clocks.
+
+config COMMON_CLK_MT2701_HIFSYS
+   bool "Clock driver for Mediatek MT2701 hifsys"
+   depends on COMMON_CLK
+   select COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 hifsys clocks.
+
+config COMMON_CLK_MT2701_ETHSYS
+   bool "Clock driver for Mediatek MT2701 ethsys"
+   depends on COMMON_CLK
+   select COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 ethsys clocks.
+
+config COMMON_CLK_MT2701_BDPSYS
+   bool "Clock driver for Mediatek MT2701 bdpsys"
+   depends on COMMON_CLK
+   select COMMON_CLK_MT2701
+   ---help---
+ This driver supports Mediatek MT2701 bdpsys clocks.
+
 config COMMON_CLK_MT8135
bool "Clock driver for Mediatek MT8135"
depends on COMMON_CLK
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index 32e7222..19ae7ef 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -1,4 +1,11 @@
 obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o 
clk-apmixed.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
+obj-$(CONFIG_COMMON_CLK_MT2701) += clk-mt2701.o
+obj-$(CONFIG_COMMON_CLK_MT2701_BDPSYS) += clk-mt2701-bdp.o
+obj-$(CONFIG_COMMON_CLK_MT2701_ETHSYS) += clk-mt2701-eth.o
+obj-$(CONFIG_COMMON_CLK_MT2701_HIFSYS) += clk-mt2701-hif.o
+obj-$(CONFIG_COMMON_CLK_MT2701_IMGSYS) += clk-mt2701-img.o
+obj-$(CONFIG_COMMON_CLK_MT2701_MMSYS) += clk-mt2701-mm.o
+obj-$(CONFIG_COMMON_CLK_MT2701_VDECSYS) += clk-mt2701-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o
 obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c
index d8787bf..934bf0e 100644
--- a/drivers/clk/mediatek/clk-gate.c
+++ b/drivers/clk/mediatek/clk-gate.c
@@ -61,6 +61,22 @@ static void mtk_cg_clr_bit(struct clk_hw *hw)
regmap_write(cg->regmap, cg->clr_ofs, BIT(cg->bit));
 }
 
+static void mtk_cg_set_bit_no_setclr(struct clk_hw *hw)
+{
+   struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
+   u32 cgbit = BIT(cg->bit);
+
+   regmap_update_bits(cg->regmap, cg->sta_ofs, cgbit, cgbit);
+}
+
+static void mtk_cg_clr_bit_no_setclr(struct clk_hw *hw)
+{
+   struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
+   u32 cgbit = BIT(cg->bit);
+
+   regmap_update_bits

[PATCH v10 7/9] reset: mediatek: Add MT2701 reset driver

2016-08-16 Thread Erin Lo
From: Shunli Wang 

In infrasys and perifsys, there are many reset
control bits for kinds of modules. These bits are
used as actual reset controllers to be registered
into kernel's generic reset controller framework.

Signed-off-by: Shunli Wang 
Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
Tested-by: John Crispin 
Acked-by: Philipp Zabel 
---
 drivers/clk/mediatek/clk-mt2701-hif.c | 2 ++
 drivers/clk/mediatek/clk-mt2701.c | 4 
 2 files changed, 6 insertions(+)

diff --git a/drivers/clk/mediatek/clk-mt2701-hif.c 
b/drivers/clk/mediatek/clk-mt2701-hif.c
index 33ead83..0ca0537 100644
--- a/drivers/clk/mediatek/clk-mt2701-hif.c
+++ b/drivers/clk/mediatek/clk-mt2701-hif.c
@@ -55,6 +55,8 @@ static void mtk_hifsys_init(struct device_node *node)
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
+
+   mtk_register_reset_controller(node, 1, 0x34);
 }
 
 static const struct of_device_id of_match_clk_mt2701_hif[] = {
diff --git a/drivers/clk/mediatek/clk-mt2701.c 
b/drivers/clk/mediatek/clk-mt2701.c
index f64dc4e..9dab533 100644
--- a/drivers/clk/mediatek/clk-mt2701.c
+++ b/drivers/clk/mediatek/clk-mt2701.c
@@ -791,6 +791,8 @@ static void mtk_infrasys_init(struct device_node *node)
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
+
+   mtk_register_reset_controller(node, 2, 0x30);
 }
 
 static const struct mtk_gate_regs peri0_cg_regs = {
@@ -911,6 +913,8 @@ static void mtk_pericfg_init(struct device_node *node)
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
+
+   mtk_register_reset_controller(node, 2, 0x0);
 }
 
 #define MT8590_PLL_FMAX(2000 * MHZ)
-- 
1.9.1



[PATCH v10 6/9] reset: mediatek: Add MT2701 reset controller dt-binding file

2016-08-16 Thread Erin Lo
From: Shunli Wang 

Dt-binding file about reset controller is used to provide
kinds of definition, which is referenced by dts file and
IC-specified reset controller driver code.

Signed-off-by: Shunli Wang 
Signed-off-by: James Liao 
Signed-off-by: Erin Lo 
Tested-by: John Crispin 
Acked-by: Philipp Zabel 
---
 include/dt-bindings/reset/mt2701-resets.h | 83 +++
 1 file changed, 83 insertions(+)
 create mode 100644 include/dt-bindings/reset/mt2701-resets.h

diff --git a/include/dt-bindings/reset/mt2701-resets.h 
b/include/dt-bindings/reset/mt2701-resets.h
new file mode 100644
index 000..aaf0305
--- /dev/null
+++ b/include/dt-bindings/reset/mt2701-resets.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2015 MediaTek, Shunli Wang 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT2701
+#define _DT_BINDINGS_RESET_CONTROLLER_MT2701
+
+/* INFRACFG resets */
+#define MT2701_INFRA_EMI_REG_RST   0
+#define MT2701_INFRA_DRAMC0_A0_RST 1
+#define MT2701_INFRA_FHCTL_RST 2
+#define MT2701_INFRA_APCIRQ_EINT_RST   3
+#define MT2701_INFRA_APXGPT_RST4
+#define MT2701_INFRA_SCPSYS_RST5
+#define MT2701_INFRA_KP_RST6
+#define MT2701_INFRA_PMIC_WRAP_RST 7
+#define MT2701_INFRA_MIPI_RST  8
+#define MT2701_INFRA_IRRX_RST  9
+#define MT2701_INFRA_CEC_RST   10
+#define MT2701_INFRA_EMI_RST   32
+#define MT2701_INFRA_DRAMC0_RST34
+#define MT2701_INFRA_TRNG_RST  37
+#define MT2701_INFRA_SYSIRQ_RST38
+
+/*  PERICFG resets */
+#define MT2701_PERI_UART0_SW_RST   0
+#define MT2701_PERI_UART1_SW_RST   1
+#define MT2701_PERI_UART2_SW_RST   2
+#define MT2701_PERI_UART3_SW_RST   3
+#define MT2701_PERI_GCPU_SW_RST5
+#define MT2701_PERI_BTIF_SW_RST6
+#define MT2701_PERI_PWM_SW_RST 8
+#define MT2701_PERI_AUXADC_SW_RST  10
+#define MT2701_PERI_DMA_SW_RST 11
+#define MT2701_PERI_NFI_SW_RST 14
+#define MT2701_PERI_NLI_SW_RST 15
+#define MT2701_PERI_THERM_SW_RST   16
+#define MT2701_PERI_MSDC2_SW_RST   17
+#define MT2701_PERI_MSDC0_SW_RST   19
+#define MT2701_PERI_MSDC1_SW_RST   20
+#define MT2701_PERI_I2C0_SW_RST22
+#define MT2701_PERI_I2C1_SW_RST23
+#define MT2701_PERI_I2C2_SW_RST24
+#define MT2701_PERI_I2C3_SW_RST25
+#define MT2701_PERI_USB_SW_RST 28
+#define MT2701_PERI_ETH_SW_RST 29
+#define MT2701_PERI_SPI0_SW_RST33
+
+/* TOPRGU resets */
+#define MT2701_TOPRGU_INFRA_RST0
+#define MT2701_TOPRGU_MM_RST   1
+#define MT2701_TOPRGU_MFG_RST  2
+#define MT2701_TOPRGU_ETHDMA_RST   3
+#define MT2701_TOPRGU_VDEC_RST 4
+#define MT2701_TOPRGU_VENC_IMG_RST 5
+#define MT2701_TOPRGU_DDRPHY_RST   6
+#define MT2701_TOPRGU_MD_RST   7
+#define MT2701_TOPRGU_INFRA_AO_RST 8
+#define MT2701_TOPRGU_CONN_RST 9
+#define MT2701_TOPRGU_APMIXED_RST  10
+#define MT2701_TOPRGU_HIFSYS_RST   11
+#define MT2701_TOPRGU_CONN_MCU_RST 12
+#define MT2701_TOPRGU_BDP_DISP_RST 13
+
+/* HIFSYS resets */
+#define MT2701_HIFSYS_UHOST0_RST   3
+#define MT2701_HIFSYS_UHOST1_RST   4
+#define MT2701_HIFSYS_UPHY0_RST21
+#define MT2701_HIFSYS_UPHY1_RST22
+#define MT2701_HIFSYS_PCIE0_RST24
+#define MT2701_HIFSYS_PCIE1_RST25
+#define MT2701_HIFSYS_PCIE2_RST26
+
+#endif  /* _DT_BINDINGS_RESET_CONTROLLER_MT2701 */
-- 
1.9.1



RE: [PATCH 3.16 197/305] memory: omap-gpmc: Fix omap gpmc EXTRADELAY timing

2016-08-16 Thread SebastienOcquidant
Ok No problem.

Sebastien



-
Eaton Industries (France) S.A.S ~ Siège social: 110 Rue Blaise Pascal, Immeuble 
Le Viséo - Bâtiment A Innovallée, 38330, Montbonnot-St.-Martin, France ~ Lieu 
d'enregistrement au registre du commerce: Grenoble ~ Numéro d'enregistrement: 
509 653 176 ~ Capital social souscrit et liberé:€ 16215441 ~ Numéro de TVA: 
FR47509653176
਍
-

-Message d'origine-
De : Ben Hutchings [mailto:b...@decadent.org.uk] 
Envoyé : samedi 13 août 2016 19:43
À : linux-kernel@vger.kernel.org; sta...@vger.kernel.org
Cc : a...@linux-foundation.org; Roger Quadros; Ocquidant, Sebastien
Objet : [PATCH 3.16 197/305] memory: omap-gpmc: Fix omap gpmc EXTRADELAY timing

3.16.37-rc1 review patch.  If anyone has any objections, please let me know.

--

From: "Ocquidant, Sebastien" 

commit 8f50b8e57442d28e41bb736c173d8a2490549a82 upstream.

In the omap gpmc driver it can be noticed that GPMC_CONFIG4_OEEXTRADELAY is 
overwritten by the WEEXTRADELAY value from the device tree and 
GPMC_CONFIG4_WEEXTRADELAY is not updated by the value from the device tree.

As a consequence, the memory accesses cannot be configured properly when the 
extra delay are needed for OE and WE.

Fix the update of GPMC_CONFIG4_WEEXTRADELAY with the value from the device tree 
file and prevents GPMC_CONFIG4_OEXTRADELAY being overwritten by the WEXTRADELAY 
value from the device tree.

Signed-off-by: Ocquidant, Sebastien 
Signed-off-by: Roger Quadros 
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings 
---
 arch/arm/mach-omap2/gpmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -274,7 +274,7 @@ static void gpmc_cs_bool_timings(int cs,
gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
   GPMC_CONFIG4_OEEXTRADELAY, p->oe_extra_delay);
gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
-  GPMC_CONFIG4_OEEXTRADELAY, p->we_extra_delay);
+  GPMC_CONFIG4_WEEXTRADELAY, p->we_extra_delay);
gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG6,
   GPMC_CONFIG6_CYCLE2CYCLESAMECSEN,
   p->cycle2cyclesamecsen);




Re: [PATCH] pwm: samsung: fix to use lowest div for large enough modulation bits

2016-08-16 Thread Krzysztof Kozlowski
On 08/02/2016 12:16 PM, Seung-Woo Kim wrote:
>>From pwm_samsung_calc_tin(), there is routine to find the lowest
> divider possible to generate lower frequency than requested one.
> But it is always possible to generate requested frequency with
> large enough modulation bits, so this patch fixes to use lowest
> div for the case. This patch removes following UBSAN warning:
> 
>UBSAN: Undefined behaviour in drivers/pwm/pwm-samsung.c:197:13
>shift exponent 32 is too large for 32-bit type 'long unsigned int'
>[...]
>[] (ubsan_epilogue) from [] 
> (__ubsan_handle_shift_out_of_bounds+0xd8/0x120)
>[] (__ubsan_handle_shift_out_of_bounds) from [] 
> (pwm_samsung_config+0x508/0x6a4)
>[] (pwm_samsung_config) from [] 
> (pwm_apply_state+0x174/0x40c)
>[] (pwm_apply_state) from [] (pwm_fan_probe+0xc8/0x488)
>[] (pwm_fan_probe) from [] 
> (platform_drv_probe+0x70/0x150)
>[...]
> 
> Signed-off-by: Seung-Woo Kim 
> ---
> The UBSAN warning from ARM is reported with the patch in following link:
> https://patchwork.kernel.org/patch/9189575/
> ---
>  drivers/pwm/pwm-samsung.c |   10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
> index ada2d32..ff0def6 100644
> --- a/drivers/pwm/pwm-samsung.c
> +++ b/drivers/pwm/pwm-samsung.c
> @@ -193,9 +193,13 @@ static unsigned long pwm_samsung_calc_tin(struct 
> samsung_pwm_chip *chip,
>* divider settings and choose the lowest divisor that can generate
>* frequencies lower than requested.
>*/
> - for (div = variant->div_base; div < 4; ++div)
> - if ((rate >> (variant->bits + div)) < freq)
> - break;
> + if (fls(rate) <= variant->bits) {
> + div = variant->div_base;
> + } else {
> + for (div = variant->div_base; div < 4; ++div)
> + if ((rate >> (variant->bits + div)) < freq)
> + break;
> + }

I have trouble with understanding the idea behind initial code from
Tomasz (commit 11ad39ede24ee). The variant->bits for all SoC except
S3C24xx is 32. This means the shift:
if ((rate >> (variant->bits + div)) < freq)
will be always by 32 or more... In practice this will choose always a
"div" of 0 because in first iteration of this loop, the shift will be by 32.

This looks weird and the fix does not really remove the weirdness out of it.

Best regards,
Krzysztof



Re: [PATCH v2 3/3] befs: fix style issues in datastream.c

2016-08-16 Thread Salah Triki
On Sun, Aug 14, 2016 at 06:48:36PM +0100, Luis de Bethencourt wrote:
> Fixing the following checkpatch.pl errors:
> 
> ERROR: "foo * bar" should be "foo *bar"
> +befs_blocknr_t blockno, befs_block_run * run);
> 
> WARNING: Missing a blank line after declarations
> +   struct buffer_head *bh;
> +   befs_debug(sb, "---> %s length: %llu", __func__, len);
> 
> WARNING: Block comments use * on subsequent lines
> +   /*
> +  Double indir block, plus all the indirect blocks it maps.
> 
> (and other instances of these)
> 
> Signed-off-by: Luis de Bethencourt 
> ---
> 
> Hi,
> 
> Removing the second "befs:" that creeped into the subject line of the patch.
> 
> Ironic since it is a patch fixing typos.
> Errare humanum est.
> 
> Thanks,
> Luis
> 
>  fs/befs/datastream.c | 32 +---
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
> index 5ce85cf..b4c7ba0 100644
> --- a/fs/befs/datastream.c
> +++ b/fs/befs/datastream.c
> @@ -22,17 +22,17 @@ const befs_inode_addr BAD_IADDR = { 0, 0, 0 };
>  
>  static int befs_find_brun_direct(struct super_block *sb,
>const befs_data_stream *data,
> -  befs_blocknr_t blockno, befs_block_run * run);
> +  befs_blocknr_t blockno, befs_block_run *run);
>  
>  static int befs_find_brun_indirect(struct super_block *sb,
>  const befs_data_stream *data,
>  befs_blocknr_t blockno,
> -befs_block_run * run);
> +befs_block_run *run);
>  
>  static int befs_find_brun_dblindirect(struct super_block *sb,
> const befs_data_stream *data,
> befs_blocknr_t blockno,
> -   befs_block_run * run);
> +   befs_block_run *run);
>  
>  /**
>   * befs_read_datastream - get buffer_head containing data, starting from pos.
> @@ -46,7 +46,7 @@ static int befs_find_brun_dblindirect(struct super_block 
> *sb,
>   */
>  struct buffer_head *
>  befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
> -  befs_off_t pos, uint * off)
> +  befs_off_t pos, uint *off)
>  {
>   struct buffer_head *bh;
>   befs_block_run run;
> @@ -94,7 +94,7 @@ befs_read_datastream(struct super_block *sb, const 
> befs_data_stream *ds,
>   */
>  int
>  befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
> -  befs_blocknr_t fblock, befs_block_run * run)
> +  befs_blocknr_t fblock, befs_block_run *run)
>  {
>   int err;
>   befs_off_t pos = fblock << BEFS_SB(sb)->block_shift;
> @@ -134,6 +134,7 @@ befs_read_lsymlink(struct super_block *sb, const 
> befs_data_stream *ds,
>   befs_off_t bytes_read = 0;  /* bytes readed */
>   u16 plen;
>   struct buffer_head *bh;
> +
>   befs_debug(sb, "---> %s length: %llu", __func__, len);
>  
>   while (bytes_read < len) {
> @@ -189,13 +190,13 @@ befs_count_blocks(struct super_block *sb, const 
> befs_data_stream *ds)
>   metablocks += ds->indirect.len;
>  
>   /*
> -Double indir block, plus all the indirect blocks it maps.
> -In the double-indirect range, all block runs of data are
> -BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know 
> -how many data block runs are in the double-indirect region,
> -and from that we know how many indirect blocks it takes to
> -map them. We assume that the indirect blocks are also
> -BEFS_DBLINDIR_BRUN_LEN blocks long.
> +  * Double indir block, plus all the indirect blocks it maps.
> +  * In the double-indirect range, all block runs of data are
> +  * BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know
> +  * how many data block runs are in the double-indirect region,
> +  * and from that we know how many indirect blocks it takes to
> +  * map them. We assume that the indirect blocks are also
> +  * BEFS_DBLINDIR_BRUN_LEN blocks long.
>*/
>   if (ds->size > ds->max_indirect_range && ds->max_indirect_range != 0) {
>   uint dbl_bytes;
> @@ -249,7 +250,7 @@ befs_count_blocks(struct super_block *sb, const 
> befs_data_stream *ds)
>   */
>  static int
>  befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
> -   befs_blocknr_t blockno, befs_block_run * run)
> +   befs_blocknr_t blockno, befs_block_run *run)
>  {
>   int i;
>   const befs_block_run *array = data->direct;
> @@ -261,6 +262,7 @@ befs_find_brun_direct(struct super_block *sb, const 
> befs_data_stream *data,
>sum += array[i].len, i++) {
>   if (blockno >= sum && blockno < sum + (array[i].len)) 

Re: [PATCHv4 0/2] USB Type-C Connector class

2016-08-16 Thread Heikki Krogerus
Hi guys,

Sorry for the long silence. I just returned from paternal leave.

On Wed, Aug 10, 2016 at 10:19:25AM +0200, Oliver Neukum wrote:
> On Tue, 2016-08-09 at 09:23 -0700, Guenter Roeck wrote:
> > > I'm not going to take this series until everyone agrees on it,
> > sorry.
> > > I'll wait for you and Guenter and Oliver to all come up with a
> > solution
> > > that works for everyone.
> > > 
> > 
> > I have not heard from Heikko for a while. There have been some
> > follow-up
> > patches in
> > 
> > https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=bxt-typec-pd-fixes
> > 
> > but I am not really sure where this is going. I've been wondering if I
> > can/should get more actively involved and start driving the series if
> > Heikki is busy. Thoughts, anyone ?
> 
> It is not clear to me where we were. It seems to me that we found
> the API good but disagreed about locking. Does that sum it up?

I'll remove the locks and resend.


Thanks,

-- 
heikki


Re: [PATCH 3/3] befs: befs: fix style issues in datastream.c

2016-08-16 Thread Salah Triki
On Sat, Aug 13, 2016 at 06:11:21PM +0100, Luis de Bethencourt wrote:
> Fixing the following checkpatch.pl errors:
> 
> ERROR: "foo * bar" should be "foo *bar"
> +befs_blocknr_t blockno, befs_block_run * run);
> 
> WARNING: Missing a blank line after declarations
> +   struct buffer_head *bh;
> +   befs_debug(sb, "---> %s length: %llu", __func__, len);
> 
> WARNING: Block comments use * on subsequent lines
> +   /*
> +  Double indir block, plus all the indirect blocks it maps.
> 
> (and other instances of these)
> 
> Signed-off-by: Luis de Bethencourt 
> ---
>  fs/befs/datastream.c | 32 +---
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
> index 5ce85cf..b4c7ba0 100644
> --- a/fs/befs/datastream.c
> +++ b/fs/befs/datastream.c
> @@ -22,17 +22,17 @@ const befs_inode_addr BAD_IADDR = { 0, 0, 0 };
>  
>  static int befs_find_brun_direct(struct super_block *sb,
>const befs_data_stream *data,
> -  befs_blocknr_t blockno, befs_block_run * run);
> +  befs_blocknr_t blockno, befs_block_run *run);
>  
>  static int befs_find_brun_indirect(struct super_block *sb,
>  const befs_data_stream *data,
>  befs_blocknr_t blockno,
> -befs_block_run * run);
> +befs_block_run *run);
>  
>  static int befs_find_brun_dblindirect(struct super_block *sb,
> const befs_data_stream *data,
> befs_blocknr_t blockno,
> -   befs_block_run * run);
> +   befs_block_run *run);
>  
>  /**
>   * befs_read_datastream - get buffer_head containing data, starting from pos.
> @@ -46,7 +46,7 @@ static int befs_find_brun_dblindirect(struct super_block 
> *sb,
>   */
>  struct buffer_head *
>  befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
> -  befs_off_t pos, uint * off)
> +  befs_off_t pos, uint *off)
>  {
>   struct buffer_head *bh;
>   befs_block_run run;
> @@ -94,7 +94,7 @@ befs_read_datastream(struct super_block *sb, const 
> befs_data_stream *ds,
>   */
>  int
>  befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
> -  befs_blocknr_t fblock, befs_block_run * run)
> +  befs_blocknr_t fblock, befs_block_run *run)
>  {
>   int err;
>   befs_off_t pos = fblock << BEFS_SB(sb)->block_shift;
> @@ -134,6 +134,7 @@ befs_read_lsymlink(struct super_block *sb, const 
> befs_data_stream *ds,
>   befs_off_t bytes_read = 0;  /* bytes readed */
>   u16 plen;
>   struct buffer_head *bh;
> +
>   befs_debug(sb, "---> %s length: %llu", __func__, len);
>  
>   while (bytes_read < len) {
> @@ -189,13 +190,13 @@ befs_count_blocks(struct super_block *sb, const 
> befs_data_stream *ds)
>   metablocks += ds->indirect.len;
>  
>   /*
> -Double indir block, plus all the indirect blocks it maps.
> -In the double-indirect range, all block runs of data are
> -BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know 
> -how many data block runs are in the double-indirect region,
> -and from that we know how many indirect blocks it takes to
> -map them. We assume that the indirect blocks are also
> -BEFS_DBLINDIR_BRUN_LEN blocks long.
> +  * Double indir block, plus all the indirect blocks it maps.
> +  * In the double-indirect range, all block runs of data are
> +  * BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know
> +  * how many data block runs are in the double-indirect region,
> +  * and from that we know how many indirect blocks it takes to
> +  * map them. We assume that the indirect blocks are also
> +  * BEFS_DBLINDIR_BRUN_LEN blocks long.
>*/
>   if (ds->size > ds->max_indirect_range && ds->max_indirect_range != 0) {
>   uint dbl_bytes;
> @@ -249,7 +250,7 @@ befs_count_blocks(struct super_block *sb, const 
> befs_data_stream *ds)
>   */
>  static int
>  befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
> -   befs_blocknr_t blockno, befs_block_run * run)
> +   befs_blocknr_t blockno, befs_block_run *run)
>  {
>   int i;
>   const befs_block_run *array = data->direct;
> @@ -261,6 +262,7 @@ befs_find_brun_direct(struct super_block *sb, const 
> befs_data_stream *data,
>sum += array[i].len, i++) {
>   if (blockno >= sum && blockno < sum + (array[i].len)) {
>   int offset = blockno - sum;
> +
>   run->allocation_group = array[i].allocation_group;
>   run->start = array[i].sta

Re: [PATCH 2/7] Documentation: bindings: Add Exynos5433 PMU compatible

2016-08-16 Thread Krzysztof Kozlowski
On 08/16/2016 08:27 AM, Chanwoo Choi wrote:
> This patch adds the exynos5433 PMU compatible to support the access
> of PMU (Power Management Unit) block.
> 
> Cc: Kukjin Kim 
> Cc: Krzysztof Kozlowski 
> Cc: Rob Herring 
> Cc: Mark Rutland 
> Signed-off-by: Chanwoo Choi 
> ---
>  Documentation/devicetree/bindings/arm/samsung/pmu.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/samsung/pmu.txt 
> b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
> index 2d6356d8daf4..bf5fc59a6938 100644
> --- a/Documentation/devicetree/bindings/arm/samsung/pmu.txt
> +++ b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
> @@ -10,6 +10,7 @@ Properties:
>  - "samsung,exynos5260-pmu" - for Exynos5260 SoC.
>  - "samsung,exynos5410-pmu" - for Exynos5410 SoC,
>  - "samsung,exynos5420-pmu" - for Exynos5420 SoC.
> +- "samsung,exynos5433-pmu" - for Exynos5433 SoC.
>  - "samsung,exynos7-pmu" - for Exynos7 SoC.
>   second value must be always "syscon".

Is there any plan to add Exynos5433 support to
drivers/soc/samsung/exynos-pmu.c? If no... then exynos7-pmu might be
reused. If yes, then this makes sense.

Best regards,
Krzysztof


[RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

2016-08-16 Thread zijun_hu
From: zijun_hu 

move out get_count_order[_long]() definitions from scope limited
by macro __KERNEL__

it not only make both functions available in wider region regardless
of whether __KERNEL__ is defined but also keep original region for
get_count_order() before the recent commit c513b4cd2fe9
("mm-vmalloc-fix-align-value-calculation-error-v2-fix-fix") 

Signed-off-by: zijun_hu 
---
 this patch is based on the newest mmotm/linux-next tree and can
 be applied directly

 include/linux/bitops.h | 52 +-
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 6f202c8fe4a6..a83c822c35c2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -181,6 +181,32 @@ static inline unsigned fls_long(unsigned long l)
return fls64(l);
 }
 
+static inline int get_count_order(unsigned int count)
+{
+   int order;
+
+   order = fls(count) - 1;
+   if (count & (count - 1))
+   order++;
+   return order;
+}
+
+/**
+ * get_count_order_long - get order after rounding @l up to power of 2
+ * @l: parameter
+ *
+ * it is same as get_count_order() but with long type parameter
+ */
+static inline int get_count_order_long(unsigned long l)
+{
+   if (l == 0UL)
+   return -1;
+   else if (l & (l - 1UL))
+   return (int)fls_long(l);
+   else
+   return (int)fls_long(l) - 1;
+}
+
 /**
  * __ffs64 - find first set bit in a 64 bit word
  * @word: The 64 bit word
@@ -233,32 +259,6 @@ static inline unsigned long __ffs64(u64 word)
 })
 #endif
 
-static inline int get_count_order(unsigned int count)
-{
-   int order;
-
-   order = fls(count) - 1;
-   if (count & (count - 1))
-   order++;
-   return order;
-}
-
-/**
- * get_count_order_long - get order after rounding @l up to power of 2
- * @l: parameter
- *
- * it is same as get_count_order() but with long type parameter
- */
-static inline int get_count_order_long(unsigned long l)
-{
-   if (l == 0UL)
-   return -1;
-   else if (l & (l - 1UL))
-   return (int)fls_long(l);
-   else
-   return (int)fls_long(l) - 1;
-}
-
 #ifndef find_last_bit
 /**
  * find_last_bit - find the last set bit in a memory region
-- 
1.9.1





Re: [PATCH 3/7] cpufreq: dt: Add exynos5433 compatible to use generic cpufreq driver

2016-08-16 Thread Krzysztof Kozlowski
On 08/16/2016 08:27 AM, Chanwoo Choi wrote:
> This patch adds the exynos5433 compatible string for supporting
> the generic cpufreq driver on Exynos5433.
> 
> Cc: "Rafael J. Wysocki" 
> Cc: Viresh Kumar 
> Cc: linux...@vger.kernel.org
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/cpufreq/cpufreq-dt-platdev.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Krzysztof Kozlowski 

I guess this does not depend on the rest and can go through PM/cpufreq tree?

Viresh, Rafael,
If you wish me to take it, let me know.

Best regards,
Krzysztof



Re: [PATCH] drivers/iio/light/Kconfig: SENSORS_BH1780 cleanup

2016-08-16 Thread Greg KH
On Tue, Aug 16, 2016 at 08:27:53AM +0200, Valentin Rothberg wrote:
> Commit 7ef9153d9af5 ("misc: delete bh1780 driver") has removed the
> Kconfig option SENSORS_BH1780.  Remove the last reference on this
> option.
> 
> Signed-off-by: Valentin Rothberg 
> ---
> I found the issue using scripts/checkkconfigsymbols.py

Ah, good catch, thanks for this, now queued up.

greg k-h


Re: [PATCH v12 3/3] Bluetooth: hci_uart: Support firmware download for Marvell

2016-08-16 Thread Loic Poulain

Hi Amit,

On 09/08/2016 18:32, Amitkumar Karwar wrote:

From: Ganapathi Bhat 

This patch implement firmware download feature for
Marvell Bluetooth devices. If firmware is already
downloaded, it will skip downloading.

Signed-off-by: Ganapathi Bhat 
Signed-off-by: Amitkumar Karwar 
Tested-by: Jeffy Chen 
---
v2: Fixed compilation warning reported by kbuild test robot
v3: Addressed review comments from Marcel Holtmann
 a) Removed vendor specific code from hci_ldisc.c
 b) Get rid of static forward declaration
 c) Removed unnecessary heavy nesting
 d) Git rid of module parameter and global variables
 e) Add logic to pick right firmware image
v4: Addresses review comments from Alan
 a) Use existing kernel helper APIs instead of writing own.
 b) Replace mdelay() with msleep()
v5: Addresses review comments from Loic Poulain
 a) Use bt_dev_err/warn/dbg helpers insted of BT_ERR/WARN/DBG
 b) Used static functions where required and removed forward delcarations
 c) Edited comments for the function hci_uart_recv_data
 d) Made HCI_UART_DNLD_FW flag a part of driver private data
v6: Addresses review comments from Loic Poulain
 a) Used skb instead of array to store firmware data during download
 b) Used hci_uart_tx_wakeup and enqueued packets instead of tty write
 c) Used GFP_KERNEL instead of GFP_ATOMIC
v7: Edited Kconfig to add dependency for BT_HCIUART_H4. The change resolves
 errors reported by kbuild test robot.
v8: Addressed review comments from Marcel Holtmann
 a) Removed unnecessary memory allocation failure messages
 b) Get rid of btmrvl.h header file and add definitions in hci_mrvl.c file
v9: Addressed review comments from Marcel Holtmann
 a) Moved firmware download code from setup to prepare handler.
 b) Change messages from bt_dev_*->BT_*, as hdev isn't available during 
firmware
  download.
v10: Addressed review comments from Marcel Holtmann
 a) Added new callback recv_for_prepare to receive data from device
  during prepare phase
 b) Avoided using private flags (HCI_UART_DNLD_FW) as new receive callback 
is
  added for the same purpose
 c) Used kernel API to handle unaligned data
 d) Moved mrvl_set_baud functionality inside setup callback
v11: Write data through ldisc in mrvl_send_ack() instead of directly calling
 write method(One Thousand Gnomes).
v12: a) Check for buffer length before copying to skb (Loic Poulain)
  b) Rearrange skb memory allocation check
---
  drivers/bluetooth/Kconfig |  11 +
  drivers/bluetooth/Makefile|   1 +
  drivers/bluetooth/hci_ldisc.c |   6 +
  drivers/bluetooth/hci_mrvl.c  | 545 ++
  drivers/bluetooth/hci_uart.h  |   8 +-
  5 files changed, 570 insertions(+), 1 deletion(-)
  create mode 100644 drivers/bluetooth/hci_mrvl.c

diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index cf50fd2..daafd0c 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -180,6 +180,17 @@ config BT_HCIUART_AG6XX
  
  	  Say Y here to compile support for Intel AG6XX protocol.
  
+config BT_HCIUART_MRVL

+   bool "Marvell protocol support"
+   depends on BT_HCIUART
+   select BT_HCIUART_H4
+   help
+ Marvell is serial protocol for communication between Bluetooth
+ device and host. This protocol is required for most Marvell Bluetooth
+ devices with UART interface.
+
+ Say Y here to compile support for HCI MRVL protocol.
+
  config BT_HCIBCM203X
tristate "HCI BCM203x USB driver"
depends on USB
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index 9c18939..364dbb6 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -37,6 +37,7 @@ hci_uart-$(CONFIG_BT_HCIUART_INTEL)   += hci_intel.o
  hci_uart-$(CONFIG_BT_HCIUART_BCM) += hci_bcm.o
  hci_uart-$(CONFIG_BT_HCIUART_QCA) += hci_qca.o
  hci_uart-$(CONFIG_BT_HCIUART_AG6XX)   += hci_ag6xx.o
+hci_uart-$(CONFIG_BT_HCIUART_MRVL) += hci_mrvl.o
  hci_uart-objs := $(hci_uart-y)
  
  ccflags-y += -D__CHECK_ENDIAN__

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 2c88586..ded13d3 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -821,6 +821,9 @@ static int __init hci_uart_init(void)
  #ifdef CONFIG_BT_HCIUART_AG6XX
ag6xx_init();
  #endif
+#ifdef CONFIG_BT_HCIUART_MRVL
+   mrvl_init();
+#endif
  
  	return 0;

  }
@@ -856,6 +859,9 @@ static void __exit hci_uart_exit(void)
  #ifdef CONFIG_BT_HCIUART_AG6XX
ag6xx_deinit();
  #endif
+#ifdef CONFIG_BT_HCIUART_MRVL
+   mrvl_deinit();
+#endif
  
  	/* Release tty registration of line discipline */

err = tty_unregister_ldisc(N_HCI);
diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c
new file mode 100644
index 000..c993c1b
--- /dev/null
+++ b/drivers/bluetooth/hci_mrvl.c

Re: [RFC 4/7] Bluetooth: hci_uart: Add support for word alignment

2016-08-16 Thread Sebastian Reichel
Hi Marcel,

On Tue, Aug 16, 2016 at 09:05:19AM +0200, Marcel Holtmann wrote:
> Hi Sebatian,
> 
> > This will be used by Nokia's H4+ protocol, which
> > adds padding to packets to reach word alignment.
> > ---
> > drivers/bluetooth/hci_h4.c   | 10 ++
> > drivers/bluetooth/hci_uart.h |  1 +
> > 2 files changed, 11 insertions(+)
> > 
> > diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
> > index 635597b6e168..a934e4eb692b 100644
> > --- a/drivers/bluetooth/hci_h4.c
> > +++ b/drivers/bluetooth/hci_h4.c
> > @@ -253,11 +253,21 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, 
> > struct sk_buff *skb,
> > }
> > 
> > if (!dlen) {
> > +   if ((&pkts[i])->wordaligned && !(skb->len % 2)) 
> > {
> > +   buffer++;
> > +   count--;
> > +   }
> > +
> > /* No more data, complete frame */
> > (&pkts[i])->recv(hdev, skb);
> > skb = NULL;
> > }
> > } else {
> > +   if ((&pkts[i])->wordaligned && !(skb->len % 2)) {
> > +   buffer++;
> > +   count--;
> > +   }
> > +
> > /* Complete frame */
> > (&pkts[i])->recv(hdev, skb);
> > skb = NULL;
> > diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
> > index 839bad1d8152..a7d67aec3632 100644
> > --- a/drivers/bluetooth/hci_uart.h
> > +++ b/drivers/bluetooth/hci_uart.h
> > @@ -121,6 +121,7 @@ struct h4_recv_pkt {
> > u8  loff;   /* Data length offset in header */
> > u8  lsize;  /* Data length field size */
> > u16 maxlen; /* Max overall packet length */
> > +   bool wordaligned;   /* packets are word aligned */
> 
> I wonder if not a u8 align would be a way better choice here. We
> set it to 1 for all existing packet types. And the Nokia driver
> can use 2 here.

Sounds less hacky than my approach. Also it made me notice, that my
code is not safe, since the buffer size is not checked. I will use
u8 align and fix the buffer size check.

-- Sebastian


signature.asc
Description: PGP signature


Re: [PATCH] drivers/iio/light/Kconfig: SENSORS_BH1780 cleanup

2016-08-16 Thread Linus Walleij
On Tue, Aug 16, 2016 at 8:27 AM, Valentin Rothberg
 wrote:

> Commit 7ef9153d9af5 ("misc: delete bh1780 driver") has removed the
> Kconfig option SENSORS_BH1780.  Remove the last reference on this
> option.
>
> Signed-off-by: Valentin Rothberg 
> ---
> I found the issue using scripts/checkkconfigsymbols.py

I didn't even know such a cool script existed, thanks for sweeping
up the floor after me!

Reviewed-by: Linus Walleij 

Yours,
Linus Walleij


Re: [RFC 5/7] Bluetooth: hci_nokia: Introduce new driver

2016-08-16 Thread Pali Rohár
On Tuesday 16 August 2016 09:02:14 Marcel Holtmann wrote:
> > +static int nokia_setup_fw(struct hci_uart *hu)
> > +{
> > +   struct nokia_bt_dev *btdev = hu->priv;
> > +   const struct firmware *fw;
> > +   const u8 *fw_ptr;
> > +   size_t fw_size;
> > +   int err;
> > +
> > +   BT_DBG("hu %p", hu);
> > +
> > +   err = request_firmware(&fw, nokia_get_fw_name(btdev), hu->tty->dev);
> 
> So does this nokia_get_fw_name really needs to be a separate function? Or can 
> this just be done right here in this function? I prefer it to be done where 
> it is actually used. Unless you use that name in many places.
> 
> > +   if (err < 0) {
> > +   BT_ERR("%s: Failed to load Nokia firmware file (%d)",
> > +  hu->hdev->name, err);
> > +   return err;
> > +   }
> > +
> > +   fw_ptr = fw->data;
> > +   fw_size = fw->size;
> > +
> > +   while (fw_size >= 4) {
> > +   u16 pkt_size = get_unaligned_le16(fw_ptr);
> > +   u8 pkt_type = fw_ptr[2];
> > +   const struct hci_command_hdr *cmd;
> > +   u16 opcode;
> > +   struct sk_buff *skb;
> > +
> > +   switch (pkt_type) {
> > +   case HCI_COMMAND_PKT:
> > +   cmd = (struct hci_command_hdr *)(fw_ptr + 3);
> > +   opcode = le16_to_cpu(cmd->opcode);
> > +
> > +   skb = __hci_cmd_sync(hu->hdev, opcode, cmd->plen,
> > +fw_ptr + 3 + HCI_COMMAND_HDR_SIZE,
> > +HCI_INIT_TIMEOUT);
> > +   if (IS_ERR(skb)) {
> > +   err = PTR_ERR(skb);
> > +   BT_ERR("%s: Firmware command %04x failed (%d)",
> > +  hu->hdev->name, opcode, err);
> > +   goto done;
> > +   }
> > +   kfree_skb(skb);
> > +   break;
> > +   case HCI_NOKIA_RADIO_PKT:
> 
> Are you sure you can ignore the RADIO_PKT commands. They are used to set up 
> the FM radio parts of the chip. They are standard HCI commands (in the case 
> of Broadcom at least). At minimum it should be added a comment here that you 
> are ignoring them on purpose.
> 
> > +   case HCI_NOKIA_NEG_PKT:
> > +   case HCI_NOKIA_ALIVE_PKT:
> 
> And here I would also a comment on why are we ignore these commands and 
> driving this all by ourselves.
> 

Good question... In Pavel's version of bluetooth driver, which is
working on Nokia N900, is sent whole firmware at one __hci_cmd_sync
step. It does not skip any packets, plus he added this comment:

/* Note that this is timing-critical. If sending packets takes
 * too long, initialization will fail.
 */

So really, can we skip those packets? And is not this reason why
this bluetooth driver does not work on Nokia N900?

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


[PATCH] hwmon: (max6650) Allow fan shutdown and a more intuitive mode interface

2016-08-16 Thread Mike Looijmans
The fan can be stopped by writing "0" to fan1_target in sysfs.

Writing non-zero values to fan1_target or pwm1 in sysfs automatically
selects the corresponding control mode (closed or open loop).

This allows userspace applications to control the fan speed without
the need to know specific details of the controller (like the fact
that fan1_target does not take effect when pwm1_enable is set to
anything but "2"). Early initialization of the fan controller prevents
overheating, for example when resetting the board while the fan was
completely turned off.

Signed-off-by: Mike Looijmans 
---
This patch requires the devicetree support patch for the max6650.

Changes the functionality and interface of the driver, to be able to
initialize the chip at boot, and allows userspace control without
requiring hardware knowledge.

 .../devicetree/bindings/hwmon/max6650.txt  |   5 +
 Documentation/hwmon/max6650|   5 +-
 drivers/hwmon/max6650.c| 153 +
 3 files changed, 106 insertions(+), 57 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/max6650.txt 
b/Documentation/devicetree/bindings/hwmon/max6650.txt
index 2e46e69..724ab3a 100644
--- a/Documentation/devicetree/bindings/hwmon/max6650.txt
+++ b/Documentation/devicetree/bindings/hwmon/max6650.txt
@@ -13,6 +13,10 @@ Optional properties, default is to retain the chip's current 
setting:
 - maxim,fan-prescale  : Pre-scaling value, as per datasheet [1]. Lower values
allow more fine-grained control of slower fans.
Valid: 1, 2, 4, 8, 16.
+- maxim,fan-target-rpm: Initial requested fan rotation speed. If specified, the
+   driver selects closed-loop mode and the requested speed.
+   This ensures the fan is already running before userspace
+   takes over.
 
 Example:
fan-max6650: max6650@1b {
@@ -20,4 +24,5 @@ Example:
compatible = "maxim,max6650";
maxim,fan-microvolt = <1200>;
maxim,fan-prescale = <4>;
+   maxim,fan-target-rpm = <1200>;
};
diff --git a/Documentation/hwmon/max6650 b/Documentation/hwmon/max6650
index 58d9644..53e308b 100644
--- a/Documentation/hwmon/max6650
+++ b/Documentation/hwmon/max6650
@@ -33,9 +33,12 @@ fan2_input   ro  "
 fan3_input ro  "
 fan4_input ro  "
 fan1_targetrw  desired fan speed in RPM (closed loop mode only)
+   Set to 0 to stop the fan. Writing any other value sets
+   the regulator mode to "closed loop".
 pwm1_enablerw  regulator mode, 0=full on, 1=open loop, 2=closed loop
 pwm1   rw  relative speed (0-255), 255=max. speed.
-   Used in open loop mode only.
+   Set to 0 to stop the fan. Writing any other value sets
+   the regulator mode to "open loop".
 fan1_div   rw  sets the speed range the inputs can handle. Legal
values are 1, 2, 4, and 8. Use lower values for
faster fans.
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 6beb62c..d40756a 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -185,6 +185,35 @@ static struct max6650_data *max6650_update_device(struct 
device *dev)
return data;
 }
 
+static bool max6650_is_powerdown(const struct max6650_data *data)
+{
+   return (data->config & MAX6650_CFG_MODE_MASK) == MAX6650_CFG_MODE_OFF;
+}
+
+/*
+ * Change the operating mode of the chip (if needed).
+ * mode is one of the MAX6650_CFG_MODE_* values.
+ */
+static int max6650_set_operating_mode(struct max6650_data *data, u8 mode)
+{
+   int result;
+   u8 config = data->config;
+
+   if (mode == (config & MAX6650_CFG_MODE_MASK))
+   return 0;
+
+   config = (config & ~MAX6650_CFG_MODE_MASK) | mode;
+
+   result = i2c_smbus_write_byte_data(data->client, MAX6650_REG_CONFIG,
+  config);
+   if (result < 0)
+   return result;
+
+   data->config = config;
+
+   return 0;
+}
+
 static ssize_t get_fan(struct device *dev, struct device_attribute *devattr,
   char *buf)
 {
@@ -258,26 +287,26 @@ static ssize_t get_target(struct device *dev, struct 
device_attribute *devattr,
 *FanSpeed = KSCALE x fCLK / [256 x (KTACH + 1)]
 *
 * then multiply by 60 to give rpm.
+*
+* When not running, report target to be "0".
 */
 
-   kscale = DIV_FROM_REG(data->config);
-   ktach = data->speed;
-   rpm = 60 * kscale * clock / (256 * (ktach + 1));
+   if (max6650_is_powerdown(data))
+   rpm = 0;
+   else {
+   kscale = DIV_FROM_REG(data->config);
+   ktach = data->speed;
+   rpm = 60 * kscale * clock / (256 *

Re: [PATCH] befs: return BEFS_ERR if validation of ag_shift fails

2016-08-16 Thread Salah Triki
On Fri, Aug 12, 2016 at 12:00:34PM +0100, Luis de Bethencourt wrote:
> On 12/08/16 11:12, Salah Triki wrote:
> > ag_shift is used by blockno2iaddr() to get allocation group number
> > from block. If ag_shift is inconsistent with block_per_ag, an out of
> > bounds allocation group may occur [1]. So add return BEFS_ERR and update
> > comment and error message to reflect this change.
> > 
> > [1] https://lkml.org/lkml/2016/8/12/42
> > 
> > Signed-off-by: Salah Triki 
> > ---
> >  fs/befs/super.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/befs/super.c b/fs/befs/super.c
> > index 7c50025..2e3a3fd 100644
> > --- a/fs/befs/super.c
> > +++ b/fs/befs/super.c
> > @@ -101,10 +101,13 @@ befs_check_sb(struct super_block *sb)
> >  
> >  
> > /* ag_shift also encodes the same information as blocks_per_ag in a
> > -* different way, non-fatal consistency check
> > +* different way as a consistency check.
> >  */
> > -   if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag)
> > -   befs_error(sb, "ag_shift disagrees with blocks_per_ag.");
> > +   if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag) {
> > +   befs_error(sb, "ag_shift disagrees with blocks_per_ag. "
> > +  "Corruption likely.");
> > +   return BEFS_ERR;
> > +   }
> >  
> > if (befs_sb->log_start != befs_sb->log_end ||
> > befs_sb->flags == BEFS_DIRTY) {
> > 
> 
> Hi Salah,
> 
> I initially also added the BEFS_ERR return for this check. I understand
> it makes sense.
> 
> But as I mentioned in the patch adding this warning [0], a correct
> blocks_per_ag isn't mandatory. I noticed this because BeFS images
> created by Haiku OS just set blocks_per_ag to 1. Which is clearly not
> what it should be.
> 
> The file systems created by Haiku OS can be read without issues since
> sb->blocks_per_ag isn't actually used in lookups/reading file datastreams.
> 
> This is what I get in dmesg when loading a Haiku OS image with
> CONFIG_BEFS_DEBUG on:
> ...
> [  196.376651] befs: (loop1):   blocks_per_ag 1
> [  196.376652] befs: (loop1):   ag_shift 14
> ...
> 
> With ag_shift of 14, blocks_per_ag should be 16,384.
> 
> If we return BEFS_ERR, the system will refuse to mount and users won't be
> able to read these Haiku OS images they could read before. Unfortunate that
> Haiku OS is not using blocks_per_ag properly, but users and avoiding
> regressions go first.
> 
> Which BeFS images are you using to test the befs code? Since all the ones
> I have are generated from Haiku OS, all of them have a bad blocks_per_ag.
> LOL
> 
> Maybe we should contact Haiku OS developers and ask them to write a correct
> blocks_per_ag. Though we should also support images created before they fix
> this.
> 
> Sorry you spent time on this when the issue is out of our control :(
> Nacked-by: Luis de Bethencourt 
> 
> Thanks,
> Luis
> 
> [0] https://lkml.org/lkml/2016/8/9/816

Hi Luis,

>  but users and avoiding regressions go first.

Indeed, you are right to stress the importance of users and avoiding
regressions.

> Which BeFS images are you using to test the befs code? 

http://befs-driver.sourceforge.net/

> Maybe we should contact Haiku OS developers and ask them to write a correct
> blocks_per_ag. 

Yes, it is a good idea.

Thanks,
Salah


Re: [bisected] "sched: Allow per-cpu kernel threads to run on online && !active" causes warning

2016-08-16 Thread Heiko Carstens
Hi Tejun,

> On Mon, Aug 15, 2016 at 01:19:08PM +0200, Heiko Carstens wrote:
> > I can imagine several ways to fix this for s390, but before doing that I'm
> > wondering if the workqueue code is correct with
> > 
> > a) assuming that the cpu_to_node() mapping is valid for all _possible_ cpus
> >that early
> 
> This can be debatable and making it "first registration sticks" is
> likely easy enough.
> 
> > and
> > 
> > b) that the cpu_to_node() mapping does never change
> 
> However, this part isn't just from workqueue.  It just hits in a more
> obvious way.  For example, memory allocation has the same problem and
> we would have to synchronize memory allocations against cpu <-> node
> mapping changing.  It'd be silly to add the complexity and overhead of
> making the mapping dynamic when that there's nothing inherently
> dynamic about it.  The surface area is pretty big here.
> 
> I have no idea how s390 fakenuma works.  Is that very difficult from
> x86's?  IIRC, x86's fakenuma isn't all that dynamic.

I'm not asking to make the cpu <-> node completely dynamic. We have already
code in place to keep the cpu <-> node mapping static, however currently
this happens too late, but can be fixed quite easily.

Unfortunately we do not always know to which node a cpu belongs when we
register it, currently all cpus will be registered to node 0 and only when
a cpu is brought online this will be corrected.

The problem we have are "standby" cpus on s390, for which we know they are
present but can't use them currently. The mechanism is the following:

We detect a standby cpu and register it via register_cpu(); since the node
isn't known yet for this cpu, the cpu_to_node() function will return 0,
therefore all standby cpus will be registered under node 0.

The new standby cpu will have a "configure" sysfs attribute. If somebody
writes "1" to it we signal the hypervisor that we want to use the cpu and
it allocates one. If this request succeeds we finally know where the cpu is
located topology wise and can fix up everything (and can also make the cpu
to node mapping static).
Note: as long as cpu isn't configured it cannot be brought online.

If the cpu now is finally brought online the change_cpu_under_node() code
within drivers/base/cpu.c fixes up the node symlinks so at least the sysfs
representation is also correct.

If later on the cpu is brought offline, deconfigured, etc. we do not change
the cpu_to_node mapping anymore.

So the question is how to define "first registration sticks". :)



Re: [patch 4 14/22] timer: Switch to a non cascading wheel

2016-08-16 Thread Richard Cochran
On Fri, Aug 12, 2016 at 01:50:16PM -0400, Rik van Riel wrote:
> Could that cause the new timer wheel code to skip over
> timer buckets occasionally, or is this hypothesis bunk?

The new wheel is not different from the old one in this respect.  Each
base keeps its own jiffies counter.  When returning from a long sleep,
the base counter can be behind the current jiffies value by more than
one.  In __run_timers() we loop through all the missed jiffies:

while (time_after_eq(jiffies, base->clk)) {

levels = collect_expired_timers(base, heads);
base->clk++;

while (levels--)
expire_timers(base, heads + levels);
}

So the hypothesis is incorrect.

Thanks,
Richard


Re: [LKP] [lkp] [sctp] a6c2f79287: netperf.Throughput_Mbps -37.2% regression

2016-08-16 Thread Xin Long
>
> I'm testing on Linus' master, can we all use that please?
>

[git] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

[mechine]
Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
mem 62G (66000220K)

[system]
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 Beta (Maipo)

[commit 3684b03]
[root@hp-dl380pg8-11 lxin]# uname -r
4.8.0-rc2.3684b03
[root@hp-dl380pg8-11 lxin]# cat test.sh
killall -0 netserver || netserver -4 &
netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 127.0.0.1
[root@hp-dl380pg8-11 lxin]# sh test.sh
SCTP 1-TO-MANY STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
127.0.0.1 () port 0 AF_INET
Recv   SendSend  Utilization   Service Demand
Socket Socket  Message  Elapsed  Send Recv SendRecv
Size   SizeSize Time Throughput  localremote   local   remote
bytes  bytes   bytessecs.10^6bits/s  % S  % S  us/KB   us/KB

212992 212992  10240300.00 16914.99   3.28 3.28 0.636   0.636

[commit f959fb4]
[root@localhost lxin]# uname -r
4.7.0-rc6.f959fb4
[root@localhost lxin]# cat test.sh
killall -0 netserver || netserver -4 &
netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 127.0.0.1
[root@localhost lxin]# sh test.sh
SCTP 1-TO-MANY STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
127.0.0.1 () port 0 AF_INET
Recv   SendSend  Utilization   Service Demand
Socket Socket  Message  Elapsed  Send Recv SendRecv
Size   SizeSize Time Throughput  localremote   local   remote
bytes  bytes   bytessecs.10^6bits/s  % S  % S  us/KB   us/KB

212992 212992  10240300.00 12975.32   3.35 3.35 0.847   0.846


Still, in my env, the latest kernel is better than old one.
Sorry, I'm not sure why it's so different in your env.

Could you do 'netperf' test manually, instead of lkp-tests, then check again.
Pls show you system's distros as well, like rhel, ubuntu or arch ?


Re: [PATCH v7 4/4] nmi_backtrace: generate one-line reports for idle cpus

2016-08-16 Thread Petr Mladek
On Mon 2016-08-15 12:41:54, Chris Metcalf wrote:
> On 8/11/2016 11:25 AM, Petr Mladek wrote:
> >On Mon 2016-08-08 12:03:38, Chris Metcalf wrote:
> When doing an nmi backtrace of many cores, most of which are idle,
> the output is a little overwhelming and very uninformative.  Suppress
> messages for cpus that are idling when they are interrupted and just
> emit one line, "NMI backtrace for N skipped: idling at pc 0xNNN".
> >Hmm, the problem is that native_safe_halt() is called from default_idle()
> >here. The function is marked as inline but the compiler did not inline
> >it.
> >
> >It helped me to put native_safe_halt() into the __cpuidle_text section:
> 
> Following Peter Z's suggestion, I have added an __always_inline marker
> to native_safe_halt.  For consistency, I also did arch_safe_halt(), since that
> invokes native_safe_halt, and then also native_halt() and halt(), so that
> we're not being weirdly inconsistent with markings for halt inlines.
> 
> There are also the native_irq_enable(), etc., accessors in that same header
> that are still only marked "inline" not "always_inline", but I wanted to stop
> before I was touching too much unrelated code.

Sounds fine.

> >I wonder if it would be possible to detect the idle thread an other
> >way. For example, I wonder if it would be enough to check for the
> >PID 0.
> 
> No, the problem is that pid 0 can also go off and run "interesting" code
> for things like power management, etc., so we really just want to
> focus on being quite sure that the running code isn't interesting before
> we suppress the backtrace information.
> 
> See the thread around here:
> 
> https://lkml.kernel.org/r/20160307204317.gr6...@twins.programming.kicks-ass.net

Makes sense. Thanks for the poitner.

Best Regards,
Petr


Re: [PATCH v6 1/3] PCI: Add Precision Time Measurement (PTM) support

2016-08-16 Thread Yong, Jonathan
On 08/16/2016 02:59, Bjorn Helgaas wrote:
> 
> I guess I was hoping you could test these patches.  Do you have any
> way to do that?
> 

No real hardware with this feature yet, so testing is entirely on software.

> I rebased them and pushed them to pci/ptm.  If everything looks good,
> I'll merge them for v4.9.
> 
> Bjorn
> 

Looks like there is still this compile warning to fix:
http://patchwork.ozlabs.org/patch/634825/



[PATCH V2] block: Fix secure erase

2016-08-16 Thread Adrian Hunter
Commit 288dab8a35a0 ("block: add a separate operation type for secure
erase") split REQ_OP_SECURE_ERASE from REQ_OP_DISCARD without considering
all the places REQ_OP_DISCARD was being used to mean either. Fix those.

Signed-off-by: Adrian Hunter 
Fixes: 288dab8a35a0 ("block: add a separate operation type for secure erase")
---


Changes in V2:
In elv_dispatch_sort() don't allow requests with different ops to pass
one another.


 block/bio.c  | 21 +++--
 block/blk-merge.c| 33 +++--
 block/elevator.c |  2 +-
 drivers/mmc/card/block.c |  1 +
 drivers/mmc/card/queue.c |  3 ++-
 drivers/mmc/card/queue.h |  4 +++-
 include/linux/bio.h  | 10 --
 include/linux/blkdev.h   |  6 --
 kernel/trace/blktrace.c  |  2 +-
 9 files changed, 50 insertions(+), 32 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index f39477538fef..aa7354088008 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -667,18 +667,19 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t 
gfp_mask,
bio->bi_iter.bi_sector  = bio_src->bi_iter.bi_sector;
bio->bi_iter.bi_size= bio_src->bi_iter.bi_size;
 
-   if (bio_op(bio) == REQ_OP_DISCARD)
-   goto integrity_clone;
-
-   if (bio_op(bio) == REQ_OP_WRITE_SAME) {
+   switch (bio_op(bio)) {
+   case REQ_OP_DISCARD:
+   case REQ_OP_SECURE_ERASE:
+   break;
+   case REQ_OP_WRITE_SAME:
bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0];
-   goto integrity_clone;
+   break;
+   default:
+   bio_for_each_segment(bv, bio_src, iter)
+   bio->bi_io_vec[bio->bi_vcnt++] = bv;
+   break;
}
 
-   bio_for_each_segment(bv, bio_src, iter)
-   bio->bi_io_vec[bio->bi_vcnt++] = bv;
-
-integrity_clone:
if (bio_integrity(bio_src)) {
int ret;
 
@@ -1788,7 +1789,7 @@ struct bio *bio_split(struct bio *bio, int sectors,
 * Discards need a mutable bio_vec to accommodate the payload
 * required by the DSM TRIM and UNMAP commands.
 */
-   if (bio_op(bio) == REQ_OP_DISCARD)
+   if (bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_SECURE_ERASE)
split = bio_clone_bioset(bio, gfp, bs);
else
split = bio_clone_fast(bio, gfp, bs);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 3eec75a9e91d..72627e3cf91e 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -172,12 +172,18 @@ void blk_queue_split(struct request_queue *q, struct bio 
**bio,
struct bio *split, *res;
unsigned nsegs;
 
-   if (bio_op(*bio) == REQ_OP_DISCARD)
+   switch (bio_op(*bio)) {
+   case REQ_OP_DISCARD:
+   case REQ_OP_SECURE_ERASE:
split = blk_bio_discard_split(q, *bio, bs, &nsegs);
-   else if (bio_op(*bio) == REQ_OP_WRITE_SAME)
+   break;
+   case REQ_OP_WRITE_SAME:
split = blk_bio_write_same_split(q, *bio, bs, &nsegs);
-   else
+   break;
+   default:
split = blk_bio_segment_split(q, *bio, q->bio_split, &nsegs);
+   break;
+   }
 
/* physical segments can be figured out during splitting */
res = split ? split : *bio;
@@ -213,7 +219,7 @@ static unsigned int __blk_recalc_rq_segments(struct 
request_queue *q,
 * This should probably be returning 0, but blk_add_request_payload()
 * (Christoph)
 */
-   if (bio_op(bio) == REQ_OP_DISCARD)
+   if (bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_SECURE_ERASE)
return 1;
 
if (bio_op(bio) == REQ_OP_WRITE_SAME)
@@ -385,7 +391,9 @@ static int __blk_bios_map_sg(struct request_queue *q, 
struct bio *bio,
nsegs = 0;
cluster = blk_queue_cluster(q);
 
-   if (bio_op(bio) == REQ_OP_DISCARD) {
+   switch (bio_op(bio)) {
+   case REQ_OP_DISCARD:
+   case REQ_OP_SECURE_ERASE:
/*
 * This is a hack - drivers should be neither modifying the
 * biovec, nor relying on bi_vcnt - but because of
@@ -393,19 +401,16 @@ static int __blk_bios_map_sg(struct request_queue *q, 
struct bio *bio,
 * a payload we need to set up here (thank you Christoph) and
 * bi_vcnt is really the only way of telling if we need to.
 */
-
-   if (bio->bi_vcnt)
-   goto single_segment;
-
-   return 0;
-   }
-
-   if (bio_op(bio) == REQ_OP_WRITE_SAME) {
-single_segment:
+   if (!bio->bi_vcnt)
+   return 0;
+   /* Fall through */
+   case REQ_OP_WRITE_SAME:
*sg = sglist;
bvec = bio_iovec(bio);
sg_set_page(*sg, bvec.bv_page, bvec.bv_len, bvec.bv_offset);
return 1;
+   def

Re: [PATCH 2/7] Documentation: bindings: Add Exynos5433 PMU compatible

2016-08-16 Thread Chanwoo Choi
Hi Krzysztof,

On 2016년 08월 16일 16:40, Krzysztof Kozlowski wrote:
> On 08/16/2016 08:27 AM, Chanwoo Choi wrote:
>> This patch adds the exynos5433 PMU compatible to support the access
>> of PMU (Power Management Unit) block.
>>
>> Cc: Kukjin Kim 
>> Cc: Krzysztof Kozlowski 
>> Cc: Rob Herring 
>> Cc: Mark Rutland 
>> Signed-off-by: Chanwoo Choi 
>> ---
>>  Documentation/devicetree/bindings/arm/samsung/pmu.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/samsung/pmu.txt 
>> b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
>> index 2d6356d8daf4..bf5fc59a6938 100644
>> --- a/Documentation/devicetree/bindings/arm/samsung/pmu.txt
>> +++ b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
>> @@ -10,6 +10,7 @@ Properties:
>> - "samsung,exynos5260-pmu" - for Exynos5260 SoC.
>> - "samsung,exynos5410-pmu" - for Exynos5410 SoC,
>> - "samsung,exynos5420-pmu" - for Exynos5420 SoC.
>> +   - "samsung,exynos5433-pmu" - for Exynos5433 SoC.
>> - "samsung,exynos7-pmu" - for Exynos7 SoC.
>>  second value must be always "syscon".
> 
> Is there any plan to add Exynos5433 support to
> drivers/soc/samsung/exynos-pmu.c? If no... then exynos7-pmu might be
> reused. If yes, then this makes sense.

Yes.
I'll support the suspend-to-ram for Exynos5433. But it is not right now.
because the current kernel support the suspend-to-ram for only 32-bit Exynos.
and the pm/suspend code are included in in arch/arm/mach-exynos/.

To support the suspend-to-ram for 64bit Exynos, I need a lot of time
to support the 64-bit suspend.

Regards,
Chanwoo Choi



Re: [RFC 5/7] Bluetooth: hci_nokia: Introduce new driver

2016-08-16 Thread Marcel Holtmann
Hi Sebastien,

> diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
> index a7d67aec3632..314b243df996 100644
> --- a/drivers/bluetooth/hci_uart.h
> +++ b/drivers/bluetooth/hci_uart.h
> @@ -35,7 +35,7 @@
> #define HCIUARTGETFLAGS   _IOR('U', 204, int)
> 
> /* UART protocols */
> -#define HCI_UART_MAX_PROTO   10
> +#define HCI_UART_MAX_PROTO   11
> 
> #define HCI_UART_H4   0
> #define HCI_UART_BCSP 1
> @@ -47,6 +47,7 @@
> #define HCI_UART_BCM  7
> #define HCI_UART_QCA  8
> #define HCI_UART_AG6XX9
> +#define HCI_UART_NOKIA   10

since it seems the driver is getting closer to be ready, lets merge this extra 
protocol identifier as a separate patch. Then we can adapt btattach as well for 
it.

Regards

Marcel



Re: musb: am3358: having problem with high-speed on usb1 at peripheral

2016-08-16 Thread Ayaka


從我的 iPad 傳送

> Felipe Balbi  於 2016年8月16日 下午3:10 寫道:
> 
> 
> Hi,
> 
> ayaka  writes:
>>> On 08/13/2016 01:44 AM, Greg KH wrote:
 On Sat, Aug 13, 2016 at 12:38:46AM +0800, ayaka wrote:
 
> On 08/12/2016 03:40 PM, Greg KH wrote:
>> On Fri, Aug 12, 2016 at 10:23:15AM +0800, ayaka wrote:
>> Hello all:
>>I recently add a support for customize am3358 board using the branch
>> processor-sdk-linux-03.00.00 from Ti git. But I meet a problem with musb
>> at the peripheral mode.
> Then you are going to have to get support from TI for this, nothing we
> can do here about random vendor kernel trees, sorry.
> 
> If you can use the 4.7 tree, or better yet, the 4.8-rc tree, then we
 I have tried the 4.8-rc1, I meet the same problem.
>>> What problem is that exactly?
>> Sorry, the USB1 can't work at high speed gadget mode and have DMA problem.
>> musb-hdrc musb-hdrc.0.auto: Failed to request rx1.
>> musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
> 
> -517 is EPROBE_DEFER. Most likely DMA hasn't probed and MUSB is
> deferring to try later. This does _NOT_ MUSB can't work with
> DMA. Perhaps you didn't enable support for MUSB's DMA engine.
> 
I have set the status of cppi41dma to okay in dts. And CONFIG_USB_TI_CPPI41_DMA,
CONFIG_TI_CPPI41 and CONFIG_TI_EDMA are enabled with build into kernel.

Anything else I should do?
> -- 
> balbi



[GIT PULL] pin control fixes for the v4.8 series

2016-08-16 Thread Linus Walleij
Hi Linus,

here are a few pin control fixes for the v4.8 series, nothing
special about them.

Please pull them in!

Yours,
Linus Walleij

The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:

  Linux 4.8-rc1 (2016-08-07 18:18:00 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
tags/pinctrl-v4.8-2

for you to fetch changes up to e95d0dfb229fffe96dc4c29054f6c7a7302e111e:

  pinctrl: intel: merrifield: Add missed header (2016-08-10 15:46:28 +0200)


Pin control fixes for the v4.8 series:

- Add the missing  header to the Intel Merrifield
  driver to get rid of build mess.

- Drop two instances of pinctrl_unregister() called for drivers
  using devm_* resource management.

- Remove the default debounce time for the AMD driver.


Agrawal, Nitesh-kumar (1):
  pinctrl/amd: Remove the default de-bounce time

Andy Shevchenko (1):
  pinctrl: intel: merrifield: Add missed header

Wei Yongjun (2):
  pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
  pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device

 drivers/pinctrl/intel/pinctrl-merrifield.c |  1 +
 drivers/pinctrl/meson/pinctrl-meson.c  |  8 +---
 drivers/pinctrl/pinctrl-amd.c  | 20 
 drivers/pinctrl/pinctrl-pistachio.c|  9 +
 4 files changed, 3 insertions(+), 35 deletions(-)


Re: include/linux/io-mapping.h:130:39: error: implicit declaration of function 'ioremap_wc'

2016-08-16 Thread Linus Walleij
On Mon, Aug 15, 2016 at 5:08 PM, kbuild test robot
 wrote:

> FYI, the error/warning still remains.

> commit: 7d4defe21c682c934a19fce1ba8b54b7bde61b08 gpio: include 
>  in gpiolib-of
> config: um-allmodconfig (attached as .config)

I think I've finally fixed this now by making OF_GPIO depend on !NO_IOMEM.

Yours,
Linus Walleij


Re: [RFC 1/7] tty: serial: omap: add UPF_BOOT_AUTOCONF flag for DT init

2016-08-16 Thread Sebastian Reichel
Hi,

On Sun, Aug 14, 2016 at 10:49:56AM +0200, Pavel Machek wrote:
> It would be nice to have a line about why it is needed,
> unfortunately include/linux/serial_core.h is not exactly helpful.
>
> Plus you'll need to sign off the patch.

I should have had another look at the long patch
descriptions before sending the patchset ;)

-- Sebastian


signature.asc
Description: PGP signature


[PATCH 1/2] mfd: mc13xxx: constify mc13xxx_variant

2016-08-16 Thread LABBE Corentin
The mc13xxx_variant structure is never modified, this patch set it as
const.

Signed-off-by: LABBE Corentin 
---
 drivers/mfd/mc13xxx-core.c | 6 +++---
 drivers/mfd/mc13xxx-i2c.c  | 2 +-
 drivers/mfd/mc13xxx-spi.c  | 2 +-
 drivers/mfd/mc13xxx.h  | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index d7f54e4..3a008e6 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -202,19 +202,19 @@ static void mc34708_print_revision(struct mc13xxx 
*mc13xxx, u32 revision)
 }
 
 /* These are only exported for mc13xxx-i2c and mc13xxx-spi */
-struct mc13xxx_variant mc13xxx_variant_mc13783 = {
+const struct mc13xxx_variant mc13xxx_variant_mc13783 = {
.name = "mc13783",
.print_revision = mc13xxx_print_revision,
 };
 EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
 
-struct mc13xxx_variant mc13xxx_variant_mc13892 = {
+const struct mc13xxx_variant mc13xxx_variant_mc13892 = {
.name = "mc13892",
.print_revision = mc13xxx_print_revision,
 };
 EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
 
-struct mc13xxx_variant mc13xxx_variant_mc34708 = {
+const struct mc13xxx_variant mc13xxx_variant_mc34708 = {
.name = "mc34708",
.print_revision = mc34708_print_revision,
 };
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 67e4c9a..3c00ccb 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -82,7 +82,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
of_match_device(mc13xxx_dt_ids, &client->dev);
mc13xxx->variant = of_id->data;
} else {
-   mc13xxx->variant = (void *)id->driver_data;
+   mc13xxx->variant = (const struct mc13xxx_variant 
*)id->driver_data;
}
 
return mc13xxx_common_init(&client->dev);
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index cbc1e5e..6100025 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -162,7 +162,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
} else {
const struct spi_device_id *id_entry = spi_get_device_id(spi);
 
-   mc13xxx->variant = (void *)id_entry->driver_data;
+   mc13xxx->variant = (const struct mc13xxx_variant 
*)id_entry->driver_data;
}
 
return mc13xxx_common_init(&spi->dev);
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index 33677d1..6d7fce5 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -24,7 +24,7 @@ struct mc13xxx_variant {
void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
 };
 
-extern struct mc13xxx_variant
+extern const struct mc13xxx_variant
mc13xxx_variant_mc13783,
mc13xxx_variant_mc13892,
mc13xxx_variant_mc34708;
-- 
2.7.3



[PATCH 2/2] mfd: mc13xxx: fix a possible NULL dereference

2016-08-16 Thread LABBE Corentin
of_match_device could return NULL, and so cause a NULL pointer
dereference later.
For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.

Reported-by: coverity (CID 986513)
Reported-by: coverity (CID 986514)
Signed-off-by: LABBE Corentin 
---
 drivers/mfd/mc13xxx-i2c.c | 4 +---
 drivers/mfd/mc13xxx-spi.c | 5 +
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 3c00ccb..8ad7593 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -78,9 +78,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
}
 
if (client->dev.of_node) {
-   const struct of_device_id *of_id =
-   of_match_device(mc13xxx_dt_ids, &client->dev);
-   mc13xxx->variant = of_id->data;
+   mc13xxx->variant = of_device_get_match_data(&client->dev);
} else {
mc13xxx->variant = (const struct mc13xxx_variant 
*)id->driver_data;
}
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 6100025..3b4f5ba 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -155,10 +155,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
}
 
if (spi->dev.of_node) {
-   const struct of_device_id *of_id =
-   of_match_device(mc13xxx_dt_ids, &spi->dev);
-
-   mc13xxx->variant = of_id->data;
+   mc13xxx->variant = of_device_get_match_data(&spi->dev);
} else {
const struct spi_device_id *id_entry = spi_get_device_id(spi);
 
-- 
2.7.3



Re: [PATCH 2/7] Documentation: bindings: Add Exynos5433 PMU compatible

2016-08-16 Thread Krzysztof Kozlowski
On 08/16/2016 10:08 AM, Chanwoo Choi wrote:
> Hi Krzysztof,
> 
> On 2016년 08월 16일 16:40, Krzysztof Kozlowski wrote:
>> On 08/16/2016 08:27 AM, Chanwoo Choi wrote:
>>> This patch adds the exynos5433 PMU compatible to support the access
>>> of PMU (Power Management Unit) block.
>>>
>>> Cc: Kukjin Kim 
>>> Cc: Krzysztof Kozlowski 
>>> Cc: Rob Herring 
>>> Cc: Mark Rutland 
>>> Signed-off-by: Chanwoo Choi 
>>> ---
>>>  Documentation/devicetree/bindings/arm/samsung/pmu.txt | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/arm/samsung/pmu.txt 
>>> b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
>>> index 2d6356d8daf4..bf5fc59a6938 100644
>>> --- a/Documentation/devicetree/bindings/arm/samsung/pmu.txt
>>> +++ b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
>>> @@ -10,6 +10,7 @@ Properties:
>>>- "samsung,exynos5260-pmu" - for Exynos5260 SoC.
>>>- "samsung,exynos5410-pmu" - for Exynos5410 SoC,
>>>- "samsung,exynos5420-pmu" - for Exynos5420 SoC.
>>> +  - "samsung,exynos5433-pmu" - for Exynos5433 SoC.
>>>- "samsung,exynos7-pmu" - for Exynos7 SoC.
>>> second value must be always "syscon".
>>
>> Is there any plan to add Exynos5433 support to
>> drivers/soc/samsung/exynos-pmu.c? If no... then exynos7-pmu might be
>> reused. If yes, then this makes sense.
> 
> Yes.
> I'll support the suspend-to-ram for Exynos5433. But it is not right now.
> because the current kernel support the suspend-to-ram for only 32-bit Exynos.
> and the pm/suspend code are included in in arch/arm/mach-exynos/.
> 
> To support the suspend-to-ram for 64bit Exynos, I need a lot of time
> to support the 64-bit suspend.

OK, make sense.

Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof


Re: drivers/pinctrl/intel/pinctrl-merrifield.c:518: error: implicit declaration of function 'readl'

2016-08-16 Thread Linus Walleij
On Mon, Aug 15, 2016 at 11:10 AM, Andy Shevchenko
 wrote:
> On Sun, 2016-08-14 at 08:05 +0800, kbuild test robot wrote:
>> Hi Andy,
>>
>> FYI, the error/warning still remains.
>
> Linus, can you apply the fix for next v4.8-rcX?

It's been applied for some time.

Sent a pull request to Torvalds now, too much to do, that's all :)

Yours,
Linus Walleij


Re: [PATCH v12 2/4] CMDQ: Mediatek CMDQ driver

2016-08-16 Thread Horng-Shyang Liao
Hi Matthias,

Sorry to disturb you.
Do you have any further comment on CMDQ v12?

Thanks.
HS

On Mon, 2016-08-08 at 16:31 +0800, HS Liao wrote:
> This patch is first version of Mediatek Command Queue(CMDQ) driver. The
> CMDQ is used to help write registers with critical time limitation,
> such as updating display configuration during the vblank. It controls
> Global Command Engine (GCE) hardware to achieve this requirement.
> Currently, CMDQ only supports display related hardwares, but we expect
> it can be extended to other hardwares for future requirements.
> 
> Signed-off-by: HS Liao 
> Signed-off-by: CK Hu 
> ---
>  drivers/soc/mediatek/Kconfig|  11 +
>  drivers/soc/mediatek/Makefile   |   1 +
>  drivers/soc/mediatek/mtk-cmdq.c | 948 
> 
>  include/soc/mediatek/cmdq.h | 179 
>  4 files changed, 1139 insertions(+)
>  create mode 100644 drivers/soc/mediatek/mtk-cmdq.c
>  create mode 100644 include/soc/mediatek/cmdq.h
> 
[...]



Re: [PATCH v6 2/8] arm: parse cpu capacity-dmips-mhz from DT

2016-08-16 Thread Vincent Guittot
Hi Juri,


On 19 July 2016 at 14:40, Juri Lelli  wrote:
> With the introduction of cpu capacity-dmips-mhz bindings, CPU capacities
> can now be calculated from values extracted from DT and information
> coming from cpufreq. Add parsing of DT information at boot time, and
> complement it with cpufreq information. We keep code that can produce
> same information, based on different DT properties and hard-coded
> values, as fall-back for backward compatibility.
>
> Caveat: the information provided by this patch will start to be used in
> the future. We need to #define arch_scale_cpu_capacity to something
> provided in arch, so that scheduler's default implementation (which gets
> used if arch_scale_cpu_capacity is not defined) is overwritten.
>
> Cc: Russell King 
> Signed-off-by: Juri Lelli 
> ---
>
> Changes from v1:
>   - normalize w.r.t. highest capacity found in DT
>   - bailout conditions (all-or-nothing)
>
> Changes from v4:
>   - parsing modified to reflect change in binding (capacity-dmips-mhz)
>
> Changes from v5:
>   - allocate raw_capacity array with kcalloc()
>   - pr_err() only for partial capacity information
> ---
>  arch/arm/kernel/topology.c | 145 
> -
>  1 file changed, 144 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
> index ec279d161b32..b3094e6eb1f5 100644
> --- a/arch/arm/kernel/topology.c
> +++ b/arch/arm/kernel/topology.c
> @@ -78,6 +78,134 @@ static unsigned long *__cpu_capacity;
>  #define cpu_capacity(cpu)  __cpu_capacity[cpu]
>
>  static unsigned long middle_capacity = 1;
> +static bool cap_from_dt = true;
> +static u32 *raw_capacity;
> +static bool cap_parsing_failed;
> +static u32 capacity_scale;
> +
> +static int __init parse_cpu_capacity(struct device_node *cpu_node, int cpu)
> +{
> +   int ret = 1;
> +   u32 cpu_capacity;
> +
> +   if (cap_parsing_failed)
> +   return !ret;
> +
> +   ret = of_property_read_u32(cpu_node,
> +  "capacity-dmips-mhz",
> +  &cpu_capacity);
> +   if (!ret) {
> +   if (!raw_capacity) {
> +   raw_capacity = kcalloc(num_possible_cpus(),
> +  sizeof(*raw_capacity),
> +  GFP_KERNEL);
> +   if (!raw_capacity) {
> +   pr_err("cpu_capacity: failed to allocate 
> memory for raw capacities\n");
> +   cap_parsing_failed = true;
> +   return !ret;
> +   }
> +   }
> +   capacity_scale = max(cpu_capacity, capacity_scale);
> +   raw_capacity[cpu] = cpu_capacity;
> +   pr_debug("cpu_capacity: %s cpu_capacity=%u (raw)\n",
> +   cpu_node->full_name, raw_capacity[cpu]);
> +   } else {
> +   if (raw_capacity) {
> +   pr_err("cpu_capacity: missing %s raw capacity\n",
> +   cpu_node->full_name);
> +   pr_err("cpu_capacity: partial information: fallback 
> to 1024 for all CPUs\n");
> +   }
> +   cap_parsing_failed = true;
> +   kfree(raw_capacity);
> +   }
> +
> +   return !ret;
> +}
> +
> +static void normalize_cpu_capacity(void)
> +{
> +   u64 capacity;
> +   int cpu;
> +
> +   if (!raw_capacity || cap_parsing_failed)
> +   return;
> +
> +   pr_debug("cpu_capacity: capacity_scale=%u\n", capacity_scale);
> +   for_each_possible_cpu(cpu) {
> +   capacity = (raw_capacity[cpu] << SCHED_CAPACITY_SHIFT)
> +   / capacity_scale;
> +   set_capacity_scale(cpu, capacity);
> +   pr_debug("cpu_capacity: CPU%d cpu_capacity=%lu\n",
> +   cpu, arch_scale_cpu_capacity(NULL, cpu));
> +   }
> +}
> +
> +#ifdef CONFIG_CPU_FREQ
> +static cpumask_var_t cpus_to_visit;
> +static bool cap_parsing_done;
> +
> +static int
> +init_cpu_capacity_callback(struct notifier_block *nb,
> +  unsigned long val,
> +  void *data)
> +{
> +   struct cpufreq_policy *policy = data;
> +   int cpu;
> +
> +   if (cap_parsing_failed || cap_parsing_done)
> +   return 0;
> +
> +   switch (val) {
> +   case CPUFREQ_NOTIFY:
> +   pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] 
> (to_visit=%*pbl)\n",
> +   cpumask_pr_args(policy->related_cpus),
> +   cpumask_pr_args(cpus_to_visit));
> +   cpumask_andnot(cpus_to_visit,
> +  cpus_to_visit,
> +  policy->related_cpus);
> +   for_each_cpu(cpu, policy->related_cpus) {
> +   raw_capaci

Re: [PATCH v2 1/2] ACPI/tables: Correct the wrong count increasing

2016-08-16 Thread Baoquan He
On 08/16/16 at 02:26am, Zheng, Lv wrote:
> Hi,
> 
> > From: linux-acpi-ow...@vger.kernel.org 
> > [mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Baoquan
> > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
> > index 9f0ad6e..34d45bb 100644
> > --- a/drivers/acpi/tables.c
> > +++ b/drivers/acpi/tables.c
> > @@ -281,7 +281,7 @@ acpi_parse_entries_array(char *id, unsigned long 
> > table_size,
> >  proc[i].handler(entry, table_end))
> > return -EINVAL;
> > 
> > -   proc->count++;
> > +   proc[i].count++;
> 
> Do we have code using acpi_subtable_proce.count?
> I think the answer is yes because of:
> [Patch] x86, ACPI: Fix the wrong assignment when Handle apic/x2apic entries
> 
> So why don't you put these 2 patches together into a single series?
> And help to validate if there are problems in other acpi_subtable_proce.count 
> users.

Thanks for comments. I hesitated to put them into one patch or two
patches when I post. Later I decided to post them in two patches because
they are in two components, one is x86, the other is ACPI. And though
very simple fix I worry they can't be described well in one patch log.

Anyway, change related to patch 1/2 had been included in Al Stone's
patchset posted earlier. So this one has to be NACKed.

> 
> Thanks
> Lv
> 
> > break;
> > }
> > if (i != proc_num)
> > --
> > 2.5.5
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3.14 42/79] drm/qxl: only report first monitor as connected if we have no state

2016-08-16 Thread Jiri Slaby
On 08/14/2016, 04:51 PM, Greg Kroah-Hartman wrote:
> On Fri, May 27, 2016 at 01:06:24PM +0200, Jiri Slaby wrote:
>> On 10/18/2015, 04:05 AM, Greg Kroah-Hartman wrote:
>>> 3.14-stable review patch.  If anyone has any objections, please let me know.
>>>
>>> --
>>>
>>> From: Dave Airlie 
>>>
>>> commit 69e5d3f893e19613486f300fd6e631810338aa4b upstream.
>>>
>>> If the server isn't new enough to give us state, report the first
>>> monitor as always connected, otherwise believe the server side.
>>
>> Hi,
>>
>> I've got a bug report, that this commit breaks 3.12-stable:
>> ===
>> While testing KDE5 packages which will be landing in Package Hub for
>> SP1, we found a issue with qxl drm driver in kernel.
>>
>> When booting SLES (or SLED) 12 SP1, in a libvirt KVM environment, with
>> QXL as video driver, KDE5 plasma was not rendered on screen, you could
>> only see mouse cursor.
>>
>> Booting with nomodeset=1 or qxl.modeset=0 fixes the issue.
>> ===
>>
>> Does it make sense? Is 3.12 missing some prerequisite? Or should we just
>> revert the commit in 3.12? And what about 3.14, 4.1?
> 
> What ever happened to this?  Did you revert this in 3.12-stable?

I forgot about this completely, so I took no action back then. Neither
was this reverted in SLE. Neither I saw any other report since then. And
given it was released in Nov 2015, perhaps, I won't do anything with
that, assuming this was kvm issue or something.

thanks,
-- 
js
suse labs


Re: [PATCH] ARM: s3c64xx: Delete unnecessary assignment for the field "owner"

2016-08-16 Thread Charles Keepax
On Mon, Aug 15, 2016 at 06:20:18PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring 
> Date: Mon, 15 Aug 2016 18:06:46 +0200
> 
> The field "owner" is set by the core.
> Thus delete an unneeded initialisation.
> 
> Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
> Signed-off-by: Markus Elfring 
> ---

Acked-by: Charles Keepax 

Thanks,
Charles


[PATCH] nvme-rdma: initialize ret to zero to avoid returning garbage

2016-08-16 Thread Colin King
From: Colin Ian King 

ret is not initialized so it contains garbage.  Ensure garbage
is not returned by initializing rc to 0.

Signed-off-by: Colin Ian King 
---
 drivers/nvme/host/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 8d2875b..9c69393 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1319,7 +1319,7 @@ out_destroy_queue_ib:
 static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue)
 {
struct nvme_rdma_ctrl *ctrl = queue->ctrl;
-   int ret;
+   int ret = 0;
 
/* Own the controller deletion */
if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING))
-- 
2.8.1



Re: [PATCH] pwm: samsung: fix to use lowest div for large enough modulation bits

2016-08-16 Thread Seung-Woo Kim
Hi Krzysztof,

On 2016년 08월 16일 16:37, Krzysztof Kozlowski wrote:
> On 08/02/2016 12:16 PM, Seung-Woo Kim wrote:
>> >From pwm_samsung_calc_tin(), there is routine to find the lowest
>> divider possible to generate lower frequency than requested one.
>> But it is always possible to generate requested frequency with
>> large enough modulation bits, so this patch fixes to use lowest
>> div for the case. This patch removes following UBSAN warning:
>>
>>UBSAN: Undefined behaviour in drivers/pwm/pwm-samsung.c:197:13
>>shift exponent 32 is too large for 32-bit type 'long unsigned int'
>>[...]
>>[] (ubsan_epilogue) from [] 
>> (__ubsan_handle_shift_out_of_bounds+0xd8/0x120)
>>[] (__ubsan_handle_shift_out_of_bounds) from [] 
>> (pwm_samsung_config+0x508/0x6a4)
>>[] (pwm_samsung_config) from [] 
>> (pwm_apply_state+0x174/0x40c)
>>[] (pwm_apply_state) from [] 
>> (pwm_fan_probe+0xc8/0x488)
>>[] (pwm_fan_probe) from [] 
>> (platform_drv_probe+0x70/0x150)
>>[...]
>>
>> Signed-off-by: Seung-Woo Kim 
>> ---
>> The UBSAN warning from ARM is reported with the patch in following link:
>> https://patchwork.kernel.org/patch/9189575/
>> ---
>>  drivers/pwm/pwm-samsung.c |   10 +++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
>> index ada2d32..ff0def6 100644
>> --- a/drivers/pwm/pwm-samsung.c
>> +++ b/drivers/pwm/pwm-samsung.c
>> @@ -193,9 +193,13 @@ static unsigned long pwm_samsung_calc_tin(struct 
>> samsung_pwm_chip *chip,
>>   * divider settings and choose the lowest divisor that can generate
>>   * frequencies lower than requested.
>>   */
>> -for (div = variant->div_base; div < 4; ++div)
>> -if ((rate >> (variant->bits + div)) < freq)
>> -break;
>> +if (fls(rate) <= variant->bits) {
>> +div = variant->div_base;
>> +} else {
>> +for (div = variant->div_base; div < 4; ++div)
>> +if ((rate >> (variant->bits + div)) < freq)
>> +break;
>> +}
> 
> I have trouble with understanding the idea behind initial code from
> Tomasz (commit 11ad39ede24ee). The variant->bits for all SoC except
> S3C24xx is 32. This means the shift:
>   if ((rate >> (variant->bits + div)) < freq)
> will be always by 32 or more... In practice this will choose always a
> "div" of 0 because in first iteration of this loop, the shift will be by 32.

I also confused that part, but I figured out that the bit is used to
consider modulation bit to generate pwm signal from the input clock.

Only the old s3c2440 has 16 bit modulation timer for pwm, and all later
soc has 32 bit modulation timer. So 32 bit timer cases, with the lowest
div, it can generate all frequencies which can be assigned with 32bit
variable.
But I uses fls() to consider 64bit case also even though there is no
really that kind of clock.

Best Regards,
- Seung-Woo Kim

> 
> This looks weird and the fix does not really remove the weirdness out of it.
> 
> Best regards,
> Krzysztof
> 
> 
> 

-- 
Seung-Woo Kim
Samsung Software R&D Center
--



Re: [PATCH v2] checkkconfigsymbols.py: add --no-color option, don't print color to non-TTY

2016-08-16 Thread Valentin Rothberg
Hi Greg,

could you pick up this patch?

On Tue, Jul 5, 2016 at 9:47 AM, Andrew Donnellan
 wrote:
> Only print the ANSI colour escape codes if stdout is a TTY. Useful if
> redirecting output to a file or piping to another script.
>
> Also add a new option, --no-color, if the user wants to disable colour
> output for whatever reason.
>
> Signed-off-by: Andrew Donnellan 

Acked-by: Valentin Rothberg 

> ---
>
> V1->V2:
> - automatically detect non-TTYs and disable colour output.
>   Suggested by Josh Triplett
> ---
>  scripts/checkkconfigsymbols.py | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
> index df643f6..b140fc9 100755
> --- a/scripts/checkkconfigsymbols.py
> +++ b/scripts/checkkconfigsymbols.py
> @@ -82,6 +82,11 @@ def parse_options():
>default=False,
>help="Reset current Git tree even when it's dirty.")
>
> +parser.add_option('', '--no-color', dest='color', action='store_false',
> +  default=True,
> +  help="Don't print colored output. Default when not "
> +   "outputting to a terminal.")
> +
>  (opts, _) = parser.parse_args()
>
>  if opts.commit and opts.diff:
> @@ -116,6 +121,9 @@ def main():
>  """Main function of this module."""
>  opts = parse_options()
>
> +global color
> +color = opts.color and sys.stdout.isatty()
> +
>  if opts.sim and not opts.commit and not opts.diff:
>  sims = find_sims(opts.sim, opts.ignore)
>  if sims:
> @@ -202,14 +210,14 @@ def yel(string):
>  """
>  Color %string yellow.
>  """
> -return "\033[33m%s\033[0m" % string
> +return "\033[33m%s\033[0m" % string if color else string
>
>
>  def red(string):
>  """
>  Color %string red.
>  """
> -return "\033[31m%s\033[0m" % string
> +return "\033[31m%s\033[0m" % string if color else string
>
>
>  def execute(cmd):
> --
> Andrew Donnellan  OzLabs, ADL Canberra
> andrew.donnel...@au1.ibm.com  IBM Australia Limited
>


Re: [LKP] [lkp] [sctp] a6c2f79287: netperf.Throughput_Mbps -37.2% regression

2016-08-16 Thread Aaron Lu
On 08/16/2016 04:02 PM, Xin Long wrote:
>>
>> I'm testing on Linus' master, can we all use that please?
>>
> 
> [git] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> 
> [mechine]
> Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
> mem 62G (66000220K)
> 
> [system]
> # cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 7.3 Beta (Maipo)
> 
> [commit 3684b03]
> [root@hp-dl380pg8-11 lxin]# uname -r
> 4.8.0-rc2.3684b03
> [root@hp-dl380pg8-11 lxin]# cat test.sh
> killall -0 netserver || netserver -4 &
> netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 127.0.0.1
> [root@hp-dl380pg8-11 lxin]# sh test.sh
> SCTP 1-TO-MANY STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
> 127.0.0.1 () port 0 AF_INET
> Recv   SendSend  Utilization   Service Demand
> Socket Socket  Message  Elapsed  Send Recv SendRecv
> Size   SizeSize Time Throughput  localremote   local   remote
> bytes  bytes   bytessecs.10^6bits/s  % S  % S  us/KB   us/KB
> 
> 212992 212992  10240300.00 16914.99   3.28 3.28 0.636   0.636
> 
> [commit f959fb4]
> [root@localhost lxin]# uname -r
> 4.7.0-rc6.f959fb4
> [root@localhost lxin]# cat test.sh
> killall -0 netserver || netserver -4 &
> netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 127.0.0.1
> [root@localhost lxin]# sh test.sh
> SCTP 1-TO-MANY STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
> 127.0.0.1 () port 0 AF_INET
> Recv   SendSend  Utilization   Service Demand
> Socket Socket  Message  Elapsed  Send Recv SendRecv
> Size   SizeSize Time Throughput  localremote   local   remote
> bytes  bytes   bytessecs.10^6bits/s  % S  % S  us/KB   us/KB
> 
> 212992 212992  10240300.00 12975.32   3.35 3.35 0.847   0.846
> 
> 
> Still, in my env, the latest kernel is better than old one.
> Sorry, I'm not sure why it's so different in your env.

Could the test have anything to do with the hardware? i.e. yours is Xeon
E5-2690 while mine is IVB i3?

> 
> Could you do 'netperf' test manually, instead of lkp-tests, then check again.

Manually test under LKP is not easy as those test machines are all doing
things automatically. But if you think that is necessary, I can do that.

> Pls show you system's distros as well, like rhel, ubuntu or arch ?

We do not use any of these distros.
The rootfs is derived from debian:
https://github.com/fengguang/reproduce-kernel-bug/blob/master/debian/debian-x86_64-2015-02-07.cgz

Thanks,
Aaron


Re: musb: am3358: having problem with high-speed on usb1 at peripheral

2016-08-16 Thread Felipe Balbi

Hi,

Ayaka  writes:
>> ayaka  writes:
 On 08/13/2016 01:44 AM, Greg KH wrote:
> On Sat, Aug 13, 2016 at 12:38:46AM +0800, ayaka wrote:
> 
>> On 08/12/2016 03:40 PM, Greg KH wrote:
>>> On Fri, Aug 12, 2016 at 10:23:15AM +0800, ayaka wrote:
>>> Hello all:
>>>I recently add a support for customize am3358 board using the branch
>>> processor-sdk-linux-03.00.00 from Ti git. But I meet a problem with musb
>>> at the peripheral mode.
>> Then you are going to have to get support from TI for this, nothing we
>> can do here about random vendor kernel trees, sorry.
>> 
>> If you can use the 4.7 tree, or better yet, the 4.8-rc tree, then we
> I have tried the 4.8-rc1, I meet the same problem.
 What problem is that exactly?
>>> Sorry, the USB1 can't work at high speed gadget mode and have DMA problem.
>>> musb-hdrc musb-hdrc.0.auto: Failed to request rx1.
>>> musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
>> 
>> -517 is EPROBE_DEFER. Most likely DMA hasn't probed and MUSB is
>> deferring to try later. This does _NOT_ MUSB can't work with
>> DMA. Perhaps you didn't enable support for MUSB's DMA engine.
>> 
> I have set the status of cppi41dma to okay in dts. And 
> CONFIG_USB_TI_CPPI41_DMA,
> CONFIG_TI_CPPI41 and CONFIG_TI_EDMA are enabled with build into kernel.
>
> Anything else I should do?

no, that should do it. Since musb returned -EPROBE_DEFER, it will retry
probing later. Check if musb probed fine. The easiest way is to check if
you have anything in /sys/class/udc/

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH] builddeb: Skip gcc-plugins when not configured

2016-08-16 Thread Michal Marek
Dne 15.8.2016 v 19:36 Kees Cook napsal(a):
> When attempting to build a Debian kernel package, the "scripts/gcc-plugins"
> directory does not exist in the output tree unless CONFIG_GCC_PLUGINS=y.
> To avoid errors when not defined, this wraps the failing "find" in a config
> test.
> 
> Reported-by: Frank Paulsen 
> Tested-by: Christian Kujau 
> Signed-off-by: Kees Cook 
> ---
> This should go into v4.8...

Applied to kbuild.git#rc-fixes.

Thanks,
Michal



Re: change in xhci result in soft lockup

2016-08-16 Thread Kui Zhang
Thanks.

This patch fixed my issue.


Kui.Z

On Mon, Aug 15, 2016 at 3:52 AM, Mathias Nyman
 wrote:
> On 14.08.2016 01:13, Kui Zhang wrote:
>>
>> Hello,
>>
>> System still hangs with 4.8.0-rc1+. There are new info in the logs.
>>
>
> Does Alban Browaeys Patch xhci: really enqueue zero length TRBs help?
> It solves an ADB triggered issue in xhci in that same bad patch.
>
> http://marc.info/?l=linux-usb&m=147102031717014&w=2
>
> -Mathias
>
>


[PATCH] pinctrl: palmas: fix a possible NULL dereference

2016-08-16 Thread LABBE Corentin
of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 1009:
pinctrl_data = match->data;

For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.

Reported-by: coverity (CID 1324136)
Signed-off-by: LABBE Corentin 
---
 drivers/pinctrl/pinctrl-palmas.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-palmas.c b/drivers/pinctrl/pinctrl-palmas.c
index 8edb3f8c..a30146d 100644
--- a/drivers/pinctrl/pinctrl-palmas.c
+++ b/drivers/pinctrl/pinctrl-palmas.c
@@ -1004,9 +1004,7 @@ static int palmas_pinctrl_probe(struct platform_device 
*pdev)
bool enable_dvfs2 = false;
 
if (pdev->dev.of_node) {
-   const struct of_device_id *match;
-   match = of_match_device(palmas_pinctrl_of_match, &pdev->dev);
-   pinctrl_data = match->data;
+   pinctrl_data = of_device_get_match_data(&pdev->dev);
enable_dvfs1 = of_property_read_bool(pdev->dev.of_node,
"ti,palmas-enable-dvfs1");
enable_dvfs2 = of_property_read_bool(pdev->dev.of_node,
-- 
2.7.3



Re: [PATCH] extcon: Use the extcon_set_state_sync() instead of deprecated functions

2016-08-16 Thread Charles Keepax
On Tue, Aug 16, 2016 at 04:08:06PM +0900, Chanwoo Choi wrote:
> This patch alters the renamed extcon API to set the state of the external
> connectors instead of deprecated extcon_set_cable_state_().
> 
> Because the patch[1] modifies the function name to maintain the function
> naming pattern.
> - extcon_set_cable_state_() -> extcon_set_state_sync()
> - extcon_get_cable_state_() -> extcon_get_state()
> 
> [1] https://lkml.org/lkml/2016/8/4/729
> - extcon: Rename the extcon_set/get_state() to maintain the function naming 
> pattern
> 
> Cc: Krzysztof Kozlowski 
> Cc: Roger Quadros 
> Cc: Charles Keepax 
> Cc: Chen-Yu Tsai 
> Cc: Ramakrishna Pallala 
> Cc: Kishon Vijay Abraham I 
> Signed-off-by: Chanwoo Choi 
> ---

For the Wolfson parts:

Acked-by: Charles Keepax 

Thanks,
Charles


Re: [PATCH v2 RESEND 2/4] Drivers: hv: balloon: account for gaps in hot add regions

2016-08-16 Thread Vitaly Kuznetsov
"Alex Ng (LIS)"  writes:

>> @@ -676,35 +686,63 @@ static void hv_mem_hot_add(unsigned long start,
>> unsigned long size,
>> 
>>  static void hv_online_page(struct page *pg)  {
>> -struct list_head *cur;
>>  struct hv_hotadd_state *has;
>> +struct hv_hotadd_gap *gap;
>>  unsigned long cur_start_pgp;
>>  unsigned long cur_end_pgp;
>> +bool is_gap = false;
>> 
>>  list_for_each(cur, &dm_device.ha_region_list) {
>>  has = list_entry(cur, struct hv_hotadd_state, list);
>>  cur_start_pgp = (unsigned long)
>> +pfn_to_page(has->start_pfn);
>> +cur_end_pgp = (unsigned long)pfn_to_page(has->end_pfn);
>> +
>> +/* The page belongs to a different HAS. */
>> +if (((unsigned long)pg < cur_start_pgp) ||
>> +((unsigned long)pg >= cur_end_pgp))
>> +continue;
>> +
>> +cur_start_pgp = (unsigned long)
>>  pfn_to_page(has->covered_start_pfn);
>>  cur_end_pgp = (unsigned long)pfn_to_page(has-
>> >covered_end_pfn);
>> 
>> -if (((unsigned long)pg >= cur_start_pgp) &&
>> -((unsigned long)pg < cur_end_pgp)) {
>> -/*
>> - * This frame is currently backed; online the
>> - * page.
>> - */
>> -__online_page_set_limits(pg);
>> -__online_page_increment_counters(pg);
>> -__online_page_free(pg);
>> +/* The page is not backed. */
>> +if (((unsigned long)pg < cur_start_pgp) ||
>> +((unsigned long)pg >= cur_end_pgp))
>> +continue;
>> +
>> +/* Check for gaps. */
>> +list_for_each_entry(gap, &has->gap_list, list) {
>> +cur_start_pgp = (unsigned long)
>> +pfn_to_page(gap->start_pfn);
>> +cur_end_pgp = (unsigned long)
>> +pfn_to_page(gap->end_pfn);
>> +if (((unsigned long)pg >= cur_start_pgp) &&
>> +((unsigned long)pg < cur_end_pgp)) {
>> +is_gap = true;
>> +break;
>> +}
>>  }
>> +
>> +if (is_gap)
>> +break;
>> +
>> +/* This frame is currently backed; online the page. */
>> +__online_page_set_limits(pg);
>> +__online_page_increment_counters(pg);
>> +__online_page_free(pg);
>> +break;
>>  }
>>  }
>> 
>
> We may need to add similar logic to check for gaps in hv_bring_pgs_online().
>
> [...]

Yes, probably, I'll take a look and try to refactor the onlinig code in
a separate function to avoid duplication.

>>  static unsigned long handle_pg_range(unsigned long pg_start, @@ -834,13
>> +881,19 @@ static unsigned long process_hot_add(unsigned long pg_start,
>>  unsigned long rg_size)
>>  {
>>  struct hv_hotadd_state *ha_region = NULL;
>> +int covered;
>> 
>>  if (pfn_cnt == 0)
>>  return 0;
>> 
>> -if (!dm_device.host_specified_ha_region)
>> -if (pfn_covered(pg_start, pfn_cnt))
>> +if (!dm_device.host_specified_ha_region) {
>> +covered = pfn_covered(pg_start, pfn_cnt);
>> +if (covered < 0)
>> +return 0;
>
> If the hot-add pages aren't covered by any region, then shouldn't it fall 
> through instead of returning?
> That way the new ha_region can be added to the list and we hot-add the
> pages accordingly.

I was under an impression this is impossible:
hot_add_req()/process_hot_add() will create a new region in this
case. 'covered < 0' was added to handle one particular error: failure to
allocate memory to record gap (struct hv_hotadd_gap) and I don't have a
better idea how to handle this: if we can't remember the gap we'll crash
later on onlining...

-- 
  Vitaly


Re: [PATCH 1/3] mm: fix set pageblock migratetype in deferred struct page init

2016-08-16 Thread Michal Hocko
On Thu 04-08-16 19:25:03, Xishi Qiu wrote:
> MAX_ORDER_NR_PAGES is usually 4M, and a pageblock is usually 2M, so we only
> set one pageblock's migratetype in deferred_free_range() if pfn is aligned
> to MAX_ORDER_NR_PAGES.

Do I read the changelog correctly and the bug causes leaking unmovable
allocations into movable zones?
-- 
Michal Hocko
SUSE Labs


[PATCH] dmaengine: img-mdc: fix a possible NULL dereference

2016-08-16 Thread LABBE Corentin
of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 850:
mdma->soc = match->data;

For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.

Reported-by: coverity (CID 1324134)
Signed-off-by: LABBE Corentin 
---
 drivers/dma/img-mdc-dma.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma/img-mdc-dma.c b/drivers/dma/img-mdc-dma.c
index a4c53be..624f1e1 100644
--- a/drivers/dma/img-mdc-dma.c
+++ b/drivers/dma/img-mdc-dma.c
@@ -861,7 +861,6 @@ static int mdc_dma_probe(struct platform_device *pdev)
 {
struct mdc_dma *mdma;
struct resource *res;
-   const struct of_device_id *match;
unsigned int i;
u32 val;
int ret;
@@ -871,8 +870,7 @@ static int mdc_dma_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, mdma);
 
-   match = of_match_device(mdc_dma_of_match, &pdev->dev);
-   mdma->soc = match->data;
+   mdma->soc = of_device_get_match_data(&pdev->dev);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mdma->regs = devm_ioremap_resource(&pdev->dev, res);
-- 
2.7.3



Re: [PATCH 4/7] pinctrl: samsung: Add GPFx support of Exynos5433

2016-08-16 Thread Krzysztof Kozlowski
On 08/16/2016 08:27 AM, Chanwoo Choi wrote:
> From: Joonyoung Shim 
> 
> This patch add the support of GPFx pin of Exynos5433 SoC. Exynos5433 has
> different memory map of GPFx from previous Exynos SoC. Exynos GPIO has
> following register to control gpio funciton. Usually, all registers of GPIO
> are included in same domain.
> - CON / DAT / PUD / DRV / CONPDN / PUDPDN
> - EINT_CON/ EINT_FLTCON0, EINT_FLTCON1 / EINT_MASK / EINT_PEND
> 
> But, GPFx are included in two domain as following. So, this patch supports
> the GPFx pin which handle the on separate two domains.
> - ALIVE domain : CON / DAT / PUD / DRV / CONPDN / PUDPDN
> - IMEM domain  : EINT_CON/ EINT_FLTCON0, EINT_FLTCON1 / EINT_MASK / EINT_PEND
> 
> Cc: Linus Walleij 
> Cc: Rob Herring 
> Cc: Mark Rutland 
> Cc: Tomasz Figa 
> Cc: Krzysztof Kozlowski 
> Cc: Sylwester Nawrocki 
> Cc: Kukjin Kim 
> Cc: linux-g...@vger.kernel.org
> Signed-off-by: Joonyoung Shim 
> Signed-off-by: Chanwoo Choi 
> ---
>  .../bindings/pinctrl/samsung-pinctrl.txt   |  1 +
>  drivers/pinctrl/samsung/pinctrl-exynos.c   |  5 +++
>  drivers/pinctrl/samsung/pinctrl-exynos.h   | 11 ++
>  drivers/pinctrl/samsung/pinctrl-samsung.c  | 43 
> ++
>  drivers/pinctrl/samsung/pinctrl-samsung.h  |  5 +++
>  5 files changed, 57 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt 
> b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
> index 6db16b90873a..807fba1f829f 100644
> --- a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
> @@ -19,6 +19,7 @@ Required Properties:
>- "samsung,exynos5260-pinctrl": for Exynos5260 compatible pin-controller.
>- "samsung,exynos5410-pinctrl": for Exynos5410 compatible pin-controller.
>- "samsung,exynos5420-pinctrl": for Exynos5420 compatible pin-controller.
> +  - "samsung,exynos5433-pinctrl": for Exynos5433 compatible pin-controller.
>- "samsung,exynos7-pinctrl": for Exynos7 compatible pin-controller.
>  
>  - reg: Base address of the pin controller hardware module and length of
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c 
> b/drivers/pinctrl/samsung/pinctrl-exynos.c
> index 051b5bf701a8..4f95983e0cdd 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
> @@ -1350,6 +1350,11 @@ static const struct samsung_pin_bank_data 
> exynos5433_pin_banks0[] = {
>   EXYNOS_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04),
>   EXYNOS_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08),
>   EXYNOS_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c),
> + EXYNOS_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004),
> + EXYNOS_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008),
> + EXYNOS_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c),
> + EXYNOS_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010),
> + EXYNOS_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014),
>  };
>  
>  /* pin banks of exynos5433 pin-controller - AUD */
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.h 
> b/drivers/pinctrl/samsung/pinctrl-exynos.h
> index 0f0f7cedb2dc..4b737b6c434d 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.h
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.h
> @@ -79,6 +79,17 @@
>   .name   = id\
>   }
>  
> +#define EXYNOS_PIN_BANK_EINTW_EXT(pins, reg, id, offs)   \
> + {   \
> + .type   = &bank_type_off,   \
> + .pctl_offset= reg,  \
> + .nr_pins= pins, \
> + .eint_type  = EINT_TYPE_WKUP,   \
> + .eint_offset= offs, \
> + .eint_ext   = true, \
> + .name   = id\
> + }
> +
>  /**
>   * struct exynos_weint_data: irq specific data for all the wakeup interrupts
>   * generated by the external wakeup interrupt controller.
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c 
> b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index 513fe6b23248..57e22085c2db 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -338,6 +338,7 @@ static void pin_to_reg_bank(struct 
> samsung_pinctrl_drv_data *drvdata,
>   struct samsung_pin_bank **bank)
>  {
>   struct samsung_pin_bank *b;
> + void __iomem *virt_base = drvdata->virt_base;
>  
>   b = drvdata->pin_banks;
>  
> @@ -345,7 +346,10 @@ static void pin_to_reg_bank(struct 
> samsung_pinctrl_drv_data *drvdata,
>   ((b->pin_base + b->nr_pins - 1) < pin))
>   b++;
>  
> - *reg = drvdata->virt_base + b->pctl_offset;
> + if (b->eint_ext)
> + virt_base = drvdata->ext_base;
> +
> + *reg = virt_base + b->pctl_offset;
>   *off

Crypto Fixes for 4.8

2016-08-16 Thread Herbert Xu
Hi Linus:

This push fixes the following issue:

- Missing ULL suffixes for 64-bit constants in sha3.
- Two caam AEAD regressions.
- Bogus setkey hooks in non-hmac caam hashes.
- Missing kbuild dependency for powerpc crc32c.


Please pull from

git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git linus


Geert Uytterhoeven (1):
  crypto: sha3 - Add missing ULL suffixes for 64-bit constants

Horia Geantă (2):
  crypto: caam - fix echainiv(authenc) encrypt shared descriptor
  crypto: caam - defer aead_set_sh_desc in case of zero authsize

Michael Ellerman (1):
  crypto: powerpc - CRYPT_CRC32C_VPMSUM should depend on ALTIVEC

Russell King (1):
  crypto: caam - fix non-hmac hashes

 crypto/Kconfig |2 +-
 crypto/sha3_generic.c  |   16 
 drivers/crypto/caam/caamalg.c  |   13 -
 drivers/crypto/caam/caamhash.c |1 +
 4 files changed, 18 insertions(+), 14 deletions(-)

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH 3/7] cpufreq: dt: Add exynos5433 compatible to use generic cpufreq driver

2016-08-16 Thread Viresh Kumar
On 16-08-16, 09:47, Krzysztof Kozlowski wrote:
> On 08/16/2016 08:27 AM, Chanwoo Choi wrote:
> > This patch adds the exynos5433 compatible string for supporting
> > the generic cpufreq driver on Exynos5433.
> > 
> > Cc: "Rafael J. Wysocki" 
> > Cc: Viresh Kumar 
> > Cc: linux...@vger.kernel.org
> > Signed-off-by: Chanwoo Choi 
> > ---
> >  drivers/cpufreq/cpufreq-dt-platdev.c | 1 +
> >  1 file changed, 1 insertion(+)
> 
> Reviewed-by: Krzysztof Kozlowski 
> 
> I guess this does not depend on the rest and can go through PM/cpufreq tree?
> 
> Viresh, Rafael,
> If you wish me to take it, let me know.

I will prefer it going through PM tree.

Acked-by: Viresh Kumar 

-- 
viresh


[PATCH] thermal: imx: fix a possible NULL dereference

2016-08-16 Thread LABBE Corentin
of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 472:
data->socdata = of_id->data;

For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.

Reported-by: coverity (CID 1324128)
Signed-off-by: LABBE Corentin 
---
 drivers/thermal/imx_thermal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index c5547bd..e473548b 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -471,8 +471,6 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
 
 static int imx_thermal_probe(struct platform_device *pdev)
 {
-   const struct of_device_id *of_id =
-   of_match_device(of_imx_thermal_match, &pdev->dev);
struct imx_thermal_data *data;
struct regmap *map;
int measure_freq;
@@ -490,7 +488,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
}
data->tempmon = map;
 
-   data->socdata = of_id->data;
+   data->socdata = of_device_get_match_data(&pdev->dev);
 
/* make sure the IRQ flag is clear before enabling irq on i.MX6SX */
if (data->socdata->version == TEMPMON_IMX6SX) {
-- 
2.7.3



Re: [LKP] [lkp] [sctp] a6c2f79287: netperf.Throughput_Mbps -37.2% regression

2016-08-16 Thread Aaron Lu
On 08/16/2016 04:02 PM, Xin Long wrote:
>>
>> I'm testing on Linus' master, can we all use that please?
>>
> 
> [git] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> 
> [mechine]
> Intel(R) Xeon(R) CPU E5-2690 v2 @ 3.00GHz
> mem 62G (66000220K)
> 
> [system]
> # cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 7.3 Beta (Maipo)
> 
> [commit 3684b03]
> [root@hp-dl380pg8-11 lxin]# uname -r
> 4.8.0-rc2.3684b03
> [root@hp-dl380pg8-11 lxin]# cat test.sh
> killall -0 netserver || netserver -4 &
> netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 127.0.0.1

I just realized the test we are doing is not exactly the same.
As the original report says:
ip: ipv4
runtime: 300s
nr_threads: 200%
cluster: cs-localhost
send_size: 10K
test: SCTP_STREAM_MANY
cpufreq_governor: performance

Note the nr_threads: 200%, which means to start 2 times of CPU number
processes of netperf.

In our IVB i3(2 cores, 2 threads per core) case, 8 netperf processes
are started concurrently:

2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &
2016-07-27 03:48:09 netperf -4 -t SCTP_STREAM_MANY -c -C -l 300 -- -m 10K -H 
127.0.0.1 &

The throughput is the average of those runs.

And I think we should be doing test on:
commit a6c2f79287 ("sctp: implement prsctp TTL policy") (the bisected one)
and
commit 826d253d57 ("sctp: add SCTP_PR_ASSOC_STATUS on sctp sockopt") (its 
immediate parent)
instead of Linus' master HEAD to avoid other factors.

Thanks,
Aaron


[PATCH 0/5] ACPI / sysfs: Cleanup sysfs table handling code

2016-08-16 Thread Lv Zheng
There are issues in sysfs table handling code:
1. It cannot handle table loaded by LoadTable opcode executed after
   acpi_sysfs_init();
2. It's signature handling code is not correct.

This patchset fixes these issues.

Lv Zheng (5):
  ACPICA: Tables: Remove acpi_tb_install_fixed_table()
  ACPICA: Tables: Remove wrong table event macros
  ACPICA: Tables: Add new table events indicating table
installation/uninstallation
  ACPI / sysfs: Fix an issue for LoadTable opcode
  ACPI / sysfs: Update sysfs signature handling code

 drivers/acpi/acpica/actables.h |7 +---
 drivers/acpi/acpica/tbfadt.c   |   24 +++--
 drivers/acpi/acpica/tbinstal.c |   73 +---
 drivers/acpi/sysfs.c   |   39 ++---
 include/acpi/actypes.h |   16 -
 5 files changed, 51 insertions(+), 108 deletions(-)

-- 
1.7.10



[PATCH 1/5] ACPICA: Tables: Remove acpi_tb_install_fixed_table()

2016-08-16 Thread Lv Zheng
acpi_tb_install_fixed_table() is now redundant as we've removed the fixed
table indexing mechanism. This patch cleans up the code accordingly.
No functional change. Lv Zheng.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/actables.h |7 +
 drivers/acpi/acpica/tbfadt.c   |   24 ---
 drivers/acpi/acpica/tbinstal.c |   65 +---
 3 files changed, 16 insertions(+), 80 deletions(-)

diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 86d4d62..9469cd4 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -155,12 +155,7 @@ void
 acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc,
u8 override, u32 *table_index);
 
-acpi_status
-acpi_tb_install_fixed_table(acpi_physical_address address,
-   char *signature, u32 *table_index);
-
-acpi_status ACPI_INIT_FUNCTION
-acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
+acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
 
 /*
  * tbxfload
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 016bcdc..e678d6f 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -344,23 +344,27 @@ void acpi_tb_parse_fadt(void)
 
/* Obtain the DSDT and FACS tables via their addresses within the FADT 
*/
 
-   acpi_tb_install_fixed_table((acpi_physical_address)acpi_gbl_FADT.Xdsdt,
-   ACPI_SIG_DSDT, &acpi_gbl_dsdt_index);
+   acpi_tb_install_standard_table((acpi_physical_address)acpi_gbl_FADT.
+  Xdsdt,
+  ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
+  FALSE, TRUE, &acpi_gbl_dsdt_index);
 
/* If Hardware Reduced flag is set, there is no FACS */
 
if (!acpi_gbl_reduced_hardware) {
if (acpi_gbl_FADT.facs) {
-   acpi_tb_install_fixed_table((acpi_physical_address)
-   acpi_gbl_FADT.facs,
-   ACPI_SIG_FACS,
-   &acpi_gbl_facs_index);
+   acpi_tb_install_standard_table((acpi_physical_address)
+  acpi_gbl_FADT.facs,
+  
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
+  FALSE, TRUE,
+  &acpi_gbl_facs_index);
}
if (acpi_gbl_FADT.Xfacs) {
-   acpi_tb_install_fixed_table((acpi_physical_address)
-   acpi_gbl_FADT.Xfacs,
-   ACPI_SIG_FACS,
-   &acpi_gbl_xfacs_index);
+   acpi_tb_install_standard_table((acpi_physical_address)
+  acpi_gbl_FADT.Xfacs,
+  
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
+  FALSE, TRUE,
+  &acpi_gbl_xfacs_index);
}
}
 }
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 8b13052..d461864 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -157,68 +157,6 @@ acpi_tb_install_table_with_override(struct acpi_table_desc 
*new_table_desc,
 
 
/***
  *
- * FUNCTION:acpi_tb_install_fixed_table
- *
- * PARAMETERS:  address - Physical address of DSDT or FACS
- *  signature   - Table signature, NULL if no need to
- *match
- *  table_index - Where the table index is returned
- *
- * RETURN:  Status
- *
- * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data
- *  structure.
- *
- 
**/
-
-acpi_status
-acpi_tb_install_fixed_table(acpi_physical_address address,
-   char *signature, u32 *table_index)
-{
-   struct acpi_table_desc new_table_desc;
-   acpi_status status;
-
-   ACPI_FUNCTION_TRACE(tb_install_fixed_table);
-
-   if (!address) {
-   ACPI_ERROR((AE_INFO,
-   "Null physical address for ACPI table [%s]",
-   signature));
-   return (AE_NO_MEMORY);
-   }
-
-   /* Fill a table descriptor for validation */
-
-   status = acpi_tb_acquire_temp_table(&new_

[PATCH 2/5] ACPICA: Tables: Remove wrong table event macros

2016-08-16 Thread Lv Zheng
There are wrong table event macros, this patch cleans them up.

Signed-off-by: Lv Zheng 
---
 include/acpi/actypes.h |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index e96907b..892595f 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1034,12 +1034,6 @@ struct acpi_statistics {
u32 method_count;
 };
 
-/* Table Event Types */
-
-#define ACPI_TABLE_EVENT_LOAD   0x0
-#define ACPI_TABLE_EVENT_UNLOAD 0x1
-#define ACPI_NUM_TABLE_EVENTS   2
-
 /*
  * Types specific to the OS service interfaces
  */
@@ -1091,9 +1085,11 @@ acpi_status (*acpi_exception_handler) (acpi_status 
aml_status,
 typedef
 acpi_status (*acpi_table_handler) (u32 event, void *table, void *context);
 
-#define ACPI_TABLE_LOAD 0x0
-#define ACPI_TABLE_UNLOAD   0x1
-#define ACPI_NUM_TABLE_EVENTS   2
+/* Table Event Types */
+
+#define ACPI_TABLE_EVENT_LOAD   0x0
+#define ACPI_TABLE_EVENT_UNLOAD 0x1
+#define ACPI_NUM_TABLE_EVENTS   2
 
 /* Address Spaces (For Operation Regions) */
 
-- 
1.7.10



[PATCH 3/5] ACPICA: Tables: Add new table events indicating table installation/uninstallation

2016-08-16 Thread Lv Zheng
This patch adds 2 new table events to indicate table
installation/uninstallation.

Currently, as ACPICA never uninstalls tables, this patch thus only add
table handler invocation for the table installation event. Lv Zheng.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/acpica/tbinstal.c |8 
 include/acpi/actypes.h |4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index d461864..5fdf251 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -301,6 +301,14 @@ acpi_tb_install_standard_table(acpi_physical_address 
address,
acpi_tb_install_table_with_override(&new_table_desc, override,
table_index);
 
+   /* Invoke table handler if present */
+
+   if (acpi_gbl_table_handler) {
+   (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_INSTALL,
+new_table_desc.pointer,
+acpi_gbl_table_handler_context);
+   }
+
 release_and_exit:
 
/* Release the temporary table descriptor */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 892595f..1d798ab 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1089,7 +1089,9 @@ acpi_status (*acpi_table_handler) (u32 event, void 
*table, void *context);
 
 #define ACPI_TABLE_EVENT_LOAD   0x0
 #define ACPI_TABLE_EVENT_UNLOAD 0x1
-#define ACPI_NUM_TABLE_EVENTS   2
+#define ACPI_TABLE_EVENT_INSTALL0x2
+#define ACPI_TABLE_EVENT_UNINSTALL  0x3
+#define ACPI_NUM_TABLE_EVENTS   4
 
 /* Address Spaces (For Operation Regions) */
 
-- 
1.7.10



[PATCH 4/5] ACPI / sysfs: Fix an issue for LoadTable opcode

2016-08-16 Thread Lv Zheng
OEM tables can be installed via RSDT/XSDT, in this case, they have already
been created under /sys/firmware/acpi/tables.

For this kind of tables, normally LoadTable opcode will be executed to load
them. If LoadTable opcode is executed after acpi_sysfs_init(),
acpi_sysfs_table_handler() will be invoked, thus a redundant table file
will be created under /sys/firmware/acpi/tables/dynamic. Then running
"acpidump" on such platform results in an error.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=150841
Reported-by: Jason Voelz 
Signed-off-by: Lv Zheng 
---
 drivers/acpi/sysfs.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 358165e..f2fa363 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -383,7 +383,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void 
*table, void *context)
struct acpi_table_attr *table_attr;
 
switch (event) {
-   case ACPI_TABLE_EVENT_LOAD:
+   case ACPI_TABLE_EVENT_INSTALL:
table_attr =
kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
if (!table_attr)
@@ -397,7 +397,9 @@ acpi_status acpi_sysfs_table_handler(u32 event, void 
*table, void *context)
} else
list_add_tail(&table_attr->node, &acpi_table_attr_list);
break;
+   case ACPI_TABLE_EVENT_LOAD:
case ACPI_TABLE_EVENT_UNLOAD:
+   case ACPI_TABLE_EVENT_UNINSTALL:
/*
 * we do not need to do anything right now
 * because the table is not deleted from the
-- 
1.7.10



[PATCH 5/5] ACPI / sysfs: Update sysfs signature handling code

2016-08-16 Thread Lv Zheng
This is a cleanup to covert sysfs signature handling code using ACPICA
APIs, so that sysfs code can automatically be benefit from any future
implementation in the name tag handling macros.
Additional filename attribute is added in order to handle both BE/LE name
tag cases.

Signed-off-by: Lv Zheng 
---
 drivers/acpi/sysfs.c |   35 +--
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index f2fa363..974eb64 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -314,10 +314,13 @@ static struct kobject *tables_kobj;
 static struct kobject *dynamic_tables_kobj;
 static struct kobject *hotplug_kobj;
 
+#define ACPI_INST_SIZE 4   /* including trailing 0 */
+
 struct acpi_table_attr {
struct bin_attribute attr;
-   char name[8];
+   char name[ACPI_NAME_SIZE];
int instance;
+   char filename[ACPI_NAME_SIZE+ACPI_INST_SIZE];
struct list_head node;
 };
 
@@ -329,14 +332,9 @@ static ssize_t acpi_table_show(struct file *filp, struct 
kobject *kobj,
container_of(bin_attr, struct acpi_table_attr, attr);
struct acpi_table_header *table_header = NULL;
acpi_status status;
-   char name[ACPI_NAME_SIZE];
 
-   if (strncmp(table_attr->name, "NULL", 4))
-   memcpy(name, table_attr->name, ACPI_NAME_SIZE);
-   else
-   memcpy(name, "\0\0\0\0", 4);
-
-   status = acpi_get_table(name, table_attr->instance, &table_header);
+   status = acpi_get_table(table_attr->name, table_attr->instance,
+   &table_header);
if (ACPI_FAILURE(status))
return -ENODEV;
 
@@ -349,30 +347,31 @@ static void acpi_table_attr_init(struct acpi_table_attr 
*table_attr,
 {
struct acpi_table_header *header = NULL;
struct acpi_table_attr *attr = NULL;
+   char instance_str[ACPI_INST_SIZE];
 
sysfs_attr_init(&table_attr->attr.attr);
-   if (table_header->signature[0] != '\0')
-   memcpy(table_attr->name, table_header->signature,
-  ACPI_NAME_SIZE);
-   else
-   memcpy(table_attr->name, "NULL", 4);
+   ACPI_MOVE_NAME(table_attr->name, table_header->signature);
 
list_for_each_entry(attr, &acpi_table_attr_list, node) {
-   if (!memcmp(table_attr->name, attr->name, ACPI_NAME_SIZE))
+   if (ACPI_COMPARE_NAME(table_attr->name, attr->name))
if (table_attr->instance < attr->instance)
table_attr->instance = attr->instance;
}
table_attr->instance++;
 
+   ACPI_MOVE_NAME(table_attr->filename, table_header->signature);
+   table_attr->filename[ACPI_NAME_SIZE] = '\0';
if (table_attr->instance > 1 || (table_attr->instance == 1 &&
 !acpi_get_table
-(table_header->signature, 2, &header)))
-   sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
-   table_attr->instance);
+(table_header->signature, 2, 
&header))) {
+   snprintf(instance_str, sizeof(instance_str), "%u",
+table_attr->instance);
+   strcat(table_attr->filename, instance_str);
+   }
 
table_attr->attr.size = table_header->length;
table_attr->attr.read = acpi_table_show;
-   table_attr->attr.attr.name = table_attr->name;
+   table_attr->attr.attr.name = table_attr->filename;
table_attr->attr.attr.mode = 0400;
 
return;
-- 
1.7.10



Re: [patch 4 14/22] timer: Switch to a non cascading wheel

2016-08-16 Thread Richard Cochran
On Fri, Aug 12, 2016 at 12:14:11PM -0700, Paul E. McKenney wrote:
> FWIW, I do appear to be seeing more lost wakeups on current mainline
> than on v4.7, but not enough of a difference to get a reliable bisction
> in reasonable time.

We are seeing reproducible hangs* when running Steven's
stress-cpu-hotplug under kvm.  This hang goes back to v4.7 at least.
I couldn't reproduce this with bare metal.  Thomas thought it was a
virtualization issue, not related to the hotplug rework.  He is away
until next week.  Maybe he knows more to say...

To reproduce, run 

   while [ 1 ]; do ./stress-cpu-hotplug ; done

and wait about 20 minutes (or longer).

Thanks,
Richard

* INFO: task cpuhp/7:49 blocked for more than 120 seconds



Re: [PATCH 1/3] mm: fix set pageblock migratetype in deferred struct page init

2016-08-16 Thread Xishi Qiu
On 2016/8/16 16:41, Michal Hocko wrote:

> On Thu 04-08-16 19:25:03, Xishi Qiu wrote:
>> MAX_ORDER_NR_PAGES is usually 4M, and a pageblock is usually 2M, so we only
>> set one pageblock's migratetype in deferred_free_range() if pfn is aligned
>> to MAX_ORDER_NR_PAGES.
> 
> Do I read the changelog correctly and the bug causes leaking unmovable
> allocations into movable zones?

Hi Michal,

This bug will cause uninitialized migratetype, you can see from
"cat /proc/pagetypeinfo", almost half blocks are Unmovable.

Also this bug missed to free the last block pages, it cause memory leaking.

Thanks,
Xishi Qiu



Re: [RFC PATCH] Introduce a 'recovery' command line option

2016-08-16 Thread Richard Weinberger
On 16.08.2016 09:15, Janne Karhunen wrote:
> On Tue, Aug 16, 2016 at 10:04 AM, Richard Weinberger
>  wrote:
> 
>> Why are you moving this feature into the kernel?
>> To support such advanced features we have the initramfs.
>>
>> dracut has already rootfallback=.
> 
> For saving some precious boot-up time (my systems run without initrd)
> and to unify the solutions. If kernel does this bootloaders and
> initrds don't have to care.

Features - collect them all? ;-)

I my opinion it is not wise to move feature into the kernel which can
be solved perfectly fine in userspace (initramfs).

How much slows an initramfs your boot time down?

Did you try using a handmade minimal initramfs? Not compressed, single c 
program,
statically linked..., etc.

Thanks,
//richard


Re: [PATCH] pwm: samsung: fix to use lowest div for large enough modulation bits

2016-08-16 Thread Tomasz Figa
2016-08-16 17:25 GMT+09:00 Seung-Woo Kim :
> Hi Krzysztof,
>
> On 2016년 08월 16일 16:37, Krzysztof Kozlowski wrote:
>> On 08/02/2016 12:16 PM, Seung-Woo Kim wrote:
>>> >From pwm_samsung_calc_tin(), there is routine to find the lowest
>>> divider possible to generate lower frequency than requested one.
>>> But it is always possible to generate requested frequency with
>>> large enough modulation bits, so this patch fixes to use lowest
>>> div for the case. This patch removes following UBSAN warning:
>>>
>>>UBSAN: Undefined behaviour in drivers/pwm/pwm-samsung.c:197:13
>>>shift exponent 32 is too large for 32-bit type 'long unsigned int'
>>>[...]
>>>[] (ubsan_epilogue) from [] 
>>> (__ubsan_handle_shift_out_of_bounds+0xd8/0x120)
>>>[] (__ubsan_handle_shift_out_of_bounds) from [] 
>>> (pwm_samsung_config+0x508/0x6a4)
>>>[] (pwm_samsung_config) from [] 
>>> (pwm_apply_state+0x174/0x40c)
>>>[] (pwm_apply_state) from [] 
>>> (pwm_fan_probe+0xc8/0x488)
>>>[] (pwm_fan_probe) from [] 
>>> (platform_drv_probe+0x70/0x150)
>>>[...]
>>>
>>> Signed-off-by: Seung-Woo Kim 
>>> ---
>>> The UBSAN warning from ARM is reported with the patch in following link:
>>> https://patchwork.kernel.org/patch/9189575/
>>> ---
>>>  drivers/pwm/pwm-samsung.c |   10 +++---
>>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
>>> index ada2d32..ff0def6 100644
>>> --- a/drivers/pwm/pwm-samsung.c
>>> +++ b/drivers/pwm/pwm-samsung.c
>>> @@ -193,9 +193,13 @@ static unsigned long pwm_samsung_calc_tin(struct 
>>> samsung_pwm_chip *chip,
>>>   * divider settings and choose the lowest divisor that can generate
>>>   * frequencies lower than requested.
>>>   */
>>> -for (div = variant->div_base; div < 4; ++div)
>>> -if ((rate >> (variant->bits + div)) < freq)
>>> -break;
>>> +if (fls(rate) <= variant->bits) {
>>> +div = variant->div_base;
>>> +} else {
>>> +for (div = variant->div_base; div < 4; ++div)
>>> +if ((rate >> (variant->bits + div)) < freq)
>>> +break;
>>> +}
>>
>> I have trouble with understanding the idea behind initial code from
>> Tomasz (commit 11ad39ede24ee). The variant->bits for all SoC except
>> S3C24xx is 32. This means the shift:
>>   if ((rate >> (variant->bits + div)) < freq)
>> will be always by 32 or more... In practice this will choose always a
>> "div" of 0 because in first iteration of this loop, the shift will be by 32.
>
> I also confused that part, but I figured out that the bit is used to
> consider modulation bit to generate pwm signal from the input clock.
>
> Only the old s3c2440 has 16 bit modulation timer for pwm, and all later
> soc has 32 bit modulation timer. So 32 bit timer cases, with the lowest
> div, it can generate all frequencies which can be assigned with 32bit
> variable.
> But I uses fls() to consider 64bit case also even though there is no
> really that kind of clock.

The code may look complicated (in fact I had to think a bit to recall
what exactly it was supposed to do), but I'm not sure how it could be
simplified. It's generally intended to handle variant->bits < 32 cases
only and is effectively a no-op when variant->bits >= 32.

I would suggest just making rate an u64 and be done with the warning.
IMHO adding this kind of special cases only complicates the (already
complicated) code unnecessarily.

Best regards,
Tomasz


  1   2   3   4   5   6   7   8   9   10   >