[RESEND PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap

2015-12-12 Thread Saurabh Sengar
added iounmap inorder to free memory mapped to base before returning

Signed-off-by: Saurabh Sengar 
---
 drivers/usb/host/pci-quirks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 26cb8c8..35af362 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -992,7 +992,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
if ((ext_cap_offset + sizeof(val)) > len) {
/* We're reading garbage from the controller */
dev_warn(>dev, "xHCI controller failing to respond");
-   return;
+   goto iounmap;
}
val = readl(base + ext_cap_offset);
 
@@ -1055,6 +1055,7 @@ hc_init:
 XHCI_MAX_HALT_USEC, val);
}
 
+iounmap:
iounmap(base);
 }
 
-- 
1.9.1

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


[PATCH] [linux-next] net: Fix typo in skb_fclone_busy

2015-12-12 Thread Masanari Iida
This patch fix a typo found within comment of skb_fclone_busy.

Signed-off-by: Masanari Iida 
---
 include/linux/skbuff.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9b9b9ea..af4f6ac 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -833,7 +833,7 @@ struct sk_buff_fclones {
  * skb_fclone_busy - check if fclone is busy
  * @skb: buffer
  *
- * Returns true is skb is a fast clone, and its clone is not freed.
+ * Returns true if skb is a fast clone, and its clone is not freed.
  * Some drivers call skb_orphan() in their ndo_start_xmit(),
  * so we also check that this didnt happen.
  */
-- 
2.6.4.442.g545299f

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


Re: [PATCH 6/9] drivers: tty: 68328serial.c: Use tabs for indentation

2015-12-12 Thread Greg KH
On Sat, Dec 12, 2015 at 11:08:00PM -0800, Greg KH wrote:
> On Fri, Dec 11, 2015 at 11:36:06AM +0100, Frederik Völkel wrote:
> > The patch replaces the spaces used for indentation at some points with
> > tabs.
> > 
> > Signed-off-by: Frederik Völkel 
> > Signed-off-by: Lukas Braun 
> > ---
> >  drivers/tty/serial/68328serial.c | 82 
> > 
> >  1 file changed, 41 insertions(+), 41 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/68328serial.c 
> > b/drivers/tty/serial/68328serial.c
> > index 0982c1a..22f52e0 100644
> > --- a/drivers/tty/serial/68328serial.c
> > +++ b/drivers/tty/serial/68328serial.c
> > @@ -228,17 +228,17 @@ static int rs_put_char(char ch)
> > unsigned long flags;
> > int loops = 0;
> >  
> > -local_irq_save(flags);
> > +   local_irq_save(flags);
> >  
> > while (!(UTX & UTX_TX_AVAIL) && (loops < 1000)) {
> > -   loops++;
> > -   udelay(5);
> > -}
> > +   loops++;
> > +   udelay(5);
> > +   }
> >  
> > UTX_TXDATA = ch;
> > -udelay(5);
> > -local_irq_restore(flags);
> > -return 1;
> > +   udelay(5);
> > +   local_irq_restore(flags);
> > +   return 1;
> >  }
> >  
> >  static void rs_start(struct tty_struct *tty)
> > @@ -268,7 +268,7 @@ static void receive_chars(struct m68k_serial *info, 
> > unsigned short rx)
> >  
> > /*
> >  * This do { } while() loop will get ALL chars out of Rx FIFO 
> > - */
> > +*/
> >  #ifndef CONFIG_XCOPILOT_BUGS
> > do {
> >  #endif 
> > @@ -400,7 +400,7 @@ static int startup(struct m68k_serial *info, struct 
> > tty_struct *tty)
> >  */
> >  #ifdef USE_INTS
> > uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | 
> > - USTCNT_RX_INTR_MASK | USTCNT_TX_INTR_MASK;
> > +   USTCNT_RX_INTR_MASK | USTCNT_TX_INTR_MASK;
> >  #else
> > uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK;
> >  #endif
> > @@ -473,24 +473,24 @@ struct {
> >  };
> >  #else
> >   hw_baud_table[18] = {
> > - {0, 0}, /* 0 */
> > - {0, 0}, /* 50 */
> > - {0, 0}, /* 75 */
> > - {0, 0}, /* 110 */
> > - {0, 0}, /* 134 */
> > - {0, 0}, /* 150 */
> > - {0, 0}, /* 200 */
> > - {0, 0}, /* 300 */
> > - {7, 0x26}, /* 600 */
> > - {6, 0x26}, /* 1200 */
> > - {0, 0}, /* 1800 */
> > - {5, 0x26}, /* 2400 */
> > - {4, 0x26}, /* 4800 */
> > - {3, 0x26}, /* 9600 */
> > - {2, 0x26}, /* 19200 */
> > - {1, 0x26}, /* 38400 */
> > - {0, 0x26}, /* 57600 */
> > - {1, 0x38}, /* 115200 */
> > +   {0, 0}, /* 0 */
> > +   {0, 0}, /* 50 */
> > +   {0, 0}, /* 75 */
> > +   {0, 0}, /* 110 */
> > +   {0, 0}, /* 134 */
> > +   {0, 0}, /* 150 */
> > +   {0, 0}, /* 200 */
> > +   {0, 0}, /* 300 */
> > +   {7, 0x26}, /* 600 */
> > +   {6, 0x26}, /* 1200 */
> > +   {0, 0}, /* 1800 */
> > +   {5, 0x26}, /* 2400 */
> > +   {4, 0x26}, /* 4800 */
> > +   {3, 0x26}, /* 9600 */
> > +   {2, 0x26}, /* 19200 */
> > +   {1, 0x26}, /* 38400 */
> > +   {0, 0x26}, /* 57600 */
> > +   {1, 0x38}, /* 115200 */
> >  }; 
> >  #endif
> >  /* rate = 1036800 / ((65 - prescale) * (1< > @@ -516,9 +516,9 @@ static void change_speed(struct m68k_serial *info, 
> > struct tty_struct *tty)
> > uart->ustcnt = ustcnt & ~USTCNT_TXEN;
> >  
> > i = cflag & CBAUD;
> > -if (i & CBAUDEX) {
> > -i = (i & ~CBAUDEX) + B38400;
> > -}
> > +   if (i & CBAUDEX) {
> > +   i = (i & ~CBAUDEX) + B38400;
> > +   }
> >  
> > uart->ubaud = PUT_FIELD(UBAUD_DIVIDE,hw_baud_table[i].divisor) | 
> > PUT_FIELD(UBAUD_PRESCALER, hw_baud_table[i].prescale);
> > @@ -907,16 +907,16 @@ static int get_lsr_info(struct m68k_serial *info, 
> > unsigned int *value)
> >  static void send_break(struct m68k_serial *info, unsigned int duration)
> >  {
> > m68328_uart *uart = _addr[info->line];
> > -unsigned long flags;
> > -if (!info->port)
> > -return;
> > -local_irq_save(flags);
> > +   unsigned long flags;
> > +   if (!info->port)
> > +   return;
> > +   local_irq_save(flags);
> >  #ifdef USE_INTS
> > uart->utx.w |= UTX_SEND_BREAK;
> > msleep_interruptible(duration);
> > uart->utx.w &= ~UTX_SEND_BREAK;
> >  #endif 
> > -local_irq_restore(flags);
> > +   local_irq_restore(flags);
> >  }
> >  
> >  static int rs_ioctl(struct tty_struct *tty,
> > @@ -1206,7 +1206,7 @@ rs68328_init(void)
> > rs_interrupt,
> > 0,
> > "M68328_UART", info))
> > -panic("Unable to attach 68328 serial interrupt\n");
> > +   panic("Unable to attach 68328 serial interrupt\n");
> >  
> > 

Re: [PATCH 6/9] drivers: tty: 68328serial.c: Use tabs for indentation

2015-12-12 Thread Greg KH
On Fri, Dec 11, 2015 at 11:36:06AM +0100, Frederik Völkel wrote:
> The patch replaces the spaces used for indentation at some points with
> tabs.
> 
> Signed-off-by: Frederik Völkel 
> Signed-off-by: Lukas Braun 
> ---
>  drivers/tty/serial/68328serial.c | 82 
> 
>  1 file changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/tty/serial/68328serial.c 
> b/drivers/tty/serial/68328serial.c
> index 0982c1a..22f52e0 100644
> --- a/drivers/tty/serial/68328serial.c
> +++ b/drivers/tty/serial/68328serial.c
> @@ -228,17 +228,17 @@ static int rs_put_char(char ch)
>   unsigned long flags;
>   int loops = 0;
>  
> -local_irq_save(flags);
> + local_irq_save(flags);
>  
>   while (!(UTX & UTX_TX_AVAIL) && (loops < 1000)) {
> - loops++;
> - udelay(5);
> -}
> + loops++;
> + udelay(5);
> + }
>  
>   UTX_TXDATA = ch;
> -udelay(5);
> -local_irq_restore(flags);
> -return 1;
> + udelay(5);
> + local_irq_restore(flags);
> + return 1;
>  }
>  
>  static void rs_start(struct tty_struct *tty)
> @@ -268,7 +268,7 @@ static void receive_chars(struct m68k_serial *info, 
> unsigned short rx)
>  
>   /*
>* This do { } while() loop will get ALL chars out of Rx FIFO 
> - */
> +  */
>  #ifndef CONFIG_XCOPILOT_BUGS
>   do {
>  #endif   
> @@ -400,7 +400,7 @@ static int startup(struct m68k_serial *info, struct 
> tty_struct *tty)
>*/
>  #ifdef USE_INTS
>   uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | 
> - USTCNT_RX_INTR_MASK | USTCNT_TX_INTR_MASK;
> + USTCNT_RX_INTR_MASK | USTCNT_TX_INTR_MASK;
>  #else
>   uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK;
>  #endif
> @@ -473,24 +473,24 @@ struct {
>  };
>  #else
>   hw_baud_table[18] = {
> - {0, 0}, /* 0 */
> - {0, 0}, /* 50 */
> - {0, 0}, /* 75 */
> - {0, 0}, /* 110 */
> - {0, 0}, /* 134 */
> - {0, 0}, /* 150 */
> - {0, 0}, /* 200 */
> - {0, 0}, /* 300 */
> - {7, 0x26}, /* 600 */
> - {6, 0x26}, /* 1200 */
> - {0, 0}, /* 1800 */
> - {5, 0x26}, /* 2400 */
> - {4, 0x26}, /* 4800 */
> - {3, 0x26}, /* 9600 */
> - {2, 0x26}, /* 19200 */
> - {1, 0x26}, /* 38400 */
> - {0, 0x26}, /* 57600 */
> - {1, 0x38}, /* 115200 */
> + {0, 0}, /* 0 */
> + {0, 0}, /* 50 */
> + {0, 0}, /* 75 */
> + {0, 0}, /* 110 */
> + {0, 0}, /* 134 */
> + {0, 0}, /* 150 */
> + {0, 0}, /* 200 */
> + {0, 0}, /* 300 */
> + {7, 0x26}, /* 600 */
> + {6, 0x26}, /* 1200 */
> + {0, 0}, /* 1800 */
> + {5, 0x26}, /* 2400 */
> + {4, 0x26}, /* 4800 */
> + {3, 0x26}, /* 9600 */
> + {2, 0x26}, /* 19200 */
> + {1, 0x26}, /* 38400 */
> + {0, 0x26}, /* 57600 */
> + {1, 0x38}, /* 115200 */
>  }; 
>  #endif
>  /* rate = 1036800 / ((65 - prescale) * (1< @@ -516,9 +516,9 @@ static void change_speed(struct m68k_serial *info, struct 
> tty_struct *tty)
>   uart->ustcnt = ustcnt & ~USTCNT_TXEN;
>  
>   i = cflag & CBAUD;
> -if (i & CBAUDEX) {
> -i = (i & ~CBAUDEX) + B38400;
> -}
> + if (i & CBAUDEX) {
> + i = (i & ~CBAUDEX) + B38400;
> + }
>  
>   uart->ubaud = PUT_FIELD(UBAUD_DIVIDE,hw_baud_table[i].divisor) | 
>   PUT_FIELD(UBAUD_PRESCALER, hw_baud_table[i].prescale);
> @@ -907,16 +907,16 @@ static int get_lsr_info(struct m68k_serial *info, 
> unsigned int *value)
>  static void send_break(struct m68k_serial *info, unsigned int duration)
>  {
>   m68328_uart *uart = _addr[info->line];
> -unsigned long flags;
> -if (!info->port)
> -return;
> -local_irq_save(flags);
> + unsigned long flags;
> + if (!info->port)
> + return;
> + local_irq_save(flags);
>  #ifdef USE_INTS  
>   uart->utx.w |= UTX_SEND_BREAK;
>   msleep_interruptible(duration);
>   uart->utx.w &= ~UTX_SEND_BREAK;
>  #endif   
> -local_irq_restore(flags);
> + local_irq_restore(flags);
>  }
>  
>  static int rs_ioctl(struct tty_struct *tty,
> @@ -1206,7 +1206,7 @@ rs68328_init(void)
>   rs_interrupt,
>   0,
>   "M68328_UART", info))
> -panic("Unable to attach 68328 serial interrupt\n");
> + panic("Unable to attach 68328 serial interrupt\n");
>  
>   tty_port_link_device(>tport, serial_driver, i);
>   }
> @@ -1295,11 +1295,11 @@ void m68328_console_write (struct console *co, const 
> char *str,
>  {
>   if (!m68328_console_initted)
>   m68328_set_baud();
> -while 

Re: [PATCH 0/9] Fix checkpatch errors

2015-12-12 Thread Greg KH
On Fri, Dec 11, 2015 at 11:36:00AM +0100, Frederik Völkel wrote:
> This patch series fixes all checkpatch error in 68328serial.c except
> 5 trailing whitespace errors we are unsure how to fix.

What are the errors you are not sure how to fix?

thanks,

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


Re: [PATCH v1 04/10] serial: mps2-uart: add MPS2 UART driver

2015-12-12 Thread Greg Kroah-Hartman
On Sun, Dec 13, 2015 at 01:39:26AM +0200, Andy Shevchenko wrote:
> On Wed, Dec 2, 2015 at 11:33 AM, Vladimir Murzin
>  wrote:
> > This driver adds support to the UART controller found on ARM MPS2
> > platform.
> 
> Just few comments (have neither time not big desire to do full review).
> 
> >
> > Signed-off-by: Vladimir Murzin 
> > ---
> >  drivers/tty/serial/Kconfig   |   12 +
> >  drivers/tty/serial/Makefile  |1 +
> >  drivers/tty/serial/mps2-uart.c   |  596 
> > ++
> >  include/uapi/linux/serial_core.h |3 +
> >  4 files changed, 612 insertions(+)
> >  create mode 100644 drivers/tty/serial/mps2-uart.c
> >
> > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> > index f38beb2..e98bfea 100644
> > --- a/drivers/tty/serial/Kconfig
> > +++ b/drivers/tty/serial/Kconfig
> > @@ -1473,6 +1473,18 @@ config SERIAL_EFM32_UART
> >   This driver support the USART and UART ports on
> >   Energy Micro's efm32 SoCs.
> >
> > +config SERIAL_MPS2_UART_CONSOLE
> > +   bool "MPS2 UART console support"
> > +   depends on SERIAL_MPS2_UART
> > +   select SERIAL_CORE_CONSOLE
> > +
> > +config SERIAL_MPS2_UART
> > +   bool "MPS2 UART port"
> > +   depends on ARM || COMPILE_TEST
> > +   select SERIAL_CORE
> > +   help
> > + This driver support the UART ports on ARM MPS2.
> > +
> >  config SERIAL_EFM32_UART_CONSOLE
> > bool "EFM32 UART/USART console support"
> > depends on SERIAL_EFM32_UART=y
> > diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> > index 5ab4111..7f589f5 100644
> > --- a/drivers/tty/serial/Makefile
> > +++ b/drivers/tty/serial/Makefile
> > @@ -93,6 +93,7 @@ obj-$(CONFIG_SERIAL_CONEXANT_DIGICOLOR)   += 
> > digicolor-usart.o
> >  obj-$(CONFIG_SERIAL_MEN_Z135)  += men_z135_uart.o
> >  obj-$(CONFIG_SERIAL_SPRD) += sprd_serial.o
> >  obj-$(CONFIG_SERIAL_STM32) += stm32-usart.o
> > +obj-$(CONFIG_SERIAL_MPS2_UART) += mps2-uart.o
> >
> >  # GPIOLIB helpers for modem control lines
> >  obj-$(CONFIG_SERIAL_MCTRL_GPIO)+= serial_mctrl_gpio.o
> > diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c
> > new file mode 100644
> > index 000..09bac16
> > --- /dev/null
> > +++ b/drivers/tty/serial/mps2-uart.c
> > @@ -0,0 +1,596 @@
> > +/*
> > + * Copyright (C) 2015 ARM Limited
> > + *
> > + * Author: Vladimir Murzin 
> > + *
> > + * 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.
> > + *
> > + * TODO: support for SysRq
> > + */
> > +
> > +#define pr_fmt(fmt)KBUILD_MODNAME ": " fmt
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define SERIAL_NAME "ttyMPS"
> 
> Can it be ttyS?

It must be ttyS, please fix this.  Don't go creating new tty device
names, it never will work out and will eventually come back to cause
problems if you do not.

thanks,

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


Re: [PATCH v2] drivers/tty/serial: make tegra_serial_handle_break() static

2015-12-12 Thread Greg Kroah-Hartman
On Wed, Nov 25, 2015 at 11:50:03PM +0600, Alexander Kuleshov wrote:
> There are no callers of the tegra_serial_handle_break() function
> outside of drivers/tty/serial/of_serial.c. So let's make it static.
> 
> Signed-off-by: Alexander Kuleshov 
> ---
> Forgot Signed-off-by line
> 
>  drivers/tty/serial/of_serial.c | 2 +-

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


Re: [PATCH] tty/n_gsm.c: use gsm->num to remove mux itself from gsm_mux[]

2015-12-12 Thread Greg Kroah-Hartman
On Fri, Nov 27, 2015 at 11:41:03AM +0800, xinhui wrote:
> There is one filed gsm->num to store mux's index of gsm_mux[]. So use
> gsm->num to remove itself from gsm_mux[] instead of the for-loop
> traverse in gsm_cleanup_mux().
> 
> Signed-off-by: Pan Xinhui 

Your "From:" line in the email needs to match your signed-off-by: line,
please fix up your email client to do this properly so that your patches
can be accepted.

thanks,

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


Re: [PATCH 00/25] serial: sh-sci: Add external clock and BRG Support

2015-12-12 Thread Greg Kroah-Hartman
On Fri, Nov 20, 2015 at 10:09:24AM +0100, Geert Uytterhoeven wrote:
> On Thu, Nov 19, 2015 at 7:38 PM, Geert Uytterhoeven
>  wrote:
> > This patch series adds support to the Renesas SCI serial driver for
> >   - the optional external clock on (H)SCI(F) and some SCIFA, where this
> > pin can serve as a clock input,
> >   - the optional clock sources for the Baud Rate Generator for External
> > Clock (BRG), as found on some SCIF variants and on HSCIF.
> > Using external clocks increases the range and accuracy of supported baud
> > rates. Please see the descriptions of the DTS patches for more detailed
> > information regarding the impact on the supported platforms.
> 
> For the consumers: I've pushed this (incl. the dependencies and a few
> WIP patches) to the scif-brg branch of my renesas-drivers repo.

I don't know what I can do with this series given the dependancies, but
if it helps, you can add:
Acked-by: Greg Kroah-Hartman 
to the serial patches and take them through what ever tree you want to.

thanks,

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


[PATCH] [trivial] treewide: Fix typo in printk

2015-12-12 Thread Masanari Iida
This patch fix spelling typos found in printk and Kconfig.

Signed-off-by: Masanari Iida 
---
 drivers/atm/firestream.c| 2 +-
 drivers/crypto/nx/nx-842.c  | 2 +-
 drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c   | 2 +-
 drivers/input/touchscreen/wdt87xx_i2c.c | 2 +-
 drivers/net/ethernet/nuvoton/w90p910_ether.c| 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c | 2 +-
 drivers/usb/gadget/legacy/Kconfig   | 3 +--
 kernel/time/timekeeping.c   | 2 +-
 lib/842/842_decompress.c| 2 +-
 net/openvswitch/vport-geneve.c  | 2 +-
 tools/testing/selftests/timers/alarmtimer-suspend.c | 2 +-
 11 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 82f2ae0..a969a7e 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -168,7 +168,7 @@ static char *res_strings[] = {
"reserved 14", 
"Unrecognized cell", 
"reserved 16", 
-   "reassemby abort: AAL5 abort", 
+   "reassembly abort: AAL5 abort", 
"packet purged", 
"packet ageing timeout", 
"channel ageing timeout", 
diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c
index 046c1c4..d94e25d 100644
--- a/drivers/crypto/nx/nx-842.c
+++ b/drivers/crypto/nx/nx-842.c
@@ -308,7 +308,7 @@ int nx842_crypto_compress(struct crypto_tfm *tfm,
h = !n && add_header ? hdrsize : 0;
 
if (ignore)
-   pr_warn("interal error, ignore is set %x\n", ignore);
+   pr_warn("internal error, ignore is set %x\n", ignore);
 
ret = compress(ctx, , >group[n], , , h);
if (ret)
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c 
b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
index fcea3a2..1844d28 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
@@ -64,7 +64,7 @@ const char *usnic_ib_qp_grp_state_to_string(enum ib_qp_state 
state)
case IB_QPS_ERR:
return "ERR";
default:
-   return "UNKOWN STATE";
+   return "UNKNOWN STATE";
 
}
 }
diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c 
b/drivers/input/touchscreen/wdt87xx_i2c.c
index 515c20a..73861ad 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -848,7 +848,7 @@ static int wdt87xx_do_update_firmware(struct i2c_client 
*client,
error = wdt87xx_get_sysparam(client, >param);
if (error)
dev_err(>dev,
-   "failed to refresh system paramaters: %d\n", error);
+   "failed to refresh system parameters: %d\n", error);
 out:
enable_irq(client->irq);
mutex_unlock(>fw_mutex);
diff --git a/drivers/net/ethernet/nuvoton/w90p910_ether.c 
b/drivers/net/ethernet/nuvoton/w90p910_ether.c
index afa4458..52d9a94 100644
--- a/drivers/net/ethernet/nuvoton/w90p910_ether.c
+++ b/drivers/net/ethernet/nuvoton/w90p910_ether.c
@@ -1038,7 +1038,7 @@ static int w90p910_ether_probe(struct platform_device 
*pdev)
 
error = register_netdev(dev);
if (error != 0) {
-   dev_err(>dev, "Regiter EMC w90p910 FAILED\n");
+   dev_err(>dev, "Register EMC w90p910 FAILED\n");
error = -ENODEV;
goto failed_put_rmiiclk;
}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
index b57cfd9..95dcbff 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
@@ -626,7 +626,7 @@ static void rtl8821ae_dm_find_minimum_rssi(struct 
ieee80211_hw *hw)
rtl_dm_dig->min_undec_pwdb_for_dm =
rtlpriv->dm.entry_min_undec_sm_pwdb;
RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
-"AP Ext Port or disconnet PWDB = 0x%x\n",
+"AP Ext Port or disconnect PWDB = 0x%x\n",
 rtl_dm_dig->min_undec_pwdb_for_dm);
}
RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
diff --git a/drivers/usb/gadget/legacy/Kconfig 
b/drivers/usb/gadget/legacy/Kconfig
index a23d1b9..0b36878 100644
--- a/drivers/usb/gadget/legacy/Kconfig
+++ b/drivers/usb/gadget/legacy/Kconfig
@@ -103,8 +103,7 @@ config USB_ETH
   - CDC Ethernet Emulation Model (EEM) is a newer standard that has
 a simpler interface that can be used by more USB hardware.
 
- RNDIS support is an additional option, more demanding than than
- subset.
+ RNDIS support is an additional option, more demanding than subset.
 
  Within the USB device, this gadget driver exposes a network device
  "usbX", where X depends 

[PATCH] staging: netlogic: Coding Style Alignment should match open parenthesis

2015-12-12 Thread Benjamin Young
Fixed alignment issues with parenthesis so the code is easier to read.

Signed-off-by: Benjamin Young 
---
 drivers/staging/netlogic/platform_net.c |  12 +--
 drivers/staging/netlogic/xlr_net.c  | 159 +---
 2 files changed, 91 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index 7806c2b..f71e42a 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -121,8 +121,8 @@ static struct platform_device *gmac_controller2_init(void 
*gmac0_addr)
ndata1.phy_addr[mac] = mac + 4 + 0x10;
 
xlr_resource_init(_net1_res[mac * 2],
-   xlr_gmac_offsets[mac + 4],
-   xlr_gmac_irqs[mac + 4]);
+ xlr_gmac_offsets[mac + 4],
+ xlr_gmac_irqs[mac + 4]);
}
xlr_net_dev1.num_resources = 8;
 
@@ -169,7 +169,7 @@ static void xls_gmac_init(void)
xlr_net_dev0.num_resources = 2;
 
xlr_resource_init(_net0_res[0], xlr_gmac_offsets[0],
-   xlr_gmac_irqs[0]);
+ xlr_gmac_irqs[0]);
platform_device_register(_net_dev0);
 
/* second block is XAUI, not supported yet */
@@ -182,8 +182,8 @@ static void xls_gmac_init(void)
ndata0.phy_addr[mac] = mac + 0x10;
 
xlr_resource_init(_net0_res[mac * 2],
-   xlr_gmac_offsets[mac],
-   xlr_gmac_irqs[mac]);
+ xlr_gmac_offsets[mac],
+ xlr_gmac_irqs[mac]);
}
xlr_net_dev0.num_resources = 8;
platform_device_register(_net_dev0);
@@ -223,7 +223,7 @@ static void xlr_gmac_init(void)
ndata0.tx_stnid[mac] = FMN_STNID_GMAC0_TX0 + mac;
ndata0.phy_addr[mac] = mac;
xlr_resource_init(_net0_res[mac * 2], xlr_gmac_offsets[mac],
-   xlr_gmac_irqs[mac]);
+ xlr_gmac_irqs[mac]);
}
xlr_net_dev0.num_resources = 8;
xlr_net_dev0.resource = xlr_net0_res;
diff --git a/drivers/staging/netlogic/xlr_net.c 
b/drivers/staging/netlogic/xlr_net.c
index ac93e63..7c44acf 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -69,8 +69,8 @@ static inline u32 xlr_nae_rdreg(u32 __iomem *base, unsigned 
int reg)
return __raw_readl(base + reg);
 }
 
-static inline void xlr_reg_update(u32 *base_addr,
-   u32 off, u32 val, u32 mask)
+static inline void xlr_reg_update(u32 *base_addr, u32 off,
+ u32 val, u32 mask)
 {
u32 tmp;
 
@@ -122,8 +122,8 @@ static inline unsigned char *xlr_alloc_skb(void)
return skb->data;
 }
 
-static void xlr_net_fmn_handler(int bkt, int src_stnid, int size,
-   int code, struct nlm_fmn_msg *msg, void *arg)
+static void xlr_net_fmn_handler(int bkt, int src_stnid, int size, int code,
+   struct nlm_fmn_msg *msg, void *arg)
 {
struct sk_buff *skb;
void *skb_data = NULL;
@@ -247,7 +247,7 @@ static int xlr_net_stop(struct net_device *ndev)
 }
 
 static void xlr_make_tx_desc(struct nlm_fmn_msg *msg, unsigned long addr,
-   struct sk_buff *skb)
+struct sk_buff *skb)
 {
unsigned long physkb = virt_to_phys(skb);
int cpu_core = nlm_core_id();
@@ -275,7 +275,7 @@ static void __maybe_unused xlr_wakeup_queue(unsigned long 
dev)
 }
 
 static netdev_tx_t xlr_net_start_xmit(struct sk_buff *skb,
-   struct net_device *ndev)
+ struct net_device *ndev)
 {
struct nlm_fmn_msg msg;
struct xlr_net_priv *priv = netdev_priv(ndev);
@@ -304,10 +304,10 @@ static void xlr_hw_set_mac_addr(struct net_device *ndev)
 
/* set mac station address */
xlr_nae_wreg(priv->base_addr, R_MAC_ADDR0,
-   ((ndev->dev_addr[5] << 24) | (ndev->dev_addr[4] << 16) |
-   (ndev->dev_addr[3] << 8) | (ndev->dev_addr[2])));
+((ndev->dev_addr[5] << 24) | (ndev->dev_addr[4] << 16) |
+(ndev->dev_addr[3] << 8) | (ndev->dev_addr[2])));
xlr_nae_wreg(priv->base_addr, R_MAC_ADDR0 + 1,
-   ((ndev->dev_addr[1] << 24) | (ndev->dev_addr[0] << 16)));
+((ndev->dev_addr[1] << 24) | (ndev->dev_addr[0] << 16)));
 
xlr_nae_wreg(priv->base_addr, R_MAC_ADDR_MASK2, 0x);
xlr_nae_wreg(priv->base_addr, R_MAC_ADDR_MASK2 + 1, 0x);
@@ -315,12 +315,12 @@ static void xlr_hw_set_mac_addr(struct net_device *ndev)
xlr_nae_wreg(priv->base_addr, R_MAC_ADDR_MASK3 + 1, 

Re: [PATCH v2] Input: xpad - remove spurious events of wireless xpad 360 controller

2015-12-12 Thread Dmitry Torokhov
On Sun, Nov 22, 2015 at 05:35:39PM +0100, clement.calm...@free.fr wrote:
> From: Clement Calmels 
> 
> When powering up a wireless xbox 360 controller, some wrong joystick
> events are generated. It is annoying because, for example, it makes
> unwanted moves in Steam big picture mode's menu.
> 
> When my controller is powering up, this packet is received by the
> driver:
> : 00 0f 00 f0 00 cc ff cf 8b e0 86 6a 68 f0 00 20  ...jh..
> 0010: 13 e3 20 1d 30 03 40 01 50 01 ff ff  .. .0.@.P...
> 
> According to xboxdrv userspace driver source code, this packet is only
> dumping a serial id and should not be interpreted as joystick events.
> This issue can be easily seen with jstest:
> $ jstest --event /dev/input/js0
> 
> This patch only adds a way to filter out this "serial" packet and as a
> result it removes the spurous events.
> 
> Signed-off-by: Clement Calmels 

Applied, thank you.

> ---
>  drivers/input/joystick/xpad.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index fd4100d..c44cbd4 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -527,7 +527,7 @@ static void xpad360w_process_packet(struct usb_xpad 
> *xpad, u16 cmd, unsigned cha
>   }
>  
>   /* Valid pad data */
> - if (!(data[1] & 0x1))
> + if (data[1] != 0x1)
>   return;
>  
>   xpad360_process_packet(xpad, cmd, [4]);
> -- 
> 2.6.2
> 

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


Re: [Resend 0/2] Add support for APQ8084 and MSM8916 Regulators

2015-12-12 Thread Andy Gross
On Sat, Dec 12, 2015 at 11:00:25PM +, Mark Brown wrote:
> On Fri, Dec 11, 2015 at 12:01:32AM -0600, Andy Gross wrote:
> > This patch set is a resend of the regulator portion of the patches
> > found at:
> > 
> > https://lkml.org/lkml/2015/9/24/561
> 
> These don't apply against current code which suggests that the
> unanswered question I asked about dependencies when they were originally
> posted is still outstanding...

Apologies on messing this up.  The only dependency on these two patches is a
Documentation change I made to clean up the rpm/smd/smd-regulator information.
I had moved the regulator information out of the rpm-smd file and made it into
its own file.

I can add this into the patch set so that all of it is in one place.  I'll also
move the regulator specific document to the regulator documentation directory
where it probably should belong.

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


Re: [PATCH 2/2] Input: add touchscreen support for TS-4800

2015-12-12 Thread Dmitry Torokhov
Hi Damien,

On Thu, Dec 10, 2015 at 11:11:12AM -0500, Damien Riegel wrote:
> On this board, the touchscreen, an ads7843, is not handled directly by
> Linux but by a companion FPGA. This FPGA is memory-mapped and the IP
> design is very similar to the mk712.

...

> +
> + poll_dev = devm_input_allocate_polled_device(>dev);
> + if (!poll_dev)
> + return -ENOMEM;

I wonder how useful touchscreen implemented as polling device is. Isn't
there an interrupt line for it?

Thanks.

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


Re: touchscreen: edt-ft5x06: Prevent DMA driver from mapping an area on stack

2015-12-12 Thread Dmitry Torokhov
On Sat, Dec 12, 2015 at 06:13:55PM +0100, Wolfram Sang wrote:
> 
> > Frankly speaking I do not know where the fix should actually be. I2C IMX
> > driver somehow taking care of this or the users of I2C, touchscreen drivers
> > in this case. In my opinion, the fix should be with the touchscreen driver
> > however I did like to have feedback or hear opinions on what is the accepted
> > solution to this.
> 
> There is no accepted solution to this yet :( DMA is/was still too rare for
> a serious discussion about this. There is also [1] and probably more...
> 
> [1]  http://patchwork.ozlabs.org/patch/220137/

I believe vast majority of i2c client drivers do not expect that the
transfer buffer they supply in i2c messages are supposed to be DMAable
(unlike USB and SPI buses that had that requirement from the beginning).

I won't be applying this patch unless we decide that I2C changes the
rules.

Thanks.

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


[PATCH] ntp:Fix second_overflow's input parameter type

2015-12-12 Thread DengChao
The function "second_overflow" uses "unsign long"
as its input parameter type which will overflow after
year 2106 on 32bit systems.
Replace it with time64_t type.
Because 64-bit division is expensive, since "next_ntp_leap_sec"
has been calculated already, we can just re-use it in the
TIME_INS/DEL cases instead of re-doing divsion which may occur
once a second.
Signed-off-by: DengChao 
---
 kernel/time/ntp.c  | 16 +---
 kernel/time/ntp_internal.h |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 149cc80..37479305 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ntp_internal.h"
 
@@ -390,10 +391,11 @@ ktime_t ntp_get_next_leap(void)
  *
  * Also handles leap second processing, and returns leap offset
  */
-int second_overflow(unsigned long secs)
+int second_overflow(time64_t secs)
 {
s64 delta;
int leap = 0;
+   s32 rem;
 
/*
 * Leap second processing. If in leap-insert state at the end of the
@@ -404,19 +406,19 @@ int second_overflow(unsigned long secs)
case TIME_OK:
if (time_status & STA_INS) {
time_state = TIME_INS;
-   ntp_next_leap_sec = secs + SECS_PER_DAY -
-   (secs % SECS_PER_DAY);
+   div_s64_rem(secs, SECS_PER_DAY, );
+   ntp_next_leap_sec = secs + SECS_PER_DAY - rem;
} else if (time_status & STA_DEL) {
time_state = TIME_DEL;
-   ntp_next_leap_sec = secs + SECS_PER_DAY -
-((secs+1) % SECS_PER_DAY);
+   div_s64_rem(secs + 1, SECS_PER_DAY, );
+   ntp_next_leap_sec = secs + SECS_PER_DAY - rem;
}
break;
case TIME_INS:
if (!(time_status & STA_INS)) {
ntp_next_leap_sec = TIME64_MAX;
time_state = TIME_OK;
-   } else if (secs % SECS_PER_DAY == 0) {
+   } else if (secs == ntp_next_leap_sec) {
leap = -1;
time_state = TIME_OOP;
printk(KERN_NOTICE
@@ -427,7 +429,7 @@ int second_overflow(unsigned long secs)
if (!(time_status & STA_DEL)) {
ntp_next_leap_sec = TIME64_MAX;
time_state = TIME_OK;
-   } else if ((secs + 1) % SECS_PER_DAY == 0) {
+   } else if (secs == ntp_next_leap_sec) {
leap = 1;
ntp_next_leap_sec = TIME64_MAX;
time_state = TIME_WAIT;
diff --git a/kernel/time/ntp_internal.h b/kernel/time/ntp_internal.h
index af92447..d8a7c11 100644
--- a/kernel/time/ntp_internal.h
+++ b/kernel/time/ntp_internal.h
@@ -6,7 +6,7 @@ extern void ntp_clear(void);
 /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
 extern u64 ntp_tick_length(void);
 extern ktime_t ntp_get_next_leap(void);
-extern int second_overflow(unsigned long secs);
+extern int second_overflow(time64_t secs);
 extern int ntp_validate_timex(struct timex *);
 extern int __do_adjtimex(struct timex *, struct timespec64 *, s32 *);
 extern void __hardpps(const struct timespec64 *, const struct timespec64 *);
-- 
1.9.1

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


[PATCH 1/2] timekeeping: Provide internal function __ktime_get_real_seconds

2015-12-12 Thread DengChao
In order to fix Y2038 issues in the ntp code we will need replace
get_seconds() with ktime_get_real_seconds() but as the ntp code uses
the timekeeping lock which is also used by ktime_get_real_seconds(),
we need a version without locking.
Add a new function __ktime_get_real_seconds() in timekeeping to
do this.

Reviewed-by: John Stultz 
Signed-off-by: DengChao 
---
 kernel/time/timekeeping.c  | 13 +
 kernel/time/timekeeping_internal.h |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d563c19..55acadb 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -846,6 +846,19 @@ time64_t ktime_get_real_seconds(void)
 }
 EXPORT_SYMBOL_GPL(ktime_get_real_seconds);
 
+/**
+ * __ktime_get_real_seconds - The same as ktime_get_real_seconds
+ * but without the sequence counter protect. This internal function
+ * is called just when timekeeping lock is already held.
+ */
+time64_t __ktime_get_real_seconds(void)
+{
+   struct timekeeper *tk = _core.timekeeper;
+
+   return tk->xtime_sec;
+}
+
+
 #ifdef CONFIG_NTP_PPS
 
 /**
diff --git a/kernel/time/timekeeping_internal.h 
b/kernel/time/timekeeping_internal.h
index 4ea005a..e20466f 100644
--- a/kernel/time/timekeeping_internal.h
+++ b/kernel/time/timekeeping_internal.h
@@ -26,4 +26,6 @@ static inline cycle_t clocksource_delta(cycle_t now, cycle_t 
last, cycle_t mask)
 }
 #endif
 
+extern time64_t __ktime_get_real_seconds(void);
+
 #endif /* _TIMEKEEPING_INTERNAL_H */
-- 
1.9.1

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


[PATCH 2/2] ntp:Change the type of time_reftime to time64_t and replace get_seconds with __ktime_get_real_seconds

2015-12-12 Thread DengChao
The type of static variant "time_reftime" and the call of get_seconds
in ntp are both not y2038 safe.
So change the type of time_reftime to time64_t and replace get_seconds
with __ktime_get_real_seconds.
The local variant "secs" in ntp_update_offset represents seconds between
now and last ntp adjustment, it seems impossible that this time will last
more than 68 years, so keep its type as "long".

Reviewed-by: John Stultz 
Signed-off-by: DengChao 
---
 kernel/time/ntp.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 149cc80..f9b9d8e 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -18,6 +18,8 @@
 #include 
 
 #include "ntp_internal.h"
+#include "timekeeping_internal.h"
+
 
 /*
  * NTP timekeeping variables:
@@ -70,7 +72,7 @@ static long   time_esterror = NTP_PHASE_LIMIT;
 static s64 time_freq;
 
 /* time at last adjustment (secs): */
-static longtime_reftime;
+static time64_ttime_reftime;
 
 static longtime_adjust;
 
@@ -311,11 +313,11 @@ static void ntp_update_offset(long offset)
 * Select how the frequency is to be controlled
 * and in which mode (PLL or FLL).
 */
-   secs = get_seconds() - time_reftime;
+   secs = (long)(__ktime_get_real_seconds() - time_reftime);
if (unlikely(time_status & STA_FREQHOLD))
secs = 0;
 
-   time_reftime = get_seconds();
+   time_reftime = __ktime_get_real_seconds();
 
offset64= offset;
freq_adj= ntp_update_offset_fll(offset64, secs);
@@ -590,7 +592,7 @@ static inline void process_adj_status(struct timex *txc, 
struct timespec64 *ts)
 * reference time to current time.
 */
if (!(time_status & STA_PLL) && (txc->status & STA_PLL))
-   time_reftime = get_seconds();
+   time_reftime = __ktime_get_real_seconds();
 
/* only set allowed bits */
time_status &= STA_RONLY;
-- 
1.9.1

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


[PATCH 0/2] ntp:Change the type of time_reftime and replace get_seconds()

2015-12-12 Thread DengChao
The type of ntp static variant "time_reftime" and the type of get_seconds()'s
return value are both unsign long now, which may cause y2038 problem on 32bit 
systems.

So change time_reftime' type to time64_t, and replace get_seconds with
ktime_get_real_seconds() in ntp.
ktime_get_real_seconds() does the same thing as get_seconds() and is y2038 safe,
but ktime_get_real_seconds holds the timekeeping lock which is also held by the 
ntp code.
We need timekeeping to provide a none lock version of ktime_get_real_seconds
before we can start to solve the ntp.c's y2038 problem.

The [PATCH 1/2] provides the internal none lock version function.
The [PATCH 2/2] does the real fix.

DengChao (2):
  timekeeping: Provide internal function __ktime_get_real_seconds
  ntp:Change the type of time_reftime to time64_t and replace
get_seconds with __ktime_get_real_seconds

 kernel/time/ntp.c  | 10 ++
 kernel/time/timekeeping.c  | 13 +
 kernel/time/timekeeping_internal.h |  2 ++
 3 files changed, 21 insertions(+), 4 deletions(-)

-- 
1.9.1

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


[GIT PULL] char/misc driver fixes for 4.4-rc5

2015-12-12 Thread Greg KH
The following changes since commit 1ec218373b8ebda821aec00bb156a9c94fad9cd4:

  Linux 4.4-rc2 (2015-11-22 16:45:59 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ 
tags/char-misc-4.4-rc5

for you to fetch changes up to e8c77bda05e5d93cce6f38cfdde4192307951dea:

  fpga manager: Fix firmware resource leak on error (2015-11-24 15:25:46 -0800)


Char/Misc driver fixes for 4.4-rc5

Only 2 small fpga driver fixes here, both have been in linux-next for a
while, and resolve some reported issues.

Signed-off-by: Greg Kroah-Hartman 


Alan Tull (1):
  fpga manager: remove label

Tobias Klauser (1):
  fpga manager: Fix firmware resource leak on error

 drivers/fpga/fpga-mgr.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] Staging driver fixes for 4.4-rc5

2015-12-12 Thread Greg KH
The following changes since commit 1ec218373b8ebda821aec00bb156a9c94fad9cd4:

  Linux 4.4-rc2 (2015-11-22 16:45:59 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-4.4-rc5

for you to fetch changes up to 9225c0b7b976dd9ceac2b80727a60d8fcb906a62:

  staging: lustre: echo_copy.._lsm() dereferences userland pointers directly 
(2015-12-01 12:13:32 -0800)


Staging driver fixes for 4.4-rc5

Here are a few staging and IIO driver fixes for 4.4-rc5.

All of them resolve reported problems and have been in linux-next for a
while.  Nothing major here, just small fixes where needed.

Signed-off-by: Greg Kroah-Hartman 


Al Viro (1):
  staging: lustre: echo_copy.._lsm() dereferences userland pointers directly

Dan Carpenter (1):
  iio: fix some warning messages

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-4.4b' of git://git.kernel.org/.../jic23/iio into 
staging-linus

Ioana Ciornei (1):
  staging: iio: dummy: complete IIO events delivery to userspace

Julia Lawall (1):
  iio: adc: spmi-vadc: add missing of_node_put

Matt Ranostay (2):
  iio: lidar: return -EINVAL on invalid signal
  iio: light: apds9960: correct ->last_busy count

 drivers/iio/adc/qcom-spmi-vadc.c|  4 +++-
 drivers/iio/industrialio-buffer.c   |  2 +-
 drivers/iio/industrialio-core.c |  2 +-
 drivers/iio/light/apds9960.c|  1 +
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c   |  6 +++---
 drivers/staging/iio/iio_simple_dummy_events.c   |  2 +-
 drivers/staging/lustre/lustre/obdecho/echo_client.c | 20 +++-
 7 files changed, 21 insertions(+), 16 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] USB driver fixes for 4.4-rc5

2015-12-12 Thread Greg KH
The following changes since commit 31ade3b83e1821da5fbb2f11b5b3d4ab2ec39db8:

  Linux 4.4-rc3 (2015-11-29 18:58:26 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ tags/usb-4.4-rc5

for you to fetch changes up to ad87e03213b552a5c33d5e1e7a19a73768397010:

  USB: add quirk for devices with broken LPM (2015-12-11 15:40:51 -0800)


USB fixes for 4.4-rc5

Here are a number of small USB fixes for 4.4-rc5.  All of them have been
in linux-next.  The majority are gadget and phy issues, with a few new
quirks and device ids added as well.

Signed-off-by: Greg Kroah-Hartman 


Aaro Koskinen (1):
  usb: musb: fail with error when no DMA controller set

Adrien Vergé (2):
  USB: quirks: Fix another ELAN touchscreen
  USB: quirks: Apply ALWAYS_POLL to all ELAN devices

Alan Stern (1):
  USB: add quirk for devices with broken LPM

Alexandre Belloni (1):
  USB: host: ohci-at91: fix a crash in ohci_hcd_at91_overcurrent_irq

Alexey Khoroshilov (1):
  USB: whci-hcd: add check for dma mapping error

Arnd Bergmann (1):
  usb: musb: USB_TI_CPPI41_DMA requires dmaengine support

Ben Hutchings (1):
  usb: Use the USB_SS_MULT() macro to decode burst multiplier for log 
message

Chunfeng Yun (1):
  usb: xhci: fix config fail of FS hub behind a HS hub with MTT

Daniel Walter (1):
  usb: gadget: functionfs: fix missing access_ok checks

Dmitry Katsubo (1):
  usb-storage: Fix scsi-sd failure "Invalid field in cdb" for USB adapter 
JMicron

Don Zickus (1):
  usb: Quiet down false peer failure messages

Felipe Balbi (2):
  usb: gadget: pxa27x: fix suspend callback
  usb: dwc3: gadget: don't prestart interrupt endpoints

Felipe F. Tonello (2):
  usb: gadget: f_midi: Transmit data only when IN ep is enabled
  usb: gadget: f_midi: fix leak on failed to enqueue out requests

Greg Kroah-Hartman (3):
  Merge tag 'fixes-for-v4.4-rc3' of git://git.kernel.org/.../balbi/usb into 
usb-linus
  Merge tag 'usb-serial-4.4-rc3' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus
  Merge tag 'fixes-for-v4.4-rc5' of git://git.kernel.org/.../balbi/usb into 
usb-linus

Hans Yang (1):
  usb: core : hub: Fix BOS 'NULL pointer' kernel panic

John Youn (1):
  usb: dwc2: Make PHY optional

Jonas Jonsson (2):
  USB: cdc_acm: Ignore Infineon Flash Loader utility
  USB: serial: Another Infineon flash loader USB ID

Konstantin Shkolnyy (1):
  USB: cp210x: Remove CP2110 ID from compatibility list

LABBE Corentin (1):
  usb: phy: msm: fix a possible NULL dereference

Mathias Nyman (1):
  xhci: fix usb2 resume timing and races.

Mian Yousaf Kaukab (1):
  usb: gadget: uvc: fix permissions of configfs attributes

Mika Westerberg (1):
  xhci: Fix memory leak in xhci_pme_acpi_rtd3_enable()

Peter Chen (2):
  usb: kconfig: fix warning of select USB_OTG
  usb: phy: mxs: add "fsl,imx6ul-usbphy" compatible string

Stefan Wahren (3):
  usb: dwc2: Return errors from PHY
  usb: dwc2: make otg clk optional
  usb: dwc2: fix kernel oops during driver probe

Tony Lindgren (1):
  usb: musb: core: Fix pm runtime for deferred probe

Yoshihiro Shimoda (1):
  usb: renesas_usbhs: gadget: Fix NULL pointer dereference in 
usbhsg_ep_dequeue()

 drivers/hid/hid-ids.h  |  5 --
 drivers/hid/usbhid/hid-quirks.c|  9 ++--
 drivers/usb/class/cdc-acm.c|  5 ++
 drivers/usb/core/config.c  |  3 +-
 drivers/usb/core/hub.c | 22 +---
 drivers/usb/core/port.c|  4 +-
 drivers/usb/core/quirks.c  |  9 
 drivers/usb/dwc2/platform.c| 81 +++---
 drivers/usb/dwc3/gadget.c  |  1 +
 drivers/usb/gadget/function/f_fs.c |  6 +--
 drivers/usb/gadget/function/f_midi.c   |  3 +-
 drivers/usb/gadget/function/uvc_configfs.c |  2 +-
 drivers/usb/gadget/udc/pxa27x_udc.c|  3 ++
 drivers/usb/host/ohci-at91.c   | 11 ++--
 drivers/usb/host/whci/qset.c   |  4 ++
 drivers/usb/host/xhci-hub.c| 47 +++--
 drivers/usb/host/xhci-pci.c|  8 ++-
 drivers/usb/host/xhci-ring.c   |  3 +-
 drivers/usb/host/xhci.c|  8 +++
 drivers/usb/musb/Kconfig   |  2 +-
 drivers/usb/musb/musb_core.c   |  8 ++-
 drivers/usb/phy/phy-msm-usb.c  |  6 +--
 drivers/usb/phy/phy-mxs-usb.c  |  5 ++
 drivers/usb/renesas_usbhs/mod_gadget.c | 11 +++-
 drivers/usb/serial/cp210x.c|  1 -
 drivers/usb/serial/usb-serial-simple.c |  1 +
 drivers/usb/storage/uas.c  |  4 ++
 drivers/usb/storage/unusual_devs.h |  2 +-
 

[PATCH v2 02/10] usb: host: ehci-sched: move constants to right

2015-12-12 Thread Geyslan G. Bem
This patch moves the constants to right.

Tested by compilation only.
Caught by coccinelle:
scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index eb14143..28fca70 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -330,7 +330,7 @@ static int __maybe_unused same_tt(struct usb_device *dev1,
  */
 static inline unsigned char tt_start_uframe(struct ehci_hcd *ehci, __hc32 mask)
 {
-   unsigned char smask = QH_SMASK & hc32_to_cpu(ehci, mask);
+   unsigned char smask = hc32_to_cpu(ehci, mask) & QH_SMASK;
if (!smask) {
ehci_err(ehci, "invalid empty smask!\n");
/* uframe 7 can't have bw so this will indicate failure */
@@ -409,11 +409,11 @@ static int tt_available (
 * must be empty, so as to not illegally delay
 * already scheduled transactions
 */
-   if (125 < usecs) {
+   if (usecs > 125) {
int ufs = (usecs / 125);
 
for (i = uframe; i < (uframe + ufs) && i < 8; i++)
-   if (0 < tt_usecs[i])
+   if (tt_usecs[i] > 0)
return 0;
}
 
-- 
2.6.3

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


[PATCH v2 08/10] usb: host: ehci-sched: add line after declarations

2015-12-12 Thread Geyslan G. Bem
This patch adds a blank line after declarations.

Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 00d1932..ff6319b 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -330,6 +330,7 @@ static int __maybe_unused same_tt(struct usb_device *dev1,
 static inline unsigned char tt_start_uframe(struct ehci_hcd *ehci, __hc32 mask)
 {
unsigned char smask = hc32_to_cpu(ehci, mask) & QH_SMASK;
+
if (!smask) {
ehci_err(ehci, "invalid empty smask!\n");
/* uframe 7 can't have bw so this will indicate failure */
@@ -345,6 +346,7 @@ max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 };
 static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8])
 {
int i;
+
for (i = 0; i < 7; i++) {
if (max_tt_usecs[i] < tt_usecs[i]) {
tt_usecs[i+1] += tt_usecs[i] - max_tt_usecs[i];
-- 
2.6.3

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


[PATCH v2 06/10] usb: host: ehci-sched: remove useless else branch

2015-12-12 Thread Geyslan G. Bem
This patch removes an useless else branch after a break, reducing one
indent block.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 62cbd21..9cee46f 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -296,10 +296,9 @@ static void compute_tt_budget(u8 
budget_table[EHCI_BANDWIDTH_SIZE],
if (x <= 125) {
budget_line[uf] = x;
break;
-   } else {
-   budget_line[uf] = 125;
-   x -= 125;
}
+   budget_line[uf] = 125;
+   x -= 125;
}
}
}
-- 
2.6.3

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


[PATCH v2 09/10] usb: host: ehci-sched: use sizeof operator with parens

2015-12-12 Thread Geyslan G. Bem
This patch adds parens to sizeof operator uses.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index ff6319b..31fc788 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1028,7 +1028,7 @@ iso_stream_alloc(gfp_t mem_flags)
 {
struct ehci_iso_stream *stream;
 
-   stream = kzalloc(sizeof *stream, mem_flags);
+   stream = kzalloc(sizeof(*stream), mem_flags);
if (likely(stream != NULL)) {
INIT_LIST_HEAD(>td_list);
INIT_LIST_HEAD(>free_list);
@@ -1196,7 +1196,7 @@ static struct ehci_iso_sched *
 iso_sched_alloc(unsigned packets, gfp_t mem_flags)
 {
struct ehci_iso_sched   *iso_sched;
-   int size = sizeof *iso_sched;
+   int size = sizeof(*iso_sched);
 
size += packets * sizeof(struct ehci_iso_packet);
iso_sched = kzalloc(size, mem_flags);
@@ -1315,7 +1315,7 @@ itd_urb_transaction(
}
}
 
-   memset(itd, 0, sizeof *itd);
+   memset(itd, 0, sizeof(*itd));
itd->itd_dma = itd_dma;
itd->frame = NO_FRAME;
list_add(>itd_list, >td_list);
@@ -2109,7 +2109,7 @@ sitd_urb_transaction(
}
}
 
-   memset(sitd, 0, sizeof *sitd);
+   memset(sitd, 0, sizeof(*sitd));
sitd->sitd_dma = sitd_dma;
sitd->frame = NO_FRAME;
list_add(>sitd_list, _sched->td_list);
-- 
2.6.3

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


[PATCH v2 10/10] usb: host: ehci-sched: remove unnecessary braces

2015-12-12 Thread Geyslan G. Bem
This patch removes unnecessary braces in single statement blocks at the
same time as replaces the if statement with a ternary conditional.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
  v2: removes unnecessary parens in ternary conditional.
---
 drivers/usb/host/ehci-sched.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 31fc788..849f45c 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1060,11 +1060,7 @@ iso_stream_init(
epnum = usb_pipeendpoint(urb->pipe);
is_input = usb_pipein(urb->pipe) ? USB_DIR_IN : 0;
maxp = usb_endpoint_maxp(>ep->desc);
-   if (is_input) {
-   buf1 = (1 << 11);
-   } else {
-   buf1 = 0;
-   }
+   buf1 = is_input ? 1 << 11 : 0;
 
/* knows about ITD vs SITD */
if (dev->speed == USB_SPEED_HIGH) {
-- 
2.6.3

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


[PATCH v2 04/10] usb: host: ehci-sched: add spaces around operators

2015-12-12 Thread Geyslan G. Bem
This patch adds spaces around operators.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 0ab3f06..6d0a573 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -346,7 +346,7 @@ max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 };
 static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8])
 {
int i;
-   for (i=0; i<7; i++) {
+   for (i = 0; i < 7; i++) {
if (max_tt_usecs[i] < tt_usecs[i]) {
tt_usecs[i+1] += tt_usecs[i] - max_tt_usecs[i];
tt_usecs[i] = max_tt_usecs[i];
-- 
2.6.3

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


[PATCH v2 03/10] usb: host: ehci-sched: remove useless initializations

2015-12-12 Thread Geyslan G. Bem
This patch removes useless initializations.

Tested by compilation only.
Caught by cppcheck.

Signed-off-by: Geyslan G. Bem 
---
  v2: replaces 'assignments' with 'initializations'
---
 drivers/usb/host/ehci-sched.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 28fca70..0ab3f06 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -2132,7 +2132,7 @@ sitd_patch(
 )
 {
struct ehci_iso_packet  *uf = _sched->packet [index];
-   u64 bufp = uf->bufp;
+   u64 bufp;
 
sitd->hw_next = EHCI_LIST_END(ehci);
sitd->hw_fullspeed_ep = stream->address;
@@ -2242,7 +2242,7 @@ static bool sitd_complete(struct ehci_hcd *ehci, struct 
ehci_sitd *sitd)
struct urb  *urb = sitd->urb;
struct usb_iso_packet_descriptor*desc;
u32 t;
-   int urb_index = -1;
+   int urb_index;
struct ehci_iso_stream  *stream = sitd->stream;
struct usb_device   *dev;
boolretval = false;
-- 
2.6.3

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


[PATCH v2 05/10] usb: host: ehci-sched: remove prohibited spaces

2015-12-12 Thread Geyslan G. Bem
This patch removes prohibited spaces before open parenthesis and open
brackets.

It also removes an assignment inside condition and unnecessary braces in
single statement block.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 265 +-
 1 file changed, 133 insertions(+), 132 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 6d0a573..62cbd21 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -34,7 +34,7 @@
  * pre-calculated schedule data to make appending to the queue be quick.
  */
 
-static int ehci_get_frame (struct usb_hcd *hcd);
+static int ehci_get_frame(struct usb_hcd *hcd);
 
 /*
  * periodic_next_shadow - return "next" pointer on shadow list
@@ -73,7 +73,7 @@ shadow_next_periodic(struct ehci_hcd *ehci, union ehci_shadow 
*periodic,
 }
 
 /* caller must hold ehci->lock */
-static void periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
+static void periodic_unlink(struct ehci_hcd *ehci, unsigned frame, void *ptr)
 {
union ehci_shadow   *prev_p = >pshadow[frame];
__hc32  *hw_p = >periodic[frame];
@@ -375,7 +375,7 @@ static inline void carryover_tt_bandwidth(unsigned short 
tt_usecs[8])
  * limit of 16, specified in USB 2.0 spec section 11.18.4 requirement #4,
  * since proper scheduling limits ssplits to less than 16 per uframe.
  */
-static int tt_available (
+static int tt_available(
struct ehci_hcd *ehci,
struct ehci_per_sched   *ps,
struct ehci_tt  *tt,
@@ -435,7 +435,7 @@ static int tt_available (
  * for a periodic transfer starting at the specified frame, using
  * all the uframes in the mask.
  */
-static int tt_no_collision (
+static int tt_no_collision(
struct ehci_hcd *ehci,
unsignedperiod,
struct usb_device   *dev,
@@ -455,8 +455,8 @@ static int tt_no_collision (
__hc32  type;
struct ehci_qh_hw   *hw;
 
-   here = ehci->pshadow [frame];
-   type = Q_NEXT_TYPE(ehci, ehci->periodic [frame]);
+   here = ehci->pshadow[frame];
+   type = Q_NEXT_TYPE(ehci, ehci->periodic[frame]);
while (here.ptr) {
switch (hc32_to_cpu(ehci, type)) {
case Q_TYPE_ITD:
@@ -479,7 +479,7 @@ static int tt_no_collision (
here = here.qh->qh_next;
continue;
case Q_TYPE_SITD:
-   if (same_tt (dev, here.sitd->urb->dev)) {
+   if (same_tt(dev, here.sitd->urb->dev)) {
u16 mask;
 
mask = hc32_to_cpu(ehci, here.sitd
@@ -494,7 +494,7 @@ static int tt_no_collision (
continue;
// case Q_TYPE_FSTN:
default:
-   ehci_dbg (ehci,
+   ehci_dbg(ehci,
"periodic frame %d bogus type %d\n",
frame, type);
}
@@ -588,9 +588,9 @@ static void qh_link_periodic(struct ehci_hcd *ehci, struct 
ehci_qh *qh)
qh->qh_next = here;
if (here.qh)
qh->hw->hw_next = *hw_p;
-   wmb ();
+   wmb();
prev->qh = qh;
-   *hw_p = QH_NEXT (ehci, qh->qh_dma);
+   *hw_p = QH_NEXT(ehci, qh->qh_dma);
}
}
qh->qh_state = QH_STATE_LINKED;
@@ -633,7 +633,7 @@ static void qh_unlink_periodic(struct ehci_hcd *ehci, 
struct ehci_qh *qh)
period = qh->ps.period ? : 1;
 
for (i = qh->ps.phase; i < ehci->periodic_size; i += period)
-   periodic_unlink (ehci, i, qh);
+   periodic_unlink(ehci, i, qh);
 
/* update per-qh bandwidth for debugfs */
ehci_to_hcd(ehci)->self.bandwidth_allocated -= qh->ps.bw_period
@@ -679,7 +679,7 @@ static void start_unlink_intr(struct ehci_hcd *ehci, struct 
ehci_qh *qh)
/* if the qh is waiting for unlink, cancel it now */
cancel_unlink_wait_intr(ehci, qh);
 
-   qh_unlink_periodic (ehci, qh);
+   qh_unlink_periodic(ehci, qh);
 
/* Make sure the unlinks are visible before starting the timer */
wmb();
@@ -763,7 +763,7 @@ static void end_unlink_intr(struct ehci_hcd *ehci, struct 
ehci_qh *qh)
 
 /*-*/
 
-static int check_period (
+static int check_period(
struct ehci_hcd *ehci,
unsignedframe,

[PATCH v2 07/10] usb: host: ehci-sched: use C89-style comments

2015-12-12 Thread Geyslan G. Bem
This patch changes comments conforming coding style.

Caught by checkpatch.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-sched.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 9cee46f..00d1932 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -52,7 +52,7 @@ periodic_next_shadow(struct ehci_hcd *ehci, union ehci_shadow 
*periodic,
return >fstn->fstn_next;
case Q_TYPE_ITD:
return >itd->itd_next;
-   // case Q_TYPE_SITD:
+   /* case Q_TYPE_SITD: */
default:
return >sitd->sitd_next;
}
@@ -491,7 +491,7 @@ static int tt_no_collision(
type = Q_NEXT_TYPE(ehci, here.sitd->hw_next);
here = here.sitd->sitd_next;
continue;
-   // case Q_TYPE_FSTN:
+   /* case Q_TYPE_FSTN: */
default:
ehci_dbg(ehci,
"periodic frame %d bogus type %d\n",
@@ -784,7 +784,7 @@ static int check_period(
return 0;
}
 
-   // success!
+   /* success! */
return 1;
 }
 
@@ -1254,7 +1254,7 @@ iso_sched_free(
 {
if (!iso_sched)
return;
-   // caller must hold ehci->lock!
+   /* caller must hold ehci->lock! */
list_splice(_sched->td_list, >free_list);
kfree(iso_sched);
 }
@@ -1715,7 +1715,7 @@ itd_patch(
struct ehci_iso_packet  *uf = _sched->packet[index];
unsignedpg = itd->pg;
 
-   // BUG_ON (pg == 6 && uf->cross);
+   /* BUG_ON(pg == 6 && uf->cross); */
 
uframe &= 0x07;
itd->index[uframe] = index;
@@ -1792,7 +1792,7 @@ static void itd_link_urb(
packet < urb->number_of_packets;) {
if (itd == NULL) {
/* ASSERT:  we have all necessary itds */
-   // BUG_ON (list_empty (_sched->td_list));
+   /* BUG_ON(list_empty(_sched->td_list)); */
 
/* ASSERT:  no itds for this endpoint in this uframe */
 
@@ -1894,9 +1894,10 @@ static bool itd_complete(struct ehci_hcd *ehci, struct 
ehci_itd *itd)
if (likely((urb_index + 1) != urb->number_of_packets))
goto done;
 
-   /* ASSERT: it's really the last itd for this urb
-   list_for_each_entry (itd, >td_list, itd_list)
-   BUG_ON (itd->urb == urb);
+   /*
+* ASSERT: it's really the last itd for this urb
+* list_for_each_entry (itd, >td_list, itd_list)
+*   BUG_ON(itd->urb == urb);
 */
 
/* give urb back to the driver; completion often (re)submits */
@@ -2275,9 +2276,10 @@ static bool sitd_complete(struct ehci_hcd *ehci, struct 
ehci_sitd *sitd)
if ((urb_index + 1) != urb->number_of_packets)
goto done;
 
-   /* ASSERT: it's really the last sitd for this urb
-   list_for_each_entry (sitd, >td_list, sitd_list)
-   BUG_ON (sitd->urb == urb);
+   /*
+* ASSERT: it's really the last sitd for this urb
+* list_for_each_entry (sitd, >td_list, sitd_list)
+*   BUG_ON(sitd->urb == urb);
 */
 
/* give urb back to the driver; completion often (re)submits */
-- 
2.6.3

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


[PATCH v2 01/10] usb: host: ehci-sched: refactor scan_isoc function

2015-12-12 Thread Geyslan G. Bem
This patch removes an infinite 'for' loop and makes use of the already
existing 'restart' tag instead, reducing one leading tab.

It also puts the easier evaluation (live variable) to be the first in
two conditionals.

  if (live && frame == now_frame) { ...

  if (live && ((frame == now_frame) || ...

The comments and code were corrected conforming file coding style.

Tested by compilation only.
Caught by checkpatch:
 WARNING: Too many leading tabs - consider code refactoring

Signed-off-by: Geyslan G. Bem 
---
  v2:
Fixes file coding indentation.
Puts 'live' variable as the first evaluation in two ifs.
---
 drivers/usb/host/ehci-sched.c | 201 +-
 1 file changed, 100 insertions(+), 101 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index f9a3327..eb14143 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -2379,9 +2379,11 @@ static int sitd_submit (struct ehci_hcd *ehci, struct 
urb *urb,
 
 static void scan_isoc(struct ehci_hcd *ehci)
 {
-   unsigneduf, now_frame, frame;
-   unsignedfmask = ehci->periodic_size - 1;
-   boolmodified, live;
+   unsigneduf, now_frame, frame;
+   unsignedfmask = ehci->periodic_size - 1;
+   boolmodified, live;
+   union ehci_shadow   q, *q_p;
+   __hc32  type, *hw_p;
 
/*
 * When running, scan from last scan point up to "now"
@@ -2399,119 +2401,116 @@ static void scan_isoc(struct ehci_hcd *ehci)
ehci->now_frame = now_frame;
 
frame = ehci->last_iso_frame;
-   for (;;) {
-   union ehci_shadow   q, *q_p;
-   __hc32  type, *hw_p;
 
 restart:
-   /* scan each element in frame's queue for completions */
-   q_p = >pshadow [frame];
-   hw_p = >periodic [frame];
-   q.ptr = q_p->ptr;
-   type = Q_NEXT_TYPE(ehci, *hw_p);
-   modified = false;
-
-   while (q.ptr != NULL) {
-   switch (hc32_to_cpu(ehci, type)) {
-   case Q_TYPE_ITD:
-   /* If this ITD is still active, leave it for
-* later processing ... check the next entry.
-* No need to check for activity unless the
-* frame is current.
-*/
-   if (frame == now_frame && live) {
-   rmb();
-   for (uf = 0; uf < 8; uf++) {
-   if (q.itd->hw_transaction[uf] &
-   ITD_ACTIVE(ehci))
-   break;
-   }
-   if (uf < 8) {
-   q_p = >itd_next;
-   hw_p = >hw_next;
-   type = Q_NEXT_TYPE(ehci,
-   q.itd->hw_next);
-   q = *q_p;
+   /* Scan each element in frame's queue for completions */
+   q_p = >pshadow[frame];
+   hw_p = >periodic[frame];
+   q.ptr = q_p->ptr;
+   type = Q_NEXT_TYPE(ehci, *hw_p);
+   modified = false;
+
+   while (q.ptr != NULL) {
+   switch (hc32_to_cpu(ehci, type)) {
+   case Q_TYPE_ITD:
+   /*
+* If this ITD is still active, leave it for
+* later processing ... check the next entry.
+* No need to check for activity unless the
+* frame is current.
+*/
+   if (live && frame == now_frame) {
+   rmb();
+   for (uf = 0; uf < 8; uf++) {
+   if (q.itd->hw_transaction[uf] &
+   ITD_ACTIVE(ehci))
break;
-   }
}
-
-   /* Take finished ITDs out of the schedule
-* and process them:  recycle, maybe report
-* URB completion.  HC won't cache the
-* pointer for much longer, if at all.
-*/
-   *q_p = q.itd->itd_next;
-   if (!ehci->use_dummy_qh ||
-   q.itd->hw_next != EHCI_LIST_END(ehci))
-  

[PATCH v2 00/10] usb: host: ehci-sched: cleanup

2015-12-12 Thread Geyslan G. Bem
Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.

Geyslan G. Bem (10):
  usb: host: ehci-sched: refactor scan_isoc function
  usb: host: ehci-sched: move constants to right
  usb: host: ehci-sched: remove useless initializations
  usb: host: ehci-sched: add spaces around operators
  usb: host: ehci-sched: remove prohibited spaces
  usb: host: ehci-sched: remove useless else branch
  usb: host: ehci-sched: use C89-style comments
  usb: host: ehci-sched: add line after declarations
  usb: host: ehci-sched: use sizeof operator with parens
  usb: host: ehci-sched: remove unnecessary braces

 drivers/usb/host/ehci-sched.c | 521 +-
 1 file changed, 260 insertions(+), 261 deletions(-)

-- 
2.6.3

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


Re: [PATCH V2 2/4] scsi: storvsc: Properly support Fibre Channel devices

2015-12-12 Thread kbuild test robot
Hi Srinivasan,

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.4-rc4 next-20151211]

url:
https://github.com/0day-ci/linux/commits/K-Y-Srinivasan/scsi-storvsc-Properly-support-FC-hosts/20151213-042209
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-h0-12130933 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> ERROR: "fc_release_transport" [drivers/scsi/hv_storvsc.ko] undefined!
>> ERROR: "fc_remove_host" [drivers/scsi/hv_storvsc.ko] undefined!
>> ERROR: "fc_attach_transport" [drivers/scsi/hv_storvsc.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 4.3 00/71] 4.3.3-stable review

2015-12-12 Thread Greg Kroah-Hartman
On Sat, Dec 12, 2015 at 08:05:22PM -0700, Shuah Khan wrote:
> On 12/12/2015 01:05 PM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.3.3 release.
> > There are 71 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Mon Dec 14 20:05:02 UTC 2015.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.3.3-rc1.gz
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Compiled and booted on my test system. No dmesg regressions.

Thanks for testing all of these and letting me know.

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


[PATCH] mm: mempool: Factor out mempool_refill()

2015-12-12 Thread Zhi Wang
This patch factors out mempool_refill() from mempool_resize(). It's reasonable
that the mempool user wants to refill the pool immdiately when it has chance
e.g. inside a sleepible context, so that next time in the IRQ context the pool
would have much more available elements to allocate.

After the refactor, mempool_refill() can also executes with mempool_resize()
/mempool_alloc/mempool_free() or another mempool_refill().

Signed-off-by: Zhi Wang 
---
 include/linux/mempool.h |  1 +
 mm/mempool.c| 61 -
 2 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 69b6951..71f7460 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -30,6 +30,7 @@ extern mempool_t *mempool_create_node(int min_nr, 
mempool_alloc_t *alloc_fn,
gfp_t gfp_mask, int nid);
 
 extern int mempool_resize(mempool_t *pool, int new_min_nr);
+extern void mempool_refill(mempool_t *pool);
 extern void mempool_destroy(mempool_t *pool);
 extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask);
 extern void mempool_free(void *element, mempool_t *pool);
diff --git a/mm/mempool.c b/mm/mempool.c
index 004d42b..139c477 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -223,6 +223,47 @@ mempool_t *mempool_create_node(int min_nr, mempool_alloc_t 
*alloc_fn,
 EXPORT_SYMBOL(mempool_create_node);
 
 /**
+ * mempool_refill - refill an existing memory pool immediately
+ * @pool:   pointer to the memory pool which was allocated via
+ *  mempool_create().
+ *
+ * This function tries to refill the pool with new elements
+ * immediately. Similar with mempool_resize(), it cannot be
+ * guaranteed that the pool will be fully filled immediately.
+ *
+ * Note, the caller must guarantee that no mempool_destroy is called
+ * while this function is running. mempool_alloc() & mempool_free()
+ * might be called (eg. from IRQ contexts) while this function executes.
+ */
+void mempool_refill(mempool_t *pool)
+{
+   void *element;
+   unsigned long flags;
+
+   spin_lock_irqsave(>lock, flags);
+   if (pool->curr_nr >= pool->min_nr) {
+   spin_unlock_irqrestore(>lock, flags);
+   return;
+   }
+
+   while (pool->curr_nr < pool->min_nr) {
+   spin_unlock_irqrestore(>lock, flags);
+   element = pool->alloc(GFP_KERNEL, pool->pool_data);
+   if (!element)
+   return;
+   spin_lock_irqsave(>lock, flags);
+   if (pool->curr_nr < pool->min_nr) {
+   add_element(pool, element);
+   } else {
+   spin_unlock_irqrestore(>lock, flags);
+   pool->free(element, pool->pool_data);   /* Raced */
+   return;
+   }
+   }
+}
+EXPORT_SYMBOL(mempool_refill);
+
+/**
  * mempool_resize - resize an existing memory pool
  * @pool:   pointer to the memory pool which was allocated via
  *  mempool_create().
@@ -256,7 +297,8 @@ int mempool_resize(mempool_t *pool, int new_min_nr)
spin_lock_irqsave(>lock, flags);
}
pool->min_nr = new_min_nr;
-   goto out_unlock;
+   spin_unlock_irqrestore(>lock, flags);
+   goto out;
}
spin_unlock_irqrestore(>lock, flags);
 
@@ -279,22 +321,9 @@ int mempool_resize(mempool_t *pool, int new_min_nr)
pool->elements = new_elements;
pool->min_nr = new_min_nr;
 
-   while (pool->curr_nr < pool->min_nr) {
-   spin_unlock_irqrestore(>lock, flags);
-   element = pool->alloc(GFP_KERNEL, pool->pool_data);
-   if (!element)
-   goto out;
-   spin_lock_irqsave(>lock, flags);
-   if (pool->curr_nr < pool->min_nr) {
-   add_element(pool, element);
-   } else {
-   spin_unlock_irqrestore(>lock, flags);
-   pool->free(element, pool->pool_data);   /* Raced */
-   goto out;
-   }
-   }
-out_unlock:
spin_unlock_irqrestore(>lock, flags);
+
+   mempool_refill(pool);
 out:
return 0;
 }
-- 
1.9.1

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


Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode

2015-12-12 Thread Al Viro
On Fri, Dec 11, 2015 at 01:54:25AM +, Al Viro wrote:

>   BTW, why are we passing unsigned long to free_page()?  We have
> a bit under 700 callers; excluding the ones that have an explicit cast
> to unsigned long right in the argument of call leaves ~150, and the rest
> tend to contain a lot of pointer casts of unsigned long thing they are feeding
> to free_page() (IOW, they would be just as happy if they kept it as a pointer
> all along).  Sure, that would mean __get_free_page() et.al. returning void *,
> but I don't see any problems with that either...  Is that just for historical
> reasons, or is there anything more subtle I'm missing here?

The situation with free_pages() is even funnier - we have 313 call sites,
and after converting it to void(void *, unsigned) 31 of them need casts
to void *.  Right now the mainline has 249 of those call sites with
cast to unsigned long (or ulong, in several places).  Then there's a bunch
of places where we do __get_free_pages(), then use it a lot (all with
casts to pointers), then pass to free_pages() - those would be just fine
with storing it as void *, but even leaving those aside...

The current signature is contrary to actual use - nearly 80% of call
sites are forced to cast a pointer to unsigned long, only to have it
cast back to void * in free_pages() itself, we would obviously be better
off if we'd switched to just passing the damn thing as a pointer.  Especially
since that 80% turn into 90% once you add the callers that could easily
switch to storing the value eventually passed to free_pages() as a pointer.

And free_page() is basically the same story, only with twice as many
call sites...

While we are at it: __get_free_pages() has 238 call sites.  193 of them
immediately cast to pointer.  And there's a bunch of places like this:
static inline void __tlb_alloc_page(struct mmu_gather *tlb)
{
unsigned long addr = __get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0);

if (addr) {
tlb->pages = (void *)addr;
tlb->max = PAGE_SIZE / sizeof(struct page *);
}
}
where the cast is not immediate, but might as well had been.  And conversion
of free_pages() whittles it down even more.  For __get_free_page() the
situation is about the same, ditto for get_zeroed_page().

I realize that get_free_page() has been returning unsigned long since 0.01,
but looking at 0.01... it might as well had been returning void * - wouldn't
be more inconvenient.  The kludge you had in get_pipe_inode() would've been
a bit more obviously wrong, but that's about it ;-)

Seriously, though - what do you think about a flagday commit right after
4.5-rc1 switching all those guys to void *?  For __get_user_pages(),
__get_user_page(), get_zeroed_page() - return values, for free_pages(),
free_page() - argument.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86/signal: fix restart_syscall number for x32 tasks

2015-12-12 Thread Dmitry V. Levin
On Mon, Dec 07, 2015 at 03:22:06PM -0800, Andy Lutomirski wrote:
> [not real reply because I'm using a bad internet connection right now
> and I'm not set up with my usual Gmane reply hack right now]
> 
> The new code is (whitespace-damaged):
> 
> static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
> {
> #if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
>  return __NR_restart_syscall;
> #else /* !CONFIG_X86_32 && CONFIG_X86_64 */
>  return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
>  __NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
> #endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
> }
> 
> This is IMO awful.  This use of TIF_IA32 is wrong, and this is
> otherwise gross.  Can we do it for real:
> 
> if (is_ia32_task())
>   return __NR_ia32_restart_syscall;
> else
>   return __NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
> /* preserve x32 bit */
> 
> I'd send the patch myself, but you apparently have a good test case
> for this, and I don't.

Unfortunately, this won't compile on CONFIG_X86_32 because
__NR_ia32_restart_syscall is defined for CONFIG_X86_64 only.

Something like this should work:

static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
{
#ifdef CONFIG_X86_64
if (is_ia32_task())
return __NR_ia32_restart_syscall;
# ifdef CONFIG_X86_X32_ABI
if (regs->orig_ax & __X32_SYSCALL_BIT)
return __NR_restart_syscall | __X32_SYSCALL_BIT;
# endif
#endif
return __NR_restart_syscall;
}

I don't see any way to avoid ifdefs here, sorry.


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


Re: [PATCH 4.2 00/61] 4.2.8-stable review

2015-12-12 Thread Shuah Khan
On 12/12/2015 01:05 PM, Greg Kroah-Hartman wrote:
> ===
> NOTE:
>   This is the last 4.2.y kernel to be released, unless something
>   major comes up, it is end-of-life after this release.  Everyone
>   should have moved to 4.3.y by now, you have been warned.
> ===
> 
> This is the start of the stable review cycle for the 4.2.8 release.
> There are 61 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Mon Dec 14 20:04:13 UTC 2015.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
>   kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.2.8-rc1.gz
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4.3 00/71] 4.3.3-stable review

2015-12-12 Thread Shuah Khan
On 12/12/2015 01:05 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.3.3 release.
> There are 71 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Mon Dec 14 20:05:02 UTC 2015.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
>   kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.3.3-rc1.gz
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4.1 00/45] 4.1.15-stable review

2015-12-12 Thread Shuah Khan
On 12/12/2015 12:32 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.1.15 release.
> There are 45 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Mon Dec 14 19:32:37 UTC 2015.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
>   kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.1.15-rc1.gz
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Odroid U3 mutex deadlock.

2015-12-12 Thread Anand Moon
Hi Thomas,

On 12 December 2015 at 16:58, Thomas Pietrowski  wrote:
> I'm also using 4.4.0-rc4 here on my U3+. And so far it is working well. I
> just had a freeze yesterday, but I didn't had the UART connected, so
> couldn't catch the reason. The curious thing was that the heartbeat LED was
> still blinking, but USB keyboard and Ethernet/SSH (but LEDs still on) were
> not working.
>
> Could you upload your .config? Maybe it could be useful for others :)
>
> Regards
>
> Am 12.12.2015 05:33 schrieb "Anand Moon" :
>>
>> Hi Krzysztof,
>>
>> I am just observing this deadlock om my Odroid U3.
>>
>> --
>>
>> [2.937531] =
>> [2.938733] [ INFO: possible recursive locking detected ]
>> [2.944117] 4.4.0-rc4-xu3s #32 Not tainted
>> [2.948195] -
>> [2.953577] swapper/0/1 is trying to acquire lock:
>> [2.958351]  (>lock){+.+...}, at: []
>> __genpd_poweron+0x64/0x108
>> [2.965727]
>> [2.965727] but task is already holding lock:
>> [2.971543]  (>lock){+.+...}, at: []
>> genpd_dev_pm_attach+0x168/0x1b8
>> [2.979355]
>> [2.979355] other info that might help us debug this:
>> [2.985865]  Possible unsafe locking scenario:
>> [2.985865]
>> [2.991768]CPU0
>> [2.994198]
>> [2.996628]   lock(>lock);
>> [2.26]   lock(>lock);
>> [3.003225]
>> [3.003225]  *** DEADLOCK ***
>> [3.003225]
>> [3.009128]  May be due to missing lock nesting notation
>> [3.009128]
>> [3.015900] 3 locks held by swapper/0/1:
>> [3.019804]  #0:  (>mutex){..}, at: []
>> __driver_attach+0x48/0x98
>> [3.027442]  #1:  (>mutex){..}, at: []
>> __driver_attach+0x58/0x98
>> [3.035081]  #2:  (>lock){+.+...}, at: []
>> genpd_dev_pm_attach+0x168/0x1b8
>> [3.043326]
>> [3.043326] stack backtrace:
>> [3.047671] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.0-rc4-xu3s
>> #32
>> [3.054351] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>> [3.060444] [] (unwind_backtrace) from []
>> (show_stack+0x10/0x14)
>> [3.068163] [] (show_stack) from []
>> (dump_stack+0x84/0xc4)
>> [3.075367] [] (dump_stack) from []
>> (__lock_acquire+0x1f88/0x215c)
>> [3.083262] [] (__lock_acquire) from []
>> (lock_acquire+0xa4/0xd0)
>> [3.090990] [] (lock_acquire) from []
>> (mutex_lock_nested+0x70/0x4d4)
>> [3.099061] [] (mutex_lock_nested) from []
>> (__genpd_poweron+0x64/0x108)
>> [3.107393] [] (__genpd_poweron) from []
>> (genpd_dev_pm_attach+0x170/0x1b8)
>> [3.115986] [] (genpd_dev_pm_attach) from []
>> (platform_drv_probe+0x2c/0xac)
>> [3.124667] [] (platform_drv_probe) from []
>> (driver_probe_device+0x208/0x2fc)
>> [3.133519] [] (driver_probe_device) from []
>> (__driver_attach+0x94/0x98)
>> [3.141939] [] (__driver_attach) from []
>> (bus_for_each_dev+0x68/0x9c)
>> [3.150097] [] (bus_for_each_dev) from []
>> (bus_add_driver+0x1a0/0x218)
>> [3.158344] [] (bus_add_driver) from []
>> (driver_register+0x78/0xf8)
>> [3.166330] [] (driver_register) from []
>> (exynos_drm_register_drivers+0x28/0x74)
>> [3.175441] [] (exynos_drm_register_drivers) from
>> [] (exynos_drm_init+0x6c/0xc4)
>> [3.184556] [] (exynos_drm_init) from []
>> (do_one_initcall+0x90/0x1dc)
>> [3.192718] [] (do_one_initcall) from []
>> (kernel_init_freeable+0x158/0x1f8)
>> [3.201396] [] (kernel_init_freeable) from []
>> (kernel_init+0x8/0xe8)
>> [3.209469] [] (kernel_init) from []
>> (ret_from_fork+0x14/0x24)
>> [3.217932] exynos-hdmi 12d0.hdmi: GPIO lookup for consumer hpd
>> [3.223293] exynos-hdmi 12d0.hdmi: using device tree for GPIO
>> lookup
>> [3.229980] of_get_named_gpiod_flags: can't parse 'hpd-gpios'
>> property of node '/hdmi@12D0[0]'
>> [3.238945] of_get_named_gpiod_flags: parsed 'hpd-gpio' property of
>> node '/hdmi@12D0[0]' - status (0)
>> [3.253430] exynos-drm exynos-drm: bound 12c1.mixer (ops
>> mixer_component_ops)
>> [3.256216] exynos-drm exynos-drm: bound 12d0.hdmi (ops
>> hdmi_component_ops)
>> [3.263245] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
>> [3.269812] [drm] No driver support for vblank timestamp query.
>> [3.323251] exynos-drm exynos-drm: fb0:  frame buffer device
>> [3.341464] [drm] Initialized exynos 1.0.0 20110530 on minor 0
>>
>>
>> ---
>> -Anand Moon

I just using exynos_defconfig + kernel hacking flags.

diff --git a/arch/arm/configs/exynos_defconfig
b/arch/arm/configs/exynos_defconfig
index e0841a5..402a37f 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -1,3 +1,4 @@
+# CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 

Re: [PATCH 0/9] 8250: AMD Carrizo UART PL300 DMA enablement

2015-12-12 Thread Andy Shevchenko
On Fri, Dec 4, 2015 at 5:24 AM, Wang Hongcheng  wrote:
> Hi all,
>
> As AMD carrizo UART device is compatible with 8250 and has pl330 DMA
> IP, our uart driver is serial:8250 and DMA engines are registered by
> driver/dma/pl330. The following patches are made, in order to enable
> DMA.
>
> Firstly, we add an universal ACPI amba glue layer to create an amba
> device based on ACPI table. Then we alter 8250/Kconfig to support
> AMD 8250 device and add quirk for AMD specific request.
> Secondly, since pl330 driver only provides dma engine for platform
> devices, we add an acpi dma engine interface.
> Then we add a new port type for AMD carrizo and set UART registers
> and dma rx size as hardware requirement.
> In the end, we make our IOMMU driver to support non-pci device, so
> UART DMA really works.
>

I commented on a few patches, thoughI might miss something in the rest.
Include me in Cc list next version.

> Thanks,
> Hongcheng
>
> Huang Rui (1):
>   ACPI: Add support for AMBA bus type
>
> Wan Zongshun (2):
>   Documentation: Add ivrs_acpihid kernel parameter description
>   iommu/amd: Add ACPI HID named devices IOMMU driver support
>
> Wang Hongcheng (6):
>   8250/Kconfig: add config option CONFIG_SERIAL_8250_AMD
>   ACPI: add struct acpi_amba_quirk for AMD pl330 specific device config
>   dmaengine: pl330: add new items for pl330 private data
>   dmaengine: pl330: provide ACPI dmaengine interface
>   dmaengine:pl330: set segment_boundary_mask = 0c
>   Serial:8250: New Port Type PORT_AMD_8250
>
>  Documentation/kernel-parameters.txt |   7 ++
>  drivers/acpi/Makefile   |   1 +
>  drivers/acpi/acpi_amba.c| 180 
> 
>  drivers/acpi/acpi_apd.c |  89 +++---
>  drivers/dma/pl330.c |  61 ++--
>  drivers/iommu/amd_iommu.c   | 165 +
>  drivers/iommu/amd_iommu_init.c  | 123 +++-
>  drivers/iommu/amd_iommu_types.h |  11 +++
>  drivers/tty/serial/8250/8250_dw.c   |  16 
>  drivers/tty/serial/8250/8250_port.c |   9 ++
>  drivers/tty/serial/8250/Kconfig |   8 ++
>  include/linux/acpi.h|  30 ++
>  include/linux/amba/pl330.h  |   4 +
>  include/linux/serial_8250.h |   4 +
>  include/uapi/linux/serial_core.h|   3 +-
>  include/uapi/linux/serial_reg.h |   2 +
>  16 files changed, 673 insertions(+), 40 deletions(-)
>  create mode 100644 drivers/acpi/acpi_amba.c
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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


Re: [PATCH 7/9] Serial:8250: New Port Type PORT_AMD_8250

2015-12-12 Thread Andy Shevchenko
On Fri, Dec 4, 2015 at 5:24 AM, Wang Hongcheng  wrote:
> Set a new port type for AMD Carrizo.  Add has_pl330_dma to 8250_dw's
> private data and init fcr,ier as well as dma rx size.
>
> Signed-off-by: Wang Hongcheng 
> ---
>  drivers/acpi/acpi_apd.c | 10 ++
>  drivers/tty/serial/8250/8250_dw.c   | 16 
>  drivers/tty/serial/8250/8250_port.c |  9 +
>  include/linux/serial_8250.h |  4 
>  include/uapi/linux/serial_core.h|  3 ++-
>  include/uapi/linux/serial_reg.h |  2 ++
>  6 files changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
> index 906a20f..787f477 100644
> --- a/drivers/acpi/acpi_apd.c
> +++ b/drivers/acpi/acpi_apd.c
> @@ -23,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "internal.h"
>
> @@ -49,6 +50,10 @@ static struct dma_pl330_platdata amd_pl330 = {
> .acpi_xlate_filter = apd_acpi_xlate_filter,
>  };
>
> +static struct plat_dw8250_data amd_dw8250 = {
> +   .has_pl330_dma = 1,
> +};
> +
>  /**
>   * struct apd_device_desc - a descriptor for apd device.
>   * @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM;
> @@ -164,6 +169,11 @@ static int acpi_apd_create_device(struct acpi_device 
> *adev,
> goto err_out;
>
> if (!strncmp(pdev->name, "AMD0020", 7)) {
> +   ret = platform_device_add_data(pdev, _dw8250,
> +  sizeof(amd_dw8250));
> +   if (ret)
> +   goto err_out;
> +
> memset(_quirks, 0, sizeof(amba_quirks));
> setup_quirks(pdev, _quirks);
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c 
> b/drivers/tty/serial/8250/8250_dw.c
> index a5d319e..a5ae9b6 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -66,6 +66,8 @@ struct dw8250_data {
>
> unsigned intskip_autocfg:1;
> unsigned intuart_16550_compatible:1;

> +

Remove this

> +   unsignedhas_pl330_dma:1;

Use unsigned int.

>  };
>
>  #define BYT_PRV_CLK0x800
> @@ -304,6 +306,7 @@ static void dw8250_setup_port(struct uart_port *p)
>  {
> struct uart_8250_port *up = up_to_u8250p(p);
> u32 reg;
> +   struct dw8250_data *d = p->private_data;

Rename d -> data and move the line to be second in the definition list.

>
> /*
>  * If the Component Version Register returns zero, we know that
> @@ -326,6 +329,16 @@ static void dw8250_setup_port(struct uart_port *p)
> p->flags |= UPF_FIXED_TYPE;
> p->fifosize = DW_UART_CPR_FIFO_SIZE(reg);
> up->capabilities = UART_CAP_FIFO;
> +   if (d->has_pl330_dma) {
> +   p->type = PORT_AMD_8250;

> +   p->flags |= UPF_SHARE_IRQ;

Isn't it a default?

> +
> +   up->ier |= UART_IER_PTIME | UART_IER_THRI |
> +   UART_IER_RLSI | UART_IER_RDI;
> +   up->fcr |= UART_FCR_R_TRIG_10 | UART_FCR_T_TRIG_11 |
> +   UART_FCR_DMA_SELECT;
> +   up->tx_loadsz = p->fifosize / 2;
> +   }
> }
>
> if (reg & DW_UART_CPR_AFCE_MODE)
> @@ -339,6 +352,7 @@ static int dw8250_probe(struct platform_device *pdev)
> int irq = platform_get_irq(pdev, 0);
> struct uart_port *p = 
> struct dw8250_data *data;
> +   struct plat_dw8250_data *pdata = dev_get_platdata(>dev);
> int err;
> u32 val;
>
> @@ -468,6 +482,7 @@ static int dw8250_probe(struct platform_device *pdev)
> p->handle_irq = NULL;
> }
>
> +   data->has_pl330_dma = pdata ? pdata->has_pl330_dma : 0;
> if (!data->skip_autocfg)
> dw8250_setup_port(p);
>
> @@ -475,6 +490,7 @@ static int dw8250_probe(struct platform_device *pdev)
> if (p->fifosize) {
> data->dma.rxconf.src_maxburst = p->fifosize / 4;
> data->dma.txconf.dst_maxburst = p->fifosize / 4;
> +   data->dma.rx_size = data->has_pl330_dma ? (p->fifosize / 2 + 
> 2) : 0;
> uart.dma = >dma;
> }
>
> diff --git a/drivers/tty/serial/8250/8250_port.c 
> b/drivers/tty/serial/8250/8250_port.c
> index 52d82d2..b258edc 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -269,6 +269,15 @@ configured less than Maximum supported fifo bytes */
> .rxtrig_bytes   = {1, 4, 8, 14},
> .flags  = UART_CAP_FIFO,
> },
> +   [PORT_AMD_8250] = {
> +   .name   = "AMD_8250",
> +   .fifo_size  = 256,
> +   .tx_loadsz  = 128,
> +   .fcr= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 |
> +   

[PATCH v2 1/2] crypto: KEYS: convert public key to the akcipher api

2015-12-12 Thread Tadeusz Struk
This patch converts the module verification code to the new akcipher API.

Signed-off-by: Tadeusz Struk 
---
 crypto/asymmetric_keys/Kconfig|2 
 crypto/asymmetric_keys/Makefile   |7 -
 crypto/asymmetric_keys/pkcs7_parser.c |   12 +-
 crypto/asymmetric_keys/pkcs7_trust.c  |2 
 crypto/asymmetric_keys/pkcs7_verify.c |2 
 crypto/asymmetric_keys/public_key.c   |   64 +++--
 crypto/asymmetric_keys/public_key.h   |   36 -
 crypto/asymmetric_keys/rsa.c  |  213 +++--
 crypto/asymmetric_keys/x509_cert_parser.c |   37 +
 crypto/asymmetric_keys/x509_public_key.c  |   17 +-
 crypto/asymmetric_keys/x509_rsakey.asn1   |4 -
 include/crypto/public_key.h   |   49 ++-
 12 files changed, 136 insertions(+), 309 deletions(-)
 delete mode 100644 crypto/asymmetric_keys/public_key.h
 delete mode 100644 crypto/asymmetric_keys/x509_rsakey.asn1

diff --git a/crypto/asymmetric_keys/Kconfig b/crypto/asymmetric_keys/Kconfig
index 4870f28..905d745 100644
--- a/crypto/asymmetric_keys/Kconfig
+++ b/crypto/asymmetric_keys/Kconfig
@@ -22,7 +22,7 @@ config ASYMMETRIC_PUBLIC_KEY_SUBTYPE
 
 config PUBLIC_KEY_ALGO_RSA
tristate "RSA public-key algorithm"
-   select MPILIB
+   select CRYPTO_RSA
help
  This option enables support for the RSA algorithm (PKCS#1, RFC3447).
 
diff --git a/crypto/asymmetric_keys/Makefile b/crypto/asymmetric_keys/Makefile
index cd1406f..b78a194 100644
--- a/crypto/asymmetric_keys/Makefile
+++ b/crypto/asymmetric_keys/Makefile
@@ -16,21 +16,18 @@ obj-$(CONFIG_X509_CERTIFICATE_PARSER) += x509_key_parser.o
 x509_key_parser-y := \
x509-asn1.o \
x509_akid-asn1.o \
-   x509_rsakey-asn1.o \
x509_cert_parser.o \
x509_public_key.o
 
 $(obj)/x509_cert_parser.o: \
$(obj)/x509-asn1.h \
-   $(obj)/x509_akid-asn1.h \
-   $(obj)/x509_rsakey-asn1.h
+   $(obj)/x509_akid-asn1.h
+
 $(obj)/x509-asn1.o: $(obj)/x509-asn1.c $(obj)/x509-asn1.h
 $(obj)/x509_akid-asn1.o: $(obj)/x509_akid-asn1.c $(obj)/x509_akid-asn1.h
-$(obj)/x509_rsakey-asn1.o: $(obj)/x509_rsakey-asn1.c $(obj)/x509_rsakey-asn1.h
 
 clean-files+= x509-asn1.c x509-asn1.h
 clean-files+= x509_akid-asn1.c x509_akid-asn1.h
-clean-files+= x509_rsakey-asn1.c x509_rsakey-asn1.h
 
 #
 # PKCS#7 message handling
diff --git a/crypto/asymmetric_keys/pkcs7_parser.c 
b/crypto/asymmetric_keys/pkcs7_parser.c
index 758acab..12912c1 100644
--- a/crypto/asymmetric_keys/pkcs7_parser.c
+++ b/crypto/asymmetric_keys/pkcs7_parser.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include "public_key.h"
+#include 
 #include "pkcs7_parser.h"
 #include "pkcs7-asn1.h"
 
@@ -44,7 +44,7 @@ struct pkcs7_parse_context {
 static void pkcs7_free_signed_info(struct pkcs7_signed_info *sinfo)
 {
if (sinfo) {
-   mpi_free(sinfo->sig.mpi[0]);
+   kfree(sinfo->sig.s);
kfree(sinfo->sig.digest);
kfree(sinfo->signing_cert_id);
kfree(sinfo);
@@ -616,16 +616,14 @@ int pkcs7_sig_note_signature(void *context, size_t hdrlen,
 const void *value, size_t vlen)
 {
struct pkcs7_parse_context *ctx = context;
-   MPI mpi;
 
BUG_ON(ctx->sinfo->sig.pkey_algo != PKEY_ALGO_RSA);
 
-   mpi = mpi_read_raw_data(value, vlen);
-   if (!mpi)
+   ctx->sinfo->sig.s = kmemdup(value, vlen, GFP_KERNEL);
+   if (!ctx->sinfo->sig.s)
return -ENOMEM;
 
-   ctx->sinfo->sig.mpi[0] = mpi;
-   ctx->sinfo->sig.nr_mpi = 1;
+   ctx->sinfo->sig.s_size = vlen;
return 0;
 }
 
diff --git a/crypto/asymmetric_keys/pkcs7_trust.c 
b/crypto/asymmetric_keys/pkcs7_trust.c
index 90d6d47..3bbdcc7 100644
--- a/crypto/asymmetric_keys/pkcs7_trust.c
+++ b/crypto/asymmetric_keys/pkcs7_trust.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include "public_key.h"
+#include 
 #include "pkcs7_parser.h"
 
 /**
diff --git a/crypto/asymmetric_keys/pkcs7_verify.c 
b/crypto/asymmetric_keys/pkcs7_verify.c
index 325575c..f5db137 100644
--- a/crypto/asymmetric_keys/pkcs7_verify.c
+++ b/crypto/asymmetric_keys/pkcs7_verify.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include "public_key.h"
+#include 
 #include "pkcs7_parser.h"
 
 /*
diff --git a/crypto/asymmetric_keys/public_key.c 
b/crypto/asymmetric_keys/public_key.c
index 6db4c01..b383629 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -18,24 +18,16 @@
 #include 
 #include 
 #include 
-#include "public_key.h"
+#include 
 
 MODULE_LICENSE("GPL");
 
 const char *const pkey_algo_name[PKEY_ALGO__LAST] = {
-   [PKEY_ALGO_DSA] = "DSA",
-   [PKEY_ALGO_RSA] = "RSA",
+   [PKEY_ALGO_DSA] = "dsa",
+   [PKEY_ALGO_RSA] = "rsa",
 };
 EXPORT_SYMBOL_GPL(pkey_algo_name);
 
-const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST] = {
-#if 

[PATCH v2 2/2] integrity: convert digsig to akcipher api

2015-12-12 Thread Tadeusz Struk
Convert asymmetric_verify to akcipher api.

Signed-off-by: Tadeusz Struk 
---
 security/integrity/Kconfig |1 +
 security/integrity/digsig_asymmetric.c |   10 +++---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/security/integrity/Kconfig b/security/integrity/Kconfig
index 73c457b..f0b2463 100644
--- a/security/integrity/Kconfig
+++ b/security/integrity/Kconfig
@@ -36,6 +36,7 @@ config INTEGRITY_ASYMMETRIC_KEYS
 select ASYMMETRIC_KEY_TYPE
 select ASYMMETRIC_PUBLIC_KEY_SUBTYPE
 select PUBLIC_KEY_ALGO_RSA
+select CRYPTO_RSA
 select X509_CERTIFICATE_PARSER
help
  This option enables digital signature verification using
diff --git a/security/integrity/digsig_asymmetric.c 
b/security/integrity/digsig_asymmetric.c
index 4fec181..5629372 100644
--- a/security/integrity/digsig_asymmetric.c
+++ b/security/integrity/digsig_asymmetric.c
@@ -92,13 +92,9 @@ int asymmetric_verify(struct key *keyring, const char *sig,
pks.pkey_hash_algo = hdr->hash_algo;
pks.digest = (u8 *)data;
pks.digest_size = datalen;
-   pks.nr_mpi = 1;
-   pks.rsa.s = mpi_read_raw_data(hdr->sig, siglen);
-
-   if (pks.rsa.s)
-   ret = verify_signature(key, );
-
-   mpi_free(pks.rsa.s);
+   pks.s = hdr->sig;
+   pks.s_size = siglen;
+   ret = verify_signature(key, );
key_put(key);
pr_debug("%s() = %d\n", __func__, ret);
return ret;

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


[PATCH v2 0/2] crypto: KEYS: convert public key to akcipher api

2015-12-12 Thread Tadeusz Struk
This patch set converts the module verification and digital signature
code to the new akcipher API.
RSA implementation has been removed from crypto/asymmetric_keys and the
new API is used for cryptographic primitives.
There is no need for MPI above the akcipher API anymore.
Modules can be verified with software as well as HW RSA implementations.

Patches generated against cryptodev-2.6

Changes in v2:
- Fix the whey public_key_signature is setup. The pointer s needs to
  point to the signature instread of the signature_v2_hdr.  
- Select CRYPTO_RSA when INTEGRITY_ASYMMETRIC_KEYS is selected.

---

Tadeusz Struk (2):
  crypto: KEYS: convert public key to the akcipher api
  integrity: convert digsig to akcipher api

 crypto/asymmetric_keys/Kconfig|2 
 crypto/asymmetric_keys/Makefile   |7 -
 crypto/asymmetric_keys/pkcs7_parser.c |   12 +-
 crypto/asymmetric_keys/pkcs7_trust.c  |2 
 crypto/asymmetric_keys/pkcs7_verify.c |2 
 crypto/asymmetric_keys/public_key.c   |   64 +++--
 crypto/asymmetric_keys/public_key.h   |   36 -
 crypto/asymmetric_keys/rsa.c  |  213 +++--
 crypto/asymmetric_keys/x509_cert_parser.c |   37 +
 crypto/asymmetric_keys/x509_public_key.c  |   17 +-
 crypto/asymmetric_keys/x509_rsakey.asn1   |4 -
 include/crypto/public_key.h   |   49 ++-
 security/integrity/Kconfig|1 
 security/integrity/digsig_asymmetric.c|   10 -
 14 files changed, 140 insertions(+), 316 deletions(-)
 delete mode 100644 crypto/asymmetric_keys/public_key.h
 delete mode 100644 crypto/asymmetric_keys/x509_rsakey.asn1

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


Re: [PATCH 5/9] dmaengine: pl330: provide ACPI dmaengine interface

2015-12-12 Thread Andy Shevchenko
On Fri, Dec 4, 2015 at 5:24 AM, Wang Hongcheng  wrote:
> register acpi_dma controller, so ACPI devices can request pl330 DMA
> channel.
> A filter is added in private data for Carrizo specific hardware
> design
>
> Signed-off-by: Wang Hongcheng 
> ---
>  drivers/acpi/acpi_apd.c| 12 
>  drivers/dma/pl330.c| 38 ++
>  include/linux/amba/pl330.h |  1 +
>  3 files changed, 51 insertions(+)
>
> diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
> index 7a582f5..906a20f 100644
> --- a/drivers/acpi/acpi_apd.c
> +++ b/drivers/acpi/acpi_apd.c
> @@ -38,12 +38,15 @@ struct apd_private_data;
>
>  static u8 peri_id[2] = { 0, 1 };
>
> +static int apd_acpi_xlate_filter(int slave_id, struct device *dev);
> +
>  static struct dma_pl330_platdata amd_pl330 = {
> .nr_valid_peri = 2,
> .peri_id = peri_id,
> .has_no_cap_mask = true,
> .mcbuf_sz = 0,
> .flags = IRQF_SHARED,
> +   .acpi_xlate_filter = apd_acpi_xlate_filter,
>  };
>
>  /**
> @@ -68,6 +71,15 @@ struct apd_private_data {
> const struct apd_device_desc *dev_desc;
>  };
>
> +int apd_acpi_xlate_filter(int slave_id, struct device *dev)
> +{
> +   if (((slave_id == 1) && (!strcmp(dev_name(dev), "AMD0020:00DMA")))
> +   || ((slave_id == 2) && (!strcmp(dev_name(dev), "AMD0020:01DMA"
> +   return 0;

First of all, too many parens. No need to have them here: (!strcmp()),
for example.

Second, looks like you actually compare slave_id with device _UID, am
I right? In that case maybe better to check device's _HID, _UID and
eventually slave_id.

> +
> +   return 1;
> +}
> +
>  #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
>  #define APD_ADDR(desc) ((unsigned long))
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 8300969..9d7af0d 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2079,6 +2079,35 @@ static struct dma_chan *of_dma_pl330_xlate(struct 
> of_phandle_args *dma_spec,
> return dma_get_slave_channel(>peripherals[chan_id].chan);
>  }
>
> +static struct dma_chan *acpi_dma_pl330_xlate(struct acpi_dma_spec *dma_spec,
> +struct acpi_dma *adma)
> +{
> +   struct pl330_dmac *pl330 = adma->data;
> +   struct dma_pl330_platdata *pdat;
> +   unsigned int chan_id;
> +   int ret;
> +
> +   if (!dma_spec)
> +   return NULL;

AFAIR dma_spec is guaranteed not to be NULL.

> +
> +   if (!adma)
> +   return NULL;

Ditto.

> +
> +   pdat = dev_get_platdata(adma->dev);
> +
> +   chan_id = dma_spec->chan_id;
> +   if (chan_id >= pl330->num_peripherals)
> +   return NULL;
> +
> +   if (pdat->acpi_xlate_filter) {
> +   ret = pdat->acpi_xlate_filter(dma_spec->slave_id, adma->dev);
> +   if (ret)
> +   return NULL;
> +   }
> +
> +   return dma_get_slave_channel(>peripherals[chan_id].chan);
> +}
> +
>  static int pl330_alloc_chan_resources(struct dma_chan *chan)
>  {
> struct dma_pl330_chan *pch = to_pchan(chan);
> @@ -2918,6 +2947,15 @@ pl330_probe(struct amba_device *adev, const struct 
> amba_id *id)
> }
> }
>
> +   if (ACPI_HANDLE(>dev)) {

I suspect where did you get this, but it's already updated. You better use
has_acpi_companion() instead.

> +   ret = acpi_dma_controller_register(>dev,
> +  acpi_dma_pl330_xlate, 
> pl330);

So, someone has either to provide CSRT (which is mostly foreign to
ACPI tables), or to provide those resources somehow else (request line
base and number). In the latter case you would need to add the hook
into acpi_dma_controller_register().

> +   if (ret) {
> +   dev_err(>dev,
> +   "unable to register DMA to the generic ACPI 
> DMA helpers\n");
> +   }
> +   }
> +
> adev->dev.dma_parms = >dma_parms;
>
> /*

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


Re: [PATCH] MAINTAINERS: Change QCOM entries

2015-12-12 Thread David Brown

On Fri, Dec 11, 2015 at 03:46:18PM -0600, Andy Gross wrote:

From: Andy Gross 

This patch changes the email address for Andy Gross and David Brown and drops
Kumar Gala.  In addition, it changes the location of the repository.

Signed-off-by: Andy Gross 
Signed-off-by: Andy Gross 


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


Re: [PATCH v5 1/9] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings

2015-12-12 Thread Andy Shevchenko
On Fri, Nov 27, 2015 at 8:43 AM, Chen-Yu Tsai  wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
>

I missed cover letter, but anyway, for now the entire series looks fine for me!
FWIW, Reviewed-by: Andy Shevchenko 

> Signed-off-by: Chen-Yu Tsai 
> Acked-by: Maxime Ripard 
> Acked-by: Rob Herring 
> Acked-by: Lee Jones 
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt 
> b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index a474359dd206..fd39fa54571b 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -5,11 +5,12 @@ axp152 (X-Powers)
>  axp202 (X-Powers)
>  axp209 (X-Powers)
>  axp221 (X-Powers)
> +axp223 (X-Powers)
>
>  Required properties:
>  - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
> - "x-powers,axp221"
> -- reg: The I2C slave address for the AXP chip
> + "x-powers,axp221", "x-powers,axp223"
> +- reg: The I2C slave address or RSB hardware address for the AXP chip
>  - interrupt-parent: The parent interrupt controller
>  - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
>  - interrupt-controller: The PMIC has its own internal IRQs
> @@ -51,7 +52,7 @@ LDO3  : LDO   : ldo3in-supply
>  LDO4   : LDO   : ldo24in-supply: shared supply
>  LDO5   : LDO   : ldo5in-supply
>
> -AXP221 regulators, type, and corresponding input supply names:
> +AXP221/AXP223 regulators, type, and corresponding input supply names:
>
>  RegulatorTypeSupply Name Notes
>  ---- -
> --
> 2.6.2
>



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


[PATCH 05/10] drivers/pci: make host/pci-rcar-gen2.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2
drivers/pci/host/Kconfig:   bool "Renesas R-Car Gen2 Internal PCI 
controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-rcar-gen2.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
index c4f64bfee551..81dda40c7a9f 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -4,6 +4,8 @@
  * Copyright (C) 2013 Renesas Solutions Corp.
  * Copyright (C) 2013 Cogent Embedded, Inc.
  *
+ * Module Author: Valentine Barshak 
+ *
  * 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.
@@ -14,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -366,8 +367,6 @@ static struct of_device_id rcar_pci_of_match[] = {
{ },
 };
 
-MODULE_DEVICE_TABLE(of, rcar_pci_of_match);
-
 static struct platform_driver rcar_pci_driver = {
.driver = {
.name = "pci-rcar-gen2",
@@ -376,9 +375,4 @@ static struct platform_driver rcar_pci_driver = {
},
.probe = rcar_pci_probe,
 };
-
-module_platform_driver(rcar_pci_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("Renesas R-Car Gen2 internal PCI");
-MODULE_AUTHOR("Valentine Barshak ");
+builtin_platform_driver(rcar_pci_driver);
-- 
2.6.1

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


[PATCH 00/10] drivers/pci: avoid module_init in non-modular host/pci*

2015-12-12 Thread Paul Gortmaker
This series of commits is a slice of a larger project to ensure
people don't have dead code for module removal in non-modular
drivers.  Overall there was roughly 5k lines of dead code in the
kernel due to this.  So far we've fixed several areas, like tty,
x86, net, etc. and we continue to work on other areas.

There are several reasons to not use module_init for code that can
never be built as a module, but the big ones are:

 (1) it is easy to accidentally code up unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
  modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else.

Here we convert some module_init() calls into device_initcall() and delete
any module_exit and remove code that gets orphaned in the process, for
an overall net code reduction, which is always welcome.

The use of device_initcall ensures that the init function ordering
remains unchanged, but one could argue that PCI host code might be more
appropriate to be handled under subsys_initcall.  Fortunately we can
revisit making this extra change at a later date if desired; it does
not need to happen now, and we reduce the risk of introducing
regressions at this point in time by separating the two changes.

Over half of the drivers changed here already explicitly disallowed any
unbind operations.  For the rest we make them the same, since there is
not really any sensible use case to unbind any built-in bus support that
I can think of.

I have more "avoid module usage in non-modular code" cleanups for the
PCI subsystem, but these all have a common theme and it makes for a
more maintainer friendly series size to just ask to digest these 1st.

Testing was done on linux-next, using an ARCH=arm allmodconfig and then
explicitly building the files changed in this series.  If desired, I
can provide a v4.4-rc4 based branch for merging vs e-mail processing,
since I don't think the underlying baseline is overly important for
this (largely trivial) series of patches.

Paul.
---

Cc: Alexandre Courbot 
Cc: Bjorn Helgaas 
Cc: Jason Cooper 
Cc: Kishon Vijay Abraham I 
Cc: Ley Foon Tan 
Cc: Lucas Stach 
Cc: Michal Simek 
Cc: Murali Karicheri 
Cc: Pratyush Anand 
Cc: Richard Zhu 
Cc: Simon Horman 
Cc: "Sören Brinkmann" 
Cc: Stephen Warren 
Cc: Thierry Reding 
Cc: Thomas Petazzoni 

Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-o...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org
Cc: linux-te...@vger.kernel.org
Cc: r...@lists.rocketboards.org

Paul Gortmaker (10):
  drivers/pci: make host/pci-imx6.c driver explicitly non-modular
  drivers/pci: make host/pcie-spear13xx.c driver explicitly non-modular
  drivers/pci: make host/pci-mvebu.c explicitly non-modular
  drivers/pci: make host/pci-dra7xx.c explicitly non-modular
  drivers/pci: make host/pci-rcar-gen2.c explicitly non-modular
  drivers/pci: make host/pci-tegra.c explicitly non-modular
  drivers/pci: make host/pcie-rcar.c explicitly non-modular
  drivers/pci: make host/pcie-xilinx.c explicitly non-modular
  drivers/pci: make host/pci-keystone.c explicitly non-modular
  drivers/pci: make host/pcie-altera.c explicitly non-modular

 drivers/pci/host/pci-dra7xx.c | 31 +++
 drivers/pci/host/pci-imx6.c   | 12 +++--
 drivers/pci/host/pci-keystone.c   | 21 +++-
 drivers/pci/host/pci-mvebu.c  | 11 +++-
 drivers/pci/host/pci-rcar-gen2.c  | 12 +++--
 drivers/pci/host/pci-tegra.c  | 11 +++-
 drivers/pci/host/pcie-altera.c| 12 -
 drivers/pci/host/pcie-rcar.c  | 11 +++-
 drivers/pci/host/pcie-spear13xx.c | 10 +++-
 drivers/pci/host/pcie-xilinx.c| 53 ++-
 10 files changed, 35 insertions(+), 149 deletions(-)

-- 
2.6.1

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


[PATCH 06/10] drivers/pci: make host/pci-tegra.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_TEGRA
drivers/pci/host/Kconfig:   bool "NVIDIA Tegra PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Thierry Reding 
Cc: Bjorn Helgaas 
Cc: Stephen Warren 
Cc: Alexandre Courbot 
Cc: linux-te...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-tegra.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 3018ae52e092..b49ea58787c1 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -9,6 +9,8 @@
  *
  * Bits taken from arch/arm/mach-dove/pcie.c
  *
+ * Module Author: Thierry Reding 
+ *
  * 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
@@ -32,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1864,7 +1866,6 @@ static const struct of_device_id tegra_pcie_of_match[] = {
{ .compatible = "nvidia,tegra20-pcie", .data = _pcie_data },
{ },
 };
-MODULE_DEVICE_TABLE(of, tegra_pcie_of_match);
 
 static void *tegra_pcie_ports_seq_start(struct seq_file *s, loff_t *pos)
 {
@@ -2055,8 +2056,4 @@ static struct platform_driver tegra_pcie_driver = {
},
.probe = tegra_pcie_probe,
 };
-module_platform_driver(tegra_pcie_driver);
-
-MODULE_AUTHOR("Thierry Reding ");
-MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(tegra_pcie_driver);
-- 
2.6.1

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


[PATCH 07/10] drivers/pci: make host/pcie-rcar.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2_PCIE
drivers/pci/host/Kconfig:   bool "Renesas R-Car PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-rcar.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index f4fa6c537448..2c619277d265 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -7,6 +7,8 @@
  *  arch/sh/drivers/pci/ops-sh7786.c
  *  Copyright (C) 2009 - 2011  Paul Mundt
  *
+ * Module Author: Phil Edworthy 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -18,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -921,7 +923,6 @@ static const struct of_device_id rcar_pcie_of_match[] = {
{ .compatible = "renesas,pcie-r8a7791", .data = rcar_pcie_hw_init },
{},
 };
-MODULE_DEVICE_TABLE(of, rcar_pcie_of_match);
 
 static int rcar_pcie_probe(struct platform_device *pdev)
 {
@@ -1007,8 +1008,4 @@ static struct platform_driver rcar_pcie_driver = {
},
.probe = rcar_pcie_probe,
 };
-module_platform_driver(rcar_pcie_driver);
-
-MODULE_AUTHOR("Phil Edworthy ");
-MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(rcar_pcie_driver);
-- 
2.6.1

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


[PATCH 10/10] drivers/pci: make host/pcie-altera.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_ALTERA
drivers/pci/host/Kconfig:   bool "Altera PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Ley Foon Tan 
Cc: Bjorn Helgaas 
Cc: r...@lists.rocketboards.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-altera.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
index 99da549d5d06..ba55885d508f 100644
--- a/drivers/pci/host/pcie-altera.c
+++ b/drivers/pci/host/pcie-altera.c
@@ -1,6 +1,9 @@
 /*
  * Copyright Altera Corporation (C) 2013-2015. All rights reserved
  *
+ * Author: Ley Foon Tan 
+ * Description: Altera PCIe host controller driver
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * version 2, as published by the Free Software Foundation.
@@ -17,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -566,7 +569,6 @@ static const struct of_device_id altera_pcie_of_match[] = {
{ .compatible = "altr,pcie-root-port-1.0", },
{},
 };
-MODULE_DEVICE_TABLE(of, altera_pcie_of_match);
 
 static struct platform_driver altera_pcie_driver = {
.probe  = altera_pcie_probe,
@@ -581,8 +583,4 @@ static int altera_pcie_init(void)
 {
return platform_driver_register(_pcie_driver);
 }
-module_init(altera_pcie_init);
-
-MODULE_AUTHOR("Ley Foon Tan ");
-MODULE_DESCRIPTION("Altera PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+device_initcall(altera_pcie_init);
-- 
2.6.1

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


[PATCH 08/10] drivers/pci: make host/pcie-xilinx.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_XILINX
drivers/pci/host/Kconfig:   bool "Xilinx AXI PCIe host bridge support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.  This
makes xilinx_pcie_free_irq_domain orphaned so we remove it too.

We don't have to worry about disallowing a driver unbind, since this
driver already does that.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Bjorn Helgaas 
Cc: Michal Simek 
Cc: "Sören Brinkmann" 
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-xilinx.c | 53 ++
 1 file changed, 2 insertions(+), 51 deletions(-)

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index 3c7a0d580b1e..73b5e856f9c2 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -18,7 +18,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -516,35 +516,6 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void 
*data)
 }
 
 /**
- * xilinx_pcie_free_irq_domain - Free IRQ domain
- * @port: PCIe port information
- */
-static void xilinx_pcie_free_irq_domain(struct xilinx_pcie_port *port)
-{
-   int i;
-   u32 irq, num_irqs;
-
-   /* Free IRQ Domain */
-   if (IS_ENABLED(CONFIG_PCI_MSI)) {
-
-   free_pages(port->msi_pages, 0);
-
-   num_irqs = XILINX_NUM_MSI_IRQS;
-   } else {
-   /* INTx */
-   num_irqs = 4;
-   }
-
-   for (i = 0; i < num_irqs; i++) {
-   irq = irq_find_mapping(port->irq_domain, i);
-   if (irq > 0)
-   irq_dispose_mapping(irq);
-   }
-
-   irq_domain_remove(port->irq_domain);
-}
-
-/**
  * xilinx_pcie_init_irq_domain - Initialize IRQ domain
  * @port: PCIe port information
  *
@@ -858,21 +829,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
return 0;
 }
 
-/**
- * xilinx_pcie_remove - Remove function
- * @pdev: Platform device pointer
- *
- * Return: '0' always
- */
-static int xilinx_pcie_remove(struct platform_device *pdev)
-{
-   struct xilinx_pcie_port *port = platform_get_drvdata(pdev);
-
-   xilinx_pcie_free_irq_domain(port);
-
-   return 0;
-}
-
 static struct of_device_id xilinx_pcie_of_match[] = {
{ .compatible = "xlnx,axi-pcie-host-1.00.a", },
{}
@@ -885,10 +841,5 @@ static struct platform_driver xilinx_pcie_driver = {
.suppress_bind_attrs = true,
},
.probe = xilinx_pcie_probe,
-   .remove = xilinx_pcie_remove,
 };
-module_platform_driver(xilinx_pcie_driver);
-
-MODULE_AUTHOR("Xilinx Inc");
-MODULE_DESCRIPTION("Xilinx AXI PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(xilinx_pcie_driver);
-- 
2.6.1

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


[PATCH 03/10] drivers/pci: make host/pci-mvebu.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_MVEBU
drivers/pci/host/Kconfig:   bool "Marvell EBU PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now ) contained at the top of the file in the comments.

Cc: Thomas Petazzoni 
Cc: Jason Cooper 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-mvebu.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 53b79c5f0559..17222f1a3ef3 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1,6 +1,8 @@
 /*
  * PCIe driver for Marvell Armada 370 and Armada XP SoCs
  *
+ * Module Author: Thomas Petazzoni 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -11,7 +13,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1296,7 +1298,6 @@ static const struct of_device_id 
mvebu_pcie_of_match_table[] = {
{ .compatible = "marvell,kirkwood-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
 
 static struct dev_pm_ops mvebu_pcie_pm_ops = {
.suspend_noirq = mvebu_pcie_suspend,
@@ -1313,8 +1314,4 @@ static struct platform_driver mvebu_pcie_driver = {
},
.probe = mvebu_pcie_probe,
 };
-module_platform_driver(mvebu_pcie_driver);
-
-MODULE_AUTHOR("Thomas Petazzoni ");
-MODULE_DESCRIPTION("Marvell EBU PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(mvebu_pcie_driver);
-- 
2.6.1

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


[PATCH 01/10] drivers/pci: make host/pci-imx6.c driver explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig for this option is currently:

config PCI_IMX6
bool "Freescale i.MX6 PCIe controller"

...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity, so that when reading the
driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.  An
alternate init level might be worth considering at a later date.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and there wasn't a supplied ".remove"
function to be called either.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Richard Zhu 
Cc: Lucas Stach 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-imx6.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 22e8224126fd..ddd6a752b554 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -641,24 +641,20 @@ static const struct of_device_id imx6_pcie_of_match[] = {
{ .compatible = "fsl,imx6q-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, imx6_pcie_of_match);
 
 static struct platform_driver imx6_pcie_driver = {
.driver = {
.name   = "imx6q-pcie",
.of_match_table = imx6_pcie_of_match,
+   .suppress_bind_attrs = true,
},
.shutdown = imx6_pcie_shutdown,
 };
 
-/* Freescale PCIe driver does not allow module unload */
+/* Freescale PCIe driver does not support module configuration */
 
 static int __init imx6_pcie_init(void)
 {
return platform_driver_probe(_pcie_driver, imx6_pcie_probe);
 }
-module_init(imx6_pcie_init);
-
-MODULE_AUTHOR("Sean Cross ");
-MODULE_DESCRIPTION("Freescale i.MX6 PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+device_initcall(imx6_pcie_init);
-- 
2.6.1

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


[PATCH 09/10] drivers/pci: make host/pci-keystone.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_KEYSTONE
drivers/pci/host/Kconfig:   bool "TI Keystone PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Murali Karicheri 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-keystone.c | 21 +++--
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 0aa81bd3de12..0493d4257bde 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -329,16 +329,6 @@ static const struct of_device_id ks_pcie_of_match[] = {
},
{ },
 };
-MODULE_DEVICE_TABLE(of, ks_pcie_of_match);
-
-static int __exit ks_pcie_remove(struct platform_device *pdev)
-{
-   struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev);
-
-   clk_disable_unprepare(ks_pcie->clk);
-
-   return 0;
-}
 
 static int __init ks_pcie_probe(struct platform_device *pdev)
 {
@@ -398,15 +388,10 @@ fail_clk:
 
 static struct platform_driver ks_pcie_driver __refdata = {
.probe  = ks_pcie_probe,
-   .remove = __exit_p(ks_pcie_remove),
.driver = {
.name   = "keystone-pcie",
.of_match_table = of_match_ptr(ks_pcie_of_match),
+   .suppress_bind_attrs = true,
},
 };
-
-module_platform_driver(ks_pcie_driver);
-
-MODULE_AUTHOR("Murali Karicheri ");
-MODULE_DESCRIPTION("Keystone PCIe host controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(ks_pcie_driver);
-- 
2.6.1

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


[PATCH 04/10] drivers/pci: make host/pci-dra7xx.c explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_DRA7XX
drivers/pci/host/Kconfig:   bool "TI DRA7xx PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Kishon Vijay Abraham I 
Cc: Bjorn Helgaas 
Cc: linux-o...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-dra7xx.c | 31 +++
 1 file changed, 3 insertions(+), 28 deletions(-)

diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c
index 8c3688046c02..3769b7654c5d 100644
--- a/drivers/pci/host/pci-dra7xx.c
+++ b/drivers/pci/host/pci-dra7xx.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -451,25 +451,6 @@ err_phy:
return ret;
 }
 
-static int __exit dra7xx_pcie_remove(struct platform_device *pdev)
-{
-   struct dra7xx_pcie *dra7xx = platform_get_drvdata(pdev);
-   struct pcie_port *pp = >pp;
-   struct device *dev = >dev;
-   int count = dra7xx->phy_count;
-
-   if (pp->irq_domain)
-   irq_domain_remove(pp->irq_domain);
-   pm_runtime_put(dev);
-   pm_runtime_disable(dev);
-   while (count--) {
-   phy_power_off(dra7xx->phy[count]);
-   phy_exit(dra7xx->phy[count]);
-   }
-
-   return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int dra7xx_pcie_suspend(struct device *dev)
 {
@@ -553,19 +534,13 @@ static const struct of_device_id of_dra7xx_pcie_match[] = 
{
{ .compatible = "ti,dra7-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, of_dra7xx_pcie_match);
 
 static struct platform_driver dra7xx_pcie_driver = {
-   .remove = __exit_p(dra7xx_pcie_remove),
.driver = {
.name   = "dra7-pcie",
.of_match_table = of_dra7xx_pcie_match,
+   .suppress_bind_attrs = true,
.pm = _pcie_pm_ops,
},
 };
-
-module_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe);
-
-MODULE_AUTHOR("Kishon Vijay Abraham I ");
-MODULE_DESCRIPTION("TI PCIe controller driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe);
-- 
2.6.1

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


[PATCH 02/10] drivers/pci: make host/pcie-spear13xx.c driver explicitly non-modular

2015-12-12 Thread Paul Gortmaker
The Kconfig for this option is currently:

config PCIE_SPEAR13XX
bool "STMicroelectronics SPEAr PCIe controller"

...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity, so that when reading the
driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.  An
alternate init level might be worth considering at a later date.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and this driver had not populated ".remove"
with any function to be called either.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Pratyush Anand 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-spear13xx.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-spear13xx.c 
b/drivers/pci/host/pcie-spear13xx.c
index b95b7563c052..8248faa45f6f 100644
--- a/drivers/pci/host/pcie-spear13xx.c
+++ b/drivers/pci/host/pcie-spear13xx.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -366,13 +366,13 @@ static const struct of_device_id 
spear13xx_pcie_of_match[] = {
{ .compatible = "st,spear1340-pcie", },
{},
 };
-MODULE_DEVICE_TABLE(of, spear13xx_pcie_of_match);
 
 static struct platform_driver spear13xx_pcie_driver = {
.probe  = spear13xx_pcie_probe,
.driver = {
.name   = "spear-pcie",
.of_match_table = of_match_ptr(spear13xx_pcie_of_match),
+   .suppress_bind_attrs = true,
},
 };
 
@@ -382,8 +382,4 @@ static int __init spear13xx_pcie_init(void)
 {
return platform_driver_register(_pcie_driver);
 }
-module_init(spear13xx_pcie_init);
-
-MODULE_DESCRIPTION("ST Microelectronics SPEAr13xx PCIe host controller 
driver");
-MODULE_AUTHOR("Pratyush Anand ");
-MODULE_LICENSE("GPL v2");
+device_initcall(spear13xx_pcie_init);
-- 
2.6.1

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


Re: [PATCH 24/28] net: pch_gbe: add device tree support

2015-12-12 Thread Andy Shevchenko
On Mon, Nov 30, 2015 at 6:21 PM, Paul Burton  wrote:
> Introduce support for retrieving the PHY reset GPIO from device tree,
> which will be used on the MIPS Boston development board. This requires
> support for probe deferral in order to work correctly, since the order
> of device probe is not guaranteed & typically the EG20T GPIO controller
> device will be probed after the ethernet MAC.
>
> Signed-off-by: Paul Burton 
> ---
>
>  .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c   | 33 
> +-
>  1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c 
> b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> index 824ff9e..f2a9a38 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> @@ -23,6 +23,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  #define DRV_VERSION "1.01"
>  const char pch_driver_version[] = DRV_VERSION;
> @@ -2594,13 +2596,41 @@ static void pch_gbe_remove(struct pci_dev *pdev)
> free_netdev(netdev);
>  }
>
> +static int pch_gbe_parse_dt(struct pci_dev *pdev,
> +   struct pch_gbe_privdata **pdata)

Why not to return pdata as it done in many other drivers?
You have ERR_PTR() macro to pass errors.

> +{
> +   struct device_node *np = pdev->dev.of_node;
> +   struct gpio_desc *gpio;
> +
> +   if (!config_enabled(CONFIG_OF) || !np)

Before I saw IS_ENABLED(). Is this one a preferable new API?

> +   return 0;
> +
> +   if (!*pdata)
> +   *pdata = devm_kzalloc(>dev, sizeof(**pdata), 
> GFP_KERNEL);
> +   if (!*pdata)
> +   return -ENOMEM;
> +
> +   gpio = devm_gpiod_get(>dev, "phy-reset", GPIOD_ASIS);
> +   if (IS_ERR(gpio))
> +   return PTR_ERR(gpio);
> +
> +   (*pdata)->phy_reset_gpio = gpio;
> +   return 0;
> +}
> +
>  static int pch_gbe_probe(struct pci_dev *pdev,
>   const struct pci_device_id *pci_id)
>  {
> struct net_device *netdev;
> struct pch_gbe_adapter *adapter;
> +   struct pch_gbe_privdata *pdata;
> int ret;
>
> +   pdata = (struct pch_gbe_privdata *)pci_id->driver_data;
> +   ret = pch_gbe_parse_dt(pdev, );

So, I didn;t see anything related to dt in that function.
Maybe you just call it always? In that case remove check for np.

> +   if (ret)
> +   goto err_out;
> +
> ret = pcim_enable_device(pdev);
> if (ret)
> return ret;
> @@ -2638,7 +2668,7 @@ static int pch_gbe_probe(struct pci_dev *pdev,
> adapter->pdev = pdev;
> adapter->hw.back = adapter;
> adapter->hw.reg = pcim_iomap_table(pdev)[PCH_GBE_PCI_BAR];
> -   adapter->pdata = (struct pch_gbe_privdata *)pci_id->driver_data;
> +   adapter->pdata = pdata;
> if (adapter->pdata && adapter->pdata->platform_init)
> adapter->pdata->platform_init(pdev, pdata);
>
> @@ -2729,6 +2759,7 @@ err_free_adapter:
> pch_gbe_hal_phy_hw_reset(>hw);
>  err_free_netdev:
> free_netdev(netdev);
> +err_out:

Redundant.

> return ret;
>  }

For now it's a common practice to mix styles in probe due to usage of
devres API.

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


Re: [PATCH 1/1] Remove unneeded "0x" when %pa formatting is used.

2015-12-12 Thread Andy Shevchenko
On Mon, Nov 30, 2015 at 10:33 PM, Dmitry Krivenok
 wrote:
>>>  if (size > max_size) {
>>>  dev_err(pcie->dev,
>>> -"res size 0x%pap exceeds max supported size 0x%llx\n",
>>> +"res size %pap exceeds max supported size 0x%llx\n",
>>
>> %pa also works.
>>
>
> Yes, but AFAIK %pap and %pa are identical (see address_val() in 
> lib/vsprintf.c),
> so I'm not sure I understand your comment.
>
> Did you mean that %pa should be used instead of %pap?
> I see that %pa is used much more often than %pap, but I didn't find any
> evidence that %pap is deprecated.

+Rasmus.

No, it's not, but it explicitly for phys_addr_t (it might be nice to
to have %par, for example for explicitly shown that is for
resource_size_t, Rasmus?).

For my opinion for resources better to use %pa for now, though %pap
will work as well.

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


Re: [PATCH RESEND 1/1] serial: 8250_pci: Fix real serial port count for F81504/508/512

2015-12-12 Thread Andy Shevchenko
On Tue, Dec 1, 2015 at 8:54 AM, Peter Hung  wrote:
> Fix real serial port count for F81504/508/512 with multi-function mode.
>
> Fintek F81504/508/512 are multi-function boards. It could be configurated
> via PCI configuration space register F0h/F3h with external EEPROM that
> programmed by customer.
>
> F0h bit0~5: Enable GPIO0~5
> bit6~7: Reserve
>
> F3h bit0~5: Multi-Functional Flag (0:GPIO/1:UART)
> bit0: UART2 pin out for UART2 / GPIO0
> bit1: UART3 pin out for UART3 / GPIO1
> bit2: UART8 pin out for UART8 / GPIO2
> bit3: UART9 pin out for UART9 / GPIO3
> bit4: UART10 pin out for UART10 / GPIO4
> bit5: UART11 pin out for UART11 / GPIO5
> bit6~7: Reserve
>
> It'll use (F0h & ~F3h) & 0x3f union set to find max set of GPIOs.
> If a port is indicated as GPIO, it'll not report as serial port and reserve
> for userspace to manipulate.
>
> F81504: Max for 4 serial ports.
> UART2/3 is multi-function.
>
> F81508: Max for 8 serial ports.
> UART2/3 is multi-function.
> 8/9/10/11 is GPIO only
>
> F81512: Max for 12 serial ports.
> UART2/3/8/9/10/11 is multi-function.

First of all, maybe you can consider to split this part of the driver
to separate one? (Like we did for 8250_mid.c). It seems 8250_pci is
too bloated. But it's just an idea, maybe for future.

>
> Signed-off-by: Peter Hung 
> ---
>  drivers/tty/serial/8250/8250_pci.c | 114 
> +++--
>  1 file changed, 108 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_pci.c 
> b/drivers/tty/serial/8250/8250_pci.c
> index 4097f3f..8a639cb 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -1532,6 +1532,9 @@ pci_brcm_trumanage_setup(struct serial_private *priv,
>  /* only worked with FINTEK_RTS_CONTROL_BY_HW on */
>  #define FINTEK_RTS_INVERT  BIT(5)
>
> +/* The device is multi-function with UART & GPIO */
> +static u8 fintek_gpio_mapping[] = {2, 3, 8, 9, 10, 11};

Clearly you have bit combination here
Bit 1: 1
Bit 3: 1

So, mask as 0x0a shall cover this IIAC.

> +
>  /* We should do proper H/W transceiver setting before change to RS485 mode */
>  static int pci_fintek_rs485_config(struct uart_port *port,
>struct serial_rs485 *rs485)
> @@ -1586,10 +1589,41 @@ static int pci_fintek_setup(struct serial_private 
> *priv,
>  {
> struct pci_dev *pdev = priv->dev;
> u8 *data;
> -   u8 config_base;
> -   u16 iobase;
> +   u8 tmp;
> +   u8 config_base = 0;
> +   u16 iobase, i, max_port, count = 0;
>
> -   config_base = 0x40 + 0x08 * idx;
> +   switch (pdev->device) {
> +   case 0x1104: /* 4 ports */

Maybe you can introduce constants for IDs.

> +   case 0x1108: /* 8 ports */
> +   max_port = pdev->device & 0xff;
> +   break;
> +   case 0x1112: /* 12 ports */
> +   max_port = 12;
> +   break;
> +   default:
> +   return -EINVAL;
> +   }
> +
> +   /* find real serial port index from logic idx */
> +   for (i = 0; i < max_port; ++i) {
> +   config_base = 0x40 + 0x08 * i;
> +
> +   pci_read_config_byte(pdev, config_base, );
> +   if (!tmp)
> +   continue;
> +
> +   if (count == idx)
> +   break;
> +
> +   ++count;
> +   }
> +
> +   if (i >= max_port) {
> +   dev_err(>dev, "%s: mapping error! i=%d, idx=%d\n",
> +   __func__, i, idx);
> +   return -ENODEV;
> +   }
>
> /* Get the io address from configuration space */
> pci_read_config_word(pdev, config_base + 4, );
> @@ -1604,8 +1638,8 @@ static int pci_fintek_setup(struct serial_private *priv,
> if (!data)
> return -ENOMEM;
>
> -   /* preserve index in PCI configuration space */
> -   *data = idx;
> +   /* preserve real index in PCI configuration space */
> +   *data = i;
> port->port.private_data = data;
>
> return 0;
> @@ -1614,12 +1648,40 @@ static int pci_fintek_setup(struct serial_private 
> *priv,
>  static int pci_fintek_init(struct pci_dev *dev)
>  {
> unsigned long iobase;
> -   u32 max_port, i;
> +   u32 max_port, i, j;
> u32 bar_data[3];
> u8 config_base;
> +   u8 tmp, f0h_data, f3h_data;
> +   bool skip_init;
> struct serial_private *priv = pci_get_drvdata(dev);
> struct uart_8250_port *port;
>
> +   /*
> +* The PCI board is multi-function, some serial port can converts to
> +* GPIO function. Customers could changes the F0/F3h values in EEPROM
> +*
> +* F0h bit0~5: Enable GPIO0~5
> +* bit6~7: Reserve
> +*
> +* F3h bit0~5: Multi-Functional Flag (0:GPIO/1:UART)
> +*  bit0: UART2 pin out 

Re: [PATCH] ath6kl: Use vmalloc to allocate ar->fw for api1 method

2015-12-12 Thread Andy Shevchenko
On Tue, Dec 1, 2015 at 7:41 AM, Brent Taylor  wrote:
> Since commit 8437754c83351d6213c1a47ff029c1126d6042a7, ar->fw is expected to 
> be pointing to memory allocated by vmalloc.  If the api1 method (via 
> ath6kl_fetch_fw_api1) is used to allocate memory for ar->fw, then kmemdup is 
> used.  This patch checks if the firmware being loaded is the 'fw' image, then 
> use vmalloc, otherwise use kmalloc.
>

I think I already told someone that this kind of fixes miss the
symmetric kvfree() calls. Please, fix.


> Signed-off-by: Brent Taylor 
> ---
>  drivers/net/wireless/ath/ath6kl/init.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/init.c 
> b/drivers/net/wireless/ath/ath6kl/init.c
> index 6ae0734..4f2b124d 100644
> --- a/drivers/net/wireless/ath/ath6kl/init.c
> +++ b/drivers/net/wireless/ath/ath6kl/init.c
> @@ -673,10 +673,15 @@ static int ath6kl_get_fw(struct ath6kl *ar, const char 
> *filename,
> return ret;
>
> *fw_len = fw_entry->size;
> -   *fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
> +   if (>fw == fw)
> +   *fw = vmalloc(fw_entry->size);
> +   else
> +   *fw = kmalloc(fw_entry->size, GFP_KERNEL);
>
> if (*fw == NULL)
> ret = -ENOMEM;
> +   else
> +   memcpy(*fw, fw_entry->data, fw_entry->size);
>
> release_firmware(fw_entry);
>
> --
> 2.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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


Re: [PATCH 04/13] lib/vsprintf.c: expand field_width to 24 bits

2015-12-12 Thread Andy Shevchenko
On Wed, Dec 2, 2015 at 1:38 AM, Andrew Morton  wrote:
> On Tue, 20 Oct 2015 22:30:04 +0200 Rasmus Villemoes 
>  wrote:
>
>> I didn't find a BUILD_BUG/compiletime_assertion/... which would work
>> outside function context, so for now I just open-coded it.
>>
>
> It comes up occasionally.  It would be better to create one.
>
>> +extern char __check_printf_spec[1-2*(sizeof(struct printf_spec) != 8)];
>
> Maybe something like
>
> /*
>  * Description goes here
>  */
> #define BUILD_BUG_ON_STATIC(unique_id, expr)\
> typedef char unique_id[1-2*(expr)];

Yeah, it would be really nice to get rid of unique_id, though I have
no idea how to achieve.

>
> BUILD_BUG_ON_STATIC(__check_printf_spec, sizeof(struct printf_spec) != 8);
>
> ("static" seems the wrong term, but what is the correct term for
> "outside of functions"?)

Just _EXT?  Or _VAR?


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


Re: [PATCH v2 4/4] arm64: dts: rockchip: Add the needed timer for RK3368 SoC

2015-12-12 Thread Heiko Stübner
Am Freitag, 25. September 2015, 10:14:58 schrieb Caesar Wang:
> There is a need of a broadcast timer in this case to ensure proper
> wakeup when the cpus are in sleep mode and a timer expires.
> 
> Signed-off-by: Caesar Wang 

applied this patch to my dts64 branch for 4.5 .

The Kconfig option will probably need to wait for 4.6 though, due to the 
clocksource change going through Daniel's tree. Or I'll try to submit that 
post 4.5-rc1 as "fix" ... we'll see.


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


[PATCH 1/8] serial: core: Fold __uart_put_char() into caller

2015-12-12 Thread Peter Hurley
uart_put_char() is the required interface; manually inline
__uart_put_char().

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index cbf36df..321b45f 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -485,12 +485,15 @@ static void uart_change_speed(struct tty_struct *tty, 
struct uart_state *state,
spin_unlock_irq(>lock);
 }
 
-static inline int __uart_put_char(struct uart_port *port,
-   struct circ_buf *circ, unsigned char c)
+static int uart_put_char(struct tty_struct *tty, unsigned char c)
 {
+   struct uart_state *state = tty->driver_data;
+   struct uart_port *port = state->uart_port;
+   struct circ_buf *circ;
unsigned long flags;
int ret = 0;
 
+   circ = >xmit;
if (!circ->buf)
return 0;
 
@@ -504,13 +507,6 @@ static inline int __uart_put_char(struct uart_port *port,
return ret;
 }
 
-static int uart_put_char(struct tty_struct *tty, unsigned char ch)
-{
-   struct uart_state *state = tty->driver_data;
-
-   return __uart_put_char(state->uart_port, >xmit, ch);
-}
-
 static void uart_flush_chars(struct tty_struct *tty)
 {
uart_start(tty);
-- 
2.6.3

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


Re: Crypto/nx842: Ignore invalid XER[S0] return error

2015-12-12 Thread Haren Myneni
On 12/12/2015 04:05 PM, Segher Boessenkool wrote:
> On Sat, Dec 12, 2015 at 03:01:26PM -0800, Haren Myneni wrote:
>> On 12/12/2015 12:43 AM, Segher Boessenkool wrote:
>>> On Fri, Dec 11, 2015 at 07:30:29PM -0800, Haren Myneni wrote:
 NX842 coprocessor sets 3rd bit in CR register with XER[S0] which is
 nothing to do with NX request. On powerpc, XER[S0] will be set if
 overflow in FPU and stays until another floating point operation is
 executed. Since this bit can be set with other valuable return status,
 ignore this XER[S0] value.
>>>
>>> XER[SO] is the *integer* summary overflow bit.  It is set by OE=1
>>> instructions ("addo" and the like), and can only be cleared explicitly
>>> (using "mtxer").
>>
>> Thanks for the correct description. I was told XER[S0] is floating overflow 
>> from FPU.
> 
> You can use the Power ISA document to make sure for yourself.
> 
 +  if (ret & ICSWX_XERS0)
 +  ret &= ~ICSWX_XERS0;
>>>
>>> You can just always clear it, there is no need to check if it is set first.
>>
>> Do you mean reset this before calling NX?
> 
> I mean write this as simply
> 
> + ret &= ~ICSWX_XERS0;
> 
> (without any "if").
> 
>> I believe NX coprocessor should not set CR bit as XER[S0] nothing to do with 
>> NX request and it is no use.
> 
> Many instructions set the CR bit to XER[SO] -- store conditional, slbfee.,
> and all "normal" dot insns and of course cmp[l][i].  Or, shorter: "everything"
> does this.
> 
>> NX is copying this CR bit with XER. But reset XER[S0] has to be done before 
>> NX request.
> 
> Only if you care what the final value of bit 3 in the CR will be.  Even
> in the unusual case where you want to look at all CR field bits at once
> it is cheap to just mask out the bit (as you do).
> 
>> We can not do this in icswx since this instruction can be used by other 
>> coprocessors in future. But I am not comfortable clearing as we are not 
>> touching this XER in the driver or result of NX operation. So I am proposing 
>> this patch to fix this not proper NX behaviour - ignores CR bit. 
> 
> I really wouldn't call it "not proper", that makes it sound like there
> is an implementation bug or design mistake.  Instead, you could say that
> your switch statement looks at the values of bits 0, 1, and 2, so you
> just mask those -- you do not care about the value of bit 3, so you mask
> it out.
> 
> Something like
> 
> + /* Mask out the bits we do not care about. */
> + ret &= ~ICSWX_XERS0;

icswx RFC says CR[3] bit can be undefined or set to XER[S0]. So was thinking NX 
should have ignored since no use to user. I may be wrong.

Thanks for your help. I will repost this patch with your suggestions.

Thanks
Haren
> 
> 
> Segher
> 

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


[PATCH 4/8] serial: core: Take port mutex for send_xchar() tty method

2015-12-12 Thread Peter Hurley
Prepare for separate methods of preventing unsafe uart port access
when sending xchar; claim port mutex for the tty ops method (which
might sleep) and rcu for the throttle/unthrottle uses.

The implied limitation is that uart drivers which support
AUTOXOFF flow control cannot define a send_xchar() method that sleeps.

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 4430518..806eba81 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -610,23 +610,31 @@ static void uart_flush_buffer(struct tty_struct *tty)
  * This function is used to send a high-priority XON/XOFF character to
  * the device
  */
-static void uart_send_xchar(struct tty_struct *tty, char ch)
+static void __uart_send_xchar(struct uart_port *uport, char ch)
 {
-   struct uart_state *state = tty->driver_data;
-   struct uart_port *port = state->uart_port;
unsigned long flags;
 
-   if (port->ops->send_xchar)
-   port->ops->send_xchar(port, ch);
+   if (uport->ops->send_xchar)
+   uport->ops->send_xchar(uport, ch);
else {
-   spin_lock_irqsave(>lock, flags);
-   port->x_char = ch;
+   spin_lock_irqsave(>lock, flags);
+   uport->x_char = ch;
if (ch)
-   port->ops->start_tx(port);
-   spin_unlock_irqrestore(>lock, flags);
+   uport->ops->start_tx(port);
+   spin_unlock_irqrestore(>lock, flags);
}
 }
 
+static void uart_send_xchar(struct tty_struct *tty, char ch)
+{
+   struct uart_state *state = tty->driver_data;
+   struct uart_port *uport = state->uart_port;
+
+   mutex_lock(>port.mutex);
+   __uart_send_xchar(uport, ch);
+   mutex_unlock(>port.mutex);
+}
+
 static void uart_throttle(struct tty_struct *tty)
 {
struct uart_state *state = tty->driver_data;
@@ -644,7 +652,7 @@ static void uart_throttle(struct tty_struct *tty)
}
 
if (mask & UPSTAT_AUTOXOFF)
-   uart_send_xchar(tty, STOP_CHAR(tty));
+   __uart_send_xchar(port, STOP_CHAR(tty));
 
if (mask & UPSTAT_AUTORTS)
uart_clear_mctrl(port, TIOCM_RTS);
@@ -667,7 +675,7 @@ static void uart_unthrottle(struct tty_struct *tty)
}
 
if (mask & UPSTAT_AUTOXOFF)
-   uart_send_xchar(tty, START_CHAR(tty));
+   __uart_send_xchar(port, START_CHAR(tty));
 
if (mask & UPSTAT_AUTORTS)
uart_set_mctrl(port, TIOCM_RTS);
-- 
2.6.3

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


[PATCH 6/8] serial: core: Prevent unsafe uart port access, part 1

2015-12-12 Thread Peter Hurley
uart_remove_one_port() may race with every serial core operation
requiring a valid dereference of state->uart_port. In particular,
uart_remove_one_port() may unlink the uart port concurrently with
any serial core operation that may dereference same.

Ensure safe dereference for those operations that already claim
the port->mutex, and extend that guarantee for trivial cases,
such as the ioctl handlers.

For ioctls, return -EIO as if the port has been hung up (since it
has).

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 115 ++-
 1 file changed, 78 insertions(+), 37 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 16c4c48..2806f52 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -681,10 +681,11 @@ static void uart_unthrottle(struct tty_struct *tty)
uart_set_mctrl(port, TIOCM_RTS);
 }
 
-static void uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
+static int uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
 {
struct uart_state *state = container_of(port, struct uart_state, port);
-   struct uart_port *uport = state->uart_port;
+   struct uart_port *uport;
+   int ret = -ENODEV;
 
memset(retinfo, 0, sizeof(*retinfo));
 
@@ -693,6 +694,10 @@ static void uart_get_info(struct tty_port *port, struct 
serial_struct *retinfo)
 * occur as we go
 */
mutex_lock(>mutex);
+   uport = state->uart_port;
+   if (!uport)
+   goto out;
+
retinfo->type   = uport->type;
retinfo->line   = uport->line;
retinfo->port   = uport->iobase;
@@ -711,7 +716,11 @@ static void uart_get_info(struct tty_port *port, struct 
serial_struct *retinfo)
retinfo->io_type = uport->iotype;
retinfo->iomem_reg_shift = uport->regshift;
retinfo->iomem_base  = (void *)(unsigned long)uport->mapbase;
+
+   ret = 0;
+out:
mutex_unlock(>mutex);
+   return ret;
 }
 
 static int uart_get_info_user(struct tty_port *port,
@@ -719,7 +728,8 @@ static int uart_get_info_user(struct tty_port *port,
 {
struct serial_struct tmp;
 
-   uart_get_info(port, );
+   if (uart_get_info(port, ) < 0)
+   return -EIO;
 
if (copy_to_user(retinfo, , sizeof(*retinfo)))
return -EFAULT;
@@ -737,6 +747,9 @@ static int uart_set_info(struct tty_struct *tty, struct 
tty_port *port,
upf_t old_flags, new_flags;
int retval = 0;
 
+   if (!uport)
+   return -EIO;
+
new_port = new_info->port;
if (HIGH_BITS_OFFSET)
new_port += (unsigned long) new_info->port_high << 
HIGH_BITS_OFFSET;
@@ -946,8 +959,6 @@ static int uart_set_info_user(struct tty_struct *tty, 
struct uart_state *state,
  * @tty: tty associated with the UART
  * @state: UART being queried
  * @value: returned modem value
- *
- * Note: uart_ioctl protects us against hangups.
  */
 static int uart_get_lsr_info(struct tty_struct *tty,
struct uart_state *state, unsigned int __user *value)
@@ -975,18 +986,22 @@ static int uart_tiocmget(struct tty_struct *tty)
 {
struct uart_state *state = tty->driver_data;
struct tty_port *port = >port;
-   struct uart_port *uport = state->uart_port;
+   struct uart_port *uport;
int result = -EIO;
 
mutex_lock(>mutex);
+   uport = state->uart_port;
+   if (!uport)
+   goto out;
+
if (!(tty->flags & (1 << TTY_IO_ERROR))) {
result = uport->mctrl;
spin_lock_irq(>lock);
result |= uport->ops->get_mctrl(uport);
spin_unlock_irq(>lock);
}
+out:
mutex_unlock(>mutex);
-
return result;
 }
 
@@ -994,15 +1009,20 @@ static int
 uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
 {
struct uart_state *state = tty->driver_data;
-   struct uart_port *uport = state->uart_port;
struct tty_port *port = >port;
+   struct uart_port *uport;
int ret = -EIO;
 
mutex_lock(>mutex);
+   uport = state->uart_port;
+   if (!uport)
+   goto out;
+
if (!(tty->flags & (1 << TTY_IO_ERROR))) {
uart_update_mctrl(uport, set, clear);
ret = 0;
}
+out:
mutex_unlock(>mutex);
return ret;
 }
@@ -1011,21 +1031,26 @@ static int uart_break_ctl(struct tty_struct *tty, int 
break_state)
 {
struct uart_state *state = tty->driver_data;
struct tty_port *port = >port;
-   struct uart_port *uport = state->uart_port;
+   struct uart_port *uport;
+   int ret = -EIO;
 
mutex_lock(>mutex);
+   uport = state->uart_port;
+   if (!uport)
+   goto out;
 
if (uport->type != PORT_UNKNOWN)
  

[PATCH 3/8] serial: core: Use tty->index for port # in debug messages

2015-12-12 Thread Peter Hurley
The uart port may have already been removed by uart_remove_one_port();
use equivalent tty->index (which is always valid in these contexts)
instead.

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 89b5ddd..4430518 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1383,8 +1383,7 @@ static void uart_close(struct tty_struct *tty, struct 
file *filp)
 
uport = state->uart_port;
port = >port;
-
-   pr_debug("uart_close(%d) called\n", uport ? uport->line : -1);
+   pr_debug("uart_close(%d) called\n", tty->index);
 
if (!port->count || tty_port_close_start(port, tty, filp) == 0)
return;
@@ -1498,7 +1497,7 @@ static void uart_hangup(struct tty_struct *tty)
struct tty_port *port = >port;
unsigned long flags;
 
-   pr_debug("uart_hangup(%d)\n", state->uart_port->line);
+   pr_debug("uart_hangup(%d)\n", tty->index);
 
mutex_lock(>mutex);
if (port->flags & ASYNC_NORMAL_ACTIVE) {
-- 
2.6.3

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


[PATCH 8/8] serial: core: Prevent unsafe uart port access, part 3

2015-12-12 Thread Peter Hurley
For serial core operations without sleeping locks and other waits
(and not already excluded by holding port->mutex), use RCU to
protect dereferencing the state->uart_port.

Introduce helper functions, uart_port_ref() and uart_port_deref(), to
wrap uart_port access in RCU read sections, and helper macros,
uart_port_lock_rcu() and uart_port_unlock_rcu(), to wrap combination
RCU read/uart port lock sections.

For functions only reading the tx circular buffer indexes (where the
uart port lock is claimed to prevent concurrent users), a NULL
uart port is simply ignored and the operation completes.

For functions changing the tx circular buffer indexes (where the
uart port lock is claimed to prevent concurrent users), the operation
is aborted if the uart port is NULL (ie, has been detached).

For functions already holding the port->mutex (and thus guaranteed
safe uart port dereference), introduce helper uart_port_check_rcu(),
which asserts port->mutex is held (if CONFIG_PROVE_RCU).

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/8250/8250_port.c |   6 +-
 drivers/tty/serial/serial_core.c| 312 +++-
 2 files changed, 205 insertions(+), 113 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c 
b/drivers/tty/serial/8250/8250_port.c
index ea9d1ce..ced0674 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2570,7 +2570,8 @@ static int bytes_to_fcr_rxtrig(struct uart_8250_port *up, 
unsigned char bytes)
 static int do_get_rxtrig(struct tty_port *port)
 {
struct uart_state *state = container_of(port, struct uart_state, port);
-   struct uart_port *uport = state->uart_port;
+   struct uart_port *uport = rcu_dereference_protected(state->uart_port,
+   lockdep_is_held(>mutex));
struct uart_8250_port *up =
container_of(uport, struct uart_8250_port, port);
 
@@ -2607,7 +2608,8 @@ static ssize_t serial8250_get_attr_rx_trig_bytes(struct 
device *dev,
 static int do_set_rxtrig(struct tty_port *port, unsigned char bytes)
 {
struct uart_state *state = container_of(port, struct uart_state, port);
-   struct uart_port *uport = state->uart_port;
+   struct uart_port *uport = rcu_dereference_protected(state->uart_port,
+   lockdep_is_held(>mutex));
struct uart_8250_port *up =
container_of(uport, struct uart_8250_port, port);
int rxtrig;
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 47a3dc9..e98b16f 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -64,6 +64,46 @@ static int uart_dcd_enabled(struct uart_port *uport)
return !!(uport->status & UPSTAT_DCD_ENABLE);
 }
 
+static inline struct uart_port *uart_port_ref(struct uart_state *state)
+{
+   struct uart_port *uport;
+
+   rcu_read_lock();
+   uport = rcu_dereference(state->uart_port);
+   if (!uport)
+   rcu_read_unlock();
+   return uport;
+}
+
+static inline void uart_port_deref(struct uart_port *uport)
+{
+   if (uport)
+   rcu_read_unlock();
+}
+
+static inline struct uart_port *uart_port_check_rcu(struct uart_state *state)
+{
+   return rcu_dereference_check(state->uart_port,
+lockdep_is_held(>port.mutex));
+}
+
+#define uart_port_lock_rcu(state, flags)   \
+   ({  \
+   struct uart_port *__uport = uart_port_ref(state);   \
+   if (__uport)\
+   spin_lock_irqsave(&__uport->lock, flags);   \
+   __uport;\
+   })
+
+#define uart_port_unlock_rcu(uport, flags) \
+   ({  \
+   struct uart_port *__uport = uport;  \
+   if (__uport)\
+   spin_unlock_irqrestore(&__uport->lock, flags);  \
+   uart_port_deref(__uport);   \
+   })
+
+
 /*
  * This routine is used by the interrupt handler to schedule processing in
  * the software interrupt portion of the driver.
@@ -82,32 +122,33 @@ void uart_write_wakeup(struct uart_port *port)
 static void uart_stop(struct tty_struct *tty)
 {
struct uart_state *state = tty->driver_data;
-   struct uart_port *port = state->uart_port;
+   struct uart_port *uport;
unsigned long flags;
 
-   spin_lock_irqsave(>lock, flags);
-   port->ops->stop_tx(port);
-   spin_unlock_irqrestore(>lock, flags);
+   uport = uart_port_lock_rcu(state, flags);
+   if (uport)
+   

[PATCH 5/8] serial: core: Expand port mutex section in uart_poll_init()

2015-12-12 Thread Peter Hurley
Prepare uart_poll_init() to safely dereference uart port; expand the
port mutex section to guarantee uart port remains valid until
uart_poll_init() completes.

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 37 ++---
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 806eba81..16c4c48 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2268,42 +2268,41 @@ static int uart_poll_init(struct tty_driver *driver, 
int line, char *options)
 {
struct uart_driver *drv = driver->driver_state;
struct uart_state *state = drv->state + line;
-   struct uart_port *port;
+   struct tty_port *port;
+   struct uart_port *uport;
int baud = 9600;
int bits = 8;
int parity = 'n';
int flow = 'n';
-   int ret;
+   int ret = -1;
 
-   if (!state || !state->uart_port)
+   if (!state)
return -1;
 
-   port = state->uart_port;
-   if (!(port->ops->poll_get_char && port->ops->poll_put_char))
-   return -1;
+   port = >port;
+   mutex_lock(>mutex);
 
-   if (port->ops->poll_init) {
-   struct tty_port *tport = >port;
+   uport = state->uart_port;
+   if (!(uport->ops->poll_get_char && uport->ops->poll_put_char))
+   goto out;
 
-   ret = 0;
-   mutex_lock(>mutex);
+   ret = 0;
+   if (uport->ops->poll_init) {
/*
 * We don't set ASYNCB_INITIALIZED as we only initialized the
 * hw, e.g. state->xmit is still uninitialized.
 */
-   if (!test_bit(ASYNCB_INITIALIZED, >flags))
-   ret = port->ops->poll_init(port);
-   mutex_unlock(>mutex);
-   if (ret)
-   return ret;
+   if (!test_bit(ASYNCB_INITIALIZED, >flags))
+   ret = uport->ops->poll_init(uport);
}
 
-   if (options) {
+   if (!ret && options) {
uart_parse_options(options, , , , );
-   return uart_set_options(port, NULL, baud, parity, bits, flow);
+   ret = uart_set_options(uport, NULL, baud, parity, bits, flow);
}
-
-   return 0;
+out:
+   mutex_unlock(>mutex);
+   return ret;
 }
 
 static int uart_poll_get_char(struct tty_driver *driver, int line)
-- 
2.6.3

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


[PATCH 0/8] Fix unsafe uart port access

2015-12-12 Thread Peter Hurley
Hi Greg,

The serial core has always intended to allow uart drivers to detach and
unload, even while ttys are open and running. Since the serial core is
the actual tty driver, it acts as a proxy for the uart driver, which
allows the uart driver to remove the port (which hangs up the tty) and
then unload.

However, all of this is broken.

Firstly, there is no mechanism for blocking the uart port removal until
current operations are complete. The tty core does not, and never has,
serialized ioctl() or any other tty operation other than open/close
with hangup.

Secondly, uart_register_driver() directly binds data from the uart driver
with the tty core, rather than providing proxy copies _without taking
module references to the uart driver_. This produces some spectacular
results if the tty is in-use when the uart driver unloads.

Thirdly, uart_unregister_driver() immediately destroys the tty port
despite that it may be in use, and will continue to be for the
lifetime of the tty, which is unbounded (userspace may retain open
ttys forever).

This series addresses the first problem of ensuring safe uart port
dereferencing with concurrent uart port removal. Two distinct
mechanisms are used to provide the necessary safe dereference: the
tty_port mutex and RCU.

By serializing the uart port detach (ie, reset to NULL) with the
tty_port mutex, existing sections of the serial core that already
hold the port mutex are guaranteed the uart port detach will not
be concurrent, and so can simply test for NULL value before first
dereference.

Most of the existing serial core that holds the port mutex is
ioctl-related and so can return -EIO as if the tty has been hungup
(which it has been).

Other portions of the serial core that sleep (eg. uart_wait_until_sent())
also now claim the port mutex to prevent concurrent uart port detach,
and thus protect the reference. The port mutex is dropped for the
actual sleep, retaken on wakeup and the uart port is re-checked
for NULL.

For portions of the serial core that don't sleep, RCU is used to
defer actual uart port teardown after detach (with synchronize_rcu())
until the current holders of rcu_read_lock() are complete.

The xmit buffer operations that don't modify the buffer indexes --
uart_write_room() and uart_chars_in_buffer() -- just report the state
of the xmit buffer anyway if the uart port has been removed, despite
that the xmit buffer is no longer lockable (the lock is in the
uart_port that is now gone).

Xmit buffer operations that do modify the buffer indexes are aborted.

Extra care is taken with the close/hangup/shutdown paths since this
must continue to perform other work even if the uart port has been
removed (for example, if the uart port was /dev/console and so will
only be closed when the file descriptor is released).

I do have a plan for the second and third problems but this series
does not implement those.

Regards,

Peter Hurley (8):
  serial: core: Fold __uart_put_char() into caller
  serial: core: Fold do_uart_get_info() into caller
  serial: core: Use tty->index for port # in debug messages
  serial: core: Take port mutex for send_xchar() tty method
  serial: core: Expand port mutex section in uart_poll_init()
  serial: core: Prevent unsafe uart port access, part 1
  serial: core: Prevent unsafe uart port access, part 2
  serial: core: Prevent unsafe uart port access, part 3

 drivers/tty/serial/8250/8250_port.c |   6 +-
 drivers/tty/serial/serial_core.c| 547 +++-
 2 files changed, 355 insertions(+), 198 deletions(-)

-- 
2.6.3

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


[PATCH 2/8] serial: core: Fold do_uart_get_info() into caller

2015-12-12 Thread Peter Hurley
do_uart_get_info() has a single caller: uart_get_info().
Manually inline do_uart_get_info().

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 321b45f..89b5ddd 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -673,14 +673,18 @@ static void uart_unthrottle(struct tty_struct *tty)
uart_set_mctrl(port, TIOCM_RTS);
 }
 
-static void do_uart_get_info(struct tty_port *port,
-   struct serial_struct *retinfo)
+static void uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
 {
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = state->uart_port;
 
memset(retinfo, 0, sizeof(*retinfo));
 
+   /*
+* Ensure the state we copy is consistent and no hardware changes
+* occur as we go
+*/
+   mutex_lock(>mutex);
retinfo->type   = uport->type;
retinfo->line   = uport->line;
retinfo->port   = uport->iobase;
@@ -699,15 +703,6 @@ static void do_uart_get_info(struct tty_port *port,
retinfo->io_type = uport->iotype;
retinfo->iomem_reg_shift = uport->regshift;
retinfo->iomem_base  = (void *)(unsigned long)uport->mapbase;
-}
-
-static void uart_get_info(struct tty_port *port,
-   struct serial_struct *retinfo)
-{
-   /* Ensure the state we copy is consistent and no hardware changes
-  occur as we go */
-   mutex_lock(>mutex);
-   do_uart_get_info(port, retinfo);
mutex_unlock(>mutex);
 }
 
@@ -715,6 +710,7 @@ static int uart_get_info_user(struct tty_port *port,
 struct serial_struct __user *retinfo)
 {
struct serial_struct tmp;
+
uart_get_info(port, );
 
if (copy_to_user(retinfo, , sizeof(*retinfo)))
-- 
2.6.3

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


[PATCH 7/8] serial: core: Prevent unsafe uart port access, part 2

2015-12-12 Thread Peter Hurley
For tty operations which may expect uart port to have been removed
but still have other necessary work to accomplish, check for NULL
uart port; specifically uart_close(), uart_hangup() and sub-functions
(uart_shutdown(), uart_port_shutdown() and uart_wait_until_sent()).

Split uart_wait_until_sent() into the original tty operation (which
now must claim the port->mutex) and __uart_wait_until_sent() (which
performs the timeout computations and waits); the port->mutex is
released during the sleep and the uart port ptr is reloaded after
wakeup.

Signed-off-by: Peter Hurley 
---
 drivers/tty/serial/serial_core.c | 66 
 1 file changed, 46 insertions(+), 20 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 2806f52..47a3dc9 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -53,7 +53,7 @@ static struct lock_class_key port_lock_key;
 
 static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
struct ktermios *old_termios);
-static void uart_wait_until_sent(struct tty_struct *tty, int timeout);
+static void __uart_wait_until_sent(struct tty_struct *tty, int timeout);
 static void uart_change_pm(struct uart_state *state,
   enum uart_pm_state pm_state);
 
@@ -221,6 +221,8 @@ static int uart_startup(struct tty_struct *tty, struct 
uart_state *state,
  * This routine will shutdown a serial port; interrupts are disabled, and
  * DTR is dropped if the hangup on close termio flag is on.  Calls to
  * uart_shutdown are serialised by the per-port semaphore.
+ *
+ * uport == NULL if uart_port has already been removed
  */
 static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
 {
@@ -237,7 +239,7 @@ static void uart_shutdown(struct tty_struct *tty, struct 
uart_state *state)
/*
 * Turn off DTR and RTS early.
 */
-   if (uart_console(uport) && tty)
+   if (uport && uart_console(uport) && tty)
uport->cons->cflag = tty->termios.c_cflag;
 
if (!tty || (tty->termios.c_cflag & HUPCL))
@@ -1406,7 +1408,6 @@ out:
  * Calls to uart_close() are serialised via the tty_lock in
  *   drivers/tty/tty_io.c:tty_release()
  *   drivers/tty/tty_io.c:do_tty_hangup()
- * This runs from a workqueue and can sleep for a _short_ time only.
  */
 static void uart_close(struct tty_struct *tty, struct file *filp)
 {
@@ -1425,18 +1426,21 @@ static void uart_close(struct tty_struct *tty, struct 
file *filp)
return;
}
 
-   uport = state->uart_port;
port = >port;
pr_debug("uart_close(%d) called\n", tty->index);
 
-   if (!port->count || tty_port_close_start(port, tty, filp) == 0)
+   if (tty_port_close_start(port, tty, filp) == 0)
return;
 
+   mutex_lock(>mutex);
+   uport = state->uart_port;
+
/*
 * At this point, we stop accepting input.  To do this, we
 * disable the receive line status interrupts.
 */
-   if (port->flags & ASYNC_INITIALIZED) {
+   if ((port->flags & ASYNC_INITIALIZED) &&
+   !WARN(!uport, "detached port still initialized!\n")) {
spin_lock_irq(>lock);
uport->ops->stop_rx(uport);
spin_unlock_irq(>lock);
@@ -1445,10 +1449,10 @@ static void uart_close(struct tty_struct *tty, struct 
file *filp)
 * has completely drained; this is especially
 * important if there is a transmit FIFO!
 */
-   uart_wait_until_sent(tty, uport->timeout);
+   __uart_wait_until_sent(tty, uport->timeout);
+   uport = state->uart_port;
}
 
-   mutex_lock(>mutex);
uart_shutdown(tty, state);
tty_port_tty_set(port, NULL);
 
@@ -1459,7 +1463,7 @@ static void uart_close(struct tty_struct *tty, struct 
file *filp)
if (port->close_delay)

msleep_interruptible(jiffies_to_msecs(port->close_delay));
spin_lock_irq(>lock);
-   } else if (!uart_console(uport)) {
+   } else if (uport && !uart_console(uport)) {
spin_unlock_irq(>lock);
uart_change_pm(state, UART_PM_STATE_OFF);
spin_lock_irq(>lock);
@@ -1475,13 +1479,13 @@ static void uart_close(struct tty_struct *tty, struct 
file *filp)
mutex_unlock(>mutex);
 }
 
-static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
+static void __uart_wait_until_sent(struct tty_struct *tty, int timeout)
 {
struct uart_state *state = tty->driver_data;
-   struct uart_port *port = state->uart_port;
+   struct uart_port *uport = state->uart_port;
unsigned long char_time, expire;
 
-   if (port->type == PORT_UNKNOWN || port->fifosize == 0)
+   if (uport->type == 

[PATCH] xen/x86/pvh: Use HVM's flush_tlb_others op

2015-12-12 Thread Boris Ostrovsky
Using MMUEXT_TLB_FLUSH_MULTI doesn't buy us much since the hypervisor
will likely perform same IPIs as would have the guest.

More importantly, using MMUEXT_INVLPG_MULTI may not to invalidate the
guest's address on remote CPU (when, for example, VCPU from another guest
is running there).

Signed-off-by: Boris Ostrovsky 
Suggested-by: Jan Beulich 
Cc: sta...@vger.kernel.org # 3.14+
---
 arch/x86/xen/mmu.c |9 ++---
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 9c479fe..9ed7eed 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -2495,14 +2495,9 @@ void __init xen_init_mmu_ops(void)
 {
x86_init.paging.pagetable_init = xen_pagetable_init;
 
-   /* Optimization - we can use the HVM one but it has no idea which
-* VCPUs are descheduled - which means that it will needlessly IPI
-* them. Xen knows so let it do the job.
-*/
-   if (xen_feature(XENFEAT_auto_translated_physmap)) {
-   pv_mmu_ops.flush_tlb_others = xen_flush_tlb_others;
+   if (xen_feature(XENFEAT_auto_translated_physmap))
return;
-   }
+
pv_mmu_ops = xen_mmu_ops;
 
memset(dummy_mapping, 0xff, PAGE_SIZE);
-- 
1.7.1

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


Re: [PATCH] lock_page() doesn't lock if __wait_on_bit_lock returns -EINTR

2015-12-12 Thread Chris Mason
On Sat, Dec 12, 2015 at 11:41:26AM -0800, Linus Torvalds wrote:
> On Sat, Dec 12, 2015 at 10:33 AM, Linus Torvalds
>  wrote:
> >
> > Peter, did that patch also handle just plain "lock_page()" case?
> 
> Looking more at it, I think this all goes back to commit 743162013d40
> ("sched: Remove proliferation of wait_on_bit() action functions").
> 
> It looks like PeterZ's pending patch should fix this, by passing in
> the proper TASK_UNINTERRUPTIBLE to the bit_wait_io function, and going
> back to signal_pending_state(). PeterZ, did I follow the history of
> this correctly?

Looks right to me, I found Peter's patch and have it running now. After
about 6 hours my patch did eventually crash again under trinity.  Btrfs has a
very old (from 2011) bug in the error handling path that trinity is
banging on.

Doing another run with Peter's patch and btrfs fixed up.  The btrfs patch is
small, but not urgent enough to shove in on Sunday.  I'll send for rc6
along with a few others we've queued up.

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


Re: Crypto/nx842: Ignore invalid XER[S0] return error

2015-12-12 Thread Segher Boessenkool
On Sat, Dec 12, 2015 at 03:01:26PM -0800, Haren Myneni wrote:
> On 12/12/2015 12:43 AM, Segher Boessenkool wrote:
> > On Fri, Dec 11, 2015 at 07:30:29PM -0800, Haren Myneni wrote:
> >> NX842 coprocessor sets 3rd bit in CR register with XER[S0] which is
> >> nothing to do with NX request. On powerpc, XER[S0] will be set if
> >> overflow in FPU and stays until another floating point operation is
> >> executed. Since this bit can be set with other valuable return status,
> >> ignore this XER[S0] value.
> > 
> > XER[SO] is the *integer* summary overflow bit.  It is set by OE=1
> > instructions ("addo" and the like), and can only be cleared explicitly
> > (using "mtxer").
> 
> Thanks for the correct description. I was told XER[S0] is floating overflow 
> from FPU.

You can use the Power ISA document to make sure for yourself.

> >> +  if (ret & ICSWX_XERS0)
> >> +  ret &= ~ICSWX_XERS0;
> > 
> > You can just always clear it, there is no need to check if it is set first.
> 
> Do you mean reset this before calling NX?

I mean write this as simply

+   ret &= ~ICSWX_XERS0;

(without any "if").

> I believe NX coprocessor should not set CR bit as XER[S0] nothing to do with 
> NX request and it is no use.

Many instructions set the CR bit to XER[SO] -- store conditional, slbfee.,
and all "normal" dot insns and of course cmp[l][i].  Or, shorter: "everything"
does this.

> NX is copying this CR bit with XER. But reset XER[S0] has to be done before 
> NX request.

Only if you care what the final value of bit 3 in the CR will be.  Even
in the unusual case where you want to look at all CR field bits at once
it is cheap to just mask out the bit (as you do).

> We can not do this in icswx since this instruction can be used by other 
> coprocessors in future. But I am not comfortable clearing as we are not 
> touching this XER in the driver or result of NX operation. So I am proposing 
> this patch to fix this not proper NX behaviour - ignores CR bit. 

I really wouldn't call it "not proper", that makes it sound like there
is an implementation bug or design mistake.  Instead, you could say that
your switch statement looks at the values of bits 0, 1, and 2, so you
just mask those -- you do not care about the value of bit 3, so you mask
it out.

Something like

+   /* Mask out the bits we do not care about. */
+   ret &= ~ICSWX_XERS0;


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


Re: [PATCH V2 2/4] scsi: storvsc: Properly support Fibre Channel devices

2015-12-12 Thread kbuild test robot
Hi Srinivasan,

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.4-rc4 next-20151211]

url:
https://github.com/0day-ci/linux/commits/K-Y-Srinivasan/scsi-storvsc-Properly-support-FC-hosts/20151213-042209
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-s4-12130552 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `storvsc_remove':
>> storvsc_drv.c:(.text+0x2e3e58): undefined reference to `fc_remove_host'
   drivers/built-in.o: In function `storvsc_drv_init':
>> storvsc_drv.c:(.init.text+0x107bf): undefined reference to 
>> `fc_attach_transport'
>> storvsc_drv.c:(.init.text+0x107f9): undefined reference to 
>> `fc_release_transport'
   drivers/built-in.o: In function `storvsc_drv_exit':
>> storvsc_drv.c:(.exit.text+0x1eb1): undefined reference to 
>> `fc_release_transport'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v2] vhost: replace % with & on data path

2015-12-12 Thread Andy Shevchenko
On Fri, Dec 4, 2015 at 10:19 PM, Venkatesh Srinivas
 wrote:
> On Mon, Nov 30, 2015 at 11:15:23AM +0200, Michael S. Tsirkin wrote:
>> We know vring num is a power of 2, so use &
>> to mask the high bits.
>>
>> Signed-off-by: Michael S. Tsirkin 
>> ---
>
> The generated code switches from DIV -> masking, source is clearer as well.

First impression was why, now it seems that compiler can't predict
this for variables.
For constants it would be optimized to the same, I suppose.

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



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


Re: [serial] Calling platform specific code on driver bind/unbind

2015-12-12 Thread Andy Shevchenko
On Fri, Dec 4, 2015 at 11:37 PM, Piotr Madalinski
 wrote:
> Hi,
> I'm hacking my openwrt router and look for a proper way to make a serial
> driver call a platform-specific function such as this:
>
> static void ath79_enable_uart(void) {
> if (soc_is_ar933x())
> ath79_gpio_function_enable(AR933X_GPIO_FUNC_UART_EN);
> }
>
> and
>
> static void ath79_disable_uart(void) {
> if (soc_is_ar933x())
> ath79_gpio_function_disable(AR933X_GPIO_FUNC_UART_EN);
> }
>
> on driver bind/unbind instead of in platform initialization code, in order
> to be able to
> reuse the pins as gpio, without disabling uart entirely.
>
> My current solution uses platform_data to pass function pointers,
> and invokes them in driver's request_port and release_port functions
> respectively.
>
> And, oddly enough, the one in release_port gets invoked on unbind but the
> other one
> isn't called on bind (I had to add a call to it in probe to get it working).
>
> So I wonder, if the request/release functions are a proper place for such a
> callback,
> or is there some better, more 'canonical' solution.

pinctrl framework / API?

>
> Also, I could attach my patches but it is my first post here, and they are a
> bit openwrt specific,
> and I don't want to be yelled upon ;-).



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


Re: [PATCH] printk-formats.txt: remove unimplemented %pT

2015-12-12 Thread Andy Shevchenko
On Sat, Dec 5, 2015 at 9:02 PM, Rasmus Villemoes
 wrote:
> %pT for task->comm has been proposed (several times, I think), but is
> not actually implemented.

Has it been in linux-next for a while at some point?

In any case currently indeed it's a dead doc.

Reviewed-by: Andy Shevchenko 

> Remove it from printk-formats.txt and add it
> back if/when it gets implemented.
>
> Signed-off-by: Rasmus Villemoes 
> ---
>
> This slipped through in 5e4ee7b ("printk: synchronize %p formatting
> documentation"), so I think the fix is appropriate for this cycle,
> even if we're soon at -rc5.
>
>  Documentation/printk-formats.txt | 9 -
>  1 file changed, 9 deletions(-)
>
> diff --git a/Documentation/printk-formats.txt 
> b/Documentation/printk-formats.txt
> index b784c270105f..602fee945d1d 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -300,15 +300,6 @@ Network device features:
>
> Passed by reference.
>
> -Command from struct task_struct
> -
> -   %pT ls
> -
> -   For printing executable name excluding path from struct
> -   task_struct.
> -
> -   Passed by reference.
> -
>  If you add other %p extensions, please extend lib/test_printf.c with
>  one or more test cases, if at all feasible.
>
> --
> 2.6.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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


Re: [PATCH] staging: speakup: kobjects.c: fix char argument to %02x

2015-12-12 Thread Andy Shevchenko
On Sun, Dec 6, 2015 at 2:05 AM, Rasmus Villemoes
 wrote:
> If char is signed and ch happens to be negative, printing ch with
> "%02x" will not do as intended (when ch is -19, one will get
> "ffed"). Fix that by masking with 0xff.
>
> Signed-off-by: Rasmus Villemoes 
> ---
>  drivers/staging/speakup/kobjects.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index fdfeb42b2b8f..8b88f03e266b 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -567,7 +567,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct 
> kobj_attribute *attr,
> if (ch >= ' ' && ch < '~')
> *cp1++ = ch;
> else
> -   cp1 += sprintf(cp1, "\\x%02x", ch);
> +   cp1 += sprintf(cp1, "\\x%02x", ch & 
> 0xff);

Have you considered to use string_escape_str()?


This one clearly looks like ESCAPE_HEX.

> }
> *cp1++ = '"';
> *cp1++ = '\n';
> --
> 2.6.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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


Congratulation

2015-12-12 Thread Western Union Money Transfer Office
Attention you have been awarded with the sum of $200,000 USD by
the Western Union Money Transfer Office, As part of our Annual market
promotions this Year @2015.

Get back us for claim by filling the details stated here:

1. Name:__
2. Address
3. Country:___
4. Phone Number
5. Occupation:
6. Sex:___
7. Age

Name: Mr.Leo Sam

Contact Email: westernunion_offic...@yahoo.com

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


Re: [PATCH v1 04/10] serial: mps2-uart: add MPS2 UART driver

2015-12-12 Thread Andy Shevchenko
On Wed, Dec 2, 2015 at 11:33 AM, Vladimir Murzin
 wrote:
> This driver adds support to the UART controller found on ARM MPS2
> platform.

Just few comments (have neither time not big desire to do full review).

>
> Signed-off-by: Vladimir Murzin 
> ---
>  drivers/tty/serial/Kconfig   |   12 +
>  drivers/tty/serial/Makefile  |1 +
>  drivers/tty/serial/mps2-uart.c   |  596 
> ++
>  include/uapi/linux/serial_core.h |3 +
>  4 files changed, 612 insertions(+)
>  create mode 100644 drivers/tty/serial/mps2-uart.c
>
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index f38beb2..e98bfea 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -1473,6 +1473,18 @@ config SERIAL_EFM32_UART
>   This driver support the USART and UART ports on
>   Energy Micro's efm32 SoCs.
>
> +config SERIAL_MPS2_UART_CONSOLE
> +   bool "MPS2 UART console support"
> +   depends on SERIAL_MPS2_UART
> +   select SERIAL_CORE_CONSOLE
> +
> +config SERIAL_MPS2_UART
> +   bool "MPS2 UART port"
> +   depends on ARM || COMPILE_TEST
> +   select SERIAL_CORE
> +   help
> + This driver support the UART ports on ARM MPS2.
> +
>  config SERIAL_EFM32_UART_CONSOLE
> bool "EFM32 UART/USART console support"
> depends on SERIAL_EFM32_UART=y
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index 5ab4111..7f589f5 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -93,6 +93,7 @@ obj-$(CONFIG_SERIAL_CONEXANT_DIGICOLOR)   += 
> digicolor-usart.o
>  obj-$(CONFIG_SERIAL_MEN_Z135)  += men_z135_uart.o
>  obj-$(CONFIG_SERIAL_SPRD) += sprd_serial.o
>  obj-$(CONFIG_SERIAL_STM32) += stm32-usart.o
> +obj-$(CONFIG_SERIAL_MPS2_UART) += mps2-uart.o
>
>  # GPIOLIB helpers for modem control lines
>  obj-$(CONFIG_SERIAL_MCTRL_GPIO)+= serial_mctrl_gpio.o
> diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c
> new file mode 100644
> index 000..09bac16
> --- /dev/null
> +++ b/drivers/tty/serial/mps2-uart.c
> @@ -0,0 +1,596 @@
> +/*
> + * Copyright (C) 2015 ARM Limited
> + *
> + * Author: Vladimir Murzin 
> + *
> + * 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.
> + *
> + * TODO: support for SysRq
> + */
> +
> +#define pr_fmt(fmt)KBUILD_MODNAME ": " fmt
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define SERIAL_NAME "ttyMPS"

Can it be ttyS?

> +#define DRIVER_NAME "mps2-uart"
> +#define MAKE_NAME(x) (DRIVER_NAME # x)
> +
> +#define UARTn_DATA 0x0

I think it makes sense to have same width for all offsets, i.e. 0x00
here and so on below.

> +
> +#define UARTn_STATE0x4
> +#define UARTn_STATE_TX_FULLBIT(0)
> +#define UARTn_STATE_RX_FULLBIT(1)
> +#define UARTn_STATE_TX_OVERRUN BIT(2)
> +#define UARTn_STATE_RX_OVERRUN BIT(3)
> +
> +#define UARTn_CTRL 0x8
> +#define UARTn_CTRL_TX_ENABLE   BIT(0)
> +#define UARTn_CTRL_RX_ENABLE   BIT(1)
> +#define UARTn_CTRL_TX_INT_ENABLE   BIT(2)
> +#define UARTn_CTRL_RX_INT_ENABLE   BIT(3)
> +#define UARTn_CTRL_TX_OVERRUN_INT_ENABLE   BIT(4)
> +#define UARTn_CTRL_RX_OVERRUN_INT_ENABLE   BIT(5)
> +
> +#define UARTn_INT  0xc
> +#define UARTn_INT_TX   BIT(0)
> +#define UARTn_INT_RX   BIT(1)
> +#define UARTn_INT_TX_OVERRUN   BIT(2)
> +#define UARTn_INT_RX_OVERRUN   BIT(3)
> +
> +#define UARTn_BAUDDIV  0x10
> +#define UARTn_BAUDDIV_MASK GENMASK(20, 0)
> +
> +#define MPS2_MAX_PORTS 3
> +
> +struct mps2_uart_port {
> +   struct uart_port port;
> +   struct clk *clk;
> +   unsigned int tx_irq;
> +   unsigned int rx_irq;
> +};
> +
> +static inline struct mps2_uart_port *to_mps2_port(struct uart_port *port)
> +{
> +   return container_of(port, struct mps2_uart_port, port);
> +}
> +
> +static void mps2_uart_write8(struct uart_port *port, u8 val, unsigned off)
> +{
> +   struct mps2_uart_port *mps_port = to_mps2_port(port);
> +
> +   writeb(val, mps_port->port.membase + off);
> +}
> +
> +static u8 mps2_uart_read8(struct uart_port *port, unsigned off)
> +{
> +   struct mps2_uart_port *mps_port = to_mps2_port(port);
> +
> +   return readb(mps_port->port.membase + off);
> +}
> +
> +static void mps2_uart_write32(struct uart_port *port, u32 val, unsigned off)
> +{
> +   struct mps2_uart_port *mps_port 

Re: undefined shift in wb_update_dirty_ratelimit()

2015-12-12 Thread Andy Shevchenko
On Mon, Dec 7, 2015 at 4:26 PM, Tejun Heo  wrote:
> Hello, Andrey.
> On Mon, Dec 07, 2015 at 05:17:06PM +0300, Andrey Ryabinin wrote:
>> I've hit undefined shift in wb_update_dirty_ratelimit() which does some
>> mysterious 'step' calculations:
>>
>>   /*
>>* Don't pursue 100% rate matching. It's impossible since the balanced
>>* rate itself is constantly fluctuating. So decrease the track speed
>>* when it gets close to the target. Helps eliminate pointless tremors.
>>*/
>>   step >>= dirty_ratelimit / (2 * step + 1);
>>
>>
>> dirty_ratelimit = INIT_BW and step = 0 results in this:
>>
>> [ 5006.957366] 
>> 
>> [ 5006.957798] UBSAN: Undefined behaviour in ../mm/page-writeback.c:1286:7
>> [ 5006.958091] shift exponent 25600 is too large for 64-bit type 'long 
>> unsigned int'
>
> We prolly should do sth like
>
> shift = dirty_ratelimit / (2 * step = 1);

> if (shift < BITS_PER_LONG) {
> step = (step >> shift) + 7 / 8;

7/8 = 0. Missed parens?
In that case it's DIV_ROUND_UP(step >> shift, 8)


> } else {
> step = 0;
> }


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


Applied "regmap: cache: Move the num_reg_defaults check as early as possible" to the regmap tree

2015-12-12 Thread Mark Brown
The patch

   regmap: cache: Move the num_reg_defaults check as early as possible

has been applied to the regmap tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 167f7066a637332b463adf3b87b2af1c1031591a Mon Sep 17 00:00:00 2001
From: Xiubo Li 
Date: Fri, 11 Dec 2015 11:23:20 +0800
Subject: [PATCH] regmap: cache: Move the num_reg_defaults check as early as
 possible

If the register defaults are provided by the driver without the
number by mistake, it should just return an error with one promotion.

This should be as early as possible, then there is no need to verify
the register defaults' stride and the other code followed.

Signed-off-by: Xiubo Li 
Signed-off-by: Mark Brown 
---
 drivers/base/regmap/regcache.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 9436a0d..60aeaad 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -109,6 +109,12 @@ int regcache_init(struct regmap *map, const struct 
regmap_config *config)
return 0;
}
 
+   if (config->reg_defaults && !config->num_reg_defaults) {
+   dev_err(map->dev,
+"Register defaults are set without the number!\n");
+   return -EINVAL;
+   }
+
for (i = 0; i < config->num_reg_defaults; i++)
if (config->reg_defaults[i].reg % map->reg_stride)
return -EINVAL;
@@ -142,8 +148,6 @@ int regcache_init(struct regmap *map, const struct 
regmap_config *config)
 * a copy of it.
 */
if (config->reg_defaults) {
-   if (!map->num_reg_defaults)
-   return -EINVAL;
tmp_buf = kmemdup(config->reg_defaults, map->num_reg_defaults *
  sizeof(struct reg_default), GFP_KERNEL);
if (!tmp_buf)
-- 
2.6.4

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


Applied "regmap: shift wrapping bugs in 64 bit code" to the regmap tree

2015-12-12 Thread Mark Brown
The patch

   regmap: shift wrapping bugs in 64 bit code

has been applied to the regmap tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 01c377bfe21a1050fd7cfd33699f7d8049dc2723 Mon Sep 17 00:00:00 2001
From: Dan Carpenter 
Date: Sat, 12 Dec 2015 15:59:14 +0300
Subject: [PATCH] regmap: shift wrapping bugs in 64 bit code

We should cast these to 64bit so that we don't truncate away the high
bits.

Fixes: afcc00b91f18 ('regmap: add 64-bit mode support')
Signed-off-by: Dan Carpenter 
Signed-off-by: Mark Brown 
---
 drivers/base/regmap/regmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index a0d30a0..9c167e7 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -250,20 +250,20 @@ static void regmap_format_64_be(void *buf, unsigned int 
val, unsigned int shift)
 {
__be64 *b = buf;
 
-   b[0] = cpu_to_be64(val << shift);
+   b[0] = cpu_to_be64((u64)val << shift);
 }
 
 static void regmap_format_64_le(void *buf, unsigned int val, unsigned int 
shift)
 {
__le64 *b = buf;
 
-   b[0] = cpu_to_le64(val << shift);
+   b[0] = cpu_to_le64((u64)val << shift);
 }
 
 static void regmap_format_64_native(void *buf, unsigned int val,
unsigned int shift)
 {
-   *(u64 *)buf = val << shift;
+   *(u64 *)buf = (u64)val << shift;
 }
 #endif
 
-- 
2.6.4

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


Applied "regmap: cache: Add warning info for the cache check" to the regmap tree

2015-12-12 Thread Mark Brown
The patch

   regmap: cache: Add warning info for the cache check

has been applied to the regmap tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 8cfe2fd3562ba673435bb2d7a4bb451aabd47809 Mon Sep 17 00:00:00 2001
From: Xiubo Li 
Date: Fri, 11 Dec 2015 11:23:19 +0800
Subject: [PATCH] regmap: cache: Add warning info for the cache check

If there is no cache used for the drivers, the register defaults
or the register defaults raw are not need any more. This patch
will check this and print a warning.

Signed-off-by: Xiubo Li 
Signed-off-by: Mark Brown 
---
 drivers/base/regmap/regcache.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 4c07802..9436a0d 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -100,15 +100,19 @@ int regcache_init(struct regmap *map, const struct 
regmap_config *config)
int i;
void *tmp_buf;
 
-   for (i = 0; i < config->num_reg_defaults; i++)
-   if (config->reg_defaults[i].reg % map->reg_stride)
-   return -EINVAL;
-
if (map->cache_type == REGCACHE_NONE) {
+   if (config->reg_defaults || config->num_reg_defaults_raw)
+   dev_warn(map->dev,
+"No cache used with register defaults set!\n");
+
map->cache_bypass = true;
return 0;
}
 
+   for (i = 0; i < config->num_reg_defaults; i++)
+   if (config->reg_defaults[i].reg % map->reg_stride)
+   return -EINVAL;
+
for (i = 0; i < ARRAY_SIZE(cache_types); i++)
if (cache_types[i]->type == map->cache_type)
break;
-- 
2.6.4

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


Applied "regmap: missing case statement" to the regmap tree

2015-12-12 Thread Mark Brown
The patch

   regmap: missing case statement

has been applied to the regmap tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 782035ea94dc4028c19e9f39857ce9756119ae94 Mon Sep 17 00:00:00 2001
From: Dan Carpenter 
Date: Sat, 12 Dec 2015 15:59:43 +0300
Subject: [PATCH] regmap: missing case statement

This new code is unreachable.  Presumably there was supposed to be a
case statement there similar to the earlier code.

Fixes: afcc00b91f18 ('regmap: add 64-bit mode support')
Signed-off-by: Dan Carpenter 
Signed-off-by: Mark Brown 
---
 drivers/base/regmap/regmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 9c167e7..d27fe2f 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -844,6 +844,7 @@ struct regmap *__regmap_init(struct device *dev,
}
break;
 #ifdef CONFIG_64BIT
+   case 64:
switch (val_endian) {
case REGMAP_ENDIAN_BIG:
map->format.format_val = regmap_format_64_be;
-- 
2.6.4

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


Applied "regulator: pv88090: logical vs bitwise AND typo" to the regulator tree

2015-12-12 Thread Mark Brown
The patch

   regulator: pv88090: logical vs bitwise AND typo

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d761c906179944c6000d3f0c29e00e7543b6c139 Mon Sep 17 00:00:00 2001
From: Dan Carpenter 
Date: Sat, 12 Dec 2015 15:38:43 +0300
Subject: [PATCH] regulator: pv88090: logical vs bitwise AND typo

These were supposed to be bitwise AND instead of logical.  Also kernel
style is for the operator to be on the first line and I removed some
extra parenthesis.

Fixes: c90456e36d9c ('regulator: pv88090: new regulator driver')
Signed-off-by: Dan Carpenter 
Signed-off-by: Mark Brown 
---
 drivers/regulator/pv88090-regulator.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/pv88090-regulator.c 
b/drivers/regulator/pv88090-regulator.c
index 2513fef..ac15f31 100644
--- a/drivers/regulator/pv88090-regulator.c
+++ b/drivers/regulator/pv88090-regulator.c
@@ -392,17 +392,17 @@ static int pv88090_i2c_probe(struct i2c_client *i2c,
if (ret < 0)
return ret;
 
-   conf2 = ((conf2 >> PV88090_BUCK_VDAC_RANGE_SHIFT)
-   && PV88090_BUCK_VDAC_RANGE_MASK);
+   conf2 = (conf2 >> PV88090_BUCK_VDAC_RANGE_SHIFT) &
+   PV88090_BUCK_VDAC_RANGE_MASK;
 
ret = regmap_read(chip->regmap,
PV88090_REG_BUCK_FOLD_RANGE, );
if (ret < 0)
return ret;
 
-   range = ((range
-   >> (PV88080_BUCK_VRANGE_GAIN_SHIFT + i - 1))
-   && PV88080_BUCK_VRANGE_GAIN_MASK);
+   range = (range >>
+(PV88080_BUCK_VRANGE_GAIN_SHIFT + i - 1)) &
+   PV88080_BUCK_VRANGE_GAIN_MASK;
index = ((range << 1) | conf2);
 
pv88090_regulator_info[i].desc.min_uV
-- 
2.6.4

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


Applied "regulator: pv88090: Fix irq leak" to the regulator tree

2015-12-12 Thread Mark Brown
The patch

   regulator: pv88090: Fix irq leak

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ecee988ac848fabbff6c926739a520b1748c4a79 Mon Sep 17 00:00:00 2001
From: Axel Lin 
Date: Thu, 10 Dec 2015 18:11:58 +0800
Subject: [PATCH] regulator: pv88090: Fix irq leak

Use devm_request_threaded_irq to ensure the irq is freed when unload the
module.

Signed-off-by: Axel Lin 
Signed-off-by: Mark Brown 
---
 drivers/regulator/pv88090-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/pv88090-regulator.c 
b/drivers/regulator/pv88090-regulator.c
index 3ec5f2b..2513fef 100644
--- a/drivers/regulator/pv88090-regulator.c
+++ b/drivers/regulator/pv88090-regulator.c
@@ -357,7 +357,7 @@ static int pv88090_i2c_probe(struct i2c_client *i2c,
return ret;
}
 
-   ret = request_threaded_irq(i2c->irq, NULL,
+   ret = devm_request_threaded_irq(>dev, i2c->irq, NULL,
pv88090_irq_handler,
IRQF_TRIGGER_LOW|IRQF_ONESHOT,
"pv88090", chip);
-- 
2.6.4

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


Re: Crypto/nx842: Ignore invalid XER[S0] return error

2015-12-12 Thread Haren Myneni
On 12/12/2015 12:43 AM, Segher Boessenkool wrote:
> On Fri, Dec 11, 2015 at 07:30:29PM -0800, Haren Myneni wrote:
>> NX842 coprocessor sets 3rd bit in CR register with XER[S0] which is
>> nothing to do with NX request. On powerpc, XER[S0] will be set if
>> overflow in FPU and stays until another floating point operation is
>> executed. Since this bit can be set with other valuable return status,
>> ignore this XER[S0] value.
> 
> XER[SO] is the *integer* summary overflow bit.  It is set by OE=1
> instructions ("addo" and the like), and can only be cleared explicitly
> (using "mtxer").

Thanks for the correct description. I was told XER[S0] is floating overflow 
from FPU.

> 
> The floating point overflow bit is FPSCR[OX].
> 
>> +/*
>> + * NX842 coprocessor sets 3rd bit in CR register with XER[S0].
>> + * Setting XER[S0] happens if overflow in FPU and stays until
>> + * other floating operation is executed. XER[S0] value is nothing
>> + * to NX and no use to user. Since this bit can be set with other
>> + * return values, ignore this error.
>> + */
>> +if (ret & ICSWX_XERS0)
>> +ret &= ~ICSWX_XERS0;
> 
> You can just always clear it, there is no need to check if it is set first.

Do you mean reset this before calling NX? I believe NX coprocessor should not 
set CR bit as XER[S0] nothing to do with NX request and it is no use. NX is 
copying this CR bit with XER. But reset XER[S0] has to be done before NX 
request. We can not do this in icswx since this instruction can be used by 
other coprocessors in future. But I am not comfortable clearing as we are not 
touching this XER in the driver or result of NX operation. So I am proposing 
this patch to fix this not proper NX behaviour - ignores CR bit. 

If you are OK, I can repost the patch with proper description.

Thanks
Haren 


  
> 
> 
> Segher
> 

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


Re: [Resend 0/2] Add support for APQ8084 and MSM8916 Regulators

2015-12-12 Thread Mark Brown
On Fri, Dec 11, 2015 at 12:01:32AM -0600, Andy Gross wrote:
> This patch set is a resend of the regulator portion of the patches
> found at:
> 
> https://lkml.org/lkml/2015/9/24/561

These don't apply against current code which suggests that the
unanswered question I asked about dependencies when they were originally
posted is still outstanding...


signature.asc
Description: PGP signature


Re: [PATCHv5 7/7] pciutils: Allow 32-bit domains

2015-12-12 Thread Andy Shevchenko
On Mon, Dec 7, 2015 at 11:32 PM, Keith Busch  wrote:
> PCI-e segments will continue to use the lower 16 bits as required by
> ACPI. Special domains may use the full 32-bits.
>
> Signed-off-by: Keith Busch 
> ---
>  lib/filter.c |2 +-
>  lib/pci.h|2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/filter.c b/lib/filter.c
> index d4254a0..075dc2f 100644
> --- a/lib/filter.c
> +++ b/lib/filter.c
> @@ -45,7 +45,7 @@ pci_filter_parse_slot_v33(struct pci_filter *f, char *str)
>   if (str[0] && strcmp(str, "*"))
> {
>   long int x = strtol(str, , 16);
> - if ((e && *e) || (x < 0 || x > 0x))
> + if ((e && *e) || (x < 0))
> return "Invalid domain number";
>   f->domain = x;
> }
> diff --git a/lib/pci.h b/lib/pci.h
> index 10ba831..7e42765 100644
> --- a/lib/pci.h
> +++ b/lib/pci.h
> @@ -119,7 +119,7 @@ struct pci_param *pci_walk_params(struct pci_access *acc, 
> struct pci_param *prev
>
>  struct pci_dev {
>struct pci_dev *next;/* Next device in the chain */
> -  u16 domain;  /* PCI domain (host bridge) */

> +  int32_t domain;  /* PCI domain (host bridge) */

Why not u32 ?

>u8 bus, dev, func;   /* Bus inside domain, device and 
> function */
>
>/* These fields are set by pci_fill_info() */
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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


awk: scripts/ld-version.sh: line 4: regular expression compile failed (missing '(')

2015-12-12 Thread kbuild test robot
Hi Alex,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   79dbddaf8e9613a529d1b07f181f07894bf6fb8e
commit: ebb5e78cc63417a35254a791de66e1cc84f963cc MIPS: Initial implementation 
of a VDSO
date:   5 weeks ago
config: mips-jz4740 (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout ebb5e78cc63417a35254a791de66e1cc84f963cc
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> awk: scripts/ld-version.sh: line 4: regular expression compile failed 
>> (missing '(')
   .*)
--
>> awk: scripts/ld-version.sh: line 4: regular expression compile failed 
>> (missing '(')
   .*)
   /bin/sh: line 0: [: -gt: unary operator expected
   arch/mips/vdso/Makefile:30: MIPS VDSO requires binutils > 2.24

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH v2 1/2] gpio: pxa: change the interrupt management

2015-12-12 Thread Robert Jarzmik
The interrupt management is changed by this patch to rely on chip data
instead of chained interrupts.

The main goal is to loosen the dependency on the global pxa chip
structure in favor of the passed chip data. The secondary goal is to
better show in /proc/interrupts the difference between interrupts for
gpio0 and gpio1 (directly wired to interrupt controller), and the other
gpios (wired onto a third line in the interrupt controller).

The last advantage of this patch is that the interrupt is actually
requested, so that another driver cannot steal this line, or overwrite
the handler.

Signed-off-by: Robert Jarzmik 
---
Since v1: moved CONFIG_OF for pxa_irq_domain_ops
---
 drivers/gpio/gpio-pxa.c | 171 +++-
 1 file changed, 95 insertions(+), 76 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 8558abf98204..c6b572be68c0 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -64,11 +64,6 @@
 int pxa_last_gpio;
 static int irq_base;
 
-#ifdef CONFIG_OF
-static struct irq_domain *domain;
-static struct device_node *pxa_gpio_of_node;
-#endif
-
 struct pxa_gpio_bank {
void __iomem*regbase;
unsigned long   irq_mask;
@@ -87,6 +82,7 @@ struct pxa_gpio_chip {
struct device *dev;
struct gpio_chip chip;
struct pxa_gpio_bank *banks;
+   struct irq_domain *irqdomain;
 
int irq0;
int irq1;
@@ -231,14 +227,23 @@ static inline int __gpio_is_occupied(struct pxa_gpio_chip 
*pchip, unsigned gpio)
return ret;
 }
 
-static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+int pxa_irq_to_gpio(int irq)
 {
-   return offset + irq_base;
+   struct pxa_gpio_chip *pchip = pxa_gpio_chip;
+   int irq_gpio0;
+
+   irq_gpio0 = irq_find_mapping(pchip->irqdomain, 0);
+   if (irq_gpio0 > 0)
+   return irq - irq_gpio0;
+
+   return irq_gpio0;
 }
 
-int pxa_irq_to_gpio(int irq)
+static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-   return irq - irq_base;
+   struct pxa_gpio_chip *pchip = chip_to_pxachip(chip);
+
+   return irq_find_mapping(pchip->irqdomain, offset);
 }
 
 static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -314,7 +319,7 @@ static int pxa_gpio_of_xlate(struct gpio_chip *gc,
 #endif
 
 static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
- void __iomem *regbase)
+ struct device_node *np, void __iomem *regbase)
 {
int i, gpio, nbanks = DIV_ROUND_UP(ngpio, 32);
struct pxa_gpio_bank *bank;
@@ -332,7 +337,7 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, 
int ngpio,
pchip->chip.to_irq = pxa_gpio_to_irq;
pchip->chip.ngpio = ngpio;
 #ifdef CONFIG_OF_GPIO
-   pchip->chip.of_node = pxa_gpio_of_node;
+   pchip->chip.of_node = np;
pchip->chip.of_xlate = pxa_gpio_of_xlate;
pchip->chip.of_gpio_n_cells = 2;
 #endif
@@ -362,8 +367,8 @@ static inline void update_edge_detect(struct pxa_gpio_bank 
*c)
 
 static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
 {
-   struct pxa_gpio_chip *pchip = pxa_gpio_chip;
-   int gpio = pxa_irq_to_gpio(d->irq);
+   struct pxa_gpio_chip *pchip = irq_data_get_irq_chip_data(d);
+   unsigned int gpio = irqd_to_hwirq(d);
struct pxa_gpio_bank *c = gpio_to_pxabank(>chip, gpio);
unsigned long gpdr, mask = GPIO_bit(gpio);
 
@@ -405,16 +410,13 @@ static int pxa_gpio_irq_type(struct irq_data *d, unsigned 
int type)
return 0;
 }
 
-static void pxa_gpio_demux_handler(struct irq_desc *desc)
+static irqreturn_t pxa_gpio_demux_handler(int in_irq, void *d)
 {
int loop, gpio, n, handled = 0;
unsigned long gedr;
-   struct irq_chip *chip = irq_desc_get_chip(desc);
-   struct pxa_gpio_chip *pchip = pxa_gpio_chip;
+   struct pxa_gpio_chip *pchip = d;
struct pxa_gpio_bank *c;
 
-   chained_irq_enter(chip, desc);
-
do {
loop = 0;
for_each_gpio_bank(gpio, c, pchip) {
@@ -428,15 +430,31 @@ static void pxa_gpio_demux_handler(struct irq_desc *desc)
generic_handle_irq(gpio_to_irq(gpio + n));
}
}
+   handled += loop;
} while (loop);
 
-   chained_irq_exit(chip, desc);
+   return handled ? IRQ_HANDLED : IRQ_NONE;
+}
+
+static irqreturn_t pxa_gpio_direct_handler(int in_irq, void *d)
+{
+   struct pxa_gpio_chip *pchip = d;
+
+   if (in_irq == pchip->irq0) {
+   generic_handle_irq(gpio_to_irq(0));
+   } else if (in_irq == pchip->irq1) {
+   generic_handle_irq(gpio_to_irq(1));
+   } else {
+   pr_err("%s() unknown irq %d\n", __func__, in_irq);
+   return IRQ_NONE;
+   }
+   return IRQ_HANDLED;
 }
 
 static void 

[PATCH v2 2/2] gpio: pxa: add pin control gpio direction and request

2015-12-12 Thread Robert Jarzmik
If a pin control driver is available, use it to change the gpio
direction. If not fallback to directly manipulating the gpio direction
register.

The reason to use the pin control driver first is that pin control in
pxa2xx architecture implies changing the gpio direction, even for non
gpio functions. In order to do it atomically, only one driver should
control the gpio direction, and if a pin controller is available, it has
to be him.

There is a small catch : if CONFIG_PINCTRL is selected, then a pinctrl
driver has to be probed. If not, gpio_request() will return
-EPROBE_DEFER as pinctrl_request_gpio() returns it in that case.

Signed-off-by: Robert Jarzmik 
---
Since v1: expand commit message to state the gpio possible breakage if
  CONFIG_PINCTRL is selected and no pinctrl driver is built.
---
 drivers/gpio/gpio-pxa.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index c6b572be68c0..2bb09c0d8752 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -251,6 +252,11 @@ static int pxa_gpio_direction_input(struct gpio_chip 
*chip, unsigned offset)
void __iomem *base = gpio_bank_base(chip, offset);
uint32_t value, mask = GPIO_bit(offset);
unsigned long flags;
+   int ret;
+
+   ret = pinctrl_gpio_direction_input(chip->base + offset);
+   if (!ret)
+   return 0;
 
spin_lock_irqsave(_lock, flags);
 
@@ -271,9 +277,14 @@ static int pxa_gpio_direction_output(struct gpio_chip 
*chip,
void __iomem *base = gpio_bank_base(chip, offset);
uint32_t tmp, mask = GPIO_bit(offset);
unsigned long flags;
+   int ret;
 
writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
 
+   ret = pinctrl_gpio_direction_output(chip->base + offset);
+   if (!ret)
+   return 0;
+
spin_lock_irqsave(_lock, flags);
 
tmp = readl_relaxed(base + GPDR_OFFSET);
@@ -318,6 +329,16 @@ static int pxa_gpio_of_xlate(struct gpio_chip *gc,
 }
 #endif
 
+static int pxa_gpio_request(struct gpio_chip *chip, unsigned int offset)
+{
+   return pinctrl_request_gpio(chip->base + offset);
+}
+
+static void pxa_gpio_free(struct gpio_chip *chip, unsigned int offset)
+{
+   pinctrl_free_gpio(chip->base + offset);
+}
+
 static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
  struct device_node *np, void __iomem *regbase)
 {
@@ -336,6 +357,8 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, 
int ngpio,
pchip->chip.set = pxa_gpio_set;
pchip->chip.to_irq = pxa_gpio_to_irq;
pchip->chip.ngpio = ngpio;
+   pchip->chip.request = pxa_gpio_request;
+   pchip->chip.free = pxa_gpio_free;
 #ifdef CONFIG_OF_GPIO
pchip->chip.of_node = np;
pchip->chip.of_xlate = pxa_gpio_of_xlate;
-- 
2.1.4

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


  1   2   3   4   5   6   7   8   9   10   >