Skip to content

Commit

Permalink
Merge pull request #158 from torvalds/master
Browse files Browse the repository at this point in the history
Sync with Linus
  • Loading branch information
dabrace authored Apr 21, 2017
2 parents aa63bd4 + c154165 commit 82e38ba
Show file tree
Hide file tree
Showing 18 changed files with 192 additions and 65 deletions.
2 changes: 2 additions & 0 deletions arch/s390/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,8 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
{
if (!MACHINE_HAS_NX)
pte_val(entry) &= ~_PAGE_NOEXEC;
if (pte_present(entry))
pte_val(entry) &= ~_PAGE_UNUSED;
if (mm_has_pgste(mm))
ptep_set_pte_at(mm, addr, ptep, entry);
else
Expand Down
13 changes: 10 additions & 3 deletions drivers/clk/clk-stm32f4.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ static const struct clk_div_table pll_divp_table[] = {
{ 0, 2 }, { 1, 4 }, { 2, 6 }, { 3, 8 }, { 0 }
};

static const struct clk_div_table pll_divq_table[] = {
{ 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 }, { 7, 7 },
{ 8, 8 }, { 9, 9 }, { 10, 10 }, { 11, 11 }, { 12, 12 }, { 13, 13 },
{ 14, 14 }, { 15, 15 },
{ 0 }
};

static const struct clk_div_table pll_divr_table[] = {
{ 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 }, { 7, 7 }, { 0 }
};
Expand Down Expand Up @@ -496,9 +503,9 @@ struct stm32f4_div_data {

#define MAX_PLL_DIV 3
static const struct stm32f4_div_data div_data[MAX_PLL_DIV] = {
{ 16, 2, 0, pll_divp_table },
{ 24, 4, CLK_DIVIDER_ONE_BASED, NULL },
{ 28, 3, 0, pll_divr_table },
{ 16, 2, 0, pll_divp_table },
{ 24, 4, 0, pll_divq_table },
{ 28, 3, 0, pll_divr_table },
};

struct stm32f4_pll_data {
Expand Down
2 changes: 2 additions & 0 deletions drivers/clk/sunxi-ng/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config SUNXI_CCU
bool "Clock support for Allwinner SoCs"
depends on ARCH_SUNXI || COMPILE_TEST
select RESET_CONTROLLER
default ARCH_SUNXI

if SUNXI_CCU
Expand Down Expand Up @@ -135,6 +136,7 @@ config SUN8I_V3S_CCU
config SUN9I_A80_CCU
bool "Support for the Allwinner A80 CCU"
select SUNXI_CCU_DIV
select SUNXI_CCU_MULT
select SUNXI_CCU_GATE
select SUNXI_CCU_NKMP
select SUNXI_CCU_NM
Expand Down
11 changes: 11 additions & 0 deletions drivers/clk/sunxi-ng/ccu-sun8i-a33.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,13 @@ static const struct sunxi_ccu_desc sun8i_a33_ccu_desc = {
.num_resets = ARRAY_SIZE(sun8i_a33_ccu_resets),
};

static struct ccu_pll_nb sun8i_a33_pll_cpu_nb = {
.common = &pll_cpux_clk.common,
/* copy from pll_cpux_clk */
.enable = BIT(31),
.lock = BIT(28),
};

static struct ccu_mux_nb sun8i_a33_cpu_nb = {
.common = &cpux_clk.common,
.cm = &cpux_clk.mux,
Expand Down Expand Up @@ -783,6 +790,10 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node)

sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc);

/* Gate then ungate PLL CPU after any rate changes */
ccu_pll_notifier_register(&sun8i_a33_pll_cpu_nb);

/* Reparent CPU during PLL CPU rate changes */
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
&sun8i_a33_cpu_nb);
}
Expand Down
49 changes: 49 additions & 0 deletions drivers/clk/sunxi-ng/ccu_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* GNU General Public License for more details.
*/

#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/iopoll.h>
#include <linux/slab.h>

#include "ccu_common.h"
#include "ccu_gate.h"
#include "ccu_reset.h"

static DEFINE_SPINLOCK(ccu_lock);
Expand All @@ -39,6 +41,53 @@ void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock)
WARN_ON(readl_relaxed_poll_timeout(addr, reg, reg & lock, 100, 70000));
}

/*
* This clock notifier is called when the frequency of a PLL clock is
* changed. In common PLL designs, changes to the dividers take effect
* almost immediately, while changes to the multipliers (implemented
* as dividers in the feedback loop) take a few cycles to work into
* the feedback loop for the PLL to stablize.
*
* Sometimes when the PLL clock rate is changed, the decrease in the
* divider is too much for the decrease in the multiplier to catch up.
* The PLL clock rate will spike, and in some cases, might lock up
* completely.
*
* This notifier callback will gate and then ungate the clock,
* effectively resetting it, so it proceeds to work. Care must be
* taken to reparent consumers to other temporary clocks during the
* rate change, and that this notifier callback must be the first
* to be registered.
*/
static int ccu_pll_notifier_cb(struct notifier_block *nb,
unsigned long event, void *data)
{
struct ccu_pll_nb *pll = to_ccu_pll_nb(nb);
int ret = 0;

if (event != POST_RATE_CHANGE)
goto out;

ccu_gate_helper_disable(pll->common, pll->enable);

ret = ccu_gate_helper_enable(pll->common, pll->enable);
if (ret)
goto out;

ccu_helper_wait_for_lock(pll->common, pll->lock);

out:
return notifier_from_errno(ret);
}

int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb)
{
pll_nb->clk_nb.notifier_call = ccu_pll_notifier_cb;

return clk_notifier_register(pll_nb->common->hw.clk,
&pll_nb->clk_nb);
}

int sunxi_ccu_probe(struct device_node *node, void __iomem *reg,
const struct sunxi_ccu_desc *desc)
{
Expand Down
12 changes: 12 additions & 0 deletions drivers/clk/sunxi-ng/ccu_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ struct sunxi_ccu_desc {

void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock);

struct ccu_pll_nb {
struct notifier_block clk_nb;
struct ccu_common *common;

u32 enable;
u32 lock;
};

#define to_ccu_pll_nb(_nb) container_of(_nb, struct ccu_pll_nb, clk_nb)

int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb);

int sunxi_ccu_probe(struct device_node *node, void __iomem *reg,
const struct sunxi_ccu_desc *desc);

Expand Down
12 changes: 11 additions & 1 deletion drivers/hid/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
return;
case HID_DG_TOOLSERIALNUMBER:
wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL);
wacom_wac->serial[0] |= value;
wacom_wac->serial[0] |= (__u32)value;
return;
case WACOM_HID_WD_SENSE:
wacom_wac->hid_data.sense_state = value;
Expand Down Expand Up @@ -2176,6 +2176,16 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
wacom_wac->hid_data.cc_index = field->index;
wacom_wac->hid_data.cc_value_index = usage->usage_index;
break;
case HID_DG_CONTACTID:
if ((field->logical_maximum - field->logical_minimum) < touch_max) {
/*
* The HID descriptor for G11 sensors leaves logical
* maximum set to '1' despite it being a multitouch
* device. Override to a sensible number.
*/
field->logical_maximum = 255;
}
break;
}
}

Expand Down
7 changes: 4 additions & 3 deletions drivers/video/backlight/pwm_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,15 @@ static int pwm_backlight_probe(struct platform_device *pdev)
}

/*
* If the GPIO is configured as input, change the direction to output
* and set the GPIO as active.
* If the GPIO is not known to be already configured as output, that
* is, if gpiod_get_direction returns either GPIOF_DIR_IN or -EINVAL,
* change the direction to output and set the GPIO as active.
* Do not force the GPIO to active when it was already output as it
* could cause backlight flickering or we would enable the backlight too
* early. Leave the decision of the initial backlight state for later.
*/
if (pb->enable_gpio &&
gpiod_get_direction(pb->enable_gpio) == GPIOF_DIR_IN)
gpiod_get_direction(pb->enable_gpio) != GPIOF_DIR_OUT)
gpiod_direction_output(pb->enable_gpio, 1);

pb->power_supply = devm_regulator_get(&pdev->dev, "power");
Expand Down
10 changes: 10 additions & 0 deletions fs/cifs/smb1ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,15 @@ cifs_dir_needs_close(struct cifsFileInfo *cfile)
return !cfile->srch_inf.endOfSearch && !cfile->invalidHandle;
}

static bool
cifs_can_echo(struct TCP_Server_Info *server)
{
if (server->tcpStatus == CifsGood)
return true;

return false;
}

struct smb_version_operations smb1_operations = {
.send_cancel = send_nt_cancel,
.compare_fids = cifs_compare_fids,
Expand Down Expand Up @@ -1049,6 +1058,7 @@ struct smb_version_operations smb1_operations = {
.get_dfs_refer = CIFSGetDFSRefer,
.qfs_tcon = cifs_qfs_tcon,
.is_path_accessible = cifs_is_path_accessible,
.can_echo = cifs_can_echo,
.query_path_info = cifs_query_path_info,
.query_file_info = cifs_query_file_info,
.get_srv_inum = cifs_get_srv_inum,
Expand Down
1 change: 1 addition & 0 deletions fs/nsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static void *__ns_get_path(struct path *path, struct ns_common *ns)
return ERR_PTR(-ENOMEM);
}
d_instantiate(dentry, inode);
dentry->d_flags |= DCACHE_RCUACCESS;
dentry->d_fsdata = (void *)ns->ops;
d = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);
if (d) {
Expand Down
16 changes: 14 additions & 2 deletions kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3405,11 +3405,23 @@ EXPORT_SYMBOL_GPL(ring_buffer_iter_reset);
int ring_buffer_iter_empty(struct ring_buffer_iter *iter)
{
struct ring_buffer_per_cpu *cpu_buffer;
struct buffer_page *reader;
struct buffer_page *head_page;
struct buffer_page *commit_page;
unsigned commit;

cpu_buffer = iter->cpu_buffer;

return iter->head_page == cpu_buffer->commit_page &&
iter->head == rb_commit_index(cpu_buffer);
/* Remember, trace recording is off when iterator is in use */
reader = cpu_buffer->reader_page;
head_page = cpu_buffer->head_page;
commit_page = cpu_buffer->commit_page;
commit = rb_page_commit(commit_page);

return ((iter->head_page == commit_page && iter->head == commit) ||
(iter->head_page == reader && commit_page == head_page &&
head_page->read == commit &&
iter->head == rb_page_commit(cpu_buffer->reader_page)));
}
EXPORT_SYMBOL_GPL(ring_buffer_iter_empty);

Expand Down
8 changes: 5 additions & 3 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -6733,11 +6733,13 @@ ftrace_trace_snapshot_callback(struct ftrace_hash *hash,
return ret;

out_reg:
ret = register_ftrace_function_probe(glob, ops, count);
ret = alloc_snapshot(&global_trace);
if (ret < 0)
goto out;

if (ret >= 0)
alloc_snapshot(&global_trace);
ret = register_ftrace_function_probe(glob, ops, count);

out:
return ret < 0 ? ret : 0;
}

Expand Down
2 changes: 1 addition & 1 deletion mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ void putback_movable_pages(struct list_head *l)
unlock_page(page);
put_page(page);
} else {
putback_lru_page(page);
dec_node_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
putback_lru_page(page);
}
}
}
Expand Down
Loading

0 comments on commit 82e38ba

Please sign in to comment.