--- /dev/null
+From 7cb81136d2efe0f5ed9d965857f4756a15e6c338 Mon Sep 17 00:00:00 2001
+From: Stefan Wahren <stefan.wahren@i2se.com>
+Date: Wed, 29 Apr 2015 16:36:43 +0000
+Subject: clk: Fix JSON output in debugfs
+
+From: Stefan Wahren <stefan.wahren@i2se.com>
+
+commit 7cb81136d2efe0f5ed9d965857f4756a15e6c338 upstream.
+
+key/value pairs in a JSON object must be separated by a comma.
+After adding the properties "accuracy" and "phase" the JSON output
+of /sys/kernel/debug/clk/clk_dump is invalid.
+
+So add the missing commas to fix it.
+
+Fixes: 5279fc402ae5 ("clk: add clk accuracy retrieval support")
+Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
+[sboyd@codeaurora.org: Added comment in function]
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/clk.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/clk/clk.c
++++ b/drivers/clk/clk.c
+@@ -230,11 +230,12 @@ static void clk_dump_one(struct seq_file
+ if (!c)
+ return;
+
++ /* This should be JSON format, i.e. elements separated with a comma */
+ seq_printf(s, "\"%s\": { ", c->name);
+ seq_printf(s, "\"enable_count\": %d,", c->enable_count);
+ seq_printf(s, "\"prepare_count\": %d,", c->prepare_count);
+- seq_printf(s, "\"rate\": %lu", clk_core_get_rate(c));
+- seq_printf(s, "\"accuracy\": %lu", clk_core_get_accuracy(c));
++ seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c));
++ seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c));
+ seq_printf(s, "\"phase\": %d", clk_core_get_phase(c));
+ }
+
--- /dev/null
+From 6d451367bfa16fc103604bacd258f534c65d1540 Mon Sep 17 00:00:00 2001
+From: Hai Li <hali@codeaurora.org>
+Date: Thu, 25 Jun 2015 18:35:33 -0400
+Subject: clk: qcom: Use parent rate when set rate to pixel RCG clock
+
+From: Hai Li <hali@codeaurora.org>
+
+commit 6d451367bfa16fc103604bacd258f534c65d1540 upstream.
+
+Since the parent rate has been recalculated, pixel RCG clock
+should rely on it to find the correct M/N values during set_rate,
+instead of calling __clk_round_rate() to its parent again.
+
+Signed-off-by: Hai Li <hali@codeaurora.org>
+Tested-by: Archit Taneja <architt@codeaurora.org>
+Fixes: 99cbd064b059 ("clk: qcom: Support display RCG clocks")
+[sboyd@codeaurora.org: Silenced unused parent variable warning]
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/qcom/clk-rcg2.c | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+--- a/drivers/clk/qcom/clk-rcg2.c
++++ b/drivers/clk/qcom/clk-rcg2.c
+@@ -530,19 +530,16 @@ static int clk_pixel_set_rate(struct clk
+ struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+ struct freq_tbl f = *rcg->freq_tbl;
+ const struct frac_entry *frac = frac_table_pixel;
+- unsigned long request, src_rate;
++ unsigned long request;
+ int delta = 100000;
+ u32 mask = BIT(rcg->hid_width) - 1;
+ u32 hid_div;
+- int index = qcom_find_src_index(hw, rcg->parent_map, f.src);
+- struct clk *parent = clk_get_parent_by_index(hw->clk, index);
+
+ for (; frac->num; frac++) {
+ request = (rate * frac->den) / frac->num;
+
+- src_rate = __clk_round_rate(parent, request);
+- if ((src_rate < (request - delta)) ||
+- (src_rate > (request + delta)))
++ if ((parent_rate < (request - delta)) ||
++ (parent_rate > (request + delta)))
+ continue;
+
+ regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
--- /dev/null
+From e0cdcda508f110b7ec190dc7c5eb2869ba73a535 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Date: Wed, 13 May 2015 15:54:40 +0900
+Subject: clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference
+
+From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+
+commit e0cdcda508f110b7ec190dc7c5eb2869ba73a535 upstream.
+
+of_clk_get_from_provider() returns ERR_PTR on failure. The
+dra7-atl-clock driver was not checking its return value and
+immediately used it in __clk_get_hw(). __clk_get_hw()
+dereferences supplied clock, if it is not NULL, so in that case
+it would dereference an ERR_PTR.
+
+Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
+Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/ti/clk-dra7-atl.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/clk/ti/clk-dra7-atl.c
++++ b/drivers/clk/ti/clk-dra7-atl.c
+@@ -252,6 +252,11 @@ static int of_dra7_atl_clk_probe(struct
+ }
+
+ clk = of_clk_get_from_provider(&clkspec);
++ if (IS_ERR(clk)) {
++ pr_err("%s: failed to get atl clock %d from provider\n",
++ __func__, i);
++ return PTR_ERR(clk);
++ }
+
+ cdesc = to_atl_desc(__clk_get_hw(clk));
+ cdesc->cinfo = cinfo;
--- /dev/null
+From 496e7ce2a46562938edcb74f65b26068ee8895f6 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+Date: Thu, 7 May 2015 01:08:08 -0700
+Subject: gpiolib: Add missing dummies for the unified device properties interface
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+
+commit 496e7ce2a46562938edcb74f65b26068ee8895f6 upstream.
+
+If GPIOLIB=n:
+
+ drivers/leds/leds-gpio.c: In function ‘gpio_leds_create’:
+ drivers/leds/leds-gpio.c:187: error: implicit declaration of function ‘devm_get_gpiod_from_child’
+ drivers/leds/leds-gpio.c:187: warning: assignment makes pointer from integer without a cast
+
+Add dummies for fwnode_get_named_gpiod() and devm_get_gpiod_from_child()
+for the !GPIOLIB case to fix this.
+
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Fixes: 40b7318319281b1b ("gpio: Support for unified device properties interface")
+Acked-by: Alexandre Courbot <acourbot@nvidia.com>
+Acked-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Bryan Wu <cooloney@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/gpio/consumer.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+--- a/include/linux/gpio/consumer.h
++++ b/include/linux/gpio/consumer.h
+@@ -406,6 +406,21 @@ static inline int desc_to_gpio(const str
+ return -EINVAL;
+ }
+
++/* Child properties interface */
++struct fwnode_handle;
++
++static inline struct gpio_desc *fwnode_get_named_gpiod(
++ struct fwnode_handle *fwnode, const char *propname)
++{
++ return ERR_PTR(-ENOSYS);
++}
++
++static inline struct gpio_desc *devm_get_gpiod_from_child(
++ struct device *dev, const char *con_id, struct fwnode_handle *child)
++{
++ return ERR_PTR(-ENOSYS);
++}
++
+ #endif /* CONFIG_GPIOLIB */
+
+ /*
--- /dev/null
+From d683cc49daf7c5afca8cd9654aaa1bf63cdf2ad9 Mon Sep 17 00:00:00 2001
+From: Chuck Lever <chuck.lever@oracle.com>
+Date: Tue, 26 May 2015 11:53:52 -0400
+Subject: NFS: Fix size of NFSACL SETACL operations
+
+From: Chuck Lever <chuck.lever@oracle.com>
+
+commit d683cc49daf7c5afca8cd9654aaa1bf63cdf2ad9 upstream.
+
+When encoding the NFSACL SETACL operation, reserve just the estimated
+size of the ACL rather than a fixed maximum. This eliminates needless
+zero padding on the wire that the server ignores.
+
+Fixes: ee5dc7732bd5 ('NFS: Fix "kernel BUG at fs/nfs/nfs3xdr.c:1338!"')
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/nfs3xdr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/nfs/nfs3xdr.c
++++ b/fs/nfs/nfs3xdr.c
+@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(str
+ if (args->npages != 0)
+ xdr_write_pages(xdr, args->pages, 0, args->len);
+ else
+- xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE);
++ xdr_reserve_space(xdr, args->len);
+
+ error = nfsacl_encode(xdr->buf, base, args->inode,
+ (args->mask & NFS_ACL) ?
--- /dev/null
+From c8fff7bc5bba6bd59cad40441c189c4efe7190f6 Mon Sep 17 00:00:00 2001
+From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Date: Wed, 8 Apr 2015 19:59:20 +0300
+Subject: of: return NUMA_NO_NODE from fallback of_node_to_nid()
+
+From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+
+commit c8fff7bc5bba6bd59cad40441c189c4efe7190f6 upstream.
+
+Node 0 might be offline as well as any other numa node,
+in this case kernel cannot handle memory allocation and crashes.
+
+Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Fixes: 0c3f061c195c ("of: implement of_node_to_nid as a weak function")
+Signed-off-by: Grant Likely <grant.likely@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/of/base.c | 2 +-
+ include/linux/of.h | 5 ++++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -89,7 +89,7 @@ EXPORT_SYMBOL(of_n_size_cells);
+ #ifdef CONFIG_NUMA
+ int __weak of_node_to_nid(struct device_node *np)
+ {
+- return numa_node_id();
++ return NUMA_NO_NODE;
+ }
+ #endif
+
+--- a/include/linux/of.h
++++ b/include/linux/of.h
+@@ -673,7 +673,10 @@ static inline void of_property_clear_fla
+ #if defined(CONFIG_OF) && defined(CONFIG_NUMA)
+ extern int of_node_to_nid(struct device_node *np);
+ #else
+-static inline int of_node_to_nid(struct device_node *device) { return 0; }
++static inline int of_node_to_nid(struct device_node *device)
++{
++ return NUMA_NO_NODE;
++}
+ #endif
+
+ static inline struct device_node *of_find_matching_node(
--- /dev/null
+From cdb672795876d7bc1870aed9a2d7cb59f43d1d96 Mon Sep 17 00:00:00 2001
+From: Miklos Szeredi <mszeredi@suse.cz>
+Date: Mon, 22 Jun 2015 13:53:48 +0200
+Subject: ovl: lookup whiteouts outside iterate_dir()
+
+From: Miklos Szeredi <mszeredi@suse.cz>
+
+commit cdb672795876d7bc1870aed9a2d7cb59f43d1d96 upstream.
+
+If jffs2 can deadlock on overlayfs readdir because it takes the same lock
+on ->iterate() as in ->lookup().
+
+Fix by moving whiteout checking outside iterate_dir(). Optimized by
+collecting potential whiteouts (DT_CHR) in a temporary list and if
+non-empty iterating throug these and checking for a 0/0 chardev.
+
+Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
+Fixes: 49c21e1cacd7 ("ovl: check whiteout while reading directory")
+Reported-by: Roman Yeryomin <leroi.lists@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/overlayfs/readdir.c | 77 +++++++++++++++++++++++++++++++------------------
+ 1 file changed, 49 insertions(+), 28 deletions(-)
+
+--- a/fs/overlayfs/readdir.c
++++ b/fs/overlayfs/readdir.c
+@@ -23,6 +23,7 @@ struct ovl_cache_entry {
+ u64 ino;
+ struct list_head l_node;
+ struct rb_node node;
++ struct ovl_cache_entry *next_maybe_whiteout;
+ bool is_whiteout;
+ char name[];
+ };
+@@ -39,7 +40,7 @@ struct ovl_readdir_data {
+ struct rb_root root;
+ struct list_head *list;
+ struct list_head middle;
+- struct dentry *dir;
++ struct ovl_cache_entry *first_maybe_whiteout;
+ int count;
+ int err;
+ };
+@@ -79,7 +80,7 @@ static struct ovl_cache_entry *ovl_cache
+ return NULL;
+ }
+
+-static struct ovl_cache_entry *ovl_cache_entry_new(struct dentry *dir,
++static struct ovl_cache_entry *ovl_cache_entry_new(struct ovl_readdir_data *rdd,
+ const char *name, int len,
+ u64 ino, unsigned int d_type)
+ {
+@@ -98,29 +99,8 @@ static struct ovl_cache_entry *ovl_cache
+ p->is_whiteout = false;
+
+ if (d_type == DT_CHR) {
+- struct dentry *dentry;
+- const struct cred *old_cred;
+- struct cred *override_cred;
+-
+- override_cred = prepare_creds();
+- if (!override_cred) {
+- kfree(p);
+- return NULL;
+- }
+-
+- /*
+- * CAP_DAC_OVERRIDE for lookup
+- */
+- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE);
+- old_cred = override_creds(override_cred);
+-
+- dentry = lookup_one_len(name, dir, len);
+- if (!IS_ERR(dentry)) {
+- p->is_whiteout = ovl_is_whiteout(dentry);
+- dput(dentry);
+- }
+- revert_creds(old_cred);
+- put_cred(override_cred);
++ p->next_maybe_whiteout = rdd->first_maybe_whiteout;
++ rdd->first_maybe_whiteout = p;
+ }
+ return p;
+ }
+@@ -148,7 +128,7 @@ static int ovl_cache_entry_add_rb(struct
+ return 0;
+ }
+
+- p = ovl_cache_entry_new(rdd->dir, name, len, ino, d_type);
++ p = ovl_cache_entry_new(rdd, name, len, ino, d_type);
+ if (p == NULL)
+ return -ENOMEM;
+
+@@ -169,7 +149,7 @@ static int ovl_fill_lower(struct ovl_rea
+ if (p) {
+ list_move_tail(&p->l_node, &rdd->middle);
+ } else {
+- p = ovl_cache_entry_new(rdd->dir, name, namelen, ino, d_type);
++ p = ovl_cache_entry_new(rdd, name, namelen, ino, d_type);
+ if (p == NULL)
+ rdd->err = -ENOMEM;
+ else
+@@ -219,6 +199,43 @@ static int ovl_fill_merge(struct dir_con
+ return ovl_fill_lower(rdd, name, namelen, offset, ino, d_type);
+ }
+
++static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd)
++{
++ int err;
++ struct ovl_cache_entry *p;
++ struct dentry *dentry;
++ const struct cred *old_cred;
++ struct cred *override_cred;
++
++ override_cred = prepare_creds();
++ if (!override_cred)
++ return -ENOMEM;
++
++ /*
++ * CAP_DAC_OVERRIDE for lookup
++ */
++ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE);
++ old_cred = override_creds(override_cred);
++
++ err = mutex_lock_killable(&dir->d_inode->i_mutex);
++ if (!err) {
++ while (rdd->first_maybe_whiteout) {
++ p = rdd->first_maybe_whiteout;
++ rdd->first_maybe_whiteout = p->next_maybe_whiteout;
++ dentry = lookup_one_len(p->name, dir, p->len);
++ if (!IS_ERR(dentry)) {
++ p->is_whiteout = ovl_is_whiteout(dentry);
++ dput(dentry);
++ }
++ }
++ mutex_unlock(&dir->d_inode->i_mutex);
++ }
++ revert_creds(old_cred);
++ put_cred(override_cred);
++
++ return err;
++}
++
+ static inline int ovl_dir_read(struct path *realpath,
+ struct ovl_readdir_data *rdd)
+ {
+@@ -229,7 +246,7 @@ static inline int ovl_dir_read(struct pa
+ if (IS_ERR(realfile))
+ return PTR_ERR(realfile);
+
+- rdd->dir = realpath->dentry;
++ rdd->first_maybe_whiteout = NULL;
+ rdd->ctx.pos = 0;
+ do {
+ rdd->count = 0;
+@@ -238,6 +255,10 @@ static inline int ovl_dir_read(struct pa
+ if (err >= 0)
+ err = rdd->err;
+ } while (!err && rdd->count);
++
++ if (!err && rdd->first_maybe_whiteout)
++ err = ovl_check_whiteouts(realpath->dentry, rdd);
++
+ fput(realfile);
+
+ return err;
--- /dev/null
+From 1ca018d28d96d07788474abf66a5f3e9594841f5 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+Date: Wed, 17 Jun 2015 19:41:51 -0400
+Subject: pNFS: Fix a memory leak when attempted pnfs fails
+
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+
+commit 1ca018d28d96d07788474abf66a5f3e9594841f5 upstream.
+
+pnfs_do_write() expects the call to pnfs_write_through_mds() to free the
+pgio header and to release the layout segment before exiting. The problem
+is that nfs_pgio_data_destroy() doesn't actually do this; it only frees
+the memory allocated by nfs_generic_pgio().
+
+Ditto for pnfs_do_read()...
+
+Fix in both cases is to add a call to hdr->release(hdr).
+
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/pnfs.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/nfs/pnfs.c
++++ b/fs/nfs/pnfs.c
+@@ -1865,6 +1865,7 @@ pnfs_write_through_mds(struct nfs_pageio
+ mirror->pg_recoalesce = 1;
+ }
+ nfs_pgio_data_destroy(hdr);
++ hdr->release(hdr);
+ }
+
+ static enum pnfs_try_status
+@@ -1979,6 +1980,7 @@ pnfs_read_through_mds(struct nfs_pageio_
+ mirror->pg_recoalesce = 1;
+ }
+ nfs_pgio_data_destroy(hdr);
++ hdr->release(hdr);
+ }
+
+ /*
--- /dev/null
+From d620876990f02788d5a663075df007ffb91bdfad Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+Date: Fri, 26 Jun 2015 15:37:58 -0400
+Subject: pNFS/flexfiles: Fix the reset of struct pgio_header when resending
+
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+
+commit d620876990f02788d5a663075df007ffb91bdfad upstream.
+
+hdr->good_bytes needs to be set to the length of the request, not
+zero.
+
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/flexfilelayout/flexfilelayout.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c
+@@ -631,7 +631,7 @@ static void ff_layout_reset_write(struct
+ nfs_direct_set_resched_writes(hdr->dreq);
+ /* fake unstable write to let common nfs resend pages */
+ hdr->verf.committed = NFS_UNSTABLE;
+- hdr->good_bytes = 0;
++ hdr->good_bytes = hdr->args.count;
+ }
+ return;
+ }
ideapad-fix-software-rfkill-setting.patch
of-address-use-atomic-allocation-in-pci_register_io_range.patch
dell-laptop-fix-allocating-freeing-smi-buffer-page.patch
+ovl-lookup-whiteouts-outside-iterate_dir.patch
+of-return-numa_no_node-from-fallback-of_node_to_nid.patch
+watchdog-omap-assert-the-counter-being-stopped-before-reprogramming.patch
+gpiolib-add-missing-dummies-for-the-unified-device-properties-interface.patch
+clk-fix-json-output-in-debugfs.patch
+clk-ti-dra7-atl-clock-fix-possible-err_ptr-dereference.patch
+clk-qcom-use-parent-rate-when-set-rate-to-pixel-rcg-clock.patch
+pnfs-fix-a-memory-leak-when-attempted-pnfs-fails.patch
+pnfs-flexfiles-fix-the-reset-of-struct-pgio_header-when-resending.patch
+nfs-fix-size-of-nfsacl-setacl-operations.patch
--- /dev/null
+From 530c11d432727c697629ad5f9d00ee8e2864d453 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 29 Apr 2015 20:38:46 +0200
+Subject: watchdog: omap: assert the counter being stopped before reprogramming
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+
+commit 530c11d432727c697629ad5f9d00ee8e2864d453 upstream.
+
+The omap watchdog has the annoying behaviour that writes to most
+registers don't have any effect when the watchdog is already running.
+Quoting the AM335x reference manual:
+
+ To modify the timer counter value (the WDT_WCRR register),
+ prescaler ratio (the WDT_WCLR[4:2] PTV bit field), delay
+ configuration value (the WDT_WDLY[31:0] DLY_VALUE bit field), or
+ the load value (the WDT_WLDR[31:0] TIMER_LOAD bit field), the
+ watchdog timer must be disabled by using the start/stop sequence
+ (the WDT_WSPR register).
+
+Currently the timer is stopped in the .probe callback but still there
+are possibilities that yield to a situation where omap_wdt_start is
+entered with the timer running (e.g. when /dev/watchdog is closed
+without stopping and then reopened). In such a case programming the
+timeout silently fails!
+
+To circumvent this stop the timer before reprogramming.
+
+Assuming one of the first things the watchdog user does is setting the
+timeout explicitly nothing too bad should happen because this explicit
+setting works fine.
+
+Fixes: 7768a13c252a ("[PATCH] OMAP: Add Watchdog driver support")
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/watchdog/omap_wdt.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/watchdog/omap_wdt.c
++++ b/drivers/watchdog/omap_wdt.c
+@@ -132,6 +132,13 @@ static int omap_wdt_start(struct watchdo
+
+ pm_runtime_get_sync(wdev->dev);
+
++ /*
++ * Make sure the watchdog is disabled. This is unfortunately required
++ * because writing to various registers with the watchdog running has no
++ * effect.
++ */
++ omap_wdt_disable(wdev);
++
+ /* initialize prescaler */
+ while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01)
+ cpu_relax();