Re: [PATCH] drivers/tty/serial: delete unused MODULE_DEVICE_TABLE from atmel_serial.c

2016-01-01 Thread Sudip Mukherjee
On Thu, Dec 17, 2015 at 10:05:46AM -0500, Paul Gortmaker wrote:
> In commit c39dfebc7798956fd2140ae6321786ff35da30c3 ("drivers/tty/serial:
> make serial/atmel_serial.c explicitly non-modular") we removed the code
> relating to modular support since it currently only supports built in.
> 
> However, when redoing my build coverage for mips allmodconfig, which
> sets CONFIG_OF, I noticed a remaining line that needs to be removed,
> else we will get a build failure for an undefined module macro.
> 
> Unfortunately this didn't appear for any of the other arch I tested
> more frequently, such as ARM.
> 
> Since MODULE_DEVICE_TABLE is a no-op for non-modular code, we can just
> remove the offending line.
> 
> Fixes: c39dfebc7798 ("drivers/tty/serial: make serial/atmel_serial.c 
> explicitly non-modular")
> Cc: Nicolas Ferre 
> Cc: Jiri Slaby 
> Cc: linux-ser...@vger.kernel.org
> Cc: Greg Kroah-Hartman 
> Cc: Sudip Mukherjee 
> Reported-by: Sudip Mukherjee 
> Signed-off-by: Paul Gortmaker 
> ---

I think this has not yet landed in linux-next. next-20151231 still
fails.

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


[PATCH] BTRFS: Adds the files and options needed for Hybrid Storage

2016-01-01 Thread Sanidhya Solanki
This patch adds the file required for Hybrid Storage. It contains
the memory, time and size limits for the cache and the statistics that
will be provided while the cache is operating.
It also adds the Makefile changes needed to add the Hybrid Storage.

Signed-off-by: Sanidhya Solanki 
---
 fs/btrfs/Makefile |  2 +-
 fs/btrfs/cache.c  | 58 +++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 fs/btrfs/cache.c

diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 6d1d0b9..dc56ae4 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -9,7 +9,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o 
root-tree.o dir-item.o \
   export.o tree-log.o free-space-cache.o zlib.o lzo.o \
   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
   reada.o backref.o ulist.o qgroup.o send.o dev-replace.o raid56.o \
-  uuid-tree.o props.o hash.o
+  uuid-tree.o props.o hash.o cache.o
 
 btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
 btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
diff --git a/fs/btrfs/cache.c b/fs/btrfs/cache.c
new file mode 100644
index 000..0ece7a1
--- /dev/null
+++ b/fs/btrfs/cache.c
@@ -0,0 +1,58 @@
+/*
+ * (c) Sanidhya Solanki, 2016
+ *
+ * Licensed under the FSF's GNU Public License v2 or later.
+ */
+#include 
+
+/* Cache size configuration )in MiB).*/
+#define MAX_CACHE_SIZE = 1
+#define MIN_CACHE_SIZE = 10
+
+/* Time (in seconds)before retrying to increase the cache size.*/
+#define CACHE_RETRY = 10
+
+/* Space required to be free (in MiB) before increasing the size of the
+ * cache. If cache size is less than cache_grow_limit, a block will be freed
+ * from the cache to allow the cache to continue growning.
+ */
+#define CACHE_GROW_LIMIT = 100
+
+/* Size required to be free (in MiB) after we shrink the cache, so that it
+ * does not grow in size immediately.
+ */
+#define CACHE_SHRINK_FREE_SPACE_LIMIT = 100
+
+/* Age (in seconds) of oldest and newest block in the cache.*/
+#define MAX_AGE_LIMIT = 300/* Five Minute Rule recommendation,
+* optimum size depends on size of data
+* blocks.
+*/
+#define MIN_AGE_LIMIT = 15 /* In case of cache stampede.*/
+
+/* Memory constraints (in percentage) before we stop caching.*/
+#define MIN_MEM_FREE = 10
+
+/* Cache statistics. */
+struct cache_stats {
+   u64 cache_size;
+   u64 maximum_cache_size_attained;
+   int cache_hit_rate;
+   int cache_miss_rate;
+   u64 cache_evicted;
+   u64 duplicate_read;
+   u64 duplicate_write;
+   int stats_update_interval;
+};
+
+#define cache_size CACHE_SIZE /* Current cache size.*/
+#define max_cache_size MAX_SIZE /* Max cache limit. */
+#define min_cache_size MIN_SIZE /* Min cache limit.*/
+#define cache_time MAX_TIME /* Maximum time to keep data in cache.*/
+#define evicted_csum   EVICTED_CSUM/* Checksum of the evited data
+* (to avoid repeatedly caching
+* data that was just evicted.
+*/
+#define read_csum  READ_CSUM /* Checksum of the read data.*/
+#define write_csum WRITE_CSUM /* Checksum of the written data.*/
+#define evict_interval EVICT_INTERVAL /* Time to keep data before eviction.*/
-- 
2.5.0

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


Re: [PATCH 5/5] Staging: panel: Make statement more readable

2016-01-01 Thread Willy Tarreau
Hi Ksenija,

several points, see below.

On Tue, Dec 29, 2015 at 09:11:03PM +0100, Ksenija Stanojevic wrote:
> Broke statement into 3 different lines to make it more readable.
> 
> Signeded-off-by: Ksenija Stanojevic 
^^
Extra "ed". Don't waste your time typing it by hand, several git commands
(including git-commit and git-format-patch) will do it for you when you
pass "-s".

> diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
> index 70cb9f3..207d8d5 100644
> --- a/drivers/staging/panel/panel.c
> +++ b/drivers/staging/panel/panel.c
> @@ -2054,8 +2054,8 @@ static u8 input_name2mask(const char *name, __u64 
> *mask, __u64 *value,
>   while (*name) {
>   int in, out, bit, neg;
>  
> - for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != *name);
> -  in++)
> + for (in = 0;
> + (in < sizeof(sigtab)) && (sigtab[in] != *name); in++)
>   ;
>  
>   if (in >= sizeof(sigtab))

well, this one is still ugly in my opinion. I've just looked at the code
and it was crap originally :
  - sigtab[] is declared as static and without a trailing zero
  - the for loop uses extra parenthesis and basically only reimplements
strchr()
  - the end condition is tested again after the for loop

=> I'd rather use strchr(), and clean up this part, approx like this, but
   do it as you want :

-   static char sigtab[10] = "EeSsPpAaBb";
+   const char sigtab[] = "EeSsPpAaBb";
...
while (*name) {
int in, out, bit, neg;
+   const char *idx;
 
-   for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != *name);
-in++)
-
-   if (in >= sizeof(sigtab))
-   return 0;
+   idx = strchr(sigtab, *name);
+   if (!idx)
+   return 0;
+
+   in = idx - sigtab;
 
I think it's more readable this way.

Regards,
Willy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl

2016-01-01 Thread Sudip Mukherjee
On Fri, Jan 01, 2016 at 11:09:45PM +0100, Arnd Bergmann wrote:
> On Friday 01 January 2016 10:34:25 Sudip Mukherjee wrote:
> > > Did you happen to check with both 32-bit and 64-bit user space on a
> > > 64-bit kernel? This is one of the things that was not working originally
> > > but should work now.
> > 
> > I dont think I can manage 32 bit userspace on 64-bit kernel here. But I
> > can definitely check it on a kvm guest.
> 
> Just to be sure we are talking about the same thing: you mean running a 64-bit
> kernel in a kvm guest with a 32-bit file system, right? Running a 32-bit
> kvm guest on a 64-bit host would not be interesting of course.

The kvm (actually qemu, started from virt-manager with -enable-kvm) that
I just configured shows the following:

lscpu shows:

Architecture:  i686
CPU op-mode(s):32-bit, 64-bit
Byte Order:Little Endian
CPU(s):1
On-line CPU(s) list:   0
Thread(s) per core:1
Core(s) per socket:1
Socket(s): 1
Vendor ID: GenuineIntel
CPU family:6
Model: 6
Stepping:  3
CPU MHz:   2993.200
BogoMIPS:  5986.40
Virtualization:VT-x
Hypervisor vendor: KVM
Virtualization type:   full
L1d cache: 32K
L1i cache: 32K
L2 cache:  4096K

uname -i shows:
i686


Will it be ok to test in this one?

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


Re: Odroid U3 mutex deadlock.

2016-01-01 Thread Anand Moon
Hi Krzysztof

On 14 December 2015 at 05:15, Krzysztof Kozlowski
 wrote:
> On 12.12.2015 13:32, Anand Moon wrote:
>> Hi Krzysztof,
>>
>> I am just observing this deadlock om my Odroid U3.
>
> This is not a deadlock yet, just a report from lockdep. Could be a real
> issue, could be false positive, maybe some locks miss nesting annotations.
>
> Typical information for bug report would be useful, like the exact
> version (it is mentioned in lockdep report but is it really correct?)
> and reproducibility. And of course git-bisect would be nice to have, see:
> Documentation/BUG-HUNTING
>
> Best regards,
> Krzysztof
>
>
Thanks for your inputs. I narrowed down to this commit.
--
commit ec459c0c77faca53cf161830cb264e51bb1abba6
Author: Marek Szyprowski 
Date:   Wed Feb 4 23:44:15 2015 +0900

ARM: dts: add dependency between TV and LCD0 power domains for exynos4

TV Mixer needs both TV and LCD0 domains enabled to be fully operational.
This dependency is modelled by making TV power domains a sub-domain of
LCD0 power domain.

Signed-off-by: Marek Szyprowski 
Signed-off-by: Kukjin Kim 
-
After reverting this I am not observing below lockdep warning report.
But after reverting this patch I observer another bug.

Best regards.
-Anand Moon

>> --
>>
>> [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] 

Re: [PATCH V5 4/9] Drivers: hv: ring_buffer: enhance hv_ringbuffer_read() to support hvsock

2016-01-01 Thread David Miller
From: Dexuan Cui 
Date: Thu, 24 Dec 2015 06:14:36 -0800

> +#define HV_RINGBUFFER_READ_FLAG_RAW  (1 << 0)
> +#define HV_RINGBUFFER_READ_FLAG_HVSOCK   (1 << 1)

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


Re: [PATCH] net: refactor icmp_global_allow to improve readability and performance.

2016-01-01 Thread Mike Danese
Yes, I completely missed the purpose of that. As a new year's
resolution, I resolve to read the comments.

Thanks for the review!

On Fri, Jan 1, 2016 at 3:07 PM, Eric Dumazet  wrote:
> On Thu, 2015-12-31 at 23:58 -0800, Mike Danese wrote:
>> We can reduce the number of operations performed by icmp_global_allow
>> and make the routine more readable by refactoring it in two ways:
>>
>> First, this patch refactors the meaning of the "delta" variable. Before
>> this change, it meant min("time since last refill of token bucket", HZ).
>> After this change, it means "time since last refill". The original
>> definition is required only once but was being calculated twice. The new
>> meaning is also more intuitive for a variable named "delta".
>>
>> Second, by calculating "delta" (time since last refill of token bucket)
>> and "cbr" (token bucket can be refilled) at the beginning of the
>> routine, we reduce the number of repeated calculations of these two
>> variables.
>>
>> There should be no functional difference.
>>
>> Signed-off-by: Mike Danese 
>> ---
>>  net/ipv4/icmp.c | 17 -
>>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> Hi Mike
>
> Sorry, this is a very broken patch.
>
> There is a comment you apparently missed completely :
>
> /* Check if token bucket is empty and cannot be refilled
>  * without taking the spinlock.
>  */
>
> There is a reason we compute 'delta' two times.
>
> One without the spinlock held, and a second time with the spinlock held.
>
> This is an opportunistic way to exit early without false sharing in the
> stress case where many cpus might enter this code.
>
> Really I do not think current code needs any 'refactoring', especially
> around December 31th at midnight ;)
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Hi linux

2016-01-01 Thread Steven Newbury

Hi linux

http://taylorkin.com/occur.php?clothes=1fwpsgvgcr1n50m0





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


Re: [PATCH v2 1/3] net-gianfar: Less function calls in gfar_ethflow_to_filer_table() after error detection

2016-01-01 Thread David Miller

This is not the proper way to resubmit patches when you are asked
to make changes to some portion of a multi-patch series.

You must always resubmit the entire series when this happens,
not just the patch that changes.

And in the revised cover "0/N" posting you list the revisions
that were made.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/4] USB: serial: cp210x: New register access functions.

2016-01-01 Thread Konstantin Shkolnyy
cp210x_get_config and cp210x_set_config are cumbersome to use. This change
introduces new register access functions to replace them. New functions
are not yet called - the switch is done gradually in following changes.

Signed-off-by: Konstantin Shkolnyy 
---
change in v3: Presented new function addition as a separate patch #1,
to simplify code review.

 drivers/usb/serial/cp210x.c | 166 
 1 file changed, 166 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index fd67958..324eb7e 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -323,6 +323,172 @@ struct cp210x_comm_status {
 #define PURGE_ALL  0x000f
 
 /*
+ * Reads a variable-sized block of CP210X_ registers, identified by req.
+ * Returns data into buf in native USB byte order.
+ */
+static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req,
+   void *buf, int bufsize)
+{
+   struct usb_serial *serial = port->serial;
+   struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
+   void *dmabuf;
+   int result;
+
+   dmabuf = kmalloc(bufsize, GFP_KERNEL);
+   if (!dmabuf) {
+   /*
+* FIXME Some callers don't bother to check for error,
+* at least give them consistent junk until they are fixed
+*/
+   memset(buf, 0, bufsize);
+   return -ENOMEM;
+   }
+
+   result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+   req, REQTYPE_INTERFACE_TO_HOST, 0,
+   port_priv->bInterfaceNumber, dmabuf, bufsize,
+   USB_CTRL_SET_TIMEOUT);
+   if (result == bufsize) {
+   memcpy(buf, dmabuf, bufsize);
+   result = 0;
+   } else {
+   dev_err(>dev, "failed get req 0x%x size %d status: %d\n",
+   req, bufsize, result);
+   if (result >= 0)
+   result = -EPROTO;
+
+   /*
+* FIXME Some callers don't bother to check for error,
+* at least give them consistent junk until they are fixed
+*/
+   memset(buf, 0, bufsize);
+   }
+
+   kfree(dmabuf);
+
+   return result;
+}
+
+/*
+ * Reads any 32-bit CP210X_ register identified by req.
+ */
+static int cp210x_read_u32_reg(struct usb_serial_port *port, u8 req, u32 *val)
+{
+   __le32 le32_val;
+   int err;
+
+   err = cp210x_read_reg_block(port, req, _val, sizeof(le32_val));
+   if (err) {
+   /*
+* FIXME Some callers don't bother to check for error,
+* at least give them consistent junk until they are fixed
+*/
+   *val = 0;
+   return err;
+   }
+
+   *val = le32_to_cpu(le32_val);
+
+   return 0;
+}
+
+/*
+ * Reads any 16-bit CP210X_ register identified by req.
+ */
+static int cp210x_read_u16_reg(struct usb_serial_port *port, u8 req, u16 *val)
+{
+   __le16 le16_val;
+   int err;
+
+   err = cp210x_read_reg_block(port, req, _val, sizeof(le16_val));
+   if (err)
+   return err;
+
+   *val = le16_to_cpu(le16_val);
+
+   return 0;
+}
+
+/*
+ * Reads any 8-bit CP210X_ register identified by req.
+ */
+static int cp210x_read_u8_reg(struct usb_serial_port *port, u8 req, u8 *val)
+{
+   return cp210x_read_reg_block(port, req, val, sizeof(*val));
+}
+
+/*
+ * Writes any 16-bit CP210X_ register (req) whose value is passed
+ * entirely in the wValue field of the USB request.
+ */
+static int cp210x_write_u16_reg(struct usb_serial_port *port, u8 req, u16 val)
+{
+   struct usb_serial *serial = port->serial;
+   struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
+   int result;
+
+   result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+   req, REQTYPE_HOST_TO_INTERFACE, val,
+   port_priv->bInterfaceNumber, NULL, 0,
+   USB_CTRL_SET_TIMEOUT);
+   if (result < 0) {
+   dev_err(>dev, "failed set request 0x%x status: %d\n",
+   req, result);
+   }
+
+   return result;
+}
+
+/*
+ * Writes a variable-sized block of CP210X_ registers, identified by req.
+ * Data in buf must be in native USB byte order.
+ */
+static int cp210x_write_reg_block(struct usb_serial_port *port, u8 req,
+   void *buf, int bufsize)
+{
+   struct usb_serial *serial = port->serial;
+   struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
+   void *dmabuf;
+   int result;
+
+   dmabuf = kmalloc(bufsize, GFP_KERNEL);
+   if (!dmabuf)
+   return -ENOMEM;
+
+   memcpy(dmabuf, buf, bufsize);
+
+   result = usb_control_msg(serial->dev, 

[PATCH v3 4/4] USB: serial: cp210x: Switch to new register access functions for large registers

2016-01-01 Thread Konstantin Shkolnyy
Change to use new large register access functions instead of
cp210x_get_config and cp210x_set_config and remove the old functions since
they are now unused.

Signed-off-by: Konstantin Shkolnyy 
---
change in v3: Presented new function addition as a separate patch #1,
to simplify code review.

 drivers/usb/serial/cp210x.c | 137 
 1 file changed, 24 insertions(+), 113 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 1339d77..ce80d5f 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -489,105 +489,6 @@ static int cp210x_write_u32_reg(struct usb_serial_port 
*port, u8 req, u32 val)
 }
 
 /*
- * cp210x_get_config
- * Reads from the CP210x configuration registers
- * 'size' is specified in bytes.
- * 'data' is a pointer to a pre-allocated array of integers large
- * enough to hold 'size' bytes (with 4 bytes to each integer)
- */
-static int cp210x_get_config(struct usb_serial_port *port, u8 request,
-   unsigned int *data, int size)
-{
-   struct usb_serial *serial = port->serial;
-   struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
-   __le32 *buf;
-   int result, i, length;
-
-   /* Number of integers required to contain the array */
-   length = (((size - 1) | 3) + 1) / 4;
-
-   buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
-   if (!buf)
-   return -ENOMEM;
-
-   /* Issue the request, attempting to read 'size' bytes */
-   result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
-   request, REQTYPE_INTERFACE_TO_HOST, 0x,
-   port_priv->bInterfaceNumber, buf, size,
-   USB_CTRL_GET_TIMEOUT);
-
-   /* Convert data into an array of integers */
-   for (i = 0; i < length; i++)
-   data[i] = le32_to_cpu(buf[i]);
-
-   kfree(buf);
-
-   if (result != size) {
-   dev_dbg(>dev, "%s - Unable to send config request, 
request=0x%x size=%d result=%d\n",
-   __func__, request, size, result);
-   if (result > 0)
-   result = -EPROTO;
-
-   return result;
-   }
-
-   return 0;
-}
-
-/*
- * cp210x_set_config
- * Writes to the CP210x configuration registers
- * Values less than 16 bits wide are sent directly
- * 'size' is specified in bytes.
- */
-static int cp210x_set_config(struct usb_serial_port *port, u8 request,
-   unsigned int *data, int size)
-{
-   struct usb_serial *serial = port->serial;
-   struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
-   __le32 *buf;
-   int result, i, length;
-
-   /* Number of integers required to contain the array */
-   length = (((size - 1) | 3) + 1) / 4;
-
-   buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
-   if (!buf)
-   return -ENOMEM;
-
-   /* Array of integers into bytes */
-   for (i = 0; i < length; i++)
-   buf[i] = cpu_to_le32(data[i]);
-
-   if (size > 2) {
-   result = usb_control_msg(serial->dev,
-   usb_sndctrlpipe(serial->dev, 0),
-   request, REQTYPE_HOST_TO_INTERFACE, 0x,
-   port_priv->bInterfaceNumber, buf, size,
-   USB_CTRL_SET_TIMEOUT);
-   } else {
-   result = usb_control_msg(serial->dev,
-   usb_sndctrlpipe(serial->dev, 0),
-   request, REQTYPE_HOST_TO_INTERFACE, data[0],
-   port_priv->bInterfaceNumber, NULL, 0,
-   USB_CTRL_SET_TIMEOUT);
-   }
-
-   kfree(buf);
-
-   if ((size > 2 && result != size) || result < 0) {
-   dev_dbg(>dev, "%s - Unable to send request, request=0x%x 
size=%d result=%d\n",
-   __func__, request, size, result);
-   if (result > 0)
-   result = -EPROTO;
-
-   return result;
-   }
-
-   return 0;
-}
-
-/*
  * Detect CP2108 GET_LINE_CTL bug and activate workaround.
  * Write a known good value 0x800, read it back.
  * If it comes back swapped the bug is detected.
@@ -786,7 +687,8 @@ static void cp210x_get_termios_port(struct usb_serial_port 
*port,
unsigned int *cflagp, unsigned int *baudp)
 {
struct device *dev = >dev;
-   unsigned int cflag, modem_ctl[4];
+   unsigned int cflag;
+   u8 modem_ctl[16];
u32 baud;
u16 bits;
 
@@ -884,8 +786,9 @@ static void cp210x_get_termios_port(struct usb_serial_port 
*port,
break;
}
 
-   cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
-   if (modem_ctl[0] & 0x0008) {
+   cp210x_read_reg_block(port, CP210X_GET_FLOW, modem_ctl,
+   

[PATCH v3 2/4] USB: serial: cp210x: Switch to new 16-bit register access functions.

2016-01-01 Thread Konstantin Shkolnyy
Change to use new 16-bit register access functions instead of
cp210x_get_config and cp210x_set_config.

Signed-off-by: Konstantin Shkolnyy 
---
change in v3: Presented new function addition as a separate patch #1,
to simplify code review.

 drivers/usb/serial/cp210x.c | 80 ++---
 1 file changed, 31 insertions(+), 49 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 324eb7e..7a91c6c 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -588,17 +588,6 @@ static int cp210x_set_config(struct usb_serial_port *port, 
u8 request,
 }
 
 /*
- * cp210x_set_config_single
- * Convenience function for calling cp210x_set_config on single data values
- * without requiring an integer pointer
- */
-static inline int cp210x_set_config_single(struct usb_serial_port *port,
-   u8 request, unsigned int data)
-{
-   return cp210x_set_config(port, request, , 2);
-}
-
-/*
  * Detect CP2108 GET_LINE_CTL bug and activate workaround.
  * Write a known good value 0x800, read it back.
  * If it comes back swapped the bug is detected.
@@ -607,48 +596,47 @@ static inline int cp210x_set_config_single(struct 
usb_serial_port *port,
 static int cp210x_detect_swapped_line_ctl(struct usb_serial_port *port)
 {
struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
-   unsigned int line_ctl_save;
-   unsigned int line_ctl_test;
+   u16 line_ctl_save;
+   u16 line_ctl_test;
int err;
 
-   err = cp210x_get_config(port, CP210X_GET_LINE_CTL, _ctl_save, 2);
+   err = cp210x_read_u16_reg(port, CP210X_GET_LINE_CTL, _ctl_save);
if (err)
return err;
 
-   line_ctl_test = 0x800;
-   err = cp210x_set_config(port, CP210X_SET_LINE_CTL, _ctl_test, 2);
+   err = cp210x_write_u16_reg(port, CP210X_SET_LINE_CTL, 0x800);
if (err)
return err;
 
-   err = cp210x_get_config(port, CP210X_GET_LINE_CTL, _ctl_test, 2);
+   err = cp210x_read_u16_reg(port, CP210X_GET_LINE_CTL, _ctl_test);
if (err)
return err;
 
/* has_swapped_line_ctl is 0 here because port_priv was kzalloced */
if (line_ctl_test == 8) {
port_priv->has_swapped_line_ctl = true;
-   line_ctl_save = swab16((u16)line_ctl_save);
+   line_ctl_save = swab16(line_ctl_save);
}
 
-   return cp210x_set_config(port, CP210X_SET_LINE_CTL, _ctl_save, 2);
+   return cp210x_write_u16_reg(port, CP210X_SET_LINE_CTL, line_ctl_save);
 }
 
 /*
- * Must always be called instead of cp210x_get_config(CP210X_GET_LINE_CTL)
+ * Must always be called instead of cp210x_read_u16_reg(CP210X_GET_LINE_CTL)
  * to workaround cp2108 bug and get correct value.
  */
-static int cp210x_get_line_ctl(struct usb_serial_port *port, unsigned int *ctl)
+static int cp210x_get_line_ctl(struct usb_serial_port *port, u16 *ctl)
 {
struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
int err;
 
-   err = cp210x_get_config(port, CP210X_GET_LINE_CTL, ctl, 2);
+   err = cp210x_read_u16_reg(port, CP210X_GET_LINE_CTL, ctl);
if (err)
return err;
 
/* Workaround swapped bytes in 16-bit value from CP210X_GET_LINE_CTL */
if (port_priv->has_swapped_line_ctl)
-   *ctl = swab16((u16)(*ctl));
+   *ctl = swab16(*ctl);
 
return 0;
 }
@@ -697,14 +685,11 @@ static unsigned int cp210x_quantise_baudrate(unsigned int 
baud)
 
 static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
 {
-   int result;
+   int err;
 
-   result = cp210x_set_config_single(port, CP210X_IFC_ENABLE,
-   UART_ENABLE);
-   if (result) {
-   dev_err(>dev, "%s - Unable to enable UART\n", __func__);
-   return result;
-   }
+   err = cp210x_write_u16_reg(port, CP210X_IFC_ENABLE, UART_ENABLE);
+   if (err)
+   return err;
 
/* Configure the termios structure */
cp210x_get_termios(tty, port);
@@ -718,15 +703,12 @@ static int cp210x_open(struct tty_struct *tty, struct 
usb_serial_port *port)
 
 static void cp210x_close(struct usb_serial_port *port)
 {
-   unsigned int purge_ctl;
-
usb_serial_generic_close(port);
 
/* Clear both queues; cp2108 needs this to avoid an occasional hang */
-   purge_ctl = PURGE_ALL;
-   cp210x_set_config(port, CP210X_PURGE, _ctl, 2);
+   cp210x_write_u16_reg(port, CP210X_PURGE, PURGE_ALL);
 
-   cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE);
+   cp210x_write_u16_reg(port, CP210X_IFC_ENABLE, UART_DISABLE);
 }
 
 /*
@@ -806,7 +788,7 @@ static void cp210x_get_termios_port(struct usb_serial_port 
*port,
struct device *dev = >dev;
unsigned int cflag, modem_ctl[4];
unsigned int baud;
-   

[PATCH v3 3/4] USB: serial: cp210x: Switch to new 8-bit and 32-bit register access functions.

2016-01-01 Thread Konstantin Shkolnyy
Change to use new 8-bit and 32-bit register access functions instead of
cp210x_get_config and cp210x_set_config.

Signed-off-by: Konstantin Shkolnyy 
---
change in v3: Presented new function addition as a separate patch #1,
to simplify code review.

 drivers/usb/serial/cp210x.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 7a91c6c..1339d77 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -787,10 +787,10 @@ static void cp210x_get_termios_port(struct 
usb_serial_port *port,
 {
struct device *dev = >dev;
unsigned int cflag, modem_ctl[4];
-   unsigned int baud;
+   u32 baud;
u16 bits;
 
-   cp210x_get_config(port, CP210X_GET_BAUDRATE, , 4);
+   cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, );
 
dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
*baudp = baud;
@@ -937,8 +937,7 @@ static void cp210x_change_speed(struct tty_struct *tty,
baud = cp210x_quantise_baudrate(baud);
 
dev_dbg(>dev, "%s - setting baud rate to %u\n", __func__, baud);
-   if (cp210x_set_config(port, CP210X_SET_BAUDRATE, ,
-   sizeof(baud))) {
+   if (cp210x_write_u32_reg(port, CP210X_SET_BAUDRATE, baud)) {
dev_warn(>dev, "failed to set baud rate to %u\n", baud);
if (old_termios)
baud = old_termios->c_ospeed;
@@ -1109,10 +1108,10 @@ static void cp210x_dtr_rts(struct usb_serial_port *p, 
int on)
 static int cp210x_tiocmget(struct tty_struct *tty)
 {
struct usb_serial_port *port = tty->driver_data;
-   unsigned int control;
+   u8 control;
int result;
 
-   cp210x_get_config(port, CP210X_GET_MDMSTS, , 1);
+   cp210x_read_u8_reg(port, CP210X_GET_MDMSTS, );
 
result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
-- 
1.8.4.5

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


Re: [PATCH] ip_tunnel: make ip6tunnel_xmit definition conditional

2016-01-01 Thread Pravin Shelar
On Fri, Jan 1, 2016 at 5:48 AM, Arnd Bergmann  wrote:
> From 433df301cf49624871346fa63f3fc65033caeda3 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann 
> Date: Fri, 1 Jan 2016 13:18:48 +0100
> Subject: [PATCH] net: make ip6tunnel_xmit definition conditional
>
> Moving the caller of iptunnel_xmit_stats causes a build error in
> randconfig builds that disable CONFIG_INET:
>
> In file included from ../net/xfrm/xfrm_input.c:17:0:
> ../include/net/ip6_tunnel.h: In function 'ip6tunnel_xmit':
> ../include/net/ip6_tunnel.h:93:2: error: implicit declaration of function 
> 'iptunnel_xmit_stats' [-Werror=implicit-function-declaration]
>   iptunnel_xmit_stats(dev, pkt_len);
>
> The reason is that the iptunnel_xmit_stats definition is hidden
> inside #ifdef CONFIG_INET but the caller is not. We can change
> one or the other to fix it, and this patch adds a second #ifdef
> around ip6tunnel_xmit() to avoid seeing the invalid call.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: 039f50629b7f ("ip_tunnel: Move stats update to iptunnel_xmit()")

Thanks for the fix.
Acked-by: Pravin B Shelar 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036

2016-01-01 Thread Xing Zheng


OK, I think I will use named structures.

Thanks.

> 在 2016年1月1日,20:55,Arnd Bergmann  写道:
> 
>> On Tuesday 29 December 2015 14:59:59 Florian Fainelli wrote:
>>> On December 27, 2015 11:22:20 PM PST, Xing Zheng  
>>> wrote:
>>> The RK3036's GRFs offset are different with RK3066/RK3188, and need to
>>> set
>>> mac TX/RX clock before probe emac.
>>> 
>>> Signed-off-by: Xing Zheng 
>>> ---
>> 
>>> };
>>> 
>>> static const struct of_device_id emac_rockchip_dt_ids[] = {
>>> -  { .compatible = "rockchip,rk3066-emac", .data =
>>> _rockchip_dt_data[0] },
>>> -  { .compatible = "rockchip,rk3188-emac", .data =
>>> _rockchip_dt_data[1] },
>>> +  { .compatible = "rockchip,rk3036-emac", .data =
>>> _rockchip_dt_data[0] },
>>> +  { .compatible = "rockchip,rk3066-emac", .data =
>>> _rockchip_dt_data[1] },
>>> +  { .compatible = "rockchip,rk3188-emac", .data =
>>> _rockchip_dt_data[2] },
>>>  { /* Sentinel */ }
>> 
>> Food for thought, you might want to use an enum here to index 
>> emac_rockchip_dt_data which would be less error prone if you add/remove 
>> entries in this structure.
> 
> I would use named structures instead:
> 
> static const struct emac_rockchip_soc_data emac_rk3066_emac_data = {
>.grf_offset = 0x154,
> };
> 
> static const struct of_device_id emac_rockchip_dt_ids[] = {
>{ .compatible = "rockchip,rk3066-emac", .data = _rk3066_emac_data,
>...
> };
> 
>Armd
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [GIT PULL] Thermal-SoC management updates for v4.4-rc8

2016-01-01 Thread Eduardo Valentin
Hello Rui,

On Sat, Jan 02, 2016 at 01:35:18AM +, Zhang, Rui wrote:
> Hi, Eduardo,
> 
> I checked those commits and none of them seems to be a real urgent fix that 
> should be included in -rc8.
> Instead, they should be queued for 4.5 IMO. What do you think?

Yeah, if you prefer, we can queue these to 4.5-rc1.

BR,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 PATCH v1 4/4] clk: rockchip: rk3036: fix and add node id for emac clock

2016-01-01 Thread Xing Zheng
Hi Heiko,
Thank you for your patch, I will apply and test it later.

Thanks.

> 在 2016年1月2日,06:10,Heiko Stübner  写道:
> 
> Hi Xing,
> 
> Am Dienstag, 29. Dezember 2015, 10:34:09 schrieb Xing Zheng:
>> On 2015年12月29日 09:59, Yakir Yang wrote:
>>> On 12/28/2015 08:41 PM, Heiko Stübner wrote:
 Am Montag, 28. Dezember 2015, 17:03:53 schrieb Xing Zheng:
> Due to referred old version TRM, there is incorrect emac clock node,
> we should fix it. The SEL_21_9 is the parent of SEL_21_4.
> 
> In the emac driver, we need to refer HCLK_MAC, and because There are
> only 3PLLs (APLL/GPLL/DPLL) on the rk3036, most clock are under the
> GPLL, and it is unable to provide the accurate rate for mac_ref which
> need to 50MHz probability, we should let it under the APLL and are
> able to set the freq which integer multiples of 50MHz, so we add these
> emac node for reference.
 
 I don't really follow here. While I do understand that the emac needs
 50MHz, I
 don't think using the APLL as source is helpful.
 
 The APLL is the main clocksource for the cpu-cores, including frequency
 scaling, and while it currently only lists 816MHz as sole frequency,
 you're
 pretty much guaranteed to not get your correct multiple of 50MHz from
 there
 either. And limiting the cpu to just do 600MHz to get the mac working
 sounds
 pretty bad ;-) .
 
 
 In the rk3036 cru-node the gpll gets set to 594MHz. Is there a
 special reason
 why it needs to be 594MHz and cannot be a round 600MHz? Because that
 would
 also provide your 50MHz-multiple nicely.
>>> 
>>> Yes, this magic 594MHz would help to support the standard HDMI
>>> resolutions, here are the math:
>>> 
>>> 1920x1080-60Hz DCLK = 148.5MHz = 594MHz / 4
>>> 1280x720-60Hz DCLK = 74.25MHz = 594MHz / 8
>>> 720x480-60Hz DCLK = 27MHz = 594MHz / 22
>>> 
>>> Thanks,
>>> - Yakir
>> 
>> Thanks Yakir.
>> 
>> Hi Heiko,
>> From the above, do you have better idea for the RK3036's emac without
>> ext-oscillator?
> 
> During the last days I did play a bit with the clock framework. As I don't 
> have a Kylin (or any rk3036) board, I did build a test-case with pclk_cpu on 
> the rk3188 (which can be affected by the armclk if not reparented to the 
> gpll), which got sucessfully adapted to get back to (or near) the originally 
> requested frequency.
> 
> So ideally you could roll back your mux/div split here and try the attached 
> diff. In theory it should help :-) .
> As can be seen by the FIXMEs, not fully finished, but I'd like to determine 
> if 
> it fixes the issue at least.
> 
> 
> 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/


Re: [PATCH v2 2/2] cpufreq: powernv: Redesign the presentation of throttle notification

2016-01-01 Thread kbuild test robot
Hi Shilpasri,

[auto build test WARNING on tip/perf/core]
[also build test WARNING on v4.4-rc7 next-20151231]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Shilpasri-G-Bhat/cpufreq-powernv-tracing-Add-powernv_throttle-tracepoint/20160102-062606
config: powerpc-allmodconfig (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
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   drivers/cpufreq/powernv-cpufreq.c: In function 'occ_reset_show':
   drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
>> drivers/cpufreq/powernv-cpufreq.c:625:1: note: in expansion of macro 
>> 'define_throttle_reason_attr'
define_throttle_reason_attr(occ_reset, OCC_RESET_THROTTLE);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'over_current_show':
   drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:624:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(over_current, OVERCURRENT);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'power_supply_failure_show':
   drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:623:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(power_supply_failure, POWER_SUPPLY_FAILURE);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'cpu_over_temperature_show':
   drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:622:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(cpu_over_temperature, CPU_OVERTEMP);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'power_cap_show':
   drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:621:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(power_cap, POWERCAP);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'throttle_reset_show':
   drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:620:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(throttle_reset, NO_THROTTLE);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'throttle_stat_show':
   drivers/cpufreq/powernv-cpufreq.c:589:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );
 ^
   drivers/cpufreq/powernv-cpufreq.c: In function 'throttle_freq_show':
   drivers/cpufreq/powernv-cpufreq.c:568:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );
 ^

vim +/define_throttle_reason_attr +625 drivers/cpufreq/powernv-cpufreq.c

   603  #define define_throttle_reason_attr(attr_name, val) 
   \
   604  static ssize_t attr_name##_show(struct kobject *kobj,   
   \
   605 struct kobj_attribute *attr, char 
*buf) \
   606  {   
   \
   607  int i, id;  
   \
   608  
   \
 > 609  kstrtoint(kobj->name + 4, 0, );  
 >\
   610  for (i = 0; i < nr_chips; i++)  
   \
   611  if (chips[i].id == id)  
   \
   612  break;  
   \
   613  
   \
   614  return 

[PATCH] ACPI / OSL: Add kerneldoc comments to memory mapping functions

2016-01-01 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Add kerneldoc comments to acpi_os_map_iomem() and acpi_os_unmap_iomem()
and explain why the latter needs the __ref annotation in one of them
(as suggested by Mathias Krause).

Signed-off-by: Rafael J. Wysocki 
---
 drivers/acpi/osl.c |   27 +++
 1 file changed, 27 insertions(+)

Index: linux-pm/drivers/acpi/osl.c
===
--- linux-pm.orig/drivers/acpi/osl.c
+++ linux-pm/drivers/acpi/osl.c
@@ -366,6 +366,19 @@ static void acpi_unmap(acpi_physical_add
iounmap(vaddr);
 }
 
+/**
+ * acpi_os_map_iomem - Get a virtual address for a given physical address 
range.
+ * @phys: Start of the physical address range to map.
+ * @size: Size of the physical address range to map.
+ *
+ * Look up the given physical address range in the list of existing ACPI memory
+ * mappings.  If found, get a reference to it and return a pointer to it (its
+ * virtual address).  If not found, map it, add it to that list and return a
+ * pointer to it.
+ *
+ * During early init (when acpi_gbl_permanent_mmap has not been set yet) this
+ * routine simply calls __acpi_map_table() to get the job done.
+ */
 void __iomem *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
 {
@@ -441,6 +454,20 @@ static void acpi_os_map_cleanup(struct a
}
 }
 
+/**
+ * acpi_os_unmap_iomem - Drop a memory mapping reference.
+ * @virt: Start of the address range to drop a reference to.
+ * @size: Size of the address range to drop a reference to.
+ *
+ * Look up the given virtual address range in the list of existing ACPI memory
+ * mappings, drop a reference to it and unmap it if there are no more active
+ * references to it.
+ *
+ * During early init (when acpi_gbl_permanent_mmap has not been set yet) this
+ * routine simply calls __acpi_unmap_table() to get the job done.  Since
+ * __acpi_unmap_table() is an __init function, the __ref annotation is needed
+ * here.
+ */
 void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size)
 {
struct acpi_ioremap *map;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] PM / sleep: Add support for read-only sysfs attributes

2016-01-01 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Some sysfs attributes in /sys/power/ should really be read-only,
so add support for that, convert those attributes to read-only
and drop the stub .show() routines from them.

Original-by: Sergey Senozhatsky 
Signed-off-by: Rafael J. Wysocki 
---
 kernel/power/main.c  |   17 ++---
 kernel/power/power.h |9 +
 2 files changed, 11 insertions(+), 15 deletions(-)

Index: linux-pm/kernel/power/power.h
===
--- linux-pm.orig/kernel/power/power.h
+++ linux-pm/kernel/power/power.h
@@ -77,6 +77,15 @@ static struct kobj_attribute _name##_att
.store  = _name##_store,\
 }
 
+#define power_attr_ro(_name) \
+static struct kobj_attribute _name##_attr = {  \
+   .attr   = { \
+   .name = __stringify(_name), \
+   .mode = S_IRUGO,\
+   },  \
+   .show   = _name##_show, \
+}
+
 /* Preferred image size in bytes (default 500 MB) */
 extern unsigned long image_size;
 /* Size of memory reserved for drivers (default SPARE_PAGES x PAGE_SIZE) */
Index: linux-pm/kernel/power/main.c
===
--- linux-pm.orig/kernel/power/main.c
+++ linux-pm/kernel/power/main.c
@@ -280,13 +280,7 @@ static ssize_t pm_wakeup_irq_show(struct
return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA;
 }
 
-static ssize_t pm_wakeup_irq_store(struct kobject *kobj,
-   struct kobj_attribute *attr,
-   const char *buf, size_t n)
-{
-   return -EINVAL;
-}
-power_attr(pm_wakeup_irq);
+power_attr_ro(pm_wakeup_irq);
 
 #else /* !CONFIG_PM_SLEEP_DEBUG */
 static inline void pm_print_times_init(void) {}
@@ -564,14 +558,7 @@ static ssize_t pm_trace_dev_match_show(s
return show_trace_dev_match(buf, PAGE_SIZE);
 }
 
-static ssize_t
-pm_trace_dev_match_store(struct kobject *kobj, struct kobj_attribute *attr,
-const char *buf, size_t n)
-{
-   return -EINVAL;
-}
-
-power_attr(pm_trace_dev_match);
+power_attr_ro(pm_trace_dev_match);
 
 #endif /* CONFIG_PM_TRACE */
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [GIT PULL] Thermal-SoC management updates for v4.4-rc8

2016-01-01 Thread Zhang, Rui
Hi, Eduardo,

I checked those commits and none of them seems to be a real urgent fix that 
should be included in -rc8.
Instead, they should be queued for 4.5 IMO. What do you think?

Thanks,
rui

> -Original Message-
> From: Eduardo Valentin [mailto:edubez...@gmail.com]
> Sent: Friday, January 01, 2016 2:07 AM
> To: Zhang, Rui 
> Cc: ACPI Devel Maling List ; Linux PM  p...@vger.kernel.org>; LKML ; Zhang, Rui
> 
> Subject: [GIT PULL] Thermal-SoC management updates for v4.4-rc8
> Importance: High
> 
> Hello Rui,
> 
> Please pull from
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
> fixes
> 
> to receive Thermal-SoC Management updates for v4.4-rc8 with top-most
> 
> ebe580748d7c33bfd308f09b825dff15fa2eccf2:
> 
>   thermal: trip_point_temp_store() calls thermal_zone_device_update()
> (2015-12-31 09:41:52 -0800)
> 
> on top of commit c6169202e40868fd00de7ce35ee16c81b1f9e123:
> 
>   Merge branch 'for-linus' of git://git.kernel.dk/linux-block (2015-12-30
> 10:26:20 -0800)
> 
> Specifics in this pull request:
> - Several fixes and cleanups on Rockchip thermal drivers.
> - Several fixes and cleanups on RCAR thermal drivers.
> - Build/boot tests powered by KernelCI [1,2] \o/
> 
> BTW, I have rebase my -fixes branch on top of linus master branch, as you
> reported merge conflict. Please let me know if this branch causes troubles
> for you.
> 
> [1] - https://kernelci.org/boot/all/job/evalenti/kernel/v4.4-rc5-27-
> gce0265dd6f8e/
> [2] - https://kernelci.org/build/evalenti/kernel/v4.4-rc5-27-gce0265dd6f8e/
> 
> BR,
> 
> Eduardo Valentin
> 
> 
> Caesar Wang (4):
>   thermal: rockchip: fix a trivial typo
>   dt-bindings: rockchip-thermal: Support the RK3228/RK3399 SoCs
> compatible
>   thermal: rockchip: Support the RK3228 SoCs in thermal driver
>   thermal: rockchip: Support the RK3399 SoCs in thermal driver
> 
> Kuninori Morimoto (5):
>   thermal: rcar: move rcar_thermal_dt_ids to upside
>   thermal: rcar: check every rcar_thermal_update_temp() return value
>   thermal: rcar: check irq possibility in rcar_thermal_irq_xxx()
>   thermal: rcar: rcar_thermal_get_temp() return error if strange temp
>   thermal: trip_point_temp_store() calls thermal_zone_device_update()
> 
>  .../bindings/thermal/rockchip-thermal.txt  |   2 +
>  drivers/thermal/rcar_thermal.c |  53 ---
>  drivers/thermal/rockchip_thermal.c | 172 
> +++--
>  drivers/thermal/thermal_core.c |   6 +-
>  4 files changed, 200 insertions(+), 33 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2,RESEND] clk: uniphier: add clock drivers for UniPhier SoCs

2016-01-01 Thread Masahiro Yamada
Hi Michael,


2015-12-31 10:35 GMT+09:00 Michael Turquette :
> Hello Yamada-san,
>
> Quoting Masahiro Yamada (2015-12-28 02:20:58)
>> diff --git a/drivers/clk/uniphier/Kconfig b/drivers/clk/uniphier/Kconfig
>> new file mode 100644
>> index 000..7606f27
>> --- /dev/null
>> +++ b/drivers/clk/uniphier/Kconfig
>> @@ -0,0 +1,35 @@
>> +menuconfig CLK_UNIPHIER
>> +   bool "Clock drivers for UniPhier SoCs"
>> +   depends on ARCH_UNIPHIER
>
> Might want to make the above line:
>
> depends on ARCH_UNIPHIER || COMPILE_TEST
>
>> +   depends on OF
>> +   default y
>> +   help
>> + Supports clock drivers for UniPhier SoCs.
>
> Why menuconfig? Can we make this a non-visible config option selected by
> the UniPhier platform?

Yes, I can do that if you like.

Do you prefer to making it flat, like all clocks are shown in the
"Common Clock Framework" menu?

Or, is it better to categorize SoC clocks with "menu" for each SoC family?



>> +
>> +if CLK_UNIPHIER
>
> Please drop the if statement here and have the below options 'depends'
> on CLK_UNIPHIER.

Why is it bad?

I think surrounding all the options with "if CLK_UNIPHIER" ... "endif"
is easier than adding "depends on CLK_UNIPHIER" to each of them.



>> +
>> +config CLK_UNIPHIER_PH1_SLD3
>> +   bool "Clock driver for UniPhier PH1-sLD3 SoC"
>> +   default y
>
> Can you make these drivers into loadable modules? If so you might
> consider tristate.

For some, I can.
For some, I can't (because they must provide an input clock for the timer.)


>> +
>> +static void __init ph1_ld4_clk_init(struct device_node *np)
>> +{
>> +   uniphier_clk_init(np, ph1_ld4_clk_idata);
>> +}
>> +CLK_OF_DECLARE(ph1_ld4_clk, "socionext,ph1-ld4-sysctrl", ph1_ld4_clk_init);
>
> Can you avoid using CLK_OF_DECLARE and instead make this into a
> platform_driver? For examples please see drivers/clk/qcom*.c


For clk-uniphier-peri.c and clk-uniphier-mio.c, yes.
They provide clocks for peripheral devices like USB, MMC, etc., so I
can delay them.


For clk-ph1-*.c, I am afraid I can't.
They provide an input clock for the timer (ARM global timer).
I think they should be initialized very early.


Is platform_driver better than CLK_OF_DECLARE() where it is possible?

I just chose CLK_OF_DECLARE() for consistency
and it seems the majority.



>> +
>> +static void __init uniphier_clk_update_parent_name(struct device_node *np,
>> +  const char **parent_name)
>> +{
>> +   const char *new_name;
>> +   int index;
>> +
>> +   if (!parent_name || !*parent_name)
>> +   return;
>> +
>> +   if (strncmp(*parent_name, UNIPHIER_CLK_EXT, 
>> strlen(UNIPHIER_CLK_EXT)))
>> +   return;
>> +
>> +   index = of_property_match_string(np, "clock-names",
>> +   *parent_name + strlen(UNIPHIER_CLK_EXT));
>> +   new_name = of_clk_get_parent_name(np, index);
>> +   if (new_name)
>> +   *parent_name = new_name;
>
> Where can I find the DT binding description and DTS for this clock
> controller? I'm confused why the parent name function is necessary and
> I'd like to see the data.


clk_register() needs the name strings of parent clocks,
not pointers to parent clocks.
(It looks a bit odd to me, although it allows us to register clocks in
any order.
In stead, we have to think about orphan-walking.)
So, we need to exactly know the names of parent clocks.

Let's assume the clock system that consists of some hardware blocks.


  root_clk: root_clk {
compatible = "foo-clk";
reg = <0x1000 0x1000>;
#clock-cells = <1>;
  };

  bar_clk {
compatible = "bar-clk";
reg = <0x2000 0x1000>;
#clock-cells = <1>;
clock-names = "input"
clocks = <_clk 0>;
   };

  baz_clk {
compatible = "baz-clk";
reg = <0x3000 0x1000>;
#clock-cells = <1>;
clock-names = "input"
clocks = <_clk 1>;
   };



The "bar_clk" is a clock provider for other peripherals,
and also a consumer of "root_clk".

The "bar_clk" wants to know the name of index 0 of root_clk
because it is needed when calling clk_register().


Let's say the names of clocks provided root_clk are, "for-bar123", "for-baz456".

The "bar_clk" needs the string "for-bar123", but it does not know.
(Likewise, the "baz_clk" needs the string "for-baz456", but it does not know.)

Of course, I can hard-code "for-bar123" in the driver of "bar_clk",
but I think it is annoying to keep the name synced between the
provider and the consumer.

So, I implemented uniphier_clk_update_parent_name()
to convert the clock-names into the parent clock name.
In this case, this function takes "input" and converts it into "for-bar123".


Is there any good idea to solve this problem?


-- 
Best Regards
Masahiro Yamada
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 

[PATCH] PCI: acpiphp_ibm: fix null dereferences on null ibm_slot

2016-01-01 Thread Colin King
From: Colin Ian King 

ibm_slot_from_id can return null if the des header signature is
not aPCI or if the kmalloc for the return acpi descriptore fails,
causing potential null pointer dereferences on the return null
descriptor.

Handle the null case with appropriate check and error return.

Signed-off-by: Colin Ian King 
---
 drivers/pci/hotplug/acpiphp_ibm.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_ibm.c 
b/drivers/pci/hotplug/acpiphp_ibm.c
index 6ca2399..9d16c9d 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -154,7 +154,8 @@ static union apci_descriptor *ibm_slot_from_id(int id)
 ibm_slot_done:
if (ret) {
ret = kmalloc(sizeof(union apci_descriptor), GFP_KERNEL);
-   memcpy(ret, des, sizeof(union apci_descriptor));
+   if (ret)
+   memcpy(ret, des, sizeof(union apci_descriptor));
}
kfree(table);
return ret;
@@ -175,8 +176,13 @@ static int ibm_set_attention_status(struct hotplug_slot 
*slot, u8 status)
acpi_status stat;
unsigned long long rc;
union apci_descriptor *ibm_slot;
+   int id = hpslot_to_sun(slot);
 
-   ibm_slot = ibm_slot_from_id(hpslot_to_sun(slot));
+   ibm_slot = ibm_slot_from_id(id);
+   if (!ibm_slot) {
+   pr_err("APLS null ACPI descriptor for slot %d\n", id);
+   return -ENODEV;
+   }
 
pr_debug("%s: set slot %d (%d) attention status to %d\n", __func__,
ibm_slot->slot.slot_num, ibm_slot->slot.slot_id,
@@ -215,8 +221,13 @@ static int ibm_set_attention_status(struct hotplug_slot 
*slot, u8 status)
 static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
 {
union apci_descriptor *ibm_slot;
+   int id = hpslot_to_sun(slot);
 
-   ibm_slot = ibm_slot_from_id(hpslot_to_sun(slot));
+   ibm_slot = ibm_slot_from_id(id);
+   if (!ibm_slot) {
+   pr_err("APLS null ACPI descriptor for slot %d\n", id);
+   return -ENODEV;
+   }
 
if (ibm_slot->slot.attn & 0xa0 || ibm_slot->slot.status[1] & 0x08)
*status = 1;
-- 
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/


[PATCH] ACPI / SBS: fix inconsistent indenting inside if statement

2016-01-01 Thread Colin King
From: Colin Ian King 

The indenting in acpi_battery_set_alarm is inconsistent and has been
so since 2007; commit 94f6c0860139da9219255b8ff45ad42117dda859
("ACPI: SBS: Add support for power_supply class (and sysfs)"). Minor
fix for this, no code functionality change.

Signed-off-by: Colin Ian King 
---
 drivers/acpi/sbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index cb3dedb..ad0b13a 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -417,11 +417,11 @@ static int acpi_battery_set_alarm(struct acpi_battery 
*battery)
if ((value & 0xf000) != sel) {
value &= 0x0fff;
value |= sel;
-   ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD,
+   ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD,
 ACPI_SBS_MANAGER,
 0x01, (u8 *), 2);
-   if (ret)
-   goto end;
+   if (ret)
+   goto end;
}
}
ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY,
-- 
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: [PATCH linux-next (v2) 2/2] clk: bcm6345: Add BCM6345 gated clock support

2016-01-01 Thread Michael Turquette
Hi Simon,

Quoting Simon Arlott (2015-12-10 13:50:59)
> +#define to_clk_bcm6345(_hw) container_of(_hw, struct clk_bcm6345, hw)
> +
> +static int clk_bcm6345_enable(struct clk_hw *hw)
> +{
> +   struct clk_bcm6345 *gate = to_clk_bcm6345(hw);
> +
> +   return regmap_write_bits(gate->map, gate->offset,
> +   gate->mask, gate->mask);

Does your regmap hold a spinlock or mutex? If a mutex then this should
be a .prepare callback instead of .enable. If it's a spinlock then
nothing to see here, move along.

> +}
> +
> +static void clk_bcm6345_disable(struct clk_hw *hw)
> +{
> +   struct clk_bcm6345 *gate = to_clk_bcm6345(hw);
> +
> +   regmap_write_bits(gate->map, gate->offset,
> +   gate->mask, 0);
> +}
> +
> +static int clk_bcm6345_is_enabled(struct clk_hw *hw)
> +{
> +   struct clk_bcm6345 *gate = to_clk_bcm6345(hw);
> +   unsigned int val;
> +   int ret;
> +
> +   ret = regmap_read(gate->map, gate->offset, );
> +   if (ret)
> +   return ret;
> +
> +   val &= gate->mask;
> +
> +   return val ? 1 : 0;
> +}
> +
> +const struct clk_ops clk_bcm6345_ops = {
> +   .enable = clk_bcm6345_enable,
> +   .disable = clk_bcm6345_disable,
> +   .is_enabled = clk_bcm6345_is_enabled,
> +};
> +
> +static struct clk * __init of_bcm6345_clk_register(const char *parent_name,
> +   const char *clk_name, struct regmap *map, u32 offset, u32 mask)
> +{
> +   struct clk_bcm6345 *gate;
> +   struct clk_init_data init;
> +   struct clk *ret;
> +
> +   gate = kzalloc(sizeof(*gate), GFP_KERNEL);
> +   if (!gate)
> +   return ERR_PTR(-ENOMEM);
> +
> +   init.name = clk_name;
> +   init.ops = _bcm6345_ops;
> +   init.flags = CLK_IS_BASIC;

Why is CLK_IS_BASIC set?

> +   init.parent_names = (parent_name ? _name : NULL);
> +   init.num_parents = (parent_name ? 1 : 0);
> +   gate->hw.init = 
> +   gate->map = map;
> +   gate->offset = offset;
> +   gate->mask = mask;
> +
> +   ret = clk_register(NULL, >hw);
> +   if (IS_ERR(ret))
> +   kfree(gate);
> +
> +   return ret;
> +}
> +
> +static void __init of_bcm6345_clk_setup(struct device_node *node)
> +{
> +   struct clk_onecell_data *clk_data;
> +   const char *parent_name = NULL;
> +   struct regmap *map;
> +   u32 offset;
> +   unsigned int clocks = 0;
> +   int i;
> +
> +   clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
> +   if (!clk_data)
> +   return;
> +
> +   clk_data->clk_num = 32;
> +   clk_data->clks = kmalloc_array(clk_data->clk_num,
> +   sizeof(*clk_data->clks), GFP_KERNEL);
> +
> +   for (i = 0; i < clk_data->clk_num; i++)
> +   clk_data->clks[i] = ERR_PTR(-ENODEV);
> +
> +   if (of_clk_get_parent_count(node) > 0)
> +   parent_name = of_clk_get_parent_name(node, 0);
> +
> +   map = syscon_regmap_lookup_by_phandle(node, "regmap");
> +   if (IS_ERR(map)) {
> +   pr_err("%s: regmap lookup error %ld\n",
> +   node->full_name, PTR_ERR(map));
> +   goto out;
> +   }
> +
> +   if (of_property_read_u32(node, "offset", )) {
> +   pr_err("%s: offset not specified\n", node->full_name);
> +   goto out;
> +   }
> +
> +   /* clks[] is sparse, indexed by bit, maximum clocks checked using i */
> +   for (i = 0; i < clk_data->clk_num; i++) {
> +   u32 bit;
> +   const char *clk_name;
> +
> +   if (of_property_read_u32_index(node, "clock-indices",
> +   i, ))
> +   goto out;
> +
> +   if (of_property_read_string_index(node, "clock-output-names",
> +   i, _name))
> +   goto out;
> +
> +   if (bit >= clk_data->clk_num) {
> +   pr_err("%s: clock bit %u out of range\n",
> +   node->full_name, bit);
> +   continue;
> +   }
> +
> +   if (!IS_ERR(clk_data->clks[bit])) {
> +   pr_err("%s: clock bit %u already exists\n",
> +   node->full_name, bit);
> +   continue;
> +   }
> +
> +   clk_data->clks[bit] = of_bcm6345_clk_register(parent_name,
> +   clk_name, map, offset, BIT(bit));
> +   if (!IS_ERR(clk_data->clks[bit]))
> +   clocks++;
> +   }
> +
> +out:
> +   if (clocks) {
> +   of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
> +   pr_info("%s: registered %u clocks\n", node->name, clocks);
> +   } else {
> +   kfree(clk_data->clks);
> +   kfree(clk_data);
> +   }
> +}
> +
> +CLK_OF_DECLARE(bcm6345_clk, 

Re: net/nfc: GPF in llcp_sock_getname

2016-01-01 Thread Cong Wang
On Fri, Jan 1, 2016 at 5:58 AM, Dmitry Vyukov  wrote:
> GPF seems to be caused by a data race on socket state.

Seems you are right, I think the following patch should work:

diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index ecf0a01..5a91997 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -500,7 +500,7 @@ static int llcp_sock_getname(struct socket *sock,
struct sockaddr *uaddr,
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, llcp_addr, uaddr);

-   if (llcp_sock == NULL || llcp_sock->dev == NULL)
+   if (llcp_sock == NULL || sk->sk_state == LLCP_CLOSED)
return -EBADFD;

pr_debug("%p %d %d %d\n", sk, llcp_sock->target_idx,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: net/nfc: GPF in llcp_sock_getname

2016-01-01 Thread Cong Wang
On Fri, Jan 1, 2016 at 12:58 PM, Cong Wang  wrote:
>
> It looks like we forget to initialize ->service_name_len
> and ->servicce_name before bind().

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


[PATCH] ASoC: cs35l32: avoid uninitialized variable access

2016-01-01 Thread Arnd Bergmann
gcc warns about the possibilty of accessing a property read from
devicetree in cs35l32_i2c_probe() when it has not been initialized
because CONFIG_OF is disabled:

sound/soc/codecs/cs35l32.c: In function 'cs35l32_i2c_probe':
sound/soc/codecs/cs35l32.c:278:2: warning: 'val' may be used uninitialized in 
this function [-Wmaybe-uninitialized]

The code is actually correct because it checks the dev->of_node
variable first and we know this is NULL here, but by adding a
check for IS_ENABLED(CONFIG_OF), we can let the compiler know
as well, and also generate smaller object code.

Signed-off-by: Arnd Bergmann 

diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c
index 44c30fe3e315..52ffaa8eb02b 100644
--- a/sound/soc/codecs/cs35l32.c
+++ b/sound/soc/codecs/cs35l32.c
@@ -372,7 +372,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client,
dev_err(_client->dev, "could not allocate pdata\n");
return -ENOMEM;
}
-   if (i2c_client->dev.of_node) {
+   if (IS_ENABLED(CONFIG_OF) && i2c_client->dev.of_node) {
ret = cs35l32_handle_of_data(i2c_client,
 >pdata);
if (ret != 0)

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


Re: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker()

2016-01-01 Thread Sergei Shtylyov

Hello

On 1/2/2016 12:33 AM, SF Markus Elfring wrote:


From: Markus Elfring 
Date: Fri, 1 Jan 2016 22:27:20 +0100

This issue was detected by using the Coccinelle software.

Move the jump label directly before the desired log statement
so that the variable "err" will not be checked once more
after it was determined that a function call failed.
Use the identifier "report_failure" instead of the label "err".


   Why? The code was smart enough and you're making it uglier that it needs 
to be.



Signed-off-by: Markus Elfring 


MBR, Sergei

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


Re: [PATCH 2/3] net-iwlegacy: One check less in il_eeprom_init() after error detection

2016-01-01 Thread Sergei Shtylyov

Hello.

On 1/1/2016 11:31 PM, SF Markus Elfring wrote:


From: Markus Elfring 
Date: Fri, 1 Jan 2016 21:12:29 +0100

This issue was detected by using the Coccinelle software.

Adjust a jump target to avoid a check repetition before the function
call "il_eeprom_free".


   One question: why?



Signed-off-by: Markus Elfring 
---
  drivers/net/wireless/intel/iwlegacy/common.c | 10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/common.c 
b/drivers/net/wireless/intel/iwlegacy/common.c
index c3afaf7..ae45fd3 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c

[...]

@@ -772,9 +772,11 @@ il_eeprom_init(struct il_priv *il)
  done:
il->ops->eeprom_release_semaphore(il);

-err:
-   if (ret)
+   if (ret) {
+free_eeprom:


   This is ugly, I'd say.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ipw2x00: add checks for dma mapping errors

2016-01-01 Thread Alexey Khoroshilov
ipw2100_alloc_skb() and ipw2100_tx_send_data() do not check if mapping
dma memory succeed. The patch adds the checks and failure handling.

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

Signed-off-by: Alexey Khoroshilov 
---
 drivers/net/wireless/ipw2x00/ipw2100.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c 
b/drivers/net/wireless/ipw2x00/ipw2100.c
index 36818c7f30b9..f93a7f71c047 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -2311,8 +2311,10 @@ static int ipw2100_alloc_skb(struct ipw2100_priv *priv,
packet->dma_addr = pci_map_single(priv->pci_dev, packet->skb->data,
  sizeof(struct ipw2100_rx),
  PCI_DMA_FROMDEVICE);
-   /* NOTE: pci_map_single does not return an error code, and 0 is a valid
-*   dma_addr */
+   if (pci_dma_mapping_error(priv->pci_dev, packet->dma_addr)) {
+   dev_kfree_skb(packet->skb);
+   return -ENOMEM;
+   }
 
return 0;
 }
@@ -3183,6 +3185,11 @@ static void ipw2100_tx_send_data(struct ipw2100_priv 
*priv)
LIBIPW_3ADDR_LEN,
tbd->buf_length,
PCI_DMA_TODEVICE);
+   if (pci_dma_mapping_error(priv->pci_dev,
+ tbd->host_addr)) {
+   IPW_DEBUG_TX("dma mapping error\n");
+   break;
+   }
 
IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n",
 txq->next, tbd->host_addr,
-- 
1.9.1

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


Re: [PATCH] net: refactor icmp_global_allow to improve readability and performance.

2016-01-01 Thread Eric Dumazet
On Thu, 2015-12-31 at 23:58 -0800, Mike Danese wrote:
> We can reduce the number of operations performed by icmp_global_allow
> and make the routine more readable by refactoring it in two ways:
> 
> First, this patch refactors the meaning of the "delta" variable. Before
> this change, it meant min("time since last refill of token bucket", HZ).
> After this change, it means "time since last refill". The original
> definition is required only once but was being calculated twice. The new
> meaning is also more intuitive for a variable named "delta".
> 
> Second, by calculating "delta" (time since last refill of token bucket)
> and "cbr" (token bucket can be refilled) at the beginning of the
> routine, we reduce the number of repeated calculations of these two
> variables.
> 
> There should be no functional difference.
> 
> Signed-off-by: Mike Danese 
> ---
>  net/ipv4/icmp.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)

Hi Mike

Sorry, this is a very broken patch.

There is a comment you apparently missed completely :

/* Check if token bucket is empty and cannot be refilled
 * without taking the spinlock.
 */

There is a reason we compute 'delta' two times.

One without the spinlock held, and a second time with the spinlock held.

This is an opportunistic way to exit early without false sharing in the
stress case where many cpus might enter this code.

Really I do not think current code needs any 'refactoring', especially
around December 31th at midnight ;)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/2] cpufreq: powernv: Redesign the presentation of throttle notification

2016-01-01 Thread kbuild test robot
Hi Shilpasri,

[auto build test WARNING on tip/perf/core]
[also build test WARNING on v4.4-rc7 next-20151231]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Shilpasri-G-Bhat/cpufreq-powernv-tracing-Add-powernv_throttle-tracepoint/20160102-062606
config: powerpc-defconfig (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
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   drivers/cpufreq/powernv-cpufreq.c: In function 'occ_reset_show':
>> drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
>> 'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:625:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(occ_reset, OCC_RESET_THROTTLE);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'over_current_show':
>> drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
>> 'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:624:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(over_current, OVERCURRENT);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'power_supply_failure_show':
>> drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
>> 'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:623:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(power_supply_failure, POWER_SUPPLY_FAILURE);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'cpu_over_temperature_show':
>> drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
>> 'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:622:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(cpu_over_temperature, CPU_OVERTEMP);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'power_cap_show':
>> drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
>> 'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:621:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(power_cap, POWERCAP);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'throttle_reset_show':
>> drivers/cpufreq/powernv-cpufreq.c:609:2: warning: ignoring return value of 
>> 'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );   \
 ^
   drivers/cpufreq/powernv-cpufreq.c:620:1: note: in expansion of macro 
'define_throttle_reason_attr'
define_throttle_reason_attr(throttle_reset, NO_THROTTLE);
^
   drivers/cpufreq/powernv-cpufreq.c: In function 'throttle_stat_show':
   drivers/cpufreq/powernv-cpufreq.c:589:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );
 ^
   drivers/cpufreq/powernv-cpufreq.c: In function 'throttle_freq_show':
   drivers/cpufreq/powernv-cpufreq.c:568:2: warning: ignoring return value of 
'kstrtoint', declared with attribute warn_unused_result [-Wunused-result]
 kstrtoint(kobj->name + 4, 0, );
 ^

vim +/kstrtoint +609 drivers/cpufreq/powernv-cpufreq.c

   593  
   594  count += sprintf([count], "turbo %d\n", 
chips[i].throt_turbo);
   595  count += sprintf([count], "sub-turbo %d\n", 
chips[i].throt_nominal);
   596  
   597  return count;
   598  }
   599  
   600  static struct kobj_attribute attr_throttle_stat =
   601  __ATTR(throttle_stat, 0444, throttle_stat_show, NULL);
   602  
   603  #define define_throttle_reason_attr(attr_name, val) 
   \
   604  static ssize_t attr_name##_show(struct kobject *kobj,   
   \
   605 struct kobj_attribute *attr, char 
*buf) \
   606  {   
   \
   607  int i, id;  
   \
   608  
   \
 > 609  kstrtoint(kobj->name + 4, 0, );  
 >\
   610  

Fwd: [PATCH] x86: Add iMac10,1 to pci_reboot_dmi_table

2016-01-01 Thread Mario Kleiner

 Forwarded Message 
Subject: [PATCH] x86: Add iMac10,1 to pci_reboot_dmi_table
Date: Fri, 18 Dec 2015 20:24:06 +0100
From: Mario Kleiner 
To: x...@kernel.org
CC: mi...@redhat.com, h...@zytor.com, mario.kleiner...@gmail.com, 
sta...@vger.kernel.org


Without the reboot=pci method, the iMac 10,1 simply
hangs after printing "Restarting system" at the point
when it should reboot. This fixes it.

Signed-off-by: Mario Kleiner 
Cc: 
---
 arch/x86/kernel/reboot.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 02693dd..f660d63 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -182,6 +182,14 @@ static struct dmi_system_id __initdata 
reboot_dmi_table[] = {

DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"),
},
},
+   {   /* Handle problems with rebooting on the iMac10,1. */
+   .callback = set_pci_reboot,
+   .ident = "Apple iMac10,1",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+   DMI_MATCH(DMI_PRODUCT_NAME, "iMac10,1"),
+   },
+   },

/* ASRock */
{   /* Handle problems with rebooting on ASRock Q1900DC-ITX */
--
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] gpiolib: always initialize *flags from of_get_named_gpio_flags

2016-01-01 Thread Arnd Bergmann
The of_get_named_gpio_flags() function does nothing other than returning
an error when CONFIG_OF_GPIO is disabled, but that causes spurious
warnings about possible use of uninitialized variables in any code that
does not check the of_get_named_gpio_flags() return value before trying
to use the flags:

drivers/input/misc/rotary_encoder.c: In function 'rotary_encoder_probe':
drivers/input/misc/rotary_encoder.c:223:28: warning: 'flags' may be used 
uninitialized in this function [-Wmaybe-uninitialized]
drivers/power/bq24735-charger.c: In function 'bq24735_charger_probe':
drivers/power/bq24735-charger.c:227:12: warning: 'flags' may be used 
uninitialized in this function [-Wmaybe-uninitialized]
drivers/power/sbs-battery.c: In function 'sbs_probe':
drivers/power/sbs-battery.c:782:17: warning: 'gpio_flags' may be used 
uninitialized in this function [-Wmaybe-uninitialized]

This changes the behavior of the inline helper to set the flags to zero
when OF_GPIO is disabled, to avoid the warnings. In all cases I've
encountered, we don't actually get to the place that uses the flags
if CONFIG_OF is disabled because we won't enter the DT parser code.

Signed-off-by: Arnd Bergmann 

diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 87d6d1632dd4..bb85a8eeba6a 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -67,6 +67,9 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc,
 static inline int of_get_named_gpio_flags(struct device_node *np,
const char *list_name, int index, enum of_gpio_flags *flags)
 {
+   if (flags)
+   *flags = 0;
+
return -ENOSYS;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpufreq: powernv: Redesign the presentation of throttle notification

2016-01-01 Thread Shilpasri G Bhat
Hi,

On 12/15/2015 02:59 AM, Paul Clarke wrote:
> On 12/13/2015 12:17 PM, Shilpasri G Bhat wrote:
>> Replace the throttling event console messages to perf trace event
>> "power:powernv_throttle" and throttle counter stats which are
>> exported in sysfs. The newly added sysfs files are as follows:
>>
>> 1)/sys/devices/system/node/node0/throttle_frequencies
>>This gives the throttle stats for each of the available frequencies.
>>The throttle stat of a frequency is the total number of times the max
>>frequency was reduced to that frequency.
>># cat /sys/devices/system/node/node0/throttle_frequencies
>>4023000 0
>>399 0
>>3956000 1
>>3923000 0
>>389 0
>>3857000 2
>>3823000 0
>>379 0
>>3757000 2
>>3724000 1
>>369 1
>>...
> 
> Is this data useful?  It seems like "elapsed time" at each frequency might be
> more useful, if any.
> 

Yes elapsed time is more useful data here. But the concern here is with the
accuracy of measurement/observation of elapsed time by the kernel. OCC can
throttle/unthrottle the frequency at the granularity of 250us. Although OCC
updates the throttle status to HOMER region immediately there may be a delay in
propagating this message by the opal-poller to the driver.

So instead we might want OCC to give us the throttled elapsed time stat for each
frequency and opal-poller/driver can take the snapshot of this info every n 
seconds.

>> 2)/sys/devices/system/node/node0/throttle_reasons
>>This gives the stats for each of the supported throttle reasons.
>>This gives the total number of times the frequency was throttled due
>>to each of the reasons.
>># cat /sys/devices/system/node/node0/throttle_reasons
>>No throttling 7
>>Power Cap 0
>>Processor Over Temperature 7
>>Power Supply Failure 0
>>Over Current 0
>>OCC Reset 0
>>
>> 3)/sys/devices/system/node/node0/throttle_stat
>>This gives the total number of throttle events occurred in turbo
>>range of frequencies and non-turbo(below nominal) range of
>>frequencies.
> 
> non-turbo should read "at or below nominal".  Maybe "sub-turbo" is a better 
> term(?)
> 
>># cat /sys/devices/system/node/node0/throttle_stat
>>Turbo 7
>>Nominal 0
> 
> Should this read "Non-turbo" or "Sub-turbo" instead of "Nominal", since the
> events could well occur when already operating below nominal.
> 

Agree. Applied 'sub-turbo' in v2

>> Signed-off-by: Shilpasri G Bhat 
>> ---
>>   drivers/cpufreq/powernv-cpufreq.c | 186 
>> +-
>>   include/trace/events/power.h  |  22 +
>>   2 files changed, 166 insertions(+), 42 deletions(-)
>>
>> diff --git a/drivers/cpufreq/powernv-cpufreq.c
>> b/drivers/cpufreq/powernv-cpufreq.c
>> index cb50138..bdde9d6 100644
>> --- a/drivers/cpufreq/powernv-cpufreq.c
>> +++ b/drivers/cpufreq/powernv-cpufreq.c
>> @@ -28,6 +28,9 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>> +#include 
>> +#include 
>>
>>   #include 
>>   #include 
>> @@ -43,12 +46,27 @@
>>   static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1];
>>   static bool rebooting, throttled, occ_reset;
>>
>> +static char throttle_reason[][30] = {
>> +"No throttling",
>> +"Power Cap",
>> +"Processor Over Temperature",
>> +"Power Supply Failure",
>> +"Over Current",
>> +"OCC Reset"
>> + };
> 
> I'm curious if this would be slightly more efficiently implemented as:
> static const char *throttle_reason[] = { ... };
> 
> Do you need 30 characters per string for a reason?
> 
> Regardless, it should be const.

Modified the declaration in v2 version of the patch.

> 
> [...]
> -- 
> PC

Thanks and Regards,
Shilpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] net: hns: avoid uninitialized variable warning:

2016-01-01 Thread Arnd Bergmann
gcc fails to see that the use of the 'last_offset' variable
in hns_nic_reuse_page() is used correctly and issues a bogus
warning:

drivers/net/ethernet/hisilicon/hns/hns_enet.c: In function 'hns_nic_reuse_page':
drivers/net/ethernet/hisilicon/hns/hns_enet.c:541:6: warning: 'last_offset' may 
be used uninitialized in this function [-Wmaybe-uninitialized]

This simplifies the function to make it more obvious what is
going on to both readers and compilers, which makes the warning
go away.

Signed-off-by: Arnd Bergmann 
---
Compile-tested only, and complex enough that this requires a proper
review and testing before it gets apply. Please have a look at this.

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c 
b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 5a81dafd725e..0e30846a24f8 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -499,50 +499,47 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i,
struct hnae_desc *desc;
int truesize, size;
int last_offset;
+   bool twobufs;
+
+   twobufs = ((PAGE_SIZE < 8192) && hnae_buf_size(ring) == 
HNS_BUFFER_SIZE_2048);
 
desc = >desc[ring->next_to_clean];
size = le16_to_cpu(desc->rx.size);
 
-#if (PAGE_SIZE < 8192)
-   if (hnae_buf_size(ring) == HNS_BUFFER_SIZE_2048) {
+   if (twobufs) {
truesize = hnae_buf_size(ring);
} else {
truesize = ALIGN(size, L1_CACHE_BYTES);
last_offset = hnae_page_size(ring) - hnae_buf_size(ring);
}
 
-#else
-   truesize = ALIGN(size, L1_CACHE_BYTES);
-   last_offset = hnae_page_size(ring) - hnae_buf_size(ring);
-#endif
-
skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len,
size - pull_len, truesize - pull_len);
 
 /* avoid re-using remote pages,flag default unreuse */
-   if (likely(page_to_nid(desc_cb->priv) == numa_node_id())) {
-#if (PAGE_SIZE < 8192)
-   if (hnae_buf_size(ring) == HNS_BUFFER_SIZE_2048) {
-   /* if we are only owner of page we can reuse it */
-   if (likely(page_count(desc_cb->priv) == 1)) {
-   /* flip page offset to other buffer */
-   desc_cb->page_offset ^= truesize;
-
-   desc_cb->reuse_flag = 1;
-   /* bump ref count on page before it is given*/
-   get_page(desc_cb->priv);
-   }
-   return;
-   }
-#endif
-   /* move offset up to the next cache line */
-   desc_cb->page_offset += truesize;
+   if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))
+   return;
+
+   if (twobufs) {
+   /* if we are only owner of page we can reuse it */
+   if (likely(page_count(desc_cb->priv) == 1)) {
+   /* flip page offset to other buffer */
+   desc_cb->page_offset ^= truesize;
 
-   if (desc_cb->page_offset <= last_offset) {
desc_cb->reuse_flag = 1;
/* bump ref count on page before it is given*/
get_page(desc_cb->priv);
}
+   return;
+   }
+
+   /* move offset up to the next cache line */
+   desc_cb->page_offset += truesize;
+
+   if (desc_cb->page_offset <= last_offset) {
+   desc_cb->reuse_flag = 1;
+   /* bump ref count on page before it is given*/
+   get_page(desc_cb->priv);
}
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpufreq: powernv: Redesign the presentation of throttle notification

2016-01-01 Thread Shilpasri G Bhat
In POWER8, OCC(On-Chip-Controller) can throttle the frequency of the
CPU when the chip crosses its thermal and power limits. Currently,
powernv-cpufreq driver detects and reports this event as a console
message. Some boxes may not sustain the max turbo frequency in all
conditions and can be throttled frequently. This can lead to the
flooding of console with throttle messages. So this patchset aims to
redesign the presentation of this event via sysfs counters and
tracepoints. 

This patchset will add a perf trace point "power:powernv_throttle" and
sysfs throttle counter stats in /sys/devices/system/cpu/cpufreq/chipN.

Shilpasri G Bhat (2):
  cpufreq: powernv/tracing: Add powernv_throttle tracepoint
  cpufreq: powernv: Redesign the presentation of throttle notification

 drivers/cpufreq/powernv-cpufreq.c | 247 +++---
 include/trace/events/power.h  |  22 
 kernel/trace/power-traces.c   |   1 +
 3 files changed, 227 insertions(+), 43 deletions(-)

-- 
1.9.3

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


[PATCH v2 1/2] cpufreq: powernv/tracing: Add powernv_throttle tracepoint

2016-01-01 Thread Shilpasri G Bhat
This patch adds the powernv_throttle tracepoint to trace the CPU
frequency throttling event, which is used by the powernv-cpufreq
driver in POWER8.

Signed-off-by: Shilpasri G Bhat 
CC: Ingo Molnar 
CC: Steven Rostedt 
---
Changes from v1:
- Export the tracepoint

 include/trace/events/power.h | 22 ++
 kernel/trace/power-traces.c  |  1 +
 2 files changed, 23 insertions(+)

diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 284244e..19e5030 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -38,6 +38,28 @@ DEFINE_EVENT(cpu, cpu_idle,
TP_ARGS(state, cpu_id)
 );
 
+TRACE_EVENT(powernv_throttle,
+
+   TP_PROTO(int chip_id, const char *reason, int pmax),
+
+   TP_ARGS(chip_id, reason, pmax),
+
+   TP_STRUCT__entry(
+   __field(int, chip_id)
+   __string(reason, reason)
+   __field(int, pmax)
+   ),
+
+   TP_fast_assign(
+   __entry->chip_id = chip_id;
+   __assign_str(reason, reason);
+   __entry->pmax = pmax;
+   ),
+
+   TP_printk("Chip %d Pmax %d %s", __entry->chip_id,
+ __entry->pmax, __get_str(reason))
+);
+
 TRACE_EVENT(pstate_sample,
 
TP_PROTO(u32 core_busy,
diff --git a/kernel/trace/power-traces.c b/kernel/trace/power-traces.c
index eb4220a..81b8745 100644
--- a/kernel/trace/power-traces.c
+++ b/kernel/trace/power-traces.c
@@ -15,4 +15,5 @@
 
 EXPORT_TRACEPOINT_SYMBOL_GPL(suspend_resume);
 EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle);
+EXPORT_TRACEPOINT_SYMBOL_GPL(powernv_throttle);
 
-- 
1.9.3

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


[PATCH v2 2/2] cpufreq: powernv: Redesign the presentation of throttle notification

2016-01-01 Thread Shilpasri G Bhat
Replace the throttling event console messages to perf trace point
"power:powernv_throttle" and throttle counter stats which are
exported in sysfs in /sys/devices/system/cpu/cpufreq/chipN. The
newly added sysfs files are as follows:

1)/sys/devices/system/cpu/cpufreq/chip0/throttle_frequencies
  This gives the throttle stats for each of the available frequencies.
  The throttle stat of a frequency is the total number of times the max
  frequency is reduced to that frequency.
  # cat /sys/devices/system/cpu/cpufreq/chip0/throttle_frequencies
  4023000 0
  399 0
  3956000 1
  3923000 0
  389 0
  3857000 2
  3823000 0
  379 0
  3757000 2
  3724000 1
  369 1
  ...

2)/sys/devices/system/cpu/cpufreq/chip0/throttle_reasons
  This directory contains throttle reason files. Each file gives the
  total number of times the max frequency is throttled, except for
  'throttle_reset', which gives the total number of times the max
  frequency is unthrottled after being throttled.
  # cd /sys/devices/system/cpu/cpufreq/chip0/throttle_reasons
  # cat cpu_over_temperature
  7
  # cat occ_reset
  0
  # cat over_current
  0
  # cat power_cap
  0
  # cat power_supply_failure
  0
  # cat throttle_reset
  7

3)/sys/devices/system/cpu/cpufreq/chip0/throttle_stat
  This gives the total number of events of max frequency throttling to
  lower frequencies in the turbo range of frequencies and the sub-turbo(at
  and below nominal) range of frequencies.
  # cat /sys/devices/system/cpu/cpufreq/chip0/throttle_stat
  turbo 7
  sub-turbo 0

Signed-off-by: Shilpasri G Bhat 
---
Changes from v1:
- Added a kobject to struct chip
- Grouped the throttle reasons under a separate attribute_group and
  exported each reason as individual file.
- Moved the sysfs files from /sys/devices/system/node/nodeN to
  /sys/devices/system/cpu/cpufreq/chipN
- As suggested by Paul Clarke replaced 'Nominal' with 'sub-turbo' and
  char * throttle_reason[][30] by const char * const throttle_reason[].
- Modified the commit message.

 drivers/cpufreq/powernv-cpufreq.c | 247 +++---
 1 file changed, 204 insertions(+), 43 deletions(-)

diff --git a/drivers/cpufreq/powernv-cpufreq.c 
b/drivers/cpufreq/powernv-cpufreq.c
index cb50138..00caef1 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -43,12 +44,37 @@
 static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1];
 static bool rebooting, throttled, occ_reset;
 
+static const char * const throttle_reason[] = {
+   "No throttling",
+   "Power Cap",
+   "Processor Over Temperature",
+   "Power Supply Failure",
+   "Over Current",
+   "OCC Reset"
+};
+
+enum throt_reason_type {
+   NO_THROTTLE = 0,
+   POWERCAP,
+   CPU_OVERTEMP,
+   POWER_SUPPLY_FAILURE,
+   OVERCURRENT,
+   OCC_RESET_THROTTLE
+};
+
 static struct chip {
unsigned int id;
bool throttled;
cpumask_t mask;
struct work_struct throttle;
bool restore;
+   /* Pmax throttle stats */
+   int throt_reason;
+   int throt_turbo;
+   int throt_nominal;
+   int reason[OCC_MAX_THROTTLE_STATUS + 1];
+   int *pstate_stat;
+   struct kobject *kobj;
 } *chips;
 
 static int nr_chips;
@@ -309,11 +335,11 @@ static inline unsigned int get_nominal_index(void)
return powernv_pstate_info.max - powernv_pstate_info.nominal;
 }
 
-static void powernv_cpufreq_throttle_check(void *data)
+static void powernv_cpufreq_read_pmax(void *data)
 {
unsigned int cpu = smp_processor_id();
unsigned long pmsr;
-   int pmsr_pmax, i;
+   int pmsr_pmax, i, index;
 
pmsr = get_pmspr(SPRN_PMSR);
 
@@ -321,28 +347,43 @@ static void powernv_cpufreq_throttle_check(void *data)
if (chips[i].id == cpu_to_chip_id(cpu))
break;
 
-   /* Check for Pmax Capping */
pmsr_pmax = (s8)PMSR_MAX(pmsr);
if (pmsr_pmax != powernv_pstate_info.max) {
if (chips[i].throttled)
-   goto next;
+   return;
chips[i].throttled = true;
-   if (pmsr_pmax < powernv_pstate_info.nominal)
-   pr_crit("CPU %d on Chip %u has Pmax reduced below 
nominal frequency (%d < %d)\n",
-   cpu, chips[i].id, pmsr_pmax,
+   if (pmsr_pmax < powernv_pstate_info.nominal) {
+   pr_warn_once("CPU %d on Chip %u has Pmax reduced below 
nominal frequency (%d < %d)\n",
+cpu, chips[i].id, pmsr_pmax,
powernv_pstate_info.nominal);
-   else
-   pr_info("CPU %d on Chip %u has Pmax reduced below turbo 
frequency (%d < %d)\n",
-   cpu, chips[i].id, pmsr_pmax,
- 

Re: [PATCHV5 3/3] x86, ras: Add __mcsafe_copy() function to recover from machine checks

2016-01-01 Thread Tony Luck
Somehow this didn't get sent ... found it in the "Drafts" folder.  But
it's rubbish, skip to the
bottom.

On Thu, Dec 31, 2015 at 12:30 PM, Tony Luck  wrote:
> I switched to BIAS 0xC000 ... and now I should get class 1 entries
> (bit31=0, bit30=1).
>
> New patch series coming soon.

Or not :-(

arch/x86/lib/lib.a(memcpy_64.o):(__ex_table+0x4): relocation truncated
to fit: R_X86_64_PC32 against `.fixup'
arch/x86/lib/lib.a(memcpy_64.o):(__ex_table+0xc): relocation truncated
to fit: R_X86_64_PC32 against `.fixup'
...

I guess it was something like this that made you do the 0x2000 and
subtract the BIAS?

I have a bad feeling that we may not really have four classes, just three:

00: no funny arithmetic
10: BIAS = 0x8000 ... doesn't trigger truncation warning because
sign bit is set
11: BIAS = 0x4000 ... ditto
01: BIAS = ? ... Is there some magic value for BIAS that gets this?

--- end of Draft ... now to the real bit

Not sure why I was hung up on *subtracting* values to get the desired
class bits. Just
blindly copying the initial case from your patch?

If you can't get from A to B one way, try going around the other
direction. Subtracting
0xC000 is the same as adding 0x4000 (when playing with u32 values).
That doesn't upset the linker.

I rebased:
git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git mcsafev6

still needs a little cleanup, but it all works, and seems to be a much
cleaner approach.  So clean that I wonder whether I really need
the CONFIG_MCE_KERNEL_RECOVERY any more?? The only
place it is used now is around the __mcsafe_copy()

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 PATCH v1 4/4] clk: rockchip: rk3036: fix and add node id for emac clock

2016-01-01 Thread Heiko Stübner
Hi Xing,

Am Dienstag, 29. Dezember 2015, 10:34:09 schrieb Xing Zheng:
> On 2015年12月29日 09:59, Yakir Yang wrote:
> > On 12/28/2015 08:41 PM, Heiko Stübner wrote:
> >> Am Montag, 28. Dezember 2015, 17:03:53 schrieb Xing Zheng:
> >>> Due to referred old version TRM, there is incorrect emac clock node,
> >>> we should fix it. The SEL_21_9 is the parent of SEL_21_4.
> >>> 
> >>> In the emac driver, we need to refer HCLK_MAC, and because There are
> >>> only 3PLLs (APLL/GPLL/DPLL) on the rk3036, most clock are under the
> >>> GPLL, and it is unable to provide the accurate rate for mac_ref which
> >>> need to 50MHz probability, we should let it under the APLL and are
> >>> able to set the freq which integer multiples of 50MHz, so we add these
> >>> emac node for reference.
> >> 
> >> I don't really follow here. While I do understand that the emac needs
> >> 50MHz, I
> >> don't think using the APLL as source is helpful.
> >> 
> >> The APLL is the main clocksource for the cpu-cores, including frequency
> >> scaling, and while it currently only lists 816MHz as sole frequency,
> >> you're
> >> pretty much guaranteed to not get your correct multiple of 50MHz from
> >> there
> >> either. And limiting the cpu to just do 600MHz to get the mac working
> >> sounds
> >> pretty bad ;-) .
> >> 
> >> 
> >> In the rk3036 cru-node the gpll gets set to 594MHz. Is there a
> >> special reason
> >> why it needs to be 594MHz and cannot be a round 600MHz? Because that
> >> would
> >> also provide your 50MHz-multiple nicely.
> > 
> > Yes, this magic 594MHz would help to support the standard HDMI
> > resolutions, here are the math:
> > 
> > 1920x1080-60Hz DCLK = 148.5MHz = 594MHz / 4
> > 1280x720-60Hz DCLK = 74.25MHz = 594MHz / 8
> > 720x480-60Hz DCLK = 27MHz = 594MHz / 22
> > 
> > Thanks,
> > - Yakir
> 
> Thanks Yakir.
> 
> Hi Heiko,
>  From the above, do you have better idea for the RK3036's emac without
> ext-oscillator?

During the last days I did play a bit with the clock framework. As I don't 
have a Kylin (or any rk3036) board, I did build a test-case with pclk_cpu on 
the rk3188 (which can be affected by the armclk if not reparented to the 
gpll), which got sucessfully adapted to get back to (or near) the originally 
requested frequency.

So ideally you could roll back your mux/div split here and try the attached 
diff. In theory it should help :-) .
As can be seen by the FIXMEs, not fully finished, but I'd like to determine if 
it fixes the issue at least.


Heiko
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 7bbb0fd..83a7234 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1423,6 +1423,9 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
 	return fail_clk;
 }
 
+static int clk_core_set_rate_nolock(struct clk_core *core,
+unsigned long req_rate);
+
 /*
  * walk down a subtree and set the new rates notifying the rate
  * change on the way
@@ -1438,6 +1441,7 @@ static void clk_change_rate(struct clk_core *core)
 
 	old_rate = core->rate;
 
+printk("%s: %s requested %lu, new %lu\n", __func__, core->name, core->req_rate, core->new_rate);
 	if (core->new_parent)
 		best_parent_rate = core->new_parent->rate;
 	else if (core->parent)
@@ -1507,6 +1511,12 @@ static void clk_change_rate(struct clk_core *core)
 	/* handle the new child who might not be in core->children yet */
 	if (core->new_child)
 		clk_change_rate(core->new_child);
+
+	/* FIXME: add flag to limit to specific clocks? */
+	if (core->req_rate && core->new_rate != old_rate) {
+		printk("\t\ttrying to adapt %s\n", core->name);
+		clk_core_set_rate_nolock(core, core->req_rate);
+	}
 }
 
 static int clk_core_set_rate_nolock(struct clk_core *core,
@@ -1520,8 +1530,10 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
 		return 0;
 
 	/* bail early if nothing to do */
-	if (rate == clk_core_get_rate_nolock(core))
+	if (rate == clk_core_get_rate_nolock(core)) {
+		core->req_rate = req_rate;
 		return 0;
+	}
 
 	if ((core->flags & CLK_SET_RATE_GATE) && core->prepare_count)
 		return -EBUSY;
@@ -1612,9 +1624,14 @@ int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max)
 	clk_prepare_lock();
 
 	if (min != clk->min_rate || max != clk->max_rate) {
+		unsigned long rate = clk->core->req_rate;
+
+		if (!rate)
+			rate = clk->core->rate;
+
 		clk->min_rate = min;
 		clk->max_rate = max;
-		ret = clk_core_set_rate_nolock(clk->core, clk->core->req_rate);
+		ret = clk_core_set_rate_nolock(clk->core, rate);
 	}
 
 	clk_prepare_unlock();
@@ -2451,7 +2468,7 @@ static int __clk_init(struct device *dev, struct clk *clk_user)
 		rate = core->parent->rate;
 	else
 		rate = 0;
-	core->rate = core->req_rate = rate;
+	core->rate = rate;
 
 	/*
 	 * walk the list of orphan clocks and reparent any that are children of
@@ -2798,6 +2815,7 @@ int __clk_get(struct clk *clk)
 
 void __clk_put(struct clk *clk)
 {
+	unsigned long rate;
 	struct module *owner;
 
 	if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
@@ -2806,9 

[GIT PULL rcu/next] RCU commits for 4.5

2016-01-01 Thread Paul E. McKenney
Hello, Ingo,

The changes in this series include the following:

1.  Adding transitivity uniformly to rcu_node structure ->lock
acquisitions.  (This is implemented by the first two commits
on top of v4.4-rc2 due to the pervasive nature of this change.)

http://article.gmane.org/gmane.linux.kernel/2100835

2.  Documentation updates, including RCU requirements.

http://article.gmane.org/gmane.linux.kernel/2104628

3.  Expedited grace-period changes.

http://article.gmane.org/gmane.linux.kernel/2104595

4.  Miscellaneous fixes.

http://article.gmane.org/gmane.linux.kernel/2104612

5.  Linked-list fixes, courtesy of KTSAN.

http://article.gmane.org/gmane.linux.kernel/2100875

6.  Torture-test updates.

http://article.gmane.org/gmane.linux.kernel/2104652

7.  Late-breaking fix to sysrq-generated crash.

http://article.gmane.org/gmane.linux.kernel/2111676

All of these changes have been subjected to 0day Test Robot and -next
testing, and are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git for-mingo

for you to fetch changes up to 984cf355aeaa8f2eda3861b50d0e8d3e3f77e83b:

  sysrq: Fix warning in sysrq generated crash. (2015-12-29 16:29:18 -0800)


Alexey Kardashevskiy (2):
  rcu: Fix comment for rcu_dereference_raw_notrace
  list: Add lockless list traversal primitives

Ani Sinha (1):
  sysrq: Fix warning in sysrq generated crash.

Chris Metcalf (1):
  Documentation/memory-barriers.txt: Fix ACCESS_ONCE thinko

Paul E. McKenney (41):
  list: Use WRITE_ONCE() when adding to lists and hlists
  list: Use READ_ONCE() when testing for empty lists
  rcu: Add transitivity to remaining rcu_node ->lock acquisitions
  rcu: Short-circuit synchronize_sched_expedited() if only one CPU
  rcu: Clarify role of ->expmaskinitnext
  rcu: Move smp_mb() from rcu_seq_snap() to rcu_exp_gp_seq_snap()
  rcu: Invert sync_rcu_exp_select_cpus() "if" statement
  rcu: Reduce expedited GP memory contention via per-CPU variables
  rcu: Make expedited grace periods resolve stall-warning ties
  rcu: Add more diagnostics to expedited stall warning messages.
  rcu: Add rcu_normal kernel parameter to suppress expediting
  rcu: Wire up rcu_end_inkernel_boot()
  rcu: Allow expedited grace periods to be disabled at init
  rcu: Move lock_class_key to local scope
  rcu: Simplify rcu_sched_qs() control flow
  rcu: Remove lock-acquisition loop from rcu_read_unlock_special()
  rcu: Fix obsolete rcu_bootup_announce_oddness() comment
  rcu: Avoid tick_nohz_active checks on NOCBs CPUs
  rcu: Stop disabling interrupts in scheduler fastpaths
  list: Use WRITE_ONCE() when initializing list_head structures
  documentation: Record RCU requirements
  Documentation: Record bottom-bit-zero guarantee for ->next
  documentation: Cover requirements controlling stall warnings
  documentation: Composability analogies
  documentation: Expand on scheduler/RCU deadlock requirements
  documentation: Clarify RCU memory barriers and requirements
  documentation: Update RCU requirements based on expedited changes
  rcutorture: Add batch number to script printout
  rcutorture: Flag nonexistent RCU GP kthread
  rcutorture:  Dump stack when GP kthread stalls
  rcutorture: Default grace period to three minutes, allow override
  rcutorture: Print symbolic name for rcu_torture_writer_state
  rcutorture: Print symbolic name for ->gp_state
  torture: Abbreviate console error dump
  torture: Place console.log files correctly from the get-go
  rcu: Remove TINY_RCU bloat from pointless boot parameters
  rcu: Eliminate unused rcu_init_one() argument
  rcu: Make cpu_needs_another_gp() be bool
  rcu: Don't redundantly disable irqs in rcu_irq_{enter,exit}()
  rcu: Make rcu_gp_init() be bool rather than int
  Merge branches 'doc.2015.12.05a', 'exp.2015.12.07a', 'fixes.2015.12.07a', 
'list.2015.12.04b' and 'torture.2015.12.05a' into HEAD

Paul Gortmaker (1):
  kernel: Make rcu/tree_trace.c explicitly non-modular

Peter Zijlstra (2):
  rcu: Create transitive rnp->lock acquisition functions
  rcu: Move wakeup out from under rnp->lock

Petko Manolov (1):
  list: Introduces generic list_splice_tail_init_rcu()

Yang Shi (1):
  rcutorture: Remove CONFIG_RCU_USER_QS from rcutorture selftest doc

 .../RCU/Design/Requirements/2013-08-is-it-dead.png |  Bin 0 -> 100825 bytes
 .../Design/Requirements/GPpartitionReaders1.svg|  374 +++
 .../RCU/Design/Requirements/RCUApplicability.svg   |  237 ++
 .../Design/Requirements/ReadersPartitionGP1.svg|  639 +
 .../RCU/Design/Requirements/Requirements.html  | 2897 
 .../RCU/Design/Requirements/Requirements.htmlx 

Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl

2016-01-01 Thread Arnd Bergmann
On Friday 01 January 2016 10:34:25 Sudip Mukherjee wrote:
> > Did you happen to check with both 32-bit and 64-bit user space on a
> > 64-bit kernel? This is one of the things that was not working originally
> > but should work now.
> 
> I dont think I can manage 32 bit userspace on 64-bit kernel here. But I
> can definitely check it on a kvm guest.

Just to be sure we are talking about the same thing: you mean running a 64-bit
kernel in a kvm guest with a 32-bit file system, right? Running a 32-bit
kvm guest on a 64-bit host would not be interesting of course.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] [BUG] clk: rockchip: don't mark clock names as initconst

2016-01-01 Thread Heiko Stübner
Am Freitag, 1. Januar 2016, 22:50:43 schrieb Arnd Bergmann:
> On Friday 01 January 2016 18:06:30 Heiko Stübner wrote:
> > "[PATCH] clk: rockchip: fix section mismatches with new child-clocks" [0]
> > 
> > should be in Mike's + Stephen's inbox since last week as well, which moves
> > the offending new elements into separate entities, which can have
> > __initdata attributes again.
> > 
> > 
> > Heiko
> > 
> > [0] http://www.spinics.net/lists/arm-kernel/msg471295.html
> 
> The patch looks good, but for some reason, the next-20151223 kernel had no
> problem and next-20151231 was broken, the top commits in
> drivers/clk/rockchips are:

That is correct. next-20151223 did not contain the offending patches yet. 
After the patches got merged into the clock-tree the kbuild-robot alerted us 
to the __initdata issue, so I created the linked patch as fixup.


Heiko

> 
> commit a915e30dd26ea5f3cc2e2c044aba38ee5973d3fa
> Merge: ce6dd266d535 b0158bb27c7b
> Author: Michael Turquette 
> Date:   Wed Dec 23 13:08:56 2015 -0800
> 
> Merge branch 'clk-rockchip' into clk-next
> 
> commit b0158bb27c7b6e9843f541c17b24dbd964b76db6
> Author: Xing Zheng 
> Date:   Tue Dec 22 22:28:01 2015 +0100
> 
> clk: rockchip: rk3036: include downstream muxes into fractional dividers
> 
> Use the newly introduced possibility to combine the fractional dividers
> 
> 
>   Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/3] drm: arm-hdlcd: add explictit DRM dependency

2016-01-01 Thread Arnd Bergmann
CONFIG_DRM_HDLCD is a tristate option that depends on the boolean
CONFIG_DRM_ARM, which in turn depends on the tristate CONFIG_DRM.
The effect of this is that a configuration with CONFIG_DRM=m
and CONFIG_DRM_HDLCD=y can be chosen, but won't link because the
DRM core symbols are not reachable from builtin code:

drivers/built-in.o: In function `hdlcd_drm_unbind':
drivers/gpu/drm/arm/hdlcd_drv.c:445: undefined reference to `drm_fbdev_cma_fini'
drivers/gpu/drm/arm/hdlcd_drv.c:448: undefined reference to 
`drm_kms_helper_poll_fini'
drivers/gpu/drm/arm/hdlcd_drv.c:450: undefined reference to `drm_vblank_cleanup'
drivers/gpu/drm/arm/hdlcd_drv.c:452: undefined reference to `drm_irq_uninstall'
drivers/gpu/drm/arm/hdlcd_drv.c:460: undefined reference to 
`drm_mode_config_cleanup'
drivers/gpu/drm/arm/hdlcd_drv.c:461: undefined reference to `drm_dev_unregister'
drivers/gpu/drm/arm/hdlcd_drv.c:462: undefined reference to `drm_dev_unref'
...

This adds another dependency on CONFIG_DRM to enforce that DRM_HDLCD
cannot be builtin if DRM is not.

Signed-off-by: Arnd Bergmann 
---
Ok, I found yet another one after a few hundred extra randconfig builds
on today's next. Let me know if you'd rather have the three Kconfig
changes combined into a single patch, it's starting to get ridiculous.

diff --git a/drivers/gpu/drm/arm/Kconfig b/drivers/gpu/drm/arm/Kconfig
index 81ea7802ca50..487fb1f0c979 100644
--- a/drivers/gpu/drm/arm/Kconfig
+++ b/drivers/gpu/drm/arm/Kconfig
@@ -7,7 +7,7 @@ config DRM_ARM
 
 config DRM_HDLCD
tristate "ARM HDLCD"
-   depends on DRM_ARM
+   depends on DRM_ARM && DRM
depends on COMMON_CLK
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER

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


Re: [RFC PATCH] ARM: pxa: add defconfig covering all the boards

2016-01-01 Thread Robert Jarzmik
Arnd Bergmann  writes:

> Sorry for the late reply. I think this is great and I'd like to just apply it.
> Can you re-send to a...@kernel.org if you're happy with that?
Yep.

> Looking at your description above, I see that you included pxa168_defconfig
> and pxa910_defconfig as well, but they are mach-mmp rather than mach-pxa.
> Can you check if that has added in anything we don't want?
Yep, done.

I added some pxa forgotten sound SoC machine code, I'll send a proper patch once
it passes my testers.

Cheers.

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


Re: [PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2016-01-01 Thread Arnd Bergmann
On Friday 01 January 2016 20:32:30 Roman Volkov wrote:
> > Applied both to next/dt, thanks a lot for following up!
> > 
> > Let me know if you think this should go into stable backports as well,
> > I did not apply it to the fixes branch as you don't have a
> > 'Cc: sta...@vger.kernel.org' tag and it has never worked so far.
> 
> Yes, this must go into the stable too. Let me know if I must change
> something or resend.

I can put them in the fixes branch with the appropriate stable
tag myself, but please clarify whether we need just the first or
both patches there. It looks to me that the second one while
correct only addresses a cosmetic problem and everything works
without it.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] [BUG] clk: rockchip: don't mark clock names as initconst

2016-01-01 Thread Arnd Bergmann
On Friday 01 January 2016 18:06:30 Heiko Stübner wrote:
> 
> "[PATCH] clk: rockchip: fix section mismatches with new child-clocks" [0]
> 
> should be in Mike's + Stephen's inbox since last week as well, which moves 
> the 
> offending new elements into separate entities, which can have __initdata 
> attributes again.
> 
> 
> Heiko
> 
> [0] http://www.spinics.net/lists/arm-kernel/msg471295.html

The patch looks good, but for some reason, the next-20151223 kernel had no
problem and next-20151231 was broken, the top commits in drivers/clk/rockchips
are:

commit a915e30dd26ea5f3cc2e2c044aba38ee5973d3fa
Merge: ce6dd266d535 b0158bb27c7b
Author: Michael Turquette 
Date:   Wed Dec 23 13:08:56 2015 -0800

Merge branch 'clk-rockchip' into clk-next

commit b0158bb27c7b6e9843f541c17b24dbd964b76db6
Author: Xing Zheng 
Date:   Tue Dec 22 22:28:01 2015 +0100

clk: rockchip: rk3036: include downstream muxes into fractional dividers

Use the newly introduced possibility to combine the fractional dividers


Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: read scrolled-back VT

2016-01-01 Thread covici
Tested  on 4.1.15 and it seems to work fine -- thanks a lot.

Samuel Thibault  wrote:

> Previously, speakup would always read the bottom part of the screen,
> even when the VT is scrolled back with shift-page.  This patch makes
> vt.c export screen_pos so that speakup can use it to properly access
> the content of the scrolled-back VT.
> 
> This was tested with both vgacon and fbcon.
> 
> Signed-off-by: Samuel Thibault 
> 
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -4250,6 +4250,7 @@ unsigned short *screen_pos(struct vc_dat
>  {
>   return screenpos(vc, 2 * w_offset, viewed);
>  }
> +EXPORT_SYMBOL_GPL(screen_pos);
>  
>  void getconsxy(struct vc_data *vc, unsigned char *p)
>  {
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -264,8 +264,9 @@ static struct notifier_block vt_notifier
>   .notifier_call = vt_notifier_call,
>  };
>  
> -static unsigned char get_attributes(u16 *pos)
> +static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
>  {
> + pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
>   return (u_char) (scr_readw(pos) >> 8);
>  }
>  
> @@ -275,7 +276,7 @@ static void speakup_date(struct vc_data
>   spk_y = spk_cy = vc->vc_y;
>   spk_pos = spk_cp = vc->vc_pos;
>   spk_old_attr = spk_attr;
> - spk_attr = get_attributes((u_short *) spk_pos);
> + spk_attr = get_attributes(vc, (u_short *)spk_pos);
>  }
>  
>  static void bleep(u_short val)
> @@ -469,8 +470,12 @@ static u16 get_char(struct vc_data *vc,
>   u16 ch = ' ';
>  
>   if (vc && pos) {
> - u16 w = scr_readw(pos);
> - u16 c = w & 0xff;
> + u16 w;
> + u16 c;
> +
> + pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
> + w = scr_readw(pos);
> + c = w & 0xff;
>  
>   if (w & vc->vc_hi_font_mask)
>   c |= 0x100;
> @@ -746,7 +751,7 @@ static int get_line(struct vc_data *vc)
>   u_char tmp2;
>  
>   spk_old_attr = spk_attr;
> - spk_attr = get_attributes((u_short *) spk_pos);
> + spk_attr = get_attributes(vc, (u_short *)spk_pos);
>   for (i = 0; i < vc->vc_cols; i++) {
>   buf[i] = (u_char) get_char(vc, (u_short *) tmp, );
>   tmp += 2;
> @@ -811,7 +816,7 @@ static int say_from_to(struct vc_data *v
>   u_short saved_punc_mask = spk_punc_mask;
>  
>   spk_old_attr = spk_attr;
> - spk_attr = get_attributes((u_short *) from);
> + spk_attr = get_attributes(vc, (u_short *)from);
>   while (from < to) {
>   buf[i++] = (char)get_char(vc, (u_short *) from, );
>   from += 2;
> @@ -886,7 +891,7 @@ static int get_sentence_buf(struct vc_da
>   sentmarks[bn][0] = [bn][0];
>   i = 0;
>   spk_old_attr = spk_attr;
> - spk_attr = get_attributes((u_short *) start);
> + spk_attr = get_attributes(vc, (u_short *)start);
>  
>   while (start < end) {
>   sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, );
> @@ -1585,7 +1590,7 @@ static int count_highlight_color(struct
>   u16 *ptr;
>  
>   for (ptr = start; ptr < end; ptr++) {
> - ch = get_attributes(ptr);
> + ch = get_attributes(vc, ptr);
>   bg = (ch & 0x70) >> 4;
>   speakup_console[vc_num]->ht.bgcount[bg]++;
>   }
> ___
> Speakup mailing list
> spea...@linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
> 

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

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


Re: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker()

2016-01-01 Thread Julia Lawall


On Fri, 1 Jan 2016, SF Markus Elfring wrote:

> From: Markus Elfring 
> Date: Fri, 1 Jan 2016 22:27:20 +0100
> 
> This issue was detected by using the Coccinelle software.
> 
> Move the jump label directly before the desired log statement
> so that the variable "err" will not be checked once more
> after it was determined that a function call failed.

Putting a label inside an if is ugly.

julia

> Use the identifier "report_failure" instead of the label "err".
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/net/wireless/marvell/libertas/if_spi.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c 
> b/drivers/net/wireless/marvell/libertas/if_spi.c
> index 82c0796..c9ae27e 100644
> --- a/drivers/net/wireless/marvell/libertas/if_spi.c
> +++ b/drivers/net/wireless/marvell/libertas/if_spi.c
> @@ -880,18 +880,18 @@ static void if_spi_host_to_card_worker(struct 
> work_struct *work)
>   );
>   if (err) {
>   netdev_err(priv->dev, "I/O error\n");
> - goto err;
> + goto report_failure;
>   }
>  
>   if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
>   err = if_spi_c2h_cmd(card);
>   if (err)
> - goto err;
> + goto report_failure;
>   }
>   if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
>   err = if_spi_c2h_data(card);
>   if (err)
> - goto err;
> + goto report_failure;
>   }
>  
>   /*
> @@ -940,9 +940,10 @@ static void if_spi_host_to_card_worker(struct 
> work_struct *work)
>   if (hiStatus & IF_SPI_HIST_CARD_EVENT)
>   if_spi_e2h(card);
>  
> -err:
> - if (err)
> + if (err) {
> +report_failure:
>   netdev_err(priv->dev, "%s: got error %d\n", __func__, err);
> + }
>  
>   lbs_deb_leave(LBS_DEB_SPI);
>  }
> -- 
> 2.6.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 22:27:20 +0100

This issue was detected by using the Coccinelle software.

Move the jump label directly before the desired log statement
so that the variable "err" will not be checked once more
after it was determined that a function call failed.
Use the identifier "report_failure" instead of the label "err".

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/marvell/libertas/if_spi.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c 
b/drivers/net/wireless/marvell/libertas/if_spi.c
index 82c0796..c9ae27e 100644
--- a/drivers/net/wireless/marvell/libertas/if_spi.c
+++ b/drivers/net/wireless/marvell/libertas/if_spi.c
@@ -880,18 +880,18 @@ static void if_spi_host_to_card_worker(struct work_struct 
*work)
);
if (err) {
netdev_err(priv->dev, "I/O error\n");
-   goto err;
+   goto report_failure;
}
 
if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
err = if_spi_c2h_cmd(card);
if (err)
-   goto err;
+   goto report_failure;
}
if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
err = if_spi_c2h_data(card);
if (err)
-   goto err;
+   goto report_failure;
}
 
/*
@@ -940,9 +940,10 @@ static void if_spi_host_to_card_worker(struct work_struct 
*work)
if (hiStatus & IF_SPI_HIST_CARD_EVENT)
if_spi_e2h(card);
 
-err:
-   if (err)
+   if (err) {
+report_failure:
netdev_err(priv->dev, "%s: got error %d\n", __func__, err);
+   }
 
lbs_deb_leave(LBS_DEB_SPI);
 }
-- 
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: net/nfc: GPF in llcp_sock_getname

2016-01-01 Thread Cong Wang
On Fri, Jan 1, 2016 at 5:58 AM, Dmitry Vyukov  wrote:
>
> kasan: GPF could be caused by NULL-ptr deref or user memory
> accessgeneral protection fault:  [#51] SMP KASAN
> Modules linked in:
> CPU: 2 PID: 4207 Comm: a.out Not tainted 4.4.0-rc7+ #184
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> task: 8800683e9780 ti: 880064c7 task.ti: 880064c7
> RIP: 0010:[]  []
> kasan_report_error+0x1b/0x560
> RSP: 0018:880064c77c90  EFLAGS: 00010286
> RAX: dc00 RBX: 0003 RCX: dc00
> RDX:  RSI: 0003 RDI: 880064c77c98
> RBP: 880064c77cc0 R08: ed000c98efd6 R09: 880064c77e58
> R10: 8800639670a0 R11: 880063967098 R12: 880064c77e6a
> R13:  R14:  R15: 880063967088
> FS:  018ca880(0063) GS:88006da0() knlGS:
> CS:  0010 DS:  ES:  CR0: 8005003b
> CR2: 00c8200012e0 CR3: 64c59000 CR4: 06e0
> Stack:
>  816d25d4  0018 0003
>  00034000 816d17ed 880064c77cd0 816d1264
>  880064c77cf8 816d17ed  880064c77e58
> Call Trace:
>  [< inline >] check_memory_region mm/kasan/kasan.c:264
>  [] __asan_loadN+0x124/0x1a0 mm/kasan/kasan.c:512
>  [] memcpy+0x1d/0x40 mm/kasan/kasan.c:297
>  [] llcp_sock_getname+0x424/0x600 net/nfc/llcp_sock.c:519
>  [] SYSC_getsockname+0x1bd/0x220 net/socket.c:1570
>  [] SyS_getsockname+0x24/0x30 net/socket.c:1555
>  [] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
> Code: 48 01 c7 e8 38 2b fc ff 5d c3 66 0f 1f 44 00 00 48 8b 17 48 b9
> 00 00 00 00 00 fc ff df 48 8b 77 10 48 89 d0 48 c1 e8 03 48 01 c8 <80>
> 38 00 75 1d 48 01 d6 eb 13 48 83 c2 08 48 89 d0 48 c1 e8 03
> RIP  [] kasan_report_error+0x1b/0x560 mm/kasan/report.c:214
>  RSP 
> ---[ end trace b0c68fb0d02b9447 ]---
>
> On commit 8513342170278468bac126640a5d2d12ffbff106 (Dec 28).
> GPF seems to be caused by a data race on socket state.

It looks like we forget to initialize ->service_name_len
and ->servicce_name before bind().

Could you try the following patch?

Thanks!

->

diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index ecf0a01..252f3c0 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -961,6 +961,8 @@ struct sock *nfc_llcp_sock_alloc(struct socket
*sock, int type, gfp_t gfp, int k

llcp_sock->ssap = 0;
llcp_sock->dsap = LLCP_SAP_SDP;
+   llcp_sock->service_name_len = 0;
+   llcp_sock->service_name = NULL;
llcp_sock->rw = LLCP_MAX_RW + 1;
llcp_sock->miux = cpu_to_be16(LLCP_MAX_MIUX + 1);
llcp_sock->send_n = llcp_sock->send_ack_n = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] net-iwlegacy: Another refactoring for il_eeprom_init()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 21:16:01 +0100

Rename a jump label according to the current Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/intel/iwlegacy/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/common.c 
b/drivers/net/wireless/intel/iwlegacy/common.c
index ae45fd3..660ab2b 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -759,7 +759,7 @@ il_eeprom_init(struct il_priv *il)
 IL_EEPROM_ACCESS_TIMEOUT);
if (ret < 0) {
IL_ERR("Time out reading EEPROM[%d]\n", addr);
-   goto done;
+   goto release_semaphore;
}
r = _il_rd(il, CSR_EEPROM_REG);
e[addr / 2] = cpu_to_le16(r >> 16);
@@ -769,7 +769,7 @@ il_eeprom_init(struct il_priv *il)
 il_eeprom_query16(il, EEPROM_VERSION));
 
ret = 0;
-done:
+release_semaphore:
il->ops->eeprom_release_semaphore(il);
 
if (ret) {
-- 
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/3] net-iwlegacy: One check less in il_eeprom_init() after error detection

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 21:12:29 +0100

This issue was detected by using the Coccinelle software.

Adjust a jump target to avoid a check repetition before the function
call "il_eeprom_free".

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/intel/iwlegacy/common.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/common.c 
b/drivers/net/wireless/intel/iwlegacy/common.c
index c3afaf7..ae45fd3 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -734,7 +734,7 @@ il_eeprom_init(struct il_priv *il)
if (ret < 0) {
IL_ERR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
ret = -ENOENT;
-   goto err;
+   goto free_eeprom;
}
 
/* Make sure driver (instead of uCode) is allowed to read EEPROM */
@@ -742,7 +742,7 @@ il_eeprom_init(struct il_priv *il)
if (ret < 0) {
IL_ERR("Failed to acquire EEPROM semaphore.\n");
ret = -ENOENT;
-   goto err;
+   goto free_eeprom;
}
 
/* eeprom is an array of 16bit values */
@@ -772,9 +772,11 @@ il_eeprom_init(struct il_priv *il)
 done:
il->ops->eeprom_release_semaphore(il);
 
-err:
-   if (ret)
+   if (ret) {
+free_eeprom:
il_eeprom_free(il);
+   }
+
/* Reset chip to save power until we load uCode during "up". */
il_apm_stop(il);
return ret;
-- 
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 1/3] net-iwlegacy: Refactoring for il_eeprom_init()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 20:54:25 +0100

Return directly if a memory allocation failed at the beginning.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/intel/iwlegacy/common.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/common.c 
b/drivers/net/wireless/intel/iwlegacy/common.c
index eb5cb60..c3afaf7 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -723,10 +723,9 @@ il_eeprom_init(struct il_priv *il)
sz = il->cfg->eeprom_size;
D_EEPROM("NVM size = %d\n", sz);
il->eeprom = kzalloc(sz, GFP_KERNEL);
-   if (!il->eeprom) {
-   ret = -ENOMEM;
-   goto alloc_err;
-   }
+   if (!il->eeprom)
+   return -ENOMEM;
+
e = (__le16 *) il->eeprom;
 
il->ops->apm_init(il);
@@ -778,7 +777,6 @@ err:
il_eeprom_free(il);
/* Reset chip to save power until we load uCode during "up". */
il_apm_stop(il);
-alloc_err:
return ret;
 }
 EXPORT_SYMBOL(il_eeprom_init);
-- 
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/3] net-iwlegacy: Fine-tuning for il_eeprom_init()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 21:25:43 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Refactoring
  One check less after error detection
  Another refactoring

 drivers/net/wireless/intel/iwlegacy/common.c | 22 +++---
 1 file changed, 11 insertions(+), 11 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 RESEND 1/3] clocksource/vt8500: Use MIN_OSCR_DELTA from PXA

2016-01-01 Thread Robert Jarzmik
Roman Volkov  writes:

> В Thu, 31 Dec 2015 23:33:45 +0100 (CET)
> Thomas Gleixner  пишет:
>
>> Roman,
>> 
>> On Thu, 31 Dec 2015, Roman Volkov wrote:
>> > Since vt8500 and PXA timers are identical, use MIN_OSCR_DELTA from
>> > PXA, which is bigger than existing value. It is required to
>> > determine the minimum delay which hardware can generate.  
>> 
>> Now that brings up the obvious question:
>> 
>> If the vt8500 and PXA timers are identical why has vt8500 it's own
>> slightly different implementation and does not use the PXA timer?
>
> Thomas,
>
> I occasionally noticed that the PXA can be reused, when working on the
> bugfix for vt8500. Another good question would be how exactly this code
> can be reused. We may rework PXA driver to make it working under
> vt8500, or include the C code from the vt8500 and get two slightly
> different modules. You may look at our previous discussion with Alexey:
>
> https://lkml.org/lkml/2015/12/21/437
>
> Adding Robert and Bill to get more opinions. At this step, fixing the
> vt8500 nanosleep bug is a priority.

Personnaly I'm not very thrilled by combining pxa and vt8500 drivers into one.

The rationale I have behind is that :
 - the new driver will have new ifs to switch form vt8500 to pxa
   For example, suspend/resume functions will be different.
   Moreover in order to not impact the pxa runtime some ifs will be necessary
   (will that be if (IS_ENABLED(CONFIG_ARCH_PXA) && ...)
 - the IPs do not look that similar to me
   They seems inter-operable, but that seems to me to be just because of the 3
   common register placement : register at match (@0x00), counter (@0x10) and
   interrupt enabled (@0x1c).
   The register acces semantics are different (vt8500 needs a bit to access),
   the input clock seems different.

For ~140 lines of code, I prefer the simplicity brought by drivers
separation. The diffstat should be pretty equivalent between 2 drivers and 1
combined driver with many ifs.

Cheers.

-- 
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] crypto: af_alg - Disallow bind/setkey/... after accept(2)

2016-01-01 Thread Stephan Mueller
Am Mittwoch, 30. Dezember 2015, 11:47:53 schrieb Herbert Xu:

Hi Herbert,

> On Tue, Dec 29, 2015 at 07:36:14PM +0100, Dmitry Vyukov wrote:
> > Hello,
> > 
> > On commit 8513342170278468bac126640a5d2d12ffbff106
> > + crypto: algif_skcipher - Use new skcipher interface
> > + crypto: algif_skcipher - Require setkey before accept(2)
> > + crypto: af_alg - Disallow bind/setkey/... after accept(2)
> 
> OK there is a silly bug in the last patch.  Here is an updated
> version.

With this patch, the AF_ALG interface stops working. I tested the HMAC 
operation and I am unable to set the key with the following call:

ret = setsockopt(handle->tfmfd, SOL_ALG, ALG_SET_KEY, key, keylen);

This call returns EBUSY.

The test can be performed with [1] using the following call:

test/kcapi -x 3 -c "hmac(sha1)" -k 6e77ebd479da794707bc6cde3694f552ea892dab -p  
31b62a797adbff6b8a358d2b5206e01fee079de8cdfc4695138bba163b4efbf30127343e7fd4fbc696c3d38d8f27f57c024b5056f726ceeb4c31d98e57751ec8cbe8904ee0f9b031ae6a0c55da5e062475b3d7832191d4057643ef5fa446801d59a04693e573a8159cd2416b7bd39c7f0fe63c599365e04d596c05736beaab58

Without the patch, all works.

[1] http://www.chronox.de/libkcapi.html

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


Re: [PATCH 1/7] char: xillybus: use to_delayed_work

2016-01-01 Thread Eli Billauer

Hello,

It's fine with me, but this patch needs to go to the char and misc 
drivers maintainers (i.e. Arnd Bergmann and Greg Kroah-Hartman). I don't 
have a repository of my own.


Thanks,
   Eli

Acked-by: Eli Billauer 

On 01/01/16 16:59, Geliang Tang wrote:

Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang
---
  drivers/char/xillybus/xillybus_core.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/xillybus/xillybus_core.c 
b/drivers/char/xillybus/xillybus_core.c
index 77d6c12..3bd36e0 100644
--- a/drivers/char/xillybus/xillybus_core.c
+++ b/drivers/char/xillybus/xillybus_core.c
@@ -1164,8 +1164,7 @@ static int xillybus_flush(struct file *filp, fl_owner_t 
id)

  static void xillybus_autoflush(struct work_struct *work)
  {
-   struct delayed_work *workitem = container_of(
-   work, struct delayed_work, work);
+   struct delayed_work *workitem = to_delayed_work(work);
struct xilly_channel *channel = container_of(
workitem, struct xilly_channel, rd_workitem);
int rc;
   


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] net-brcmfmac: Delete an unnecessary variable initialisation in brcmf_sdio_download_firmware()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 20:20:15 +0100

Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index ceb2a75..c21eeb1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3260,7 +3260,7 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio 
*bus,
const struct firmware *fw,
void *nvram, u32 nvlen)
 {
-   int bcmerror = -EFAULT;
+   int bcmerror;
u32 rstvec;
 
sdio_claim_host(bus->sdiodev->func[1]);
-- 
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 1/2] net-ath9k_htc: Delete an unnecessary variable initialisation in ath9k_hif_usb_rx_stream()

2016-01-01 Thread Oleksij Rempel
Am 01.01.2016 um 19:23 schrieb SF Markus Elfring:
> From: Markus Elfring 
> Date: Fri, 1 Jan 2016 19:00:53 +0100
> 
> Omit explicit initialisation at the beginning for one local variable
> that is redefined before its first use.
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
> b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 165dd20..51bd61b 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -525,7 +525,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb 
> *hif_dev,
>   struct sk_buff *skb)
>  {
>   struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER];
> - int index = 0, i = 0, len = skb->len;
> + int index = 0, i, len = skb->len;
>   int rx_remain_len, rx_pkt_len;
>   u16 pool_index = 0;
>   u8 *ptr;
> 


Reviewed-by: Oleksij Rempel 

-- 
Regards,
Oleksij



signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

2016-01-01 Thread Oleksij Rempel
Am 01.01.2016 um 19:25 schrieb SF Markus Elfring:
> From: Markus Elfring 
> Date: Fri, 1 Jan 2016 19:09:32 +0100
> 
> Replace an explicit initialisation for one local variable at the beginning
> by a conditional assignment.
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
> b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index a680a97..30bd59e 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -246,7 +246,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv 
> *priv,
>   struct ieee80211_conf *conf = >hw->conf;
>   bool fastcc;
>   struct ieee80211_channel *channel = hw->conf.chandef.chan;
> - struct ath9k_hw_cal_data *caldata = NULL;
> + struct ath9k_hw_cal_data *caldata;
>   enum htc_phymode mode;
>   __be16 htc_mode;
>   u8 cmd_rsp;
> @@ -274,10 +274,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv 
> *priv,
>   priv->ah->curchan->channel,
>   channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf),
>   fastcc);
> -
> - if (!fastcc)
> - caldata = >caldata;
> -
> + caldata = fastcc ? NULL : >caldata;
>   ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
>   if (ret) {
>   ath_err(common,
> 

Reviewed-by: Oleksij Rempel 

-- 
Regards,
Oleksij



signature.asc
Description: OpenPGP digital signature


Re: CGroup Namespaces (v8)

2016-01-01 Thread Dan Williams
On Fri, Jan 1, 2016 at 10:06 AM, Serge E. Hallyn
 wrote:
> On Fri, Jan 01, 2016 at 01:42:57AM -0800, Dan Williams wrote:
>> Commit 54b39d263704 "cgroup: cgroup namespace setns support" not
>> booting is a separate issue.
>
> Oh - been there since my first version of the set (v4).  Odd, I
> thought that the automated korg testing caught those.
>
> What is the simplest way to fix this?  Do I send new versions of
> patches v3 and v4?  Does Tejun or Stephen just do it inline in the
> git tree?  Do we leave it be?

I'm assuming it can be fixed up when you re-spin the patches to fix
the boot failure.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 6/6] perf/amd/iommu: Enable support for multiple IOMMUs

2016-01-01 Thread Suravee Suthikulpanit
The current amd_iommu_pc_get_set_reg_val() does not support muli-IOMMU
system. This patch replace amd_iommu_pc_get_set_reg_val() with
amd_iommu_pc_set_reg_val() and amd_iommu_pc_[set|get]_cnt_vals().

This implementation makes an assumption that the counters on all IOMMUs
will be programmed the same way (i.e with the same events).

Signed-off-by: Suravee Suthikulpanit 
---
 arch/x86/kernel/cpu/perf_event_amd_iommu.c | 80 +--
 drivers/iommu/amd_iommu_init.c | 87 ++
 include/linux/perf/perf_event_amd_iommu.h  |  8 ++-
 3 files changed, 136 insertions(+), 39 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c 
b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index 8af7149..9c60eb3 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -264,44 +264,46 @@ static void perf_iommu_enable_event(struct perf_event *ev)
u64 reg = 0ULL;
 
reg = csource;
-   amd_iommu_pc_get_set_reg_val(devid,
+   amd_iommu_pc_set_reg_val(devid,
_GET_BANK(ev), _GET_CNTR(ev) ,
-IOMMU_PC_COUNTER_SRC_REG, , true);
+IOMMU_PC_COUNTER_SRC_REG, );
 
reg = 0ULL | devid | (_GET_DEVID_MASK(ev) << 32);
if (reg)
reg |= (1UL << 31);
-   amd_iommu_pc_get_set_reg_val(devid,
+   amd_iommu_pc_set_reg_val(devid,
_GET_BANK(ev), _GET_CNTR(ev) ,
-IOMMU_PC_DEVID_MATCH_REG, , true);
+IOMMU_PC_DEVID_MATCH_REG, );
 
reg = 0ULL | _GET_PASID(ev) | (_GET_PASID_MASK(ev) << 32);
if (reg)
reg |= (1UL << 31);
-   amd_iommu_pc_get_set_reg_val(devid,
+   amd_iommu_pc_set_reg_val(devid,
_GET_BANK(ev), _GET_CNTR(ev) ,
-IOMMU_PC_PASID_MATCH_REG, , true);
+IOMMU_PC_PASID_MATCH_REG, );
 
reg = 0ULL | _GET_DOMID(ev) | (_GET_DOMID_MASK(ev) << 32);
if (reg)
reg |= (1UL << 31);
-   amd_iommu_pc_get_set_reg_val(devid,
+   amd_iommu_pc_set_reg_val(devid,
_GET_BANK(ev), _GET_CNTR(ev) ,
-IOMMU_PC_DOMID_MATCH_REG, , true);
+IOMMU_PC_DOMID_MATCH_REG, );
 }
 
 static void perf_iommu_disable_event(struct perf_event *event)
 {
u64 reg = 0ULL;
 
-   amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
+   amd_iommu_pc_set_reg_val(_GET_DEVID(event),
_GET_BANK(event), _GET_CNTR(event),
-   IOMMU_PC_COUNTER_SRC_REG, , true);
+   IOMMU_PC_COUNTER_SRC_REG, );
 }
 
 static void perf_iommu_start(struct perf_event *event, int flags)
 {
struct hw_perf_event *hwc = >hw;
+   struct perf_amd_iommu *perf_iommu =
+   container_of(event->pmu, struct perf_amd_iommu, pmu);
 
pr_debug("perf: amd_iommu:perf_iommu_start\n");
if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
@@ -311,10 +313,19 @@ static void perf_iommu_start(struct perf_event *event, 
int flags)
hwc->state = 0;
 
if (flags & PERF_EF_RELOAD) {
-   u64 prev_raw_count =  local64_read(>prev_count);
-   amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
-   _GET_BANK(event), _GET_CNTR(event),
-   IOMMU_PC_COUNTER_REG, _raw_count, true);
+   int i;
+
+   for (i = 0; i < amd_iommu_get_num_iommus(); i++) {
+   int index = get_iommu_bnk_cnt_evt_idx(perf_iommu, i,
+ _GET_BANK(event), _GET_CNTR(event));
+
+   perf_iommu_cnts[i] = local64_read(
+   _iommu->prev_cnts[index]);
+   }
+
+   amd_iommu_pc_set_cnt_vals(_GET_BANK(event), _GET_CNTR(event),
+ amd_iommu_get_num_iommus(),
+ perf_iommu_cnts);
}
 
perf_iommu_enable_event(event);
@@ -324,29 +335,42 @@ static void perf_iommu_start(struct perf_event *event, 
int flags)
 
 static void perf_iommu_read(struct perf_event *event)
 {
-   u64 count = 0ULL;
+   int i;
u64 prev_raw_count = 0ULL;
u64 delta = 0ULL;
struct hw_perf_event *hwc = >hw;
+   struct perf_amd_iommu *perf_iommu =
+   container_of(event->pmu, struct perf_amd_iommu, pmu);
+
pr_debug("perf: amd_iommu:perf_iommu_read\n");
 
-   amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
-   _GET_BANK(event), _GET_CNTR(event),
-   IOMMU_PC_COUNTER_REG, , false);
+   if (amd_iommu_pc_get_cnt_vals(_GET_BANK(event), _GET_CNTR(event),
+ amd_iommu_get_num_iommus(),
+   

[PATCH v2 2/6] perf/amd/iommu: Modify functions to query max banks and counters

2016-01-01 Thread Suravee Suthikulpanit
Currently, amd_iommu_pc_get_max_[banks|counters]() require devid,
which should not be the case. Also, these don't properly support
multi-IOMMU system.

Current and future AMD systems with IOMMU that support perf counter
would likely contain homogeneous IOMMUs where multiple IOMMUs are
availalbe. So, this patch modifies these function to iterate all IOMMU
to check the max banks and counters reported by the hardware.

Signed-off-by: Suravee Suthikulpanit 
---
 arch/x86/kernel/cpu/perf_event_amd_iommu.c | 17 +++--
 drivers/iommu/amd_iommu_init.c | 20 
 include/linux/perf/perf_event_amd_iommu.h  |  7 ++-
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c 
b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index 1192f1d..e6d2485 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -237,14 +237,6 @@ static int perf_iommu_event_init(struct perf_event *event)
return -EINVAL;
}
 
-   /* integrate with iommu base devid (), assume one iommu */
-   perf_iommu->max_banks =
-   amd_iommu_pc_get_max_banks(IOMMU_BASE_DEVID);
-   perf_iommu->max_counters =
-   amd_iommu_pc_get_max_counters(IOMMU_BASE_DEVID);
-   if ((perf_iommu->max_banks == 0) || (perf_iommu->max_counters == 0))
-   return -EINVAL;
-
/* update the hw_perf_event struct with the iommu config data */
hwc->config = config;
hwc->extra_reg.config = config1;
@@ -455,6 +447,11 @@ static __init int _init_perf_amd_iommu(
if (_init_events_attrs(perf_iommu) != 0)
pr_err("perf: amd_iommu: Only support raw events.\n");
 
+   perf_iommu->max_banks = amd_iommu_pc_get_max_banks();
+   perf_iommu->max_counters = amd_iommu_pc_get_max_counters();
+   if ((perf_iommu->max_banks == 0) || (perf_iommu->max_counters == 0))
+   return -EINVAL;
+
/* Init null attributes */
perf_iommu->null_group = NULL;
perf_iommu->pmu.attr_groups = perf_iommu->attr_groups;
@@ -465,8 +462,8 @@ static __init int _init_perf_amd_iommu(
amd_iommu_pc_exit();
} else {
pr_info("perf: amd_iommu: Detected. (%d banks, %d 
counters/bank)\n",
-   amd_iommu_pc_get_max_banks(IOMMU_BASE_DEVID),
-   amd_iommu_pc_get_max_counters(IOMMU_BASE_DEVID));
+   amd_iommu_pc_get_max_banks(),
+   amd_iommu_pc_get_max_counters());
}
 
return ret;
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index b6d684c..275c0f5 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2251,15 +2251,17 @@ EXPORT_SYMBOL(amd_iommu_v2_supported);
  *
  /
 
-u8 amd_iommu_pc_get_max_banks(u16 devid)
+u8 amd_iommu_pc_get_max_banks(void)
 {
struct amd_iommu *iommu;
u8 ret = 0;
 
-   /* locate the iommu governing the devid */
-   iommu = amd_iommu_rlookup_table[devid];
-   if (iommu)
+   for_each_iommu(iommu) {
+   if (!iommu->max_banks ||
+   (ret && (iommu->max_banks != ret)))
+   return 0;
ret = iommu->max_banks;
+   }
 
return ret;
 }
@@ -2271,15 +2273,17 @@ bool amd_iommu_pc_supported(void)
 }
 EXPORT_SYMBOL(amd_iommu_pc_supported);
 
-u8 amd_iommu_pc_get_max_counters(u16 devid)
+u8 amd_iommu_pc_get_max_counters(void)
 {
struct amd_iommu *iommu;
u8 ret = 0;
 
-   /* locate the iommu governing the devid */
-   iommu = amd_iommu_rlookup_table[devid];
-   if (iommu)
+   for_each_iommu(iommu) {
+   if (!iommu->max_counters ||
+   (ret && (iommu->max_counters != ret)))
+   return 0;
ret = iommu->max_counters;
+   }
 
return ret;
 }
diff --git a/include/linux/perf/perf_event_amd_iommu.h 
b/include/linux/perf/perf_event_amd_iommu.h
index 845d173..815eabb 100644
--- a/include/linux/perf/perf_event_amd_iommu.h
+++ b/include/linux/perf/perf_event_amd_iommu.h
@@ -24,15 +24,12 @@
 #define PC_MAX_SPEC_BNKS   64
 #define PC_MAX_SPEC_CNTRS  16
 
-/* iommu pc reg masks*/
-#define IOMMU_BASE_DEVID   0x
-
 /* amd_iommu_init.c external support functions */
 extern bool amd_iommu_pc_supported(void);
 
-extern u8 amd_iommu_pc_get_max_banks(u16 devid);
+extern u8 amd_iommu_pc_get_max_banks(void);
 
-extern u8 amd_iommu_pc_get_max_counters(u16 devid);
+extern u8 amd_iommu_pc_get_max_counters(void);
 
 extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr,
u8 fxn, u64 *value, bool is_write);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe 

[PATCH v2 1/6] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

2016-01-01 Thread Suravee Suthikulpanit
This patch consolidates "arch/x86/kernel/cpu/perf_event_amd_iommu.h" and
"drivers/iommu/amd_iommu_proto.h", which contain duplicate function
declarations, into "include/linux/perf/perf_event_amd_iommu.h"

Signed-off-by: Suravee Suthikulpanit 
---
 arch/x86/kernel/cpu/perf_event_amd_iommu.c |  2 +-
 arch/x86/kernel/cpu/perf_event_amd_iommu.h | 40 --
 drivers/iommu/amd_iommu_init.c |  2 ++
 drivers/iommu/amd_iommu_proto.h|  7 --
 include/linux/perf/perf_event_amd_iommu.h  | 40 ++
 5 files changed, 43 insertions(+), 48 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/perf_event_amd_iommu.h
 create mode 100644 include/linux/perf/perf_event_amd_iommu.h

diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c 
b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index 86f8259..1192f1d 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -12,12 +12,12 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include "perf_event.h"
-#include "perf_event_amd_iommu.h"
 
 #define COUNTER_SHIFT  16
 
diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.h 
b/arch/x86/kernel/cpu/perf_event_amd_iommu.h
deleted file mode 100644
index 845d173..000
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 Advanced Micro Devices, Inc.
- *
- * Author: Steven Kinney 
- * Author: Suravee Suthikulpanit 
- *
- * 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.
- */
-
-#ifndef _PERF_EVENT_AMD_IOMMU_H_
-#define _PERF_EVENT_AMD_IOMMU_H_
-
-/* iommu pc mmio region register indexes */
-#define IOMMU_PC_COUNTER_REG   0x00
-#define IOMMU_PC_COUNTER_SRC_REG   0x08
-#define IOMMU_PC_PASID_MATCH_REG   0x10
-#define IOMMU_PC_DOMID_MATCH_REG   0x18
-#define IOMMU_PC_DEVID_MATCH_REG   0x20
-#define IOMMU_PC_COUNTER_REPORT_REG0x28
-
-/* maximun specified bank/counters */
-#define PC_MAX_SPEC_BNKS   64
-#define PC_MAX_SPEC_CNTRS  16
-
-/* iommu pc reg masks*/
-#define IOMMU_BASE_DEVID   0x
-
-/* amd_iommu_init.c external support functions */
-extern bool amd_iommu_pc_supported(void);
-
-extern u8 amd_iommu_pc_get_max_banks(u16 devid);
-
-extern u8 amd_iommu_pc_get_max_counters(u16 devid);
-
-extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr,
-   u8 fxn, u64 *value, bool is_write);
-
-#endif /*_PERF_EVENT_AMD_IOMMU_H_*/
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 013bdff..b6d684c 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -27,6 +27,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/drivers/iommu/amd_iommu_proto.h b/drivers/iommu/amd_iommu_proto.h
index 0bd9eb3..ac2da91 100644
--- a/drivers/iommu/amd_iommu_proto.h
+++ b/drivers/iommu/amd_iommu_proto.h
@@ -55,13 +55,6 @@ extern int amd_iommu_domain_set_gcr3(struct iommu_domain 
*dom, int pasid,
 extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid);
 extern struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev);
 
-/* IOMMU Performance Counter functions */
-extern bool amd_iommu_pc_supported(void);
-extern u8 amd_iommu_pc_get_max_banks(u16 devid);
-extern u8 amd_iommu_pc_get_max_counters(u16 devid);
-extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn,
-   u64 *value, bool is_write);
-
 #ifdef CONFIG_IRQ_REMAP
 extern int amd_iommu_create_irq_domain(struct amd_iommu *iommu);
 #else
diff --git a/include/linux/perf/perf_event_amd_iommu.h 
b/include/linux/perf/perf_event_amd_iommu.h
new file mode 100644
index 000..845d173
--- /dev/null
+++ b/include/linux/perf/perf_event_amd_iommu.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Steven Kinney 
+ * Author: Suravee Suthikulpanit 
+ *
+ * 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.
+ */
+
+#ifndef _PERF_EVENT_AMD_IOMMU_H_
+#define _PERF_EVENT_AMD_IOMMU_H_
+
+/* iommu pc mmio region register indexes */
+#define IOMMU_PC_COUNTER_REG   0x00
+#define IOMMU_PC_COUNTER_SRC_REG   0x08
+#define IOMMU_PC_PASID_MATCH_REG   0x10
+#define IOMMU_PC_DOMID_MATCH_REG   0x18
+#define IOMMU_PC_DEVID_MATCH_REG   0x20
+#define IOMMU_PC_COUNTER_REPORT_REG0x28
+
+/* maximun specified bank/counters */
+#define PC_MAX_SPEC_BNKS   64
+#define PC_MAX_SPEC_CNTRS   

[PATCH v2 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus()

2016-01-01 Thread Suravee Suthikulpanit
This patch introduces amd_iommu_get_num_iommus(). Initially, this is
intended to be used by Perf AMD IOMMU driver.

Signed-off-by: Suravee Suthikulpanit 
---
 drivers/iommu/amd_iommu_init.c| 8 +++-
 include/linux/perf/perf_event_amd_iommu.h | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 275c0f5..33dbf3f 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1030,7 +1030,7 @@ static int __init init_iommu_one(struct amd_iommu *iommu, 
struct ivhd_header *h)
 
/* Add IOMMU to internal data structures */
list_add_tail(>list, _iommu_list);
-   iommu->index = amd_iommus_present++;
+   iommu->index = amd_iommus_present++;
 
if (unlikely(iommu->index >= MAX_IOMMUS)) {
WARN(1, "AMD-Vi: System has more IOMMUs than supported by this 
driver\n");
@@ -2244,6 +2244,12 @@ bool amd_iommu_v2_supported(void)
 }
 EXPORT_SYMBOL(amd_iommu_v2_supported);
 
+int amd_iommu_get_num_iommus(void)
+{
+   return amd_iommus_present;
+}
+EXPORT_SYMBOL(amd_iommu_get_num_iommus);
+
 /
  *
  * IOMMU EFR Performance Counter support functionality. This code allows
diff --git a/include/linux/perf/perf_event_amd_iommu.h 
b/include/linux/perf/perf_event_amd_iommu.h
index 815eabb..cb820c2 100644
--- a/include/linux/perf/perf_event_amd_iommu.h
+++ b/include/linux/perf/perf_event_amd_iommu.h
@@ -25,6 +25,8 @@
 #define PC_MAX_SPEC_CNTRS  16
 
 /* amd_iommu_init.c external support functions */
+extern int amd_iommu_get_num_iommus(void);
+
 extern bool amd_iommu_pc_supported(void);
 
 extern u8 amd_iommu_pc_get_max_banks(void);
-- 
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] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 19:09:32 +0100

Replace an explicit initialisation for one local variable at the beginning
by a conditional assignment.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a680a97..30bd59e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -246,7 +246,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv 
*priv,
struct ieee80211_conf *conf = >hw->conf;
bool fastcc;
struct ieee80211_channel *channel = hw->conf.chandef.chan;
-   struct ath9k_hw_cal_data *caldata = NULL;
+   struct ath9k_hw_cal_data *caldata;
enum htc_phymode mode;
__be16 htc_mode;
u8 cmd_rsp;
@@ -274,10 +274,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv 
*priv,
priv->ah->curchan->channel,
channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf),
fastcc);
-
-   if (!fastcc)
-   caldata = >caldata;
-
+   caldata = fastcc ? NULL : >caldata;
ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
if (ret) {
ath_err(common,
-- 
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 5/6] perf/amd/iommu: Introduce get_iommu_bnk_cnt_evt_idx

2016-01-01 Thread Suravee Suthikulpanit
Introduce a helper function to calculate bit-index for assigning
performance counter assignment.

Signed-off-by: Suravee Suthikulpanit 
---
 arch/x86/kernel/cpu/perf_event_amd_iommu.c | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c 
b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index 99fcd10..8af7149 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -153,18 +153,28 @@ static struct attribute_group amd_iommu_cpumask_group = {
 
 /*-*/
 
+static inline
+int get_iommu_bnk_cnt_evt_idx(struct perf_amd_iommu *perf_iommu,
+ int iommu_index, int bank_index,
+ int cntr_index)
+{
+   int cntrs_per_iommu = perf_iommu->max_banks * perf_iommu->max_counters;
+   int index = (perf_iommu->max_counters * bank_index) + cntr_index;
+
+   return (cntrs_per_iommu * iommu_index) + index;
+}
+
 static int get_next_avail_iommu_bnk_cntr(struct perf_amd_iommu *perf_iommu)
 {
unsigned long flags;
int shift, bank, cntr, retval;
-   int max_banks = perf_iommu->max_banks;
-   int max_cntrs = perf_iommu->max_counters;
 
raw_spin_lock_irqsave(_iommu->lock, flags);
 
-   for (bank = 0, shift = 0; bank < max_banks; bank++) {
-   for (cntr = 0; cntr < max_cntrs; cntr++) {
-   shift = bank + (bank*3) + cntr;
+   for (bank = 0, shift = 0; bank < perf_iommu->max_banks; bank++) {
+   for (cntr = 0; cntr < perf_iommu->max_counters; cntr++) {
+   shift = get_iommu_bnk_cnt_evt_idx(perf_iommu,
+ 0, bank, cntr);
if (perf_iommu->cntr_assign_mask & (1ULL

[PATCH v2 4/6] perf/amd/iommu: Introduce data structure for tracking prev count.

2016-01-01 Thread Suravee Suthikulpanit
To enable AMD IOMMU PMU to support multiple IOMMUs, this patch introduces
a new data structure, perf_amd_iommu.prev_cnts, to track previous counts
of IOMMU performance counters in multi-IOMMU environment.

Also, this patch allocates perf_iommu_cnts for internal use
when manages counters.

Signed-off-by: Suravee Suthikulpanit 
---
 arch/x86/kernel/cpu/perf_event_amd_iommu.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c 
b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index e6d2485..99fcd10 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -42,6 +42,7 @@ struct perf_amd_iommu {
u64 cntr_assign_mask;
raw_spinlock_t lock;
const struct attribute_group *attr_groups[4];
+   local64_t *prev_cnts;
 };
 
 #define format_group   attr_groups[0]
@@ -126,6 +127,8 @@ static struct amd_iommu_event_desc 
amd_iommu_v2_event_descs[] = {
{ /* end: all zeroes */ },
 };
 
+static u64 *perf_iommu_cnts;
+
 /*-
  * sysfs cpumask attributes
  *-*/
@@ -423,10 +426,14 @@ static __init int _init_events_attrs(struct 
perf_amd_iommu *perf_iommu)
 
 static __init void amd_iommu_pc_exit(void)
 {
-   if (__perf_iommu.events_group != NULL) {
-   kfree(__perf_iommu.events_group);
-   __perf_iommu.events_group = NULL;
-   }
+   kfree(__perf_iommu.events_group);
+   __perf_iommu.events_group = NULL;
+
+   kfree(__perf_iommu.prev_cnts);
+   __perf_iommu.prev_cnts = NULL;
+
+   kfree(perf_iommu_cnts);
+   perf_iommu_cnts = NULL;
 }
 
 static __init int _init_perf_amd_iommu(
@@ -456,6 +463,17 @@ static __init int _init_perf_amd_iommu(
perf_iommu->null_group = NULL;
perf_iommu->pmu.attr_groups = perf_iommu->attr_groups;
 
+   perf_iommu->prev_cnts = kzalloc(sizeof(*perf_iommu->prev_cnts) *
+   (amd_iommu_get_num_iommus() * perf_iommu->max_banks *
+   perf_iommu->max_counters), GFP_KERNEL);
+   if (!perf_iommu->prev_cnts)
+   return -ENOMEM;
+
+   perf_iommu_cnts = kzalloc(sizeof(*perf_iommu_cnts) *
+ amd_iommu_get_num_iommus(), GFP_KERNEL);
+   if (!perf_iommu_cnts)
+   return -ENOMEM;
+
ret = perf_pmu_register(_iommu->pmu, name, -1);
if (ret) {
pr_err("perf: amd_iommu: Failed to initialized.\n");
-- 
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 v2 0/6] perf/amd/iommu: Enable multi-IOMMU support

2016-01-01 Thread Suravee Suthikulpanit
This patch series modifies the existing perf_event_amd_iommu driver
to support systems with multiple IOMMUs. It introduces new AMD IOMMU APIs,
which will are used by the AMD IOMMU Perf driver to access performance
counters in multiple IOMMUs.

In addition, this series should also fix current AMD IOMMU PMU driver
initialization issue in some existing CZ platform.

Changes from V1 (https://lkml.org/lkml/2015/12/22/535):
  * Update patch3 and 6 to use amd_iommus_present instead of introducing
amd_iommu_cnt static variable since they are the same thing

Suravee Suthikulpanit (6):
  perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
  perf/amd/iommu: Modify functions to query max banks and counters
  iommu/amd: Introduce amd_iommu_get_num_iommus()
  perf/amd/iommu: Introduce data structure for tracking prev count.
  perf/amd/iommu: Introduce get_iommu_bnk_cnt_evt_idx
  perf/amd/iommu: Enable support for multiple IOMMUs

 arch/x86/kernel/cpu/perf_event_amd_iommu.c | 145 +++--
 arch/x86/kernel/cpu/perf_event_amd_iommu.h |  40 
 drivers/iommu/amd_iommu_init.c | 117 +++
 drivers/iommu/amd_iommu_proto.h|   7 --
 include/linux/perf/perf_event_amd_iommu.h  |  43 +
 5 files changed, 239 insertions(+), 113 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/perf_event_amd_iommu.h
 create mode 100644 include/linux/perf/perf_event_amd_iommu.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 1/2] net-ath9k_htc: Delete an unnecessary variable initialisation in ath9k_hif_usb_rx_stream()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 19:00:53 +0100

Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 165dd20..51bd61b 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -525,7 +525,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb 
*hif_dev,
struct sk_buff *skb)
 {
struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER];
-   int index = 0, i = 0, len = skb->len;
+   int index = 0, i, len = skb->len;
int rx_remain_len, rx_pkt_len;
u16 pool_index = 0;
u8 *ptr;
-- 
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/2] net-ath9k_htc: Fine-tuning for two function implementations

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 19:16:05 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an unnecessary variable initialisation in ath9k_hif_usb_rx_stream()
  Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

 drivers/net/wireless/ath/ath9k/hif_usb.c  | 2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-
 2 files changed, 3 insertions(+), 6 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] drivers: staging: media: davinci_vpfe: dm365_resizer: fixed some spelling mistakes

2016-01-01 Thread Trevor Woerner
On 01/01/16 11:08, Saatvik Arya wrote:
> fixed spelling mistakes which reffered to OUTPUT as OUPUT

Somewhat ironically, "reffered" is not spelled correctly ;-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: CGroup Namespaces (v8)

2016-01-01 Thread Serge E. Hallyn
On Fri, Jan 01, 2016 at 01:42:57AM -0800, Dan Williams wrote:
> On Fri, Jan 1, 2016 at 12:59 AM, Serge E. Hallyn
>  wrote:
> > On Fri, Jan 01, 2016 at 12:19:44AM -0800, Dan Williams wrote:
> >> On Tue, Dec 22, 2015 at 8:23 PM,   wrote:
> >> > Hi,
> >> >
> >> > following is a revised set of the CGroup Namespace patchset which Aditya
> >> > Kali has previously sent.  The code can also be found in the cgroupns.v8
> >> > branch of
> >> >
> >> > https://git.kernel.org/cgit/linux/kernel/git/sergeh/linux-security.git/
> >>
> >> Happy New Year!
> >>
> >> I'm hitting both a build and boot regression in -next with these
> >> patches.  The bisect log reports:
> >>
> >> git bisect skip f176ae3a5df610e0373c39538cc7744c7788b3df
> >> # bad: [54b39d263704b66cc8006ce8f7dd4743fdabae70] cgroup: cgroup
> >> namespace setns support
> >> git bisect bad 54b39d263704b66cc8006ce8f7dd4743fdabae70
> >> # good: [bf9b3590879afbaa54148d817ed68a0b51180375] sched: new clone
> >> flag CLONE_NEWCGROUP for c
> >> group namespace
> >> git bisect good bf9b3590879afbaa54148d817ed68a0b51180375
> >> # only skipped commits left to test
> >> # possible first bad commit:
> >> [54b39d263704b66cc8006ce8f7dd4743fdabae70] cgroup: cgroup namespa
> >> ce setns support
> >> # possible first bad commit:
> >> [f176ae3a5df610e0373c39538cc7744c7788b3df] cgroup: introduce cgro
> >> up namespaces
> >>
> >> Where compiling "f176ae3a5df6"  fails with:
> >>
> >> kernel/cgroup.c: In function ‘cgroupns_put’:
> >> kernel/cgroup.c:5956:2: error: implicit declaration of function
> >> ‘to_cg_ns’ [-Werror=implicit-f
> >> unction-declaration]
> >>  put_cgroup_ns(to_cg_ns(ns));
> >
> > Hi,
> >
> > is it possible you have a bad tree?
> 
> No, I don't believe so...
> 
> >  Looking at
> > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/kernel/cgroup.c?id=refs/tags/next-20151231
> > to_cg_ns should definately be defined there.
> >
> 
> Right, but it's not defined until commit 54b39d263704 "cgroup: cgroup
> namespace setns support", however it is first used in the preceeding
> commit f176ae3a5df6 "cgroup: introduce cgroup namespaces".  The bad
> patch ordering breaks bisection.
> 
> Commit 54b39d263704 "cgroup: cgroup namespace setns support" not
> booting is a separate issue.

Oh - been there since my first version of the set (v4).  Odd, I
thought that the automated korg testing caught those.

What is the simplest way to fix this?  Do I send new versions of
patches v3 and v4?  Does Tejun or Stephen just do it inline in the
git tree?  Do we leave it be?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ima_write_policy() optimizations;

2016-01-01 Thread kbuild test robot
Hi Petko,

[auto build test ERROR on integrity/next]
[cannot apply to v4.4-rc7 next-20151231]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Petko-Manolov/ima_write_policy-optimizations/20160102-013037
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next
config: i386-randconfig-x002-12300610 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   security/integrity/ima/ima_fs.c:275:9: sparse: undefined identifier 'data'
   security/integrity/ima/ima_fs.c:276:14: sparse: undefined identifier 'data'
   security/integrity/ima/ima_fs.c:279:11: sparse: undefined identifier 'data'
   security/integrity/ima/ima_fs.c:282:28: sparse: undefined identifier 'data'
   security/integrity/ima/ima_fs.c:289:37: sparse: undefined identifier 'data'
   security/integrity/ima/ima_fs.c:296:15: sparse: undefined identifier 'data'
   security/integrity/ima/ima_fs.c: In function 'ima_write_policy':
>> security/integrity/ima/ima_fs.c:275:2: error: 'data' undeclared (first use 
>> in this function)
 data = kmalloc(datalen + 1, GFP_KERNEL);
 ^
   security/integrity/ima/ima_fs.c:275:2: note: each undeclared identifier is 
reported only once for each function it appears in

vim +/data +275 security/integrity/ima/ima_fs.c

4af4662f Mimi Zohar 2009-02-04  269 /* No partial writes. */
6ccd0456 Eric Paris 2010-04-20  270 result = -EINVAL;
6ccd0456 Eric Paris 2010-04-20  271 if (*ppos != 0)
6ccd0456 Eric Paris 2010-04-20  272 goto out;
6ccd0456 Eric Paris 2010-04-20  273  
6ccd0456 Eric Paris 2010-04-20  274 result = -ENOMEM;
4af4662f Mimi Zohar 2009-02-04 @275 data = kmalloc(datalen + 1, GFP_KERNEL);
4af4662f Mimi Zohar 2009-02-04  276 if (!data)
6ccd0456 Eric Paris 2010-04-20  277 goto out;
4af4662f Mimi Zohar 2009-02-04  278  

:: The code at line 275 was first introduced by commit
:: 4af4662fa4a9dc62289c580337ae2506339c4729 integrity: IMA policy

:: TO: Mimi Zohar 
:: CC: James Morris 

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


.config.gz
Description: Binary data


Re: [PATCH] Staging: speakup: read scrolled-back VT

2016-01-01 Thread One Thousand Gnomes
On Fri, 1 Jan 2016 18:20:39 +0100
Samuel Thibault  wrote:

> Previously, speakup would always read the bottom part of the screen,
> even when the VT is scrolled back with shift-page.  This patch makes
> vt.c export screen_pos so that speakup can use it to properly access
> the content of the scrolled-back VT.
> 
> This was tested with both vgacon and fbcon.
> 
> Signed-off-by: Samuel Thibault 

I know the policy was that we don't put core code hooks in for staging
stuff but I hope in this case we do.

Reviewed-by: Alan Cox 


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


Re: [PATCH v3 RESEND 0/2] WM8505/WM8650 DT fixes for SD card controller

2016-01-01 Thread Roman Volkov
В Fri, 01 Jan 2016 15:29:29 +0100
Arnd Bergmann  пишет:

> On Friday 01 January 2016 16:38:10 Roman Volkov wrote:
> > From: Roman Volkov 
> > 
> > This patch set enables SD controller support for WM8650 and
> > fixes minor errors in WM8505 Device Tree file.
> > 
> > Changes in v3:
> > 1. Add minor fixes for WM8505 SDHC node
> > 
> > Tested on both WM8505 and WM8650.
> > 
> > Roman Volkov (2):
> >   dts: vt8500: Add SDHC node to DTS file for WM8650
> >   dts: vt8500: Fix errors in SDHC node for WM8505
> > 
> >  arch/arm/boot/dts/wm8505.dtsi | 4 ++--
> >  arch/arm/boot/dts/wm8650.dtsi | 9 +
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> > 
> > -- 
> > Hi maintainers, I see my previous versions were not applied. Could
> > this little patch set be applied for the linux-next? I don't think
> > this is new functionality, this must be considered as bugfix for
> > existing Device Tree.
> > 
> > Any other suggestions?
> >   
> 
> Applied both to next/dt, thanks a lot for following up!
> 
> Let me know if you think this should go into stable backports as well,
> I did not apply it to the fixes branch as you don't have a
> 'Cc: sta...@vger.kernel.org' tag and it has never worked so far.

Yes, this must go into the stable too. Let me know if I must change
something or resend.

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


Re: [PATCH 2/7] edac: i5100_edac: use to_delayed_work

2016-01-01 Thread Borislav Petkov
On Fri, Jan 01, 2016 at 10:59:07PM +0800, Geliang Tang wrote:
> Use to_delayed_work() instead of open-coding it.
> 
> Signed-off-by: Geliang Tang 
> ---
>  drivers/edac/i5100_edac.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
> index 4091777..c655162 100644
> --- a/drivers/edac/i5100_edac.c
> +++ b/drivers/edac/i5100_edac.c
> @@ -575,9 +575,7 @@ static void i5100_check_error(struct mem_ctl_info *mci)
>  
>  static void i5100_refresh_scrubbing(struct work_struct *work)
>  {
> - struct delayed_work *i5100_scrubbing = container_of(work,
> - struct delayed_work,
> - work);
> + struct delayed_work *i5100_scrubbing = to_delayed_work(work);
>   struct i5100_priv *priv = container_of(i5100_scrubbing,
>  struct i5100_priv,
>  i5100_scrubbing);
> -- 

Applied, thanks.

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] pinctrl: mediatek: convert to arch_initcall

2016-01-01 Thread Linus Walleij
On Fri, Jan 1, 2016 at 3:27 PM, Matthias Brugger  wrote:
> On January 1, 2016 3:56:01 AM EET, Daniel Kurtz  wrote:

>>> It's fairly clear that there's at least a case for simplifying the
>>> existing practice here, for example by moving everything into a
>>single
>>> (perhaps aliased) initcall rather than by randomly picking a level
>>per
>>> system or by actually fiddling with the link ordering if the case is
>>> sufficiently clear that pinctrl in general ought to load earlier than
>>it
>>> does.
>>
>>Nothing above sounds like a reason not to merge this patch, however.
>>Why should we block useful patches that use existing tools to fix real
>>architecture-specific issues until new infrastructure is merged that
>>solves general problems?
>
> I think what Mark means is, that we define some pinctrl_initcall which
> is a macro to subsys_initcall (or arch_initcall or similar). We apply this
> to all pinctrl drivers including the one from Mediatek. This way at least
> we have a common method and changing the behaviour in the future is
> easier to handle.

That would be pinctrl_soc_initcall() in that case. Just pinctrl_initcall()
would assume it's for all drivers and there is a bunch of them that are just
fine with simple device_initcall()s.

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


Re: linux-next: manual merge of the security tree with the vfs tree

2016-01-01 Thread Petko Manolov
On 16-01-01 04:34:16, Al Viro wrote:
> On Thu, Dec 31, 2015 at 12:45:35PM +0200, Petko Manolov wrote:
> 
> > I introduced the write mutex when ima_write_policy() stopped being 
> > serialized by 
> > other means.  Come to think about it the semaphore could be taken right 
> > before 
> > copy_from_user() so it is my fault, not Stephen's.
> 
> s/before/after/, surely?

Right.  This is a quick patch which i hope solves most issues...


Petko


>From 6c9058009c59fda5b8e98a3fc09497ce3efdb3e9 Mon Sep 17 00:00:00 2001
From: Petko Manolov 
Date: Fri, 1 Jan 2016 19:10:43 +0200
Subject: [PATCH] ima_write_policy() optimizations;

There is no need to hold the write semaphore for so long.  We only need it
around ima_parse_add_rule();

The return path now takes into account failed kmalloc() call.

Signed-off-by: Petko Manolov 
---
 security/integrity/ima/ima_fs.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index 3caed6d..d2c0d55 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -261,13 +261,7 @@ static const struct file_operations 
ima_ascii_measurements_ops = {
 static ssize_t ima_write_policy(struct file *file, const char __user *buf,
size_t datalen, loff_t *ppos)
 {
-   char *data = NULL;
ssize_t result;
-   int res;
-
-   res = mutex_lock_interruptible(_write_mutex);
-   if (res)
-   return res;
 
if (datalen >= PAGE_SIZE)
datalen = PAGE_SIZE - 1;
@@ -286,15 +280,21 @@ static ssize_t ima_write_policy(struct file *file, const 
char __user *buf,
 
result = -EFAULT;
if (copy_from_user(data, buf, datalen))
-   goto out;
+   goto out_free;
+
+   result = mutex_lock_interruptible(_write_mutex);
+   if (result)
+   goto out_free;
 
result = ima_parse_add_rule(data);
-out:
+
+   mutex_unlock(_write_mutex);
+
if (result < 0)
valid_policy = 0;
+out_free:
kfree(data);
-   mutex_unlock(_write_mutex);
-
+out:
return result;
 }
 
-- 
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/


[PATCH] Staging: speakup: read scrolled-back VT

2016-01-01 Thread Samuel Thibault
Previously, speakup would always read the bottom part of the screen,
even when the VT is scrolled back with shift-page.  This patch makes
vt.c export screen_pos so that speakup can use it to properly access
the content of the scrolled-back VT.

This was tested with both vgacon and fbcon.

Signed-off-by: Samuel Thibault 

--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4250,6 +4250,7 @@ unsigned short *screen_pos(struct vc_dat
 {
return screenpos(vc, 2 * w_offset, viewed);
 }
+EXPORT_SYMBOL_GPL(screen_pos);
 
 void getconsxy(struct vc_data *vc, unsigned char *p)
 {
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -264,8 +264,9 @@ static struct notifier_block vt_notifier
.notifier_call = vt_notifier_call,
 };
 
-static unsigned char get_attributes(u16 *pos)
+static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 {
+   pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
return (u_char) (scr_readw(pos) >> 8);
 }
 
@@ -275,7 +276,7 @@ static void speakup_date(struct vc_data
spk_y = spk_cy = vc->vc_y;
spk_pos = spk_cp = vc->vc_pos;
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) spk_pos);
+   spk_attr = get_attributes(vc, (u_short *)spk_pos);
 }
 
 static void bleep(u_short val)
@@ -469,8 +470,12 @@ static u16 get_char(struct vc_data *vc,
u16 ch = ' ';
 
if (vc && pos) {
-   u16 w = scr_readw(pos);
-   u16 c = w & 0xff;
+   u16 w;
+   u16 c;
+
+   pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
+   w = scr_readw(pos);
+   c = w & 0xff;
 
if (w & vc->vc_hi_font_mask)
c |= 0x100;
@@ -746,7 +751,7 @@ static int get_line(struct vc_data *vc)
u_char tmp2;
 
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) spk_pos);
+   spk_attr = get_attributes(vc, (u_short *)spk_pos);
for (i = 0; i < vc->vc_cols; i++) {
buf[i] = (u_char) get_char(vc, (u_short *) tmp, );
tmp += 2;
@@ -811,7 +816,7 @@ static int say_from_to(struct vc_data *v
u_short saved_punc_mask = spk_punc_mask;
 
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) from);
+   spk_attr = get_attributes(vc, (u_short *)from);
while (from < to) {
buf[i++] = (char)get_char(vc, (u_short *) from, );
from += 2;
@@ -886,7 +891,7 @@ static int get_sentence_buf(struct vc_da
sentmarks[bn][0] = [bn][0];
i = 0;
spk_old_attr = spk_attr;
-   spk_attr = get_attributes((u_short *) start);
+   spk_attr = get_attributes(vc, (u_short *)start);
 
while (start < end) {
sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, );
@@ -1585,7 +1590,7 @@ static int count_highlight_color(struct
u16 *ptr;
 
for (ptr = start; ptr < end; ptr++) {
-   ch = get_attributes(ptr);
+   ch = get_attributes(vc, ptr);
bg = (ch & 0x70) >> 4;
speakup_console[vc_num]->ht.bgcount[bg]++;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 32/32] virtio_ring: use virt_store_mb

2016-01-01 Thread Sergei Shtylyov

Hello.

On 12/31/2015 10:09 PM, Michael S. Tsirkin wrote:


We need a full barrier after writing out event index, using
virt_store_mb there seems better than open-coding.  As usual, we need a
wrapper to account for strong barriers.

It's tempting to use this in vhost as well, for that, we'll
need a variant of smp_store_mb that works on __user pointers.

Signed-off-by: Michael S. Tsirkin 
---
  include/linux/virtio_ring.h  | 12 
  drivers/virtio/virtio_ring.c | 15 +--
  2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index f3fa55b..3a74d91 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -45,6 +45,18 @@ static inline void virtio_wmb(bool weak_barriers)
wmb();
  }

+static inline void virtio_store_mb(bool weak_barriers,
+  __virtio16 *p, __virtio16 v)
+{
+   if (weak_barriers)
+   virt_store_mb(*p, v);
+   else
+   {


   The kernel coding style dictates:

if (weak_barriers) {
virt_store_mb(*p, v);
} else {


+   WRITE_ONCE(*p, v);
+   mb();
+   }
+}
+

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] [BUG] clk: rockchip: don't mark clock names as initconst

2016-01-01 Thread Heiko Stübner
Hi Arnd,

Am Freitag, 1. Januar 2016, 14:42:52 schrieb Arnd Bergmann:
> The latest changes to the rockchip clk implementation cause
> tons of warnings and/or errors (depending on the configuration):
> 
> WARNING: vmlinux.o(.data+0x125394): Section mismatch in reference from the
> variable __compound_literal.125 to the (unknown reference)
> .init.rodata:(unknown)
> 
> The reason is a compount literal in a macro that refers to an
> object in the .init.rodata section:
> 
>  #define COMPOSITE_FRACMUX(_id, cname, pname, f, mo, df, go, gs, gf, ch) \
> {   \
>   ...
> .child  = &(struct rockchip_clk_branch)ch, \
> }
> 
> 'ch' here is placed in .data, and I could find no way to override that
> using an attribute or pragma because there is no identifier associated
> with it.

"[PATCH] clk: rockchip: fix section mismatches with new child-clocks" [0]

should be in Mike's + Stephen's inbox since last week as well, which moves the 
offending new elements into separate entities, which can have __initdata 
attributes again.


Heiko

[0] http://www.spinics.net/lists/arm-kernel/msg471295.html


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


[PATCH 2/2] net-qmi_wwan: Delete an unnecessary variable initialisation in qmi_wwan_register_subdriver()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 17:35:03 +0100

Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.

Signed-off-by: Markus Elfring 
---
 drivers/net/usb/qmi_wwan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 5b8af06..5962099 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -286,7 +286,7 @@ static int qmi_wwan_cdc_wdm_manage_power(struct 
usb_interface *intf, int on)
 static int qmi_wwan_register_subdriver(struct usbnet *dev)
 {
int rv;
-   struct usb_driver *subdriver = NULL;
+   struct usb_driver *subdriver;
struct qmi_wwan_state *info = (void *)>data;
 
/* collect bulk endpoints */
-- 
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 1/2] net-qmi_wwan: Refactoring for qmi_wwan_bind()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 17:32:07 +0100

Reduce the scope for the local variable "desc" to one branch
of an if statement.

Signed-off-by: Markus Elfring 
---
 drivers/net/usb/qmi_wwan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index d0b2973..5b8af06 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -345,7 +345,6 @@ static int qmi_wwan_bind(struct usbnet *dev, struct 
usb_interface *intf)
int status = -1;
u8 *buf = intf->cur_altsetting->extra;
int len = intf->cur_altsetting->extralen;
-   struct usb_interface_descriptor *desc = >cur_altsetting->desc;
struct usb_cdc_union_desc *cdc_union;
struct usb_cdc_ether_desc *cdc_ether;
struct usb_driver *driver = driver_of(intf);
@@ -366,6 +365,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct 
usb_interface *intf)
 
/* Use separate control and data interfaces if we found a CDC Union */
if (cdc_union) {
+   struct usb_interface_descriptor *desc = 
>cur_altsetting->desc;
+
info->data = usb_ifnum_to_if(dev->udev,
 cdc_union->bSlaveInterface0);
if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 ||
-- 
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/2] net-qmi_wwan: Fine-tuning for two function implementations

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 17:47:46 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Refactoring for qmi_wwan_bind()
  Delete an unnecessary variable initialisation in qmi_wwan_register_subdriver()

 drivers/net/usb/qmi_wwan.c | 5 +++--
 1 file changed, 3 insertions(+), 2 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/


[ACPI] BUG: KASan: out of bounds on stack in vsnprintf

2016-01-01 Thread Thomas Meyer
Hi,

I started to run my kernels with KASan enabled and found this after resume from 
ram on a 4.3.3 kernel:

Jan 01 15:16:59 localhost.localdomain kernel: 
==
Jan 01 15:16:59 localhost.localdomain kernel: BUG: KASan: out of bounds on 
stack in vsnprintf+0x14c4/0x1a00 at addr 8800b5957838
Jan 01 15:16:59 localhost.localdomain kernel: Read of size 8 by task 
systemd-sleep/5375
Jan 01 15:16:59 localhost.localdomain kernel: page:ea0002d655c0 count:0 
mapcount:0 mapping:  (null) index:0x0
Jan 01 15:17:00 localhost.localdomain kernel: flags: 0x4000()
Jan 01 15:17:01 localhost.localdomain kernel: page dumped because: kasan: bad 
access detected
Jan 01 15:17:01 localhost.localdomain kernel: CPU: 0 PID: 5375 Comm: 
systemd-sleep Not tainted 4.3.3 #15
Jan 01 15:17:01 localhost.localdomain kernel: Hardware name: Acer Aspire 
1810T/JM11-MS, BIOS v1.3310 03/25/2010
Jan 01 15:17:01 localhost.localdomain kernel:  8800b5957838 
6c6dad1e 8800b59575f8 81937da7
Jan 01 15:17:01 localhost.localdomain kernel:  8800b5957680 
8800b5957670 8143b533 0002
Jan 01 15:17:01 localhost.localdomain kernel:   
0046 81b12196 00030206
Jan 01 15:17:01 localhost.localdomain kernel: Call Trace:
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
dump_stack+0x4b/0x74
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
kasan_report_error+0x3b3/0x3e0
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_ns_search_and_enter+0xa7/0x3b5
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
__asan_report_load8_noabort+0x5c/0x70
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
vsnprintf+0x14c4/0x1a00
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
vsnprintf+0x14c4/0x1a00
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
pointer.isra.22+0x980/0x980
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
up+0x70/0xb0
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
kasan_slab_free+0x44/0x50
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
vsprintf+0x14/0x20
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_os_vprintf+0x16/0x2b
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_os_printf+0x9e/0xca
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_os_vprintf+0x2b/0x2b
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_exception+0xb2/0x132
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_bios_warning+0x117/0x117
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_ns_evaluate+0xb3/0x853
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
kasan_kmalloc+0x5e/0x70
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_get_sleep_type_data+0x549/0x568
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_hw_legacy_wake_prep+0x83/0x227
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_hw_legacy_sleep+0x3bd/0x3bd
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_write_bit_register+0x288/0x2ce
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
acpi_read_bit_register+0x196/0x196
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_hw_sleep_dispatch+0xb0/0xb5
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_leave_sleep_state_prep+0x12/0x14
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
acpi_suspend_enter+0x10e/0x19a
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
trace_suspend_resume+0xe0/0xe0
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
suspend_devices_and_enter+0x964/0xdf0
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
printk+0xa3/0xd3
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
arch_suspend_enable_irqs+0x10/0x10
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
sysfs_kf_bin_read+0x2c0/0x2c0
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
pm_suspend+0x4f9/0x690
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
sysfs_kf_bin_read+0x2c0/0x2c0
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
state_store+0x85/0x90
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
kobj_attr_show+0x60/0x60
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
kobj_attr_store+0x36/0x70
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
sysfs_kf_write+0x12c/0x1f0
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
kernfs_fop_write+0x1f8/0x3a0
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
__vfs_write+0xea/0x400
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
__vfs_read+0x3f0/0x3f0
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
handle_mm_fault+0x1579/0x34a0
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
do_mmap+0x66f/0x900
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
selinux_file_permission+0x2d5/0x430
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
security_file_permission+0x6a/0x1a0
Jan 01 15:17:01 localhost.localdomain kernel:  [] ? 
rw_verify_area+0xb7/0x290
Jan 01 15:17:01 localhost.localdomain kernel:  [] 
vfs_write+0x134/0x4c0
Jan 01 15:17:01 

[PATCH] drivers: staging: media: davinci_vpfe: dm365_resizer: fixed some spelling mistakes

2016-01-01 Thread Saatvik Arya
fixed spelling mistakes which reffered to OUTPUT as OUPUT

Signed-off-by: Saatvik Arya 
---
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 22 +++---
 drivers/staging/media/davinci_vpfe/dm365_resizer.h |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c 
b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index acb293e..10f51f4 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -495,7 +495,7 @@ resizer_configure_in_continious_mode(struct 
vpfe_resizer_device *resizer)
int line_len;
int ret;
 
-   if (resizer->resizer_a.output != RESIZER_OUPUT_MEMORY) {
+   if (resizer->resizer_a.output != RESIZER_OUTPUT_MEMORY) {
dev_err(dev, "enable resizer - Resizer-A\n");
return -EINVAL;
}
@@ -507,7 +507,7 @@ resizer_configure_in_continious_mode(struct 
vpfe_resizer_device *resizer)
param->rsz_en[RSZ_B] = DISABLE;
param->oper_mode = RESIZER_MODE_CONTINIOUS;
 
-   if (resizer->resizer_b.output == RESIZER_OUPUT_MEMORY) {
+   if (resizer->resizer_b.output == RESIZER_OUTPUT_MEMORY) {
struct v4l2_mbus_framefmt *outformat2;
 
param->rsz_en[RSZ_B] = ENABLE;
@@ -1048,13 +1048,13 @@ static void resizer_ss_isr(struct vpfe_resizer_device 
*resizer)
if (ipipeif_sink != IPIPEIF_INPUT_MEMORY)
return;
 
-   if (resizer->resizer_a.output == RESIZER_OUPUT_MEMORY) {
+   if (resizer->resizer_a.output == RESIZER_OUTPUT_MEMORY) {
val = vpss_dma_complete_interrupt();
if (val != 0 && val != 2)
return;
}
 
-   if (resizer->resizer_a.output == RESIZER_OUPUT_MEMORY) {
+   if (resizer->resizer_a.output == RESIZER_OUTPUT_MEMORY) {
spin_lock(_out->dma_queue_lock);
vpfe_video_process_buffer_complete(video_out);
video_out->state = VPFE_VIDEO_BUFFER_NOT_QUEUED;
@@ -1064,7 +1064,7 @@ static void resizer_ss_isr(struct vpfe_resizer_device 
*resizer)
 
/* If resizer B is enabled */
if (pipe->output_num > 1 && resizer->resizer_b.output ==
-   RESIZER_OUPUT_MEMORY) {
+   RESIZER_OUTPUT_MEMORY) {
spin_lock(_out->dma_queue_lock);
vpfe_video_process_buffer_complete(video_out2);
video_out2->state = VPFE_VIDEO_BUFFER_NOT_QUEUED;
@@ -1074,7 +1074,7 @@ static void resizer_ss_isr(struct vpfe_resizer_device 
*resizer)
 
/* start HW if buffers are queued */
if (vpfe_video_is_pipe_ready(pipe) &&
-   resizer->resizer_a.output == RESIZER_OUPUT_MEMORY) {
+   resizer->resizer_a.output == RESIZER_OUTPUT_MEMORY) {
resizer_enable(resizer, 1);
vpfe_ipipe_enable(vpfe_dev, 1);
vpfe_ipipeif_enable(vpfe_dev);
@@ -1242,8 +1242,8 @@ static int resizer_do_hw_setup(struct vpfe_resizer_device 
*resizer)
struct resizer_params *param = >config;
int ret = 0;
 
-   if (resizer->resizer_a.output == RESIZER_OUPUT_MEMORY ||
-   resizer->resizer_b.output == RESIZER_OUPUT_MEMORY) {
+   if (resizer->resizer_a.output == RESIZER_OUTPUT_MEMORY ||
+   resizer->resizer_b.output == RESIZER_OUTPUT_MEMORY) {
if (ipipeif_sink == IPIPEIF_INPUT_MEMORY &&
ipipeif_source == IPIPEIF_OUTPUT_RESIZER)
ret = resizer_configure_in_single_shot_mode(resizer);
@@ -1268,7 +1268,7 @@ static int resizer_set_stream(struct v4l2_subdev *sd, int 
enable)
if (>crop_resizer.subdev != sd)
return 0;
 
-   if (resizer->resizer_a.output != RESIZER_OUPUT_MEMORY)
+   if (resizer->resizer_a.output != RESIZER_OUTPUT_MEMORY)
return 0;
 
switch (enable) {
@@ -1722,7 +1722,7 @@ static int resizer_link_setup(struct media_entity *entity,
}
if (resizer->resizer_a.output != RESIZER_OUTPUT_NONE)
return -EBUSY;
-   resizer->resizer_a.output = RESIZER_OUPUT_MEMORY;
+   resizer->resizer_a.output = RESIZER_OUTPUT_MEMORY;
break;
 
default:
@@ -1747,7 +1747,7 @@ static int resizer_link_setup(struct media_entity *entity,
}
if (resizer->resizer_b.output != RESIZER_OUTPUT_NONE)
return -EBUSY;
-   resizer->resizer_b.output = RESIZER_OUPUT_MEMORY;
+   resizer->resizer_b.output = RESIZER_OUTPUT_MEMORY;
break;
 
default:
diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.h 
b/drivers/staging/media/davinci_vpfe/dm365_resizer.h
index 93b0f44..00e64b0 100644
--- 

[PATCH] net-huawei_cdc_ncm: Delete an unnecessary variable initialisation in huawei_cdc_ncm_bind()

2016-01-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Jan 2016 16:54:13 +0100

Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.

Signed-off-by: Markus Elfring 
---
 drivers/net/usb/huawei_cdc_ncm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
index 2680a65..53caeb3 100644
--- a/drivers/net/usb/huawei_cdc_ncm.c
+++ b/drivers/net/usb/huawei_cdc_ncm.c
@@ -71,7 +71,7 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
 {
struct cdc_ncm_ctx *ctx;
struct usb_driver *subdriver = ERR_PTR(-ENODEV);
-   int ret = -ENODEV;
+   int ret;
struct huawei_cdc_ncm_state *drvstate = (void *)_dev->data;
int drvflags = 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 5/6] mwifiex: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/net/wireless/marvell/mwifiex/11h.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c 
b/drivers/net/wireless/marvell/mwifiex/11h.c
index 71a1b58..81c60d0 100644
--- a/drivers/net/wireless/marvell/mwifiex/11h.c
+++ b/drivers/net/wireless/marvell/mwifiex/11h.c
@@ -123,8 +123,7 @@ void mwifiex_11h_process_join(struct mwifiex_private *priv, 
u8 **buffer,
 void mwifiex_dfs_cac_work_queue(struct work_struct *work)
 {
struct cfg80211_chan_def chandef;
-   struct delayed_work *delayed_work =
-   container_of(work, struct delayed_work, work);
+   struct delayed_work *delayed_work = to_delayed_work(work);
struct mwifiex_private *priv =
container_of(delayed_work, struct mwifiex_private,
 dfs_cac_work);
@@ -289,8 +288,7 @@ int mwifiex_11h_handle_radar_detected(struct 
mwifiex_private *priv,
 void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)
 {
struct mwifiex_uap_bss_param *bss_cfg;
-   struct delayed_work *delayed_work =
-   container_of(work, struct delayed_work, work);
+   struct delayed_work *delayed_work = to_delayed_work(work);
struct mwifiex_private *priv =
container_of(delayed_work, struct mwifiex_private,
 dfs_chan_sw_work);
-- 
2.5.0


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


[PATCH 4/6] rtlwifi: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h 
b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 4544752..d37ce16 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -2873,7 +2873,7 @@ value to host byte ordering.*/
(ppsc->cur_ps_level |= _ps_flg)
 
 #define container_of_dwork_rtl(x, y, z) \
-   container_of(container_of(x, struct delayed_work, work), y, z)
+   container_of(to_delayed_work(x), y, z)
 
 #define FILL_OCTET_STRING(_os, _octet, _len)   \
(_os).octet = (u8 *)(_octet);   \
-- 
2.5.0


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


[PATCH 6/6] tilepro: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/net/ethernet/tile/tilepro.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilepro.c 
b/drivers/net/ethernet/tile/tilepro.c
index 6f0a449..298e059 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -1349,8 +1349,7 @@ static int tile_net_open_inner(struct net_device *dev)
  */
 static void tile_net_open_retry(struct work_struct *w)
 {
-   struct delayed_work *dw =
-   container_of(w, struct delayed_work, work);
+   struct delayed_work *dw = to_delayed_work(w);
 
struct tile_net_priv *priv =
container_of(dw, struct tile_net_priv, retry_work);
-- 
2.5.0


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


[PATCH 1/6] cfg80211/mac80211: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 net/mac80211/mlme.c | 3 +--
 net/wireless/mlme.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 1c342e2..ea70917 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1638,8 +1638,7 @@ void ieee80211_dynamic_ps_timer(unsigned long data)
 
 void ieee80211_dfs_cac_timer_work(struct work_struct *work)
 {
-   struct delayed_work *delayed_work =
-   container_of(work, struct delayed_work, work);
+   struct delayed_work *delayed_work = to_delayed_work(work);
struct ieee80211_sub_if_data *sdata =
container_of(delayed_work, struct ieee80211_sub_if_data,
 dfs_cac_timer_work);
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index fb44fa3..4fccf52 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -721,7 +721,7 @@ void cfg80211_dfs_channels_update_work(struct work_struct 
*work)
unsigned long timeout, next_time = 0;
int bandid, i;
 
-   delayed_work = container_of(work, struct delayed_work, work);
+   delayed_work = to_delayed_work(work);
rdev = container_of(delayed_work, struct cfg80211_registered_device,
dfs_update_channels_wk);
wiphy = >wiphy;
-- 
2.5.0


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


[PATCH 3/6] wl1251: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/net/wireless/ti/wl1251/ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl1251/ps.c 
b/drivers/net/wireless/ti/wl1251/ps.c
index b9e27b9..fa01b0a 100644
--- a/drivers/net/wireless/ti/wl1251/ps.c
+++ b/drivers/net/wireless/ti/wl1251/ps.c
@@ -32,7 +32,7 @@ void wl1251_elp_work(struct work_struct *work)
struct delayed_work *dwork;
struct wl1251 *wl;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wl = container_of(dwork, struct wl1251, elp_work);
 
wl1251_debug(DEBUG_PSM, "elp work");
-- 
2.5.0


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


[PATCH 2/6] wlcore: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/net/wireless/ti/wlcore/main.c | 10 +-
 drivers/net/wireless/ti/wlcore/ps.c   |  2 +-
 drivers/net/wireless/ti/wlcore/scan.c |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
index ec7f6af..5c12caa 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -244,7 +244,7 @@ static void wl12xx_tx_watchdog_work(struct work_struct 
*work)
struct delayed_work *dwork;
struct wl1271 *wl;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wl = container_of(dwork, struct wl1271, tx_watchdog_work);
 
mutex_lock(>mutex);
@@ -2085,7 +2085,7 @@ static void wlcore_channel_switch_work(struct work_struct 
*work)
struct wl12xx_vif *wlvif;
int ret;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wlvif = container_of(dwork, struct wl12xx_vif, channel_switch_work);
wl = wlvif->wl;
 
@@ -2121,7 +2121,7 @@ static void wlcore_connection_loss_work(struct 
work_struct *work)
struct ieee80211_vif *vif;
struct wl12xx_vif *wlvif;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wlvif = container_of(dwork, struct wl12xx_vif, connection_loss_work);
wl = wlvif->wl;
 
@@ -2150,7 +2150,7 @@ static void wlcore_pending_auth_complete_work(struct 
work_struct *work)
unsigned long time_spare;
int ret;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wlvif = container_of(dwork, struct wl12xx_vif,
 pending_auth_complete_work);
wl = wlvif->wl;
@@ -5660,7 +5660,7 @@ static void wlcore_roc_complete_work(struct work_struct 
*work)
struct wl1271 *wl;
int ret;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wl = container_of(dwork, struct wl1271, roc_complete_work);
 
ret = wlcore_roc_completed(wl);
diff --git a/drivers/net/wireless/ti/wlcore/ps.c 
b/drivers/net/wireless/ti/wlcore/ps.c
index 4cd316e..d4420da 100644
--- a/drivers/net/wireless/ti/wlcore/ps.c
+++ b/drivers/net/wireless/ti/wlcore/ps.c
@@ -38,7 +38,7 @@ void wl1271_elp_work(struct work_struct *work)
struct wl12xx_vif *wlvif;
int ret;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wl = container_of(dwork, struct wl1271, elp_work);
 
wl1271_debug(DEBUG_PSM, "elp work");
diff --git a/drivers/net/wireless/ti/wlcore/scan.c 
b/drivers/net/wireless/ti/wlcore/scan.c
index 1e3d51c..a384f3f 100644
--- a/drivers/net/wireless/ti/wlcore/scan.c
+++ b/drivers/net/wireless/ti/wlcore/scan.c
@@ -38,7 +38,7 @@ void wl1271_scan_complete_work(struct work_struct *work)
struct wl12xx_vif *wlvif;
int ret;
 
-   dwork = container_of(work, struct delayed_work, work);
+   dwork = to_delayed_work(work);
wl = container_of(dwork, struct wl1271, scan_complete_work);
 
wl1271_debug(DEBUG_SCAN, "Scanning complete");
-- 
2.5.0


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


RE: [PATCH 3/3][v3] Thermal: do thermal zone update after a cooling device registered

2016-01-01 Thread Chen, Yu C
Hi Eduardo,
thanks for your review,

> -Original Message-
> From: Eduardo Valentin [mailto:edubez...@gmail.com]
> Sent: Friday, January 01, 2016 3:04 AM
> To: Chen, Yu C
> Cc: Zhang, Rui; javi.mer...@arm.com; linux...@vger.kernel.org; linux-
> ker...@vger.kernel.org; sta...@vger.kernel.org
> Subject: Re: [PATCH 3/3][v3] Thermal: do thermal zone update after a cooling
> device registered
> 
> Hello Chen,
> 
> On Fri, Oct 30, 2015 at 04:32:10PM +0800, Chen Yu wrote:
> > When a new cooling device is registered, we need to update the thermal
> > zone to set the new registered cooling device to a proper state.
> >
> > This fixes a problem that the system is cool, while the fan devices
> > are left running on full speed after boot, if fan device is registered
> > after thermal zone device.
> >
> > Here is the history of why current patch looks like this:
> > https://patchwork.kernel.org/patch/7273041/
> >
> > CC:  #3.18+
> > Reference:https://bugzilla.kernel.org/show_bug.cgi?id=92431
> > Tested-by: Manuel Krause 
> > Tested-by: szegad 
> > Tested-by: prash 
> > Tested-by: amish 
> > Reviewed-by: Javi Merino 
> > Signed-off-by: Zhang Rui 
> > Signed-off-by: Chen Yu 
> > ---
> >  drivers/thermal/thermal_core.c | 14 +-
> >  include/linux/thermal.h|  2 ++
> >  2 files changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/thermal_core.c
> > b/drivers/thermal/thermal_core.c index 9aae767..ba08b55 100644
> > --- a/drivers/thermal/thermal_core.c
> > +++ b/drivers/thermal/thermal_core.c
> > @@ -1341,6 +1341,7 @@ int thermal_zone_bind_cooling_device(struct
> thermal_zone_device *tz,
> > if (!result) {
> > list_add_tail(>tz_node, >thermal_instances);
> > list_add_tail(>cdev_node, >thermal_instances);
> > +   atomic_set(>need_update, 1);
> > }
> > mutex_unlock(>lock);
> > mutex_unlock(>lock);
> > @@ -1450,6 +1451,7 @@ __thermal_cooling_device_register(struct
> device_node *np,
> >   const struct thermal_cooling_device_ops
> *ops)  {
> > struct thermal_cooling_device *cdev;
> > +   struct thermal_zone_device *pos = NULL;
> > int result;
> >
> > if (type && strlen(type) >= THERMAL_NAME_LENGTH) @@ -1494,6
> +1496,12
> > @@ __thermal_cooling_device_register(struct device_node *np,
> > /* Update binding information for 'this' new cdev */
> > bind_cdev(cdev);
> >
> > +   mutex_lock(_list_lock);
> > +   list_for_each_entry(pos, _tz_list, node)
> > +   if (atomic_cmpxchg(>need_update, 1, 0))
> > +   thermal_zone_device_update(pos);
> > +   mutex_unlock(_list_lock);
> > +
> > return cdev;
> >  }
> >
> > @@ -1826,6 +1834,8 @@ struct thermal_zone_device
> *thermal_zone_device_register(const char *type,
> > tz->trips = trips;
> > tz->passive_delay = passive_delay;
> > tz->polling_delay = polling_delay;
> > +   /* A new thermal zone needs to be updated anyway. */
> > +   atomic_set(>need_update, 1);
> >
> > dev_set_name(>device, "thermal_zone%d", tz->id);
> > result = device_register(>device); @@ -1921,7 +1931,9 @@
> struct
> > thermal_zone_device *thermal_zone_device_register(const char *type,
> > INIT_DELAYED_WORK(&(tz->poll_queue),
> thermal_zone_device_check);
> >
> > thermal_zone_device_reset(tz);
> > -   thermal_zone_device_update(tz);
> > +   /* Update the new thermal zone and mark it as already updated. */
> > +   if (atomic_cmpxchg(>need_update, 1, 0))
> > +   thermal_zone_device_update(tz);
> >
> > return tz;
> >
> > diff --git a/include/linux/thermal.h b/include/linux/thermal.h index
> > 5bcabc7..385d411 100644
> > --- a/include/linux/thermal.h
> > +++ b/include/linux/thermal.h
> > @@ -168,6 +168,7 @@ struct thermal_attr {
> >   * @forced_passive:If > 0, temperature at which to switch on all 
> > ACPI
> >   * processor cooling devices.  Currently only used by the
> >   * step-wise governor.
> > + * @need_update:   if equals 1, thermal_zone_device_update needs to
> be invoked.
> >   * @ops:   operations this _zone_device supports
> >   * @tzp:   thermal zone parameters
> >   * @governor:  pointer to the governor for this thermal zone
> > @@ -195,6 +196,7 @@ struct thermal_zone_device {
> > int emul_temperature;
> > int passive;
> > unsigned int forced_passive;
> > +   atomic_t need_update;
> 
> The only problem I have with the above change is the fact that it does not
> touch thermal_zone_device_update() in any place. Please, remember that
> thermal_zone_device_update() is an exported function. That means that
> anyone can actually call it. And that is what happens today. If you git grep 
> for
> it you will see that there are occurrences inside thermal core and inside
> thermal drivers. And this change do not take care of them. Are you sure you
> don't need to revisit all occurrences?
[Yu] Do you mean this patch should be aware of other places who have 

[PATCH 7/7] mvsas: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/scsi/mvsas/mv_sas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index e712fe7..78bf557 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1887,7 +1887,7 @@ static void mvs_phy_disconnected(struct mvs_phy *phy)
 
 static void mvs_work_queue(struct work_struct *work)
 {
-   struct delayed_work *dw = container_of(work, struct delayed_work, work);
+   struct delayed_work *dw = to_delayed_work(work);
struct mvs_wq *mwq = container_of(dw, struct mvs_wq, work_q);
struct mvs_info *mvi = mwq->mvi;
unsigned long flags;
-- 
2.5.0


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


[PATCH 2/7] edac: i5100_edac: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/edac/i5100_edac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
index 4091777..c655162 100644
--- a/drivers/edac/i5100_edac.c
+++ b/drivers/edac/i5100_edac.c
@@ -575,9 +575,7 @@ static void i5100_check_error(struct mem_ctl_info *mci)
 
 static void i5100_refresh_scrubbing(struct work_struct *work)
 {
-   struct delayed_work *i5100_scrubbing = container_of(work,
-   struct delayed_work,
-   work);
+   struct delayed_work *i5100_scrubbing = to_delayed_work(work);
struct i5100_priv *priv = container_of(i5100_scrubbing,
   struct i5100_priv,
   i5100_scrubbing);
-- 
2.5.0


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


  1   2   3   4   >