mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Merge 9dc7ad2b67 ("perf/aux: Fix AUX buffer serialization") into android14-6.1-lts
Steps on the way to 6.1.110 Resolves merge conflicts in: io_uring/sqpoll.c Change-Id: Ic3cb865b98eb20277b5d566683e5c1f53a0d5e76 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -303,13 +303,6 @@ int r4k_clockevent_init(void)
|
||||
if (!c0_compare_int_usable())
|
||||
return -ENXIO;
|
||||
|
||||
/*
|
||||
* With vectored interrupts things are getting platform specific.
|
||||
* get_c0_compare_int is a hook to allow a platform to return the
|
||||
* interrupt number of its liking.
|
||||
*/
|
||||
irq = get_c0_compare_int();
|
||||
|
||||
cd = &per_cpu(mips_clockevent_device, cpu);
|
||||
|
||||
cd->name = "MIPS";
|
||||
@@ -320,7 +313,6 @@ int r4k_clockevent_init(void)
|
||||
min_delta = calculate_min_delta();
|
||||
|
||||
cd->rating = 300;
|
||||
cd->irq = irq;
|
||||
cd->cpumask = cpumask_of(cpu);
|
||||
cd->set_next_event = mips_next_event;
|
||||
cd->event_handler = mips_event_handler;
|
||||
@@ -332,6 +324,13 @@ int r4k_clockevent_init(void)
|
||||
|
||||
cp0_timer_irq_installed = 1;
|
||||
|
||||
/*
|
||||
* With vectored interrupts things are getting platform specific.
|
||||
* get_c0_compare_int is a hook to allow a platform to return the
|
||||
* interrupt number of its liking.
|
||||
*/
|
||||
irq = get_c0_compare_int();
|
||||
|
||||
if (request_irq(irq, c0_compare_interrupt, flags, "timer",
|
||||
c0_compare_interrupt))
|
||||
pr_err("Failed to request irq %d (timer)\n", irq);
|
||||
|
||||
@@ -307,6 +307,9 @@ clear_bss_done:
|
||||
#else
|
||||
mv a0, s1
|
||||
#endif /* CONFIG_BUILTIN_DTB */
|
||||
/* Set trap vector to spin forever to help debug */
|
||||
la a3, .Lsecondary_park
|
||||
csrw CSR_TVEC, a3
|
||||
call setup_vm
|
||||
#ifdef CONFIG_MMU
|
||||
la a0, early_pg_dir
|
||||
|
||||
@@ -71,6 +71,15 @@ SECTIONS
|
||||
. = ALIGN(PAGE_SIZE);
|
||||
__end_ro_after_init = .;
|
||||
|
||||
.data.rel.ro : {
|
||||
*(.data.rel.ro .data.rel.ro.*)
|
||||
}
|
||||
.got : {
|
||||
__got_start = .;
|
||||
*(.got)
|
||||
__got_end = .;
|
||||
}
|
||||
|
||||
RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE)
|
||||
BOOT_DATA_PRESERVED
|
||||
|
||||
|
||||
@@ -383,6 +383,7 @@ int setup_one_line(struct line *lines, int n, char *init,
|
||||
parse_chan_pair(NULL, line, n, opts, error_out);
|
||||
err = 0;
|
||||
}
|
||||
*error_out = "configured as 'none'";
|
||||
} else {
|
||||
char *new = kstrdup(init, GFP_KERNEL);
|
||||
if (!new) {
|
||||
@@ -406,6 +407,7 @@ int setup_one_line(struct line *lines, int n, char *init,
|
||||
}
|
||||
}
|
||||
if (err) {
|
||||
*error_out = "failed to parse channel pair";
|
||||
line->init_str = NULL;
|
||||
line->valid = 0;
|
||||
kfree(new);
|
||||
|
||||
@@ -577,6 +577,13 @@ struct fpu_state_config {
|
||||
* even without XSAVE support, i.e. legacy features FP + SSE
|
||||
*/
|
||||
u64 legacy_features;
|
||||
/*
|
||||
* @independent_features:
|
||||
*
|
||||
* Features that are supported by XSAVES, but not managed as part of
|
||||
* the FPU core, such as LBR
|
||||
*/
|
||||
u64 independent_features;
|
||||
};
|
||||
|
||||
/* FPU state configuration information */
|
||||
|
||||
@@ -792,6 +792,9 @@ void __init fpu__init_system_xstate(unsigned int legacy_size)
|
||||
goto out_disable;
|
||||
}
|
||||
|
||||
fpu_kernel_cfg.independent_features = fpu_kernel_cfg.max_features &
|
||||
XFEATURE_MASK_INDEPENDENT;
|
||||
|
||||
/*
|
||||
* Clear XSAVE features that are disabled in the normal CPUID.
|
||||
*/
|
||||
|
||||
@@ -64,9 +64,9 @@ static inline u64 xfeatures_mask_supervisor(void)
|
||||
static inline u64 xfeatures_mask_independent(void)
|
||||
{
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return XFEATURE_MASK_INDEPENDENT & ~XFEATURE_MASK_LBR;
|
||||
return fpu_kernel_cfg.independent_features & ~XFEATURE_MASK_LBR;
|
||||
|
||||
return XFEATURE_MASK_INDEPENDENT;
|
||||
return fpu_kernel_cfg.independent_features;
|
||||
}
|
||||
|
||||
/* XSAVE/XRSTOR wrapper functions */
|
||||
|
||||
@@ -25,6 +25,9 @@ static __always_inline void rep_movs(void *to, const void *from, size_t n)
|
||||
|
||||
static void string_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
|
||||
{
|
||||
const void *orig_to = to;
|
||||
const size_t orig_n = n;
|
||||
|
||||
if (unlikely(!n))
|
||||
return;
|
||||
|
||||
@@ -39,7 +42,7 @@ static void string_memcpy_fromio(void *to, const volatile void __iomem *from, si
|
||||
}
|
||||
rep_movs(to, (const void *)from, n);
|
||||
/* KMSAN must treat values read from devices as initialized. */
|
||||
kmsan_unpoison_memory(to, n);
|
||||
kmsan_unpoison_memory(orig_to, orig_n);
|
||||
}
|
||||
|
||||
static void string_memcpy_toio(volatile void __iomem *to, const void *from, size_t n)
|
||||
|
||||
@@ -540,7 +540,8 @@ static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc)
|
||||
|
||||
while (sg_len) {
|
||||
/* table overflow should never happen */
|
||||
BUG_ON (pi++ >= MAX_DCMDS);
|
||||
if (WARN_ON_ONCE(pi >= MAX_DCMDS))
|
||||
return AC_ERR_SYSTEM;
|
||||
|
||||
len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG;
|
||||
table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE);
|
||||
@@ -552,11 +553,13 @@ static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc)
|
||||
addr += len;
|
||||
sg_len -= len;
|
||||
++table;
|
||||
++pi;
|
||||
}
|
||||
}
|
||||
|
||||
/* Should never happen according to Tejun */
|
||||
BUG_ON(!pi);
|
||||
if (WARN_ON_ONCE(!pi))
|
||||
return AC_ERR_SYSTEM;
|
||||
|
||||
/* Convert the last command to an input/output */
|
||||
table--;
|
||||
|
||||
@@ -564,6 +564,7 @@ void * devres_open_group(struct device *dev, void *id, gfp_t gfp)
|
||||
grp->id = grp;
|
||||
if (id)
|
||||
grp->id = id;
|
||||
grp->color = 0;
|
||||
|
||||
spin_lock_irqsave(&dev->devres_lock, flags);
|
||||
add_dr(dev, &grp->node[0]);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#define PLL_USER_CTL(p) ((p)->offset + (p)->regs[PLL_OFF_USER_CTL])
|
||||
# define PLL_POST_DIV_SHIFT 8
|
||||
# define PLL_POST_DIV_MASK(p) GENMASK((p)->width, 0)
|
||||
# define PLL_POST_DIV_MASK(p) GENMASK((p)->width - 1, 0)
|
||||
# define PLL_ALPHA_EN BIT(24)
|
||||
# define PLL_ALPHA_MODE BIT(25)
|
||||
# define PLL_VCO_SHIFT 20
|
||||
@@ -1421,8 +1421,8 @@ clk_trion_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
}
|
||||
|
||||
return regmap_update_bits(regmap, PLL_USER_CTL(pll),
|
||||
PLL_POST_DIV_MASK(pll) << PLL_POST_DIV_SHIFT,
|
||||
val << PLL_POST_DIV_SHIFT);
|
||||
PLL_POST_DIV_MASK(pll) << pll->post_div_shift,
|
||||
val << pll->post_div_shift);
|
||||
}
|
||||
|
||||
const struct clk_ops clk_alpha_pll_postdiv_trion_ops = {
|
||||
|
||||
@@ -83,20 +83,28 @@ static u64 notrace tpm_read_sched_clock(void)
|
||||
static int tpm_set_next_event(unsigned long delta,
|
||||
struct clock_event_device *evt)
|
||||
{
|
||||
unsigned long next, now;
|
||||
unsigned long next, prev, now;
|
||||
|
||||
next = tpm_read_counter();
|
||||
next += delta;
|
||||
prev = tpm_read_counter();
|
||||
next = prev + delta;
|
||||
writel(next, timer_base + TPM_C0V);
|
||||
now = tpm_read_counter();
|
||||
|
||||
/*
|
||||
* Need to wait CNT increase at least 1 cycle to make sure
|
||||
* the C0V has been updated into HW.
|
||||
*/
|
||||
if ((next & 0xffffffff) != readl(timer_base + TPM_C0V))
|
||||
while (now == tpm_read_counter())
|
||||
;
|
||||
|
||||
/*
|
||||
* NOTE: We observed in a very small probability, the bus fabric
|
||||
* contention between GPU and A7 may results a few cycles delay
|
||||
* of writing CNT registers which may cause the min_delta event got
|
||||
* missed, so we need add a ETIME check here in case it happened.
|
||||
*/
|
||||
return (int)(next - now) <= 0 ? -ETIME : 0;
|
||||
return (now - prev) >= delta ? -ETIME : 0;
|
||||
}
|
||||
|
||||
static int tpm_set_state_oneshot(struct clock_event_device *evt)
|
||||
|
||||
@@ -25,10 +25,7 @@ static void timer_of_irq_exit(struct of_timer_irq *of_irq)
|
||||
|
||||
struct clock_event_device *clkevt = &to->clkevt;
|
||||
|
||||
if (of_irq->percpu)
|
||||
free_percpu_irq(of_irq->irq, clkevt);
|
||||
else
|
||||
free_irq(of_irq->irq, clkevt);
|
||||
free_irq(of_irq->irq, clkevt);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,9 +39,6 @@ static void timer_of_irq_exit(struct of_timer_irq *of_irq)
|
||||
* - Get interrupt number by name
|
||||
* - Get interrupt number by index
|
||||
*
|
||||
* When the interrupt is per CPU, 'request_percpu_irq()' is called,
|
||||
* otherwise 'request_irq()' is used.
|
||||
*
|
||||
* Returns 0 on success, < 0 otherwise
|
||||
*/
|
||||
static int timer_of_irq_init(struct device_node *np,
|
||||
@@ -69,12 +63,9 @@ static int timer_of_irq_init(struct device_node *np,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = of_irq->percpu ?
|
||||
request_percpu_irq(of_irq->irq, of_irq->handler,
|
||||
np->full_name, clkevt) :
|
||||
request_irq(of_irq->irq, of_irq->handler,
|
||||
of_irq->flags ? of_irq->flags : IRQF_TIMER,
|
||||
np->full_name, clkevt);
|
||||
ret = request_irq(of_irq->irq, of_irq->handler,
|
||||
of_irq->flags ? of_irq->flags : IRQF_TIMER,
|
||||
np->full_name, clkevt);
|
||||
if (ret) {
|
||||
pr_err("Failed to request irq %d for %pOF\n", of_irq->irq, np);
|
||||
return ret;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
struct of_timer_irq {
|
||||
int irq;
|
||||
int index;
|
||||
int percpu;
|
||||
const char *name;
|
||||
unsigned long flags;
|
||||
irq_handler_t handler;
|
||||
|
||||
@@ -100,7 +100,9 @@ static u32 adf_gen2_disable_pending_vf2pf_interrupts(void __iomem *pmisc_addr)
|
||||
errmsk3 |= ADF_GEN2_ERR_MSK_VF2PF(ADF_GEN2_VF_MSK);
|
||||
ADF_CSR_WR(pmisc_addr, ADF_GEN2_ERRMSK3, errmsk3);
|
||||
|
||||
errmsk3 &= ADF_GEN2_ERR_MSK_VF2PF(sources | disabled);
|
||||
/* Update only section of errmsk3 related to VF2PF */
|
||||
errmsk3 &= ~ADF_GEN2_ERR_MSK_VF2PF(ADF_GEN2_VF_MSK);
|
||||
errmsk3 |= ADF_GEN2_ERR_MSK_VF2PF(sources | disabled);
|
||||
ADF_CSR_WR(pmisc_addr, ADF_GEN2_ERRMSK3, errmsk3);
|
||||
|
||||
/* Return the sources of the (new) interrupt(s) */
|
||||
|
||||
@@ -180,8 +180,12 @@ static u32 disable_pending_vf2pf_interrupts(void __iomem *pmisc_addr)
|
||||
ADF_CSR_WR(pmisc_addr, ADF_GEN2_ERRMSK3, errmsk3);
|
||||
ADF_CSR_WR(pmisc_addr, ADF_GEN2_ERRMSK5, errmsk5);
|
||||
|
||||
errmsk3 &= ADF_DH895XCC_ERR_MSK_VF2PF_L(sources | disabled);
|
||||
errmsk5 &= ADF_DH895XCC_ERR_MSK_VF2PF_U(sources | disabled);
|
||||
/* Update only section of errmsk3 and errmsk5 related to VF2PF */
|
||||
errmsk3 &= ~ADF_DH895XCC_ERR_MSK_VF2PF_L(ADF_DH895XCC_VF_MSK);
|
||||
errmsk5 &= ~ADF_DH895XCC_ERR_MSK_VF2PF_U(ADF_DH895XCC_VF_MSK);
|
||||
|
||||
errmsk3 |= ADF_DH895XCC_ERR_MSK_VF2PF_L(sources | disabled);
|
||||
errmsk5 |= ADF_DH895XCC_ERR_MSK_VF2PF_U(sources | disabled);
|
||||
ADF_CSR_WR(pmisc_addr, ADF_GEN2_ERRMSK3, errmsk3);
|
||||
ADF_CSR_WR(pmisc_addr, ADF_GEN2_ERRMSK5, errmsk5);
|
||||
|
||||
|
||||
@@ -764,6 +764,9 @@ int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl,
|
||||
|
||||
lockdep_assert_held(&ctl->dsp->pwr_lock);
|
||||
|
||||
if (ctl->flags && !(ctl->flags & WMFW_CTL_FLAG_WRITEABLE))
|
||||
return -EPERM;
|
||||
|
||||
if (len + off * sizeof(u32) > ctl->len)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@@ -873,8 +873,7 @@ static int check_tiling_flags_gfx6(struct amdgpu_framebuffer *afb)
|
||||
{
|
||||
u64 micro_tile_mode;
|
||||
|
||||
/* Zero swizzle mode means linear */
|
||||
if (AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE) == 0)
|
||||
if (AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) == 1) /* LINEAR_ALIGNED */
|
||||
return 0;
|
||||
|
||||
micro_tile_mode = AMDGPU_TILING_GET(afb->tiling_flags, MICRO_TILE_MODE);
|
||||
|
||||
@@ -132,8 +132,10 @@ int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init)
|
||||
|
||||
if (virt->ops && virt->ops->req_full_gpu) {
|
||||
r = virt->ops->req_full_gpu(adev, init);
|
||||
if (r)
|
||||
if (r) {
|
||||
adev->no_hw_access = true;
|
||||
return r;
|
||||
}
|
||||
|
||||
adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
|
||||
}
|
||||
|
||||
@@ -4330,11 +4330,11 @@ static int gfx_v11_0_hw_init(void *handle)
|
||||
/* RLC autoload sequence 1: Program rlc ram */
|
||||
if (adev->gfx.imu.funcs->program_rlc_ram)
|
||||
adev->gfx.imu.funcs->program_rlc_ram(adev);
|
||||
/* rlc autoload firmware */
|
||||
r = gfx_v11_0_rlc_backdoor_autoload_enable(adev);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
/* rlc autoload firmware */
|
||||
r = gfx_v11_0_rlc_backdoor_autoload_enable(adev);
|
||||
if (r)
|
||||
return r;
|
||||
} else {
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
|
||||
if (adev->gfx.imu.funcs && (amdgpu_dpm > 0)) {
|
||||
|
||||
@@ -135,6 +135,34 @@ static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev,
|
||||
|
||||
tmp = RREG32(ih_regs->ih_rb_cntl);
|
||||
tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RB_ENABLE, (enable ? 1 : 0));
|
||||
|
||||
if (enable) {
|
||||
/* Unset the CLEAR_OVERFLOW bit to make sure the next step
|
||||
* is switching the bit from 0 to 1
|
||||
*/
|
||||
tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
|
||||
if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
|
||||
if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
|
||||
return -ETIMEDOUT;
|
||||
} else {
|
||||
WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
|
||||
}
|
||||
|
||||
/* Clear RB_OVERFLOW bit */
|
||||
tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
|
||||
if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
|
||||
if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
|
||||
return -ETIMEDOUT;
|
||||
} else {
|
||||
WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
|
||||
}
|
||||
|
||||
/* Unset the CLEAR_OVERFLOW bit immediately so new overflows
|
||||
* can be detected.
|
||||
*/
|
||||
tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
|
||||
}
|
||||
|
||||
/* enable_intr field is only valid in ring0 */
|
||||
if (ih == &adev->irq.ih)
|
||||
tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0));
|
||||
|
||||
@@ -6767,7 +6767,7 @@ static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state,
|
||||
}
|
||||
}
|
||||
|
||||
if (j == dc_state->stream_count)
|
||||
if (j == dc_state->stream_count || pbn_div == 0)
|
||||
continue;
|
||||
|
||||
slot_num = DIV_ROUND_UP(pbn, pbn_div);
|
||||
|
||||
@@ -433,17 +433,20 @@ static enum mod_hdcp_status authenticated_dp(struct mod_hdcp *hdcp,
|
||||
}
|
||||
|
||||
if (status == MOD_HDCP_STATUS_SUCCESS)
|
||||
mod_hdcp_execute_and_set(mod_hdcp_read_bstatus,
|
||||
if (!mod_hdcp_execute_and_set(mod_hdcp_read_bstatus,
|
||||
&input->bstatus_read, &status,
|
||||
hdcp, "bstatus_read");
|
||||
hdcp, "bstatus_read"))
|
||||
goto out;
|
||||
if (status == MOD_HDCP_STATUS_SUCCESS)
|
||||
mod_hdcp_execute_and_set(check_link_integrity_dp,
|
||||
if (!mod_hdcp_execute_and_set(check_link_integrity_dp,
|
||||
&input->link_integrity_check, &status,
|
||||
hdcp, "link_integrity_check");
|
||||
hdcp, "link_integrity_check"))
|
||||
goto out;
|
||||
if (status == MOD_HDCP_STATUS_SUCCESS)
|
||||
mod_hdcp_execute_and_set(check_no_reauthentication_request_dp,
|
||||
if (!mod_hdcp_execute_and_set(check_no_reauthentication_request_dp,
|
||||
&input->reauth_request_check, &status,
|
||||
hdcp, "reauth_request_check");
|
||||
hdcp, "reauth_request_check"))
|
||||
goto out;
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1871,7 +1871,8 @@ static int smu_adjust_power_state_dynamic(struct smu_context *smu,
|
||||
smu_dpm_ctx->dpm_level = level;
|
||||
}
|
||||
|
||||
if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM) {
|
||||
if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
|
||||
smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM) {
|
||||
index = fls(smu->workload_mask);
|
||||
index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0;
|
||||
workload[0] = smu->workload_setting[index];
|
||||
@@ -1950,7 +1951,8 @@ static int smu_switch_power_profile(void *handle,
|
||||
workload[0] = smu->workload_setting[index];
|
||||
}
|
||||
|
||||
if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM)
|
||||
if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
|
||||
smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM)
|
||||
smu_bump_power_profile_mode(smu, workload, 0);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -171,11 +171,13 @@ err_hid_data:
|
||||
void amdtp_hid_remove(struct amdtp_cl_data *cli_data)
|
||||
{
|
||||
int i;
|
||||
struct amdtp_hid_data *hid_data;
|
||||
|
||||
for (i = 0; i < cli_data->num_hid_devices; ++i) {
|
||||
if (cli_data->hid_sensor_hubs[i]) {
|
||||
kfree(cli_data->hid_sensor_hubs[i]->driver_data);
|
||||
hid_data = cli_data->hid_sensor_hubs[i]->driver_data;
|
||||
hid_destroy_device(cli_data->hid_sensor_hubs[i]);
|
||||
kfree(hid_data);
|
||||
cli_data->hid_sensor_hubs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static void cougar_fix_g6_mapping(void)
|
||||
static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc,
|
||||
unsigned int *rsize)
|
||||
{
|
||||
if (rdesc[2] == 0x09 && rdesc[3] == 0x02 &&
|
||||
if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 &&
|
||||
(rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) {
|
||||
hid_info(hdev,
|
||||
"usage count exceeds max: fixing up report descriptor\n");
|
||||
|
||||
@@ -1977,6 +1977,7 @@ static umode_t vmbus_chan_attr_is_visible(struct kobject *kobj,
|
||||
|
||||
return attr->mode;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vmbus_device_unregister);
|
||||
|
||||
static struct attribute_group vmbus_chan_group = {
|
||||
.attrs = vmbus_chan_attrs,
|
||||
|
||||
@@ -176,7 +176,7 @@ static ssize_t adc128_in_store(struct device *dev,
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
/* 10 mV LSB on limit registers */
|
||||
regval = clamp_val(DIV_ROUND_CLOSEST(val, 10), 0, 255);
|
||||
regval = DIV_ROUND_CLOSEST(clamp_val(val, 0, 2550), 10);
|
||||
data->in[index][nr] = regval << 4;
|
||||
reg = index == 1 ? ADC128_REG_IN_MIN(nr) : ADC128_REG_IN_MAX(nr);
|
||||
i2c_smbus_write_byte_data(data->client, reg, regval);
|
||||
@@ -214,7 +214,7 @@ static ssize_t adc128_temp_store(struct device *dev,
|
||||
return err;
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
regval = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -128, 127);
|
||||
regval = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000);
|
||||
data->temp[index] = regval << 1;
|
||||
i2c_smbus_write_byte_data(data->client,
|
||||
index == 1 ? ADC128_REG_TEMP_MAX
|
||||
|
||||
@@ -301,7 +301,8 @@ static ssize_t tcrit2_store(struct device *dev, struct device_attribute *attr,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 0, index ? 255 : 127);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, 0, (index ? 255 : 127) * 1000),
|
||||
1000);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
data->tcrit2[index] = val;
|
||||
@@ -350,7 +351,7 @@ static ssize_t tcrit1_store(struct device *dev, struct device_attribute *attr,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 0, 255);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 255000), 1000);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
data->tcrit1[index] = val;
|
||||
@@ -391,7 +392,7 @@ static ssize_t tcrit1_hyst_store(struct device *dev,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
val = DIV_ROUND_CLOSEST(val, 1000);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, -255000, 255000), 1000);
|
||||
val = clamp_val((int)data->tcrit1[index] - val, 0, 31);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
@@ -431,7 +432,7 @@ static ssize_t offset_store(struct device *dev, struct device_attribute *attr,
|
||||
return ret;
|
||||
|
||||
/* Accuracy is 1/2 degrees C */
|
||||
val = clamp_val(DIV_ROUND_CLOSEST(val, 500), -128, 127);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, -64000, 63500), 500);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
data->toffset[index] = val;
|
||||
|
||||
@@ -2171,7 +2171,7 @@ store_temp_offset(struct device *dev, struct device_attribute *attr,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -128, 127);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
data->temp_offset[nr] = val;
|
||||
|
||||
@@ -895,7 +895,7 @@ store_target_temp(struct device *dev, struct device_attribute *attr,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 0, 127);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 127000), 1000);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
data->target_temp[nr] = val;
|
||||
@@ -920,7 +920,7 @@ store_tolerance(struct device *dev, struct device_attribute *attr,
|
||||
return err;
|
||||
|
||||
/* Limit the temp to 0C - 15C */
|
||||
val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 0, 15);
|
||||
val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 15000), 1000);
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
reg = w83627ehf_read_value(data, W83627EHF_REG_TOLERANCE[nr]);
|
||||
|
||||
@@ -291,7 +291,10 @@ static int hci_dma_init(struct i3c_hci *hci)
|
||||
|
||||
rh->ibi_chunk_sz = dma_get_cache_alignment();
|
||||
rh->ibi_chunk_sz *= IBI_CHUNK_CACHELINES;
|
||||
BUG_ON(rh->ibi_chunk_sz > 256);
|
||||
if (rh->ibi_chunk_sz > 256) {
|
||||
ret = -EINVAL;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ibi_status_ring_sz = rh->ibi_status_sz * rh->ibi_status_entries;
|
||||
ibi_data_ring_sz = rh->ibi_chunk_sz * rh->ibi_chunks_total;
|
||||
|
||||
@@ -146,15 +146,18 @@ struct ad7124_chip_info {
|
||||
struct ad7124_channel_config {
|
||||
bool live;
|
||||
unsigned int cfg_slot;
|
||||
enum ad7124_ref_sel refsel;
|
||||
bool bipolar;
|
||||
bool buf_positive;
|
||||
bool buf_negative;
|
||||
unsigned int vref_mv;
|
||||
unsigned int pga_bits;
|
||||
unsigned int odr;
|
||||
unsigned int odr_sel_bits;
|
||||
unsigned int filter_type;
|
||||
/* Following fields are used to compare equality. */
|
||||
struct_group(config_props,
|
||||
enum ad7124_ref_sel refsel;
|
||||
bool bipolar;
|
||||
bool buf_positive;
|
||||
bool buf_negative;
|
||||
unsigned int vref_mv;
|
||||
unsigned int pga_bits;
|
||||
unsigned int odr;
|
||||
unsigned int odr_sel_bits;
|
||||
unsigned int filter_type;
|
||||
);
|
||||
};
|
||||
|
||||
struct ad7124_channel {
|
||||
@@ -333,11 +336,12 @@ static struct ad7124_channel_config *ad7124_find_similar_live_cfg(struct ad7124_
|
||||
ptrdiff_t cmp_size;
|
||||
int i;
|
||||
|
||||
cmp_size = (u8 *)&cfg->live - (u8 *)cfg;
|
||||
cmp_size = sizeof_field(struct ad7124_channel_config, config_props);
|
||||
for (i = 0; i < st->num_channels; i++) {
|
||||
cfg_aux = &st->channels[i].cfg;
|
||||
|
||||
if (cfg_aux->live && !memcmp(cfg, cfg_aux, cmp_size))
|
||||
if (cfg_aux->live &&
|
||||
!memcmp(&cfg->config_props, &cfg_aux->config_props, cmp_size))
|
||||
return cfg_aux;
|
||||
}
|
||||
|
||||
@@ -761,6 +765,7 @@ static int ad7124_soft_reset(struct ad7124_state *st)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
fsleep(200);
|
||||
timeout = 100;
|
||||
do {
|
||||
ret = ad_sd_read_reg(&st->sd, AD7124_STATUS, 1, &readval);
|
||||
|
||||
@@ -49,7 +49,7 @@ static const unsigned int ad7616_oversampling_avail[8] = {
|
||||
1, 2, 4, 8, 16, 32, 64, 128,
|
||||
};
|
||||
|
||||
static int ad7606_reset(struct ad7606_state *st)
|
||||
int ad7606_reset(struct ad7606_state *st)
|
||||
{
|
||||
if (st->gpio_reset) {
|
||||
gpiod_set_value(st->gpio_reset, 1);
|
||||
@@ -60,6 +60,7 @@ static int ad7606_reset(struct ad7606_state *st)
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(ad7606_reset, IIO_AD7606);
|
||||
|
||||
static int ad7606_reg_access(struct iio_dev *indio_dev,
|
||||
unsigned int reg,
|
||||
@@ -88,31 +89,6 @@ static int ad7606_read_samples(struct ad7606_state *st)
|
||||
{
|
||||
unsigned int num = st->chip_info->num_channels - 1;
|
||||
u16 *data = st->data;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* The frstdata signal is set to high while and after reading the sample
|
||||
* of the first channel and low for all other channels. This can be used
|
||||
* to check that the incoming data is correctly aligned. During normal
|
||||
* operation the data should never become unaligned, but some glitch or
|
||||
* electrostatic discharge might cause an extra read or clock cycle.
|
||||
* Monitoring the frstdata signal allows to recover from such failure
|
||||
* situations.
|
||||
*/
|
||||
|
||||
if (st->gpio_frstdata) {
|
||||
ret = st->bops->read_block(st->dev, 1, data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!gpiod_get_value(st->gpio_frstdata)) {
|
||||
ad7606_reset(st);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
data++;
|
||||
num--;
|
||||
}
|
||||
|
||||
return st->bops->read_block(st->dev, num, data);
|
||||
}
|
||||
|
||||
@@ -153,6 +153,8 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
|
||||
const char *name, unsigned int id,
|
||||
const struct ad7606_bus_ops *bops);
|
||||
|
||||
int ad7606_reset(struct ad7606_state *st);
|
||||
|
||||
enum ad7606_supported_device_ids {
|
||||
ID_AD7605_4,
|
||||
ID_AD7606_8,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/err.h>
|
||||
@@ -21,8 +22,29 @@ static int ad7606_par16_read_block(struct device *dev,
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct ad7606_state *st = iio_priv(indio_dev);
|
||||
|
||||
insw((unsigned long)st->base_address, buf, count);
|
||||
|
||||
/*
|
||||
* On the parallel interface, the frstdata signal is set to high while
|
||||
* and after reading the sample of the first channel and low for all
|
||||
* other channels. This can be used to check that the incoming data is
|
||||
* correctly aligned. During normal operation the data should never
|
||||
* become unaligned, but some glitch or electrostatic discharge might
|
||||
* cause an extra read or clock cycle. Monitoring the frstdata signal
|
||||
* allows to recover from such failure situations.
|
||||
*/
|
||||
int num = count;
|
||||
u16 *_buf = buf;
|
||||
|
||||
if (st->gpio_frstdata) {
|
||||
insw((unsigned long)st->base_address, _buf, 1);
|
||||
if (!gpiod_get_value(st->gpio_frstdata)) {
|
||||
ad7606_reset(st);
|
||||
return -EIO;
|
||||
}
|
||||
_buf++;
|
||||
num--;
|
||||
}
|
||||
insw((unsigned long)st->base_address, _buf, num);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,8 +57,28 @@ static int ad7606_par8_read_block(struct device *dev,
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct ad7606_state *st = iio_priv(indio_dev);
|
||||
/*
|
||||
* On the parallel interface, the frstdata signal is set to high while
|
||||
* and after reading the sample of the first channel and low for all
|
||||
* other channels. This can be used to check that the incoming data is
|
||||
* correctly aligned. During normal operation the data should never
|
||||
* become unaligned, but some glitch or electrostatic discharge might
|
||||
* cause an extra read or clock cycle. Monitoring the frstdata signal
|
||||
* allows to recover from such failure situations.
|
||||
*/
|
||||
int num = count;
|
||||
u16 *_buf = buf;
|
||||
|
||||
insb((unsigned long)st->base_address, buf, count * 2);
|
||||
if (st->gpio_frstdata) {
|
||||
insb((unsigned long)st->base_address, _buf, 2);
|
||||
if (!gpiod_get_value(st->gpio_frstdata)) {
|
||||
ad7606_reset(st);
|
||||
return -EIO;
|
||||
}
|
||||
_buf++;
|
||||
num--;
|
||||
}
|
||||
insb((unsigned long)st->base_address, _buf, num * 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
|
||||
|
||||
ret = dma_get_slave_caps(chan, &caps);
|
||||
if (ret < 0)
|
||||
goto err_free;
|
||||
goto err_release;
|
||||
|
||||
/* Needs to be aligned to the maximum of the minimums */
|
||||
if (caps.src_addr_widths)
|
||||
@@ -206,6 +206,8 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,
|
||||
|
||||
return &dmaengine_buffer->queue.buffer;
|
||||
|
||||
err_release:
|
||||
dma_release_channel(chan);
|
||||
err_free:
|
||||
kfree(dmaengine_buffer);
|
||||
return ERR_PTR(ret);
|
||||
|
||||
@@ -679,17 +679,17 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,
|
||||
break;
|
||||
case IIO_VAL_INT_PLUS_MICRO:
|
||||
if (scale_val2 < 0)
|
||||
*processed = -raw64 * scale_val;
|
||||
*processed = -raw64 * scale_val * scale;
|
||||
else
|
||||
*processed = raw64 * scale_val;
|
||||
*processed = raw64 * scale_val * scale;
|
||||
*processed += div_s64(raw64 * (s64)scale_val2 * scale,
|
||||
1000000LL);
|
||||
break;
|
||||
case IIO_VAL_INT_PLUS_NANO:
|
||||
if (scale_val2 < 0)
|
||||
*processed = -raw64 * scale_val;
|
||||
*processed = -raw64 * scale_val * scale;
|
||||
else
|
||||
*processed = raw64 * scale_val;
|
||||
*processed = raw64 * scale_val * scale;
|
||||
*processed += div_s64(raw64 * (s64)scale_val2 * scale,
|
||||
1000000000LL);
|
||||
break;
|
||||
|
||||
@@ -417,6 +417,20 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Limit number of contacts to a reasonable value (100). This
|
||||
* ensures that we need less than 2 pages for struct input_mt
|
||||
* (we are not using in-kernel slot assignment so not going to
|
||||
* allocate memory for the "red" table), and we should have no
|
||||
* trouble getting this much memory.
|
||||
*/
|
||||
if (code == ABS_MT_SLOT && max > 99) {
|
||||
printk(KERN_DEBUG
|
||||
"%s: unreasonably large number of slots requested: %d\n",
|
||||
UINPUT_NAME, max);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ static int ili251x_firmware_to_buffer(const struct firmware *fw,
|
||||
* once, copy them all into this buffer at the right locations, and then
|
||||
* do all operations on this linear buffer.
|
||||
*/
|
||||
fw_buf = kzalloc(SZ_64K, GFP_KERNEL);
|
||||
fw_buf = kvmalloc(SZ_64K, GFP_KERNEL);
|
||||
if (!fw_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -616,7 +616,7 @@ static int ili251x_firmware_to_buffer(const struct firmware *fw,
|
||||
return 0;
|
||||
|
||||
err_big:
|
||||
kfree(fw_buf);
|
||||
kvfree(fw_buf);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ exit:
|
||||
ili210x_hardware_reset(priv->reset_gpio);
|
||||
dev_dbg(dev, "Firmware update ended, error=%i\n", error);
|
||||
enable_irq(client->irq);
|
||||
kfree(fwbuf);
|
||||
kvfree(fwbuf);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -1409,7 +1409,7 @@ restart:
|
||||
*/
|
||||
writel(qi->free_head << shift, iommu->reg + DMAR_IQT_REG);
|
||||
|
||||
while (qi->desc_status[wait_index] != QI_DONE) {
|
||||
while (READ_ONCE(qi->desc_status[wait_index]) != QI_DONE) {
|
||||
/*
|
||||
* We will leave the interrupts disabled, to prevent interrupt
|
||||
* context to queue another cmd while a cmd is already submitted
|
||||
|
||||
@@ -449,6 +449,7 @@ static int sun50i_iommu_enable(struct sun50i_iommu *iommu)
|
||||
IOMMU_TLB_PREFETCH_MASTER_ENABLE(3) |
|
||||
IOMMU_TLB_PREFETCH_MASTER_ENABLE(4) |
|
||||
IOMMU_TLB_PREFETCH_MASTER_ENABLE(5));
|
||||
iommu_write(iommu, IOMMU_BYPASS_REG, 0);
|
||||
iommu_write(iommu, IOMMU_INT_ENABLE_REG, IOMMU_INT_MASK);
|
||||
iommu_write(iommu, IOMMU_DM_AUT_CTRL_REG(SUN50I_IOMMU_ACI_NONE),
|
||||
IOMMU_DM_AUT_CTRL_RD_UNAVAIL(SUN50I_IOMMU_ACI_NONE, 0) |
|
||||
|
||||
@@ -567,6 +567,10 @@ static struct irq_chip armada_370_xp_irq_chip = {
|
||||
static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
|
||||
unsigned int virq, irq_hw_number_t hw)
|
||||
{
|
||||
/* IRQs 0 and 1 cannot be mapped, they are handled internally */
|
||||
if (hw <= 1)
|
||||
return -EINVAL;
|
||||
|
||||
armada_370_xp_irq_mask(irq_get_irq_data(virq));
|
||||
if (!is_percpu_irq(hw))
|
||||
writel(hw, per_cpu_int_base +
|
||||
|
||||
@@ -91,7 +91,6 @@ static int spi_byte_probe(struct spi_device *spi)
|
||||
dev_err(dev, "Device must have exactly one LED sub-node.");
|
||||
return -EINVAL;
|
||||
}
|
||||
child = of_get_next_available_child(dev_of_node(dev), NULL);
|
||||
|
||||
led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
|
||||
if (!led)
|
||||
@@ -107,11 +106,13 @@ static int spi_byte_probe(struct spi_device *spi)
|
||||
led->ldev.max_brightness = led->cdef->max_value - led->cdef->off_value;
|
||||
led->ldev.brightness_set_blocking = spi_byte_brightness_set_blocking;
|
||||
|
||||
child = of_get_next_available_child(dev_of_node(dev), NULL);
|
||||
state = of_get_property(child, "default-state", NULL);
|
||||
if (state) {
|
||||
if (!strcmp(state, "on")) {
|
||||
led->ldev.brightness = led->ldev.max_brightness;
|
||||
} else if (strcmp(state, "off")) {
|
||||
of_node_put(child);
|
||||
/* all other cases except "off" */
|
||||
dev_err(dev, "default-state can only be 'on' or 'off'");
|
||||
return -EINVAL;
|
||||
@@ -122,9 +123,12 @@ static int spi_byte_probe(struct spi_device *spi)
|
||||
|
||||
ret = devm_led_classdev_register(&spi->dev, &led->ldev);
|
||||
if (ret) {
|
||||
of_node_put(child);
|
||||
mutex_destroy(&led->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
of_node_put(child);
|
||||
spi_set_drvdata(spi, led);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -213,8 +213,10 @@ static char __init *dm_parse_device_entry(struct dm_device *dev, char *str)
|
||||
strscpy(dev->dmi.uuid, field[1], sizeof(dev->dmi.uuid));
|
||||
/* minor */
|
||||
if (strlen(field[2])) {
|
||||
if (kstrtoull(field[2], 0, &dev->dmi.dev))
|
||||
if (kstrtoull(field[2], 0, &dev->dmi.dev) ||
|
||||
dev->dmi.dev >= (1 << MINORBITS))
|
||||
return ERR_PTR(-EINVAL);
|
||||
dev->dmi.dev = huge_encode_dev((dev_t)dev->dmi.dev);
|
||||
dev->dmi.flags |= DM_PERSISTENT_DEV_FLAG;
|
||||
}
|
||||
/* flags */
|
||||
|
||||
@@ -1038,8 +1038,11 @@ static int camss_of_parse_endpoint_node(struct device *dev,
|
||||
struct v4l2_mbus_config_mipi_csi2 *mipi_csi2;
|
||||
struct v4l2_fwnode_endpoint vep = { { 0 } };
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep);
|
||||
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
csd->interface.csiphy_id = vep.base.port;
|
||||
|
||||
|
||||
@@ -113,8 +113,9 @@ static int vid_cap_queue_setup(struct vb2_queue *vq,
|
||||
if (*nplanes != buffers)
|
||||
return -EINVAL;
|
||||
for (p = 0; p < buffers; p++) {
|
||||
if (sizes[p] < tpg_g_line_width(&dev->tpg, p) * h +
|
||||
dev->fmt_cap->data_offset[p])
|
||||
if (sizes[p] < tpg_g_line_width(&dev->tpg, p) * h /
|
||||
dev->fmt_cap->vdownsampling[p] +
|
||||
dev->fmt_cap->data_offset[p])
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
@@ -1809,8 +1810,10 @@ int vidioc_s_edid(struct file *file, void *_fh,
|
||||
return -EINVAL;
|
||||
if (edid->blocks == 0) {
|
||||
dev->edid_blocks = 0;
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_edid_present, 0);
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_hotplug, 0);
|
||||
if (dev->num_outputs) {
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_edid_present, 0);
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_hotplug, 0);
|
||||
}
|
||||
phys_addr = CEC_PHYS_ADDR_INVALID;
|
||||
goto set_phys_addr;
|
||||
}
|
||||
@@ -1834,8 +1837,10 @@ int vidioc_s_edid(struct file *file, void *_fh,
|
||||
display_present |=
|
||||
dev->display_present[i] << j++;
|
||||
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_edid_present, display_present);
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_hotplug, display_present);
|
||||
if (dev->num_outputs) {
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_edid_present, display_present);
|
||||
v4l2_ctrl_s_ctrl(dev->ctrl_tx_hotplug, display_present);
|
||||
}
|
||||
|
||||
set_phys_addr:
|
||||
/* TODO: a proper hotplug detect cycle should be emulated here */
|
||||
|
||||
@@ -63,14 +63,16 @@ static int vid_out_queue_setup(struct vb2_queue *vq,
|
||||
if (sizes[0] < size)
|
||||
return -EINVAL;
|
||||
for (p = 1; p < planes; p++) {
|
||||
if (sizes[p] < dev->bytesperline_out[p] * h +
|
||||
vfmt->data_offset[p])
|
||||
if (sizes[p] < dev->bytesperline_out[p] * h /
|
||||
vfmt->vdownsampling[p] +
|
||||
vfmt->data_offset[p])
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
for (p = 0; p < planes; p++)
|
||||
sizes[p] = p ? dev->bytesperline_out[p] * h +
|
||||
vfmt->data_offset[p] : size;
|
||||
sizes[p] = p ? dev->bytesperline_out[p] * h /
|
||||
vfmt->vdownsampling[p] +
|
||||
vfmt->data_offset[p] : size;
|
||||
}
|
||||
|
||||
if (vq->num_buffers + *nbuffers < 2)
|
||||
@@ -127,7 +129,7 @@ static int vid_out_buf_prepare(struct vb2_buffer *vb)
|
||||
|
||||
for (p = 0; p < planes; p++) {
|
||||
if (p)
|
||||
size = dev->bytesperline_out[p] * h;
|
||||
size = dev->bytesperline_out[p] * h / vfmt->vdownsampling[p];
|
||||
size += vb->planes[p].data_offset;
|
||||
|
||||
if (vb2_get_plane_payload(vb, p) < size) {
|
||||
@@ -334,8 +336,8 @@ int vivid_g_fmt_vid_out(struct file *file, void *priv,
|
||||
for (p = 0; p < mp->num_planes; p++) {
|
||||
mp->plane_fmt[p].bytesperline = dev->bytesperline_out[p];
|
||||
mp->plane_fmt[p].sizeimage =
|
||||
mp->plane_fmt[p].bytesperline * mp->height +
|
||||
fmt->data_offset[p];
|
||||
mp->plane_fmt[p].bytesperline * mp->height /
|
||||
fmt->vdownsampling[p] + fmt->data_offset[p];
|
||||
}
|
||||
for (p = fmt->buffers; p < fmt->planes; p++) {
|
||||
unsigned stride = dev->bytesperline_out[p];
|
||||
|
||||
@@ -144,7 +144,8 @@ void vmci_resource_remove(struct vmci_resource *resource)
|
||||
spin_lock(&vmci_resource_table.lock);
|
||||
|
||||
hlist_for_each_entry(r, &vmci_resource_table.entries[idx], node) {
|
||||
if (vmci_handle_is_equal(r->handle, resource->handle)) {
|
||||
if (vmci_handle_is_equal(r->handle, resource->handle) &&
|
||||
resource->type == r->type) {
|
||||
hlist_del_init_rcu(&r->node);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
if (skb_copy_bits(skb, BAREUDP_BASE_HLEN, &ipversion,
|
||||
sizeof(ipversion))) {
|
||||
bareudp->dev->stats.rx_dropped++;
|
||||
DEV_STATS_INC(bareudp->dev, rx_dropped);
|
||||
goto drop;
|
||||
}
|
||||
ipversion >>= 4;
|
||||
@@ -92,7 +92,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||
} else if (ipversion == 6 && bareudp->multi_proto_mode) {
|
||||
proto = htons(ETH_P_IPV6);
|
||||
} else {
|
||||
bareudp->dev->stats.rx_dropped++;
|
||||
DEV_STATS_INC(bareudp->dev, rx_dropped);
|
||||
goto drop;
|
||||
}
|
||||
} else if (bareudp->ethertype == htons(ETH_P_MPLS_UC)) {
|
||||
@@ -106,7 +106,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||
ipv4_is_multicast(tunnel_hdr->daddr)) {
|
||||
proto = htons(ETH_P_MPLS_MC);
|
||||
} else {
|
||||
bareudp->dev->stats.rx_dropped++;
|
||||
DEV_STATS_INC(bareudp->dev, rx_dropped);
|
||||
goto drop;
|
||||
}
|
||||
} else {
|
||||
@@ -122,7 +122,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||
(addr_type & IPV6_ADDR_MULTICAST)) {
|
||||
proto = htons(ETH_P_MPLS_MC);
|
||||
} else {
|
||||
bareudp->dev->stats.rx_dropped++;
|
||||
DEV_STATS_INC(bareudp->dev, rx_dropped);
|
||||
goto drop;
|
||||
}
|
||||
}
|
||||
@@ -134,12 +134,12 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||
proto,
|
||||
!net_eq(bareudp->net,
|
||||
dev_net(bareudp->dev)))) {
|
||||
bareudp->dev->stats.rx_dropped++;
|
||||
DEV_STATS_INC(bareudp->dev, rx_dropped);
|
||||
goto drop;
|
||||
}
|
||||
tun_dst = udp_tun_rx_dst(skb, family, TUNNEL_KEY, 0, 0);
|
||||
if (!tun_dst) {
|
||||
bareudp->dev->stats.rx_dropped++;
|
||||
DEV_STATS_INC(bareudp->dev, rx_dropped);
|
||||
goto drop;
|
||||
}
|
||||
skb_dst_set(skb, &tun_dst->dst);
|
||||
@@ -165,8 +165,8 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
|
||||
&((struct ipv6hdr *)oiph)->saddr);
|
||||
}
|
||||
if (err > 1) {
|
||||
++bareudp->dev->stats.rx_frame_errors;
|
||||
++bareudp->dev->stats.rx_errors;
|
||||
DEV_STATS_INC(bareudp->dev, rx_frame_errors);
|
||||
DEV_STATS_INC(bareudp->dev, rx_errors);
|
||||
goto drop;
|
||||
}
|
||||
}
|
||||
@@ -462,11 +462,11 @@ tx_error:
|
||||
dev_kfree_skb(skb);
|
||||
|
||||
if (err == -ELOOP)
|
||||
dev->stats.collisions++;
|
||||
DEV_STATS_INC(dev, collisions);
|
||||
else if (err == -ENETUNREACH)
|
||||
dev->stats.tx_carrier_errors++;
|
||||
DEV_STATS_INC(dev, tx_carrier_errors);
|
||||
|
||||
dev->stats.tx_errors++;
|
||||
DEV_STATS_INC(dev, tx_errors);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1815,7 +1815,7 @@ static int m_can_open(struct net_device *dev)
|
||||
/* start the m_can controller */
|
||||
err = m_can_start(dev);
|
||||
if (err)
|
||||
goto exit_irq_fail;
|
||||
goto exit_start_fail;
|
||||
|
||||
if (!cdev->is_peripheral)
|
||||
napi_enable(&cdev->napi);
|
||||
@@ -1824,6 +1824,9 @@ static int m_can_open(struct net_device *dev)
|
||||
|
||||
return 0;
|
||||
|
||||
exit_start_fail:
|
||||
if (cdev->is_peripheral || dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
exit_irq_fail:
|
||||
if (cdev->is_peripheral)
|
||||
destroy_workqueue(cdev->tx_wq);
|
||||
|
||||
@@ -753,7 +753,7 @@ static int mcp251x_hw_wake(struct spi_device *spi)
|
||||
int ret;
|
||||
|
||||
/* Force wakeup interrupt to wake device, but don't execute IST */
|
||||
disable_irq(spi->irq);
|
||||
disable_irq_nosync(spi->irq);
|
||||
mcp251x_write_2regs(spi, CANINTE, CANINTE_WAKIE, CANINTF_WAKIF);
|
||||
|
||||
/* Wait for oscillator startup timer after wake up */
|
||||
|
||||
@@ -97,7 +97,16 @@ void can_ram_get_layout(struct can_ram_layout *layout,
|
||||
if (ring) {
|
||||
u8 num_rx_coalesce = 0, num_tx_coalesce = 0;
|
||||
|
||||
num_rx = can_ram_rounddown_pow_of_two(config, &config->rx, 0, ring->rx_pending);
|
||||
/* If the ring parameters have been configured in
|
||||
* CAN-CC mode, but and we are in CAN-FD mode now,
|
||||
* they might be to big. Use the default CAN-FD values
|
||||
* in this case.
|
||||
*/
|
||||
num_rx = ring->rx_pending;
|
||||
if (num_rx > layout->max_rx)
|
||||
num_rx = layout->default_rx;
|
||||
|
||||
num_rx = can_ram_rounddown_pow_of_two(config, &config->rx, 0, num_rx);
|
||||
|
||||
/* The ethtool doc says:
|
||||
* To disable coalescing, set usecs = 0 and max_frames = 1.
|
||||
|
||||
@@ -458,11 +458,25 @@ int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv)
|
||||
|
||||
/* switching from CAN-2.0 to CAN-FD mode or vice versa */
|
||||
if (fd_mode != test_bit(MCP251XFD_FLAGS_FD_MODE, priv->flags)) {
|
||||
const struct ethtool_ringparam ring = {
|
||||
.rx_pending = priv->rx_obj_num,
|
||||
.tx_pending = priv->tx->obj_num,
|
||||
};
|
||||
const struct ethtool_coalesce ec = {
|
||||
.rx_coalesce_usecs_irq = priv->rx_coalesce_usecs_irq,
|
||||
.rx_max_coalesced_frames_irq = priv->rx_obj_num_coalesce_irq,
|
||||
.tx_coalesce_usecs_irq = priv->tx_coalesce_usecs_irq,
|
||||
.tx_max_coalesced_frames_irq = priv->tx_obj_num_coalesce_irq,
|
||||
};
|
||||
struct can_ram_layout layout;
|
||||
|
||||
can_ram_get_layout(&layout, &mcp251xfd_ram_config, NULL, NULL, fd_mode);
|
||||
priv->rx_obj_num = layout.default_rx;
|
||||
tx_ring->obj_num = layout.default_tx;
|
||||
can_ram_get_layout(&layout, &mcp251xfd_ram_config, &ring, &ec, fd_mode);
|
||||
|
||||
priv->rx_obj_num = layout.cur_rx;
|
||||
priv->rx_obj_num_coalesce_irq = layout.rx_coalesce;
|
||||
|
||||
tx_ring->obj_num = layout.cur_tx;
|
||||
priv->tx_obj_num_coalesce_irq = layout.tx_coalesce;
|
||||
}
|
||||
|
||||
if (fd_mode) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define VSC73XX_BLOCK_ANALYZER 0x2 /* Only subblock 0 */
|
||||
#define VSC73XX_BLOCK_MII 0x3 /* Subblocks 0 and 1 */
|
||||
#define VSC73XX_BLOCK_MEMINIT 0x3 /* Only subblock 2 */
|
||||
#define VSC73XX_BLOCK_CAPTURE 0x4 /* Only subblock 2 */
|
||||
#define VSC73XX_BLOCK_CAPTURE 0x4 /* Subblocks 0-4, 6, 7 */
|
||||
#define VSC73XX_BLOCK_ARBITER 0x5 /* Only subblock 0 */
|
||||
#define VSC73XX_BLOCK_SYSTEM 0x7 /* Only subblock 0 */
|
||||
|
||||
@@ -371,13 +371,19 @@ int vsc73xx_is_addr_valid(u8 block, u8 subblock)
|
||||
break;
|
||||
|
||||
case VSC73XX_BLOCK_MII:
|
||||
case VSC73XX_BLOCK_CAPTURE:
|
||||
case VSC73XX_BLOCK_ARBITER:
|
||||
switch (subblock) {
|
||||
case 0 ... 1:
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case VSC73XX_BLOCK_CAPTURE:
|
||||
switch (subblock) {
|
||||
case 0 ... 4:
|
||||
case 6 ... 7:
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -916,14 +916,18 @@ static inline void dpaa_setup_egress(const struct dpaa_priv *priv,
|
||||
}
|
||||
}
|
||||
|
||||
static void dpaa_fq_setup(struct dpaa_priv *priv,
|
||||
const struct dpaa_fq_cbs *fq_cbs,
|
||||
struct fman_port *tx_port)
|
||||
static int dpaa_fq_setup(struct dpaa_priv *priv,
|
||||
const struct dpaa_fq_cbs *fq_cbs,
|
||||
struct fman_port *tx_port)
|
||||
{
|
||||
int egress_cnt = 0, conf_cnt = 0, num_portals = 0, portal_cnt = 0, cpu;
|
||||
const cpumask_t *affine_cpus = qman_affine_cpus();
|
||||
u16 channels[NR_CPUS];
|
||||
struct dpaa_fq *fq;
|
||||
u16 *channels;
|
||||
|
||||
channels = kcalloc(num_possible_cpus(), sizeof(u16), GFP_KERNEL);
|
||||
if (!channels)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_cpu_and(cpu, affine_cpus, cpu_online_mask)
|
||||
channels[num_portals++] = qman_affine_channel(cpu);
|
||||
@@ -982,6 +986,10 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
kfree(channels);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int dpaa_tx_fq_to_id(const struct dpaa_priv *priv,
|
||||
@@ -3454,7 +3462,9 @@ static int dpaa_eth_probe(struct platform_device *pdev)
|
||||
*/
|
||||
dpaa_eth_add_channel(priv->channel, &pdev->dev);
|
||||
|
||||
dpaa_fq_setup(priv, &dpaa_fq_cbs, priv->mac_dev->port[TX]);
|
||||
err = dpaa_fq_setup(priv, &dpaa_fq_cbs, priv->mac_dev->port[TX]);
|
||||
if (err)
|
||||
goto free_dpaa_bps;
|
||||
|
||||
/* Create a congestion group for this netdev, with
|
||||
* dynamically-allocated CGR ID.
|
||||
|
||||
@@ -515,12 +515,16 @@ static int dpaa_set_coalesce(struct net_device *dev,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
const cpumask_t *cpus = qman_affine_cpus();
|
||||
bool needs_revert[NR_CPUS] = {false};
|
||||
struct qman_portal *portal;
|
||||
u32 period, prev_period;
|
||||
u8 thresh, prev_thresh;
|
||||
bool *needs_revert;
|
||||
int cpu, res;
|
||||
|
||||
needs_revert = kcalloc(num_possible_cpus(), sizeof(bool), GFP_KERNEL);
|
||||
if (!needs_revert)
|
||||
return -ENOMEM;
|
||||
|
||||
period = c->rx_coalesce_usecs;
|
||||
thresh = c->rx_max_coalesced_frames;
|
||||
|
||||
@@ -543,6 +547,8 @@ static int dpaa_set_coalesce(struct net_device *dev,
|
||||
needs_revert[cpu] = true;
|
||||
}
|
||||
|
||||
kfree(needs_revert);
|
||||
|
||||
return 0;
|
||||
|
||||
revert_values:
|
||||
@@ -556,6 +562,8 @@ revert_values:
|
||||
qman_dqrr_set_ithresh(portal, prev_thresh);
|
||||
}
|
||||
|
||||
kfree(needs_revert);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -611,6 +611,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
|
||||
memset(&vsi->mqprio_qopt, 0, sizeof(vsi->mqprio_qopt));
|
||||
}
|
||||
}
|
||||
|
||||
if (vsi->netdev)
|
||||
netif_device_detach(vsi->netdev);
|
||||
skip:
|
||||
|
||||
/* clear SW filtering DB */
|
||||
@@ -2630,11 +2633,11 @@ static void ice_vsi_assign_bpf_prog(struct ice_vsi *vsi, struct bpf_prog *prog)
|
||||
int i;
|
||||
|
||||
old_prog = xchg(&vsi->xdp_prog, prog);
|
||||
if (old_prog)
|
||||
bpf_prog_put(old_prog);
|
||||
|
||||
ice_for_each_rxq(vsi, i)
|
||||
WRITE_ONCE(vsi->rx_rings[i]->xdp_prog, vsi->xdp_prog);
|
||||
|
||||
if (old_prog)
|
||||
bpf_prog_put(old_prog);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2883,6 +2886,18 @@ int ice_vsi_determine_xdp_res(struct ice_vsi *vsi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_max_xdp_frame_size - returns the maximum allowed frame size for XDP
|
||||
* @vsi: Pointer to VSI structure
|
||||
*/
|
||||
static int ice_max_xdp_frame_size(struct ice_vsi *vsi)
|
||||
{
|
||||
if (test_bit(ICE_FLAG_LEGACY_RX, vsi->back->flags))
|
||||
return ICE_RXBUF_1664;
|
||||
else
|
||||
return ICE_RXBUF_3072;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_xdp_setup_prog - Add or remove XDP eBPF program
|
||||
* @vsi: VSI to setup XDP for
|
||||
@@ -2893,17 +2908,26 @@ static int
|
||||
ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int frame_size = vsi->netdev->mtu + ICE_ETH_PKT_HDR_PAD;
|
||||
bool if_running = netif_running(vsi->netdev);
|
||||
unsigned int frame_size = vsi->netdev->mtu + ICE_ETH_PKT_HDR_PAD;
|
||||
int ret = 0, xdp_ring_err = 0;
|
||||
bool if_running;
|
||||
|
||||
if (frame_size > vsi->rx_buf_len) {
|
||||
if (frame_size > ice_max_xdp_frame_size(vsi)) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "MTU too large for loading XDP");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/* hot swap progs and avoid toggling link */
|
||||
if (ice_is_xdp_ena_vsi(vsi) == !!prog) {
|
||||
ice_vsi_assign_bpf_prog(vsi, prog);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if_running = netif_running(vsi->netdev) &&
|
||||
!test_and_set_bit(ICE_VSI_DOWN, vsi->state);
|
||||
|
||||
/* need to stop netdev while setting up the program for Rx rings */
|
||||
if (if_running && !test_and_set_bit(ICE_VSI_DOWN, vsi->state)) {
|
||||
if (if_running) {
|
||||
ret = ice_down(vsi);
|
||||
if (ret) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "Preparing device for XDP attach failed");
|
||||
@@ -2932,13 +2956,6 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
|
||||
xdp_ring_err = ice_realloc_zc_buf(vsi, false);
|
||||
if (xdp_ring_err)
|
||||
NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed");
|
||||
} else {
|
||||
/* safe to call even when prog == vsi->xdp_prog as
|
||||
* dev_xdp_install in net/core/dev.c incremented prog's
|
||||
* refcount so corresponding bpf_prog_put won't cause
|
||||
* underflow
|
||||
*/
|
||||
ice_vsi_assign_bpf_prog(vsi, prog);
|
||||
}
|
||||
|
||||
if (if_running)
|
||||
@@ -7140,6 +7157,7 @@ static void ice_update_pf_netdev_link(struct ice_pf *pf)
|
||||
*/
|
||||
static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
|
||||
{
|
||||
struct ice_vsi *vsi = ice_get_main_vsi(pf);
|
||||
struct device *dev = ice_pf_to_dev(pf);
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
bool dvm;
|
||||
@@ -7292,6 +7310,9 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
|
||||
ice_rebuild_arfs(pf);
|
||||
}
|
||||
|
||||
if (vsi && vsi->netdev)
|
||||
netif_device_attach(vsi->netdev);
|
||||
|
||||
ice_update_pf_netdev_link(pf);
|
||||
|
||||
/* tell the firmware we are up */
|
||||
@@ -7322,18 +7343,6 @@ clear_recovery:
|
||||
dev_err(dev, "Rebuild failed, unload and reload driver\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_max_xdp_frame_size - returns the maximum allowed frame size for XDP
|
||||
* @vsi: Pointer to VSI structure
|
||||
*/
|
||||
static int ice_max_xdp_frame_size(struct ice_vsi *vsi)
|
||||
{
|
||||
if (test_bit(ICE_FLAG_LEGACY_RX, vsi->back->flags))
|
||||
return ICE_RXBUF_1664;
|
||||
else
|
||||
return ICE_RXBUF_3072;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_change_mtu - NDO callback to change the MTU
|
||||
* @netdev: network interface device structure
|
||||
|
||||
@@ -6925,10 +6925,20 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
|
||||
|
||||
static void igb_tsync_interrupt(struct igb_adapter *adapter)
|
||||
{
|
||||
const u32 mask = (TSINTR_SYS_WRAP | E1000_TSICR_TXTS |
|
||||
TSINTR_TT0 | TSINTR_TT1 |
|
||||
TSINTR_AUTT0 | TSINTR_AUTT1);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 tsicr = rd32(E1000_TSICR);
|
||||
struct ptp_clock_event event;
|
||||
|
||||
if (hw->mac.type == e1000_82580) {
|
||||
/* 82580 has a hardware bug that requires an explicit
|
||||
* write to clear the TimeSync interrupt cause.
|
||||
*/
|
||||
wr32(E1000_TSICR, tsicr & mask);
|
||||
}
|
||||
|
||||
if (tsicr & TSINTR_SYS_WRAP) {
|
||||
event.type = PTP_CLOCK_PPS;
|
||||
if (adapter->ptp_caps.pps)
|
||||
|
||||
@@ -7063,6 +7063,7 @@ static void igc_io_resume(struct pci_dev *pdev)
|
||||
rtnl_lock();
|
||||
if (netif_running(netdev)) {
|
||||
if (igc_open(netdev)) {
|
||||
rtnl_unlock();
|
||||
netdev_err(netdev, "igc_open failed after reset\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ static int next_chunk_len(struct mctp_serial *dev)
|
||||
* will be those non-escaped bytes, and does not include the escaped
|
||||
* byte.
|
||||
*/
|
||||
for (i = 1; i + dev->txpos + 1 < dev->txlen; i++) {
|
||||
if (needs_escape(dev->txbuf[dev->txpos + i + 1]))
|
||||
for (i = 1; i + dev->txpos < dev->txlen; i++) {
|
||||
if (needs_escape(dev->txbuf[dev->txpos + i]))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,8 +353,8 @@ static int ipheth_close(struct net_device *net)
|
||||
{
|
||||
struct ipheth_device *dev = netdev_priv(net);
|
||||
|
||||
cancel_delayed_work_sync(&dev->carrier_work);
|
||||
netif_stop_queue(net);
|
||||
cancel_delayed_work_sync(&dev->carrier_work);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,6 @@
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
// randomly generated ethernet address
|
||||
static u8 node_id [ETH_ALEN];
|
||||
|
||||
/* use ethtool to change the level for any given device */
|
||||
static int msg_level = -1;
|
||||
module_param (msg_level, int, 0);
|
||||
@@ -1726,7 +1723,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
|
||||
|
||||
dev->net = net;
|
||||
strscpy(net->name, "usb%d", sizeof(net->name));
|
||||
eth_hw_addr_set(net, node_id);
|
||||
|
||||
/* rx and tx sides can use different message sizes;
|
||||
* bind() should set rx_urb_size in that case.
|
||||
@@ -1800,9 +1796,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
|
||||
goto out4;
|
||||
}
|
||||
|
||||
/* let userspace know we have a random address */
|
||||
if (ether_addr_equal(net->dev_addr, node_id))
|
||||
net->addr_assign_type = NET_ADDR_RANDOM;
|
||||
/* this flags the device for user space */
|
||||
if (!is_valid_ether_addr(net->dev_addr))
|
||||
eth_hw_addr_random(net);
|
||||
|
||||
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
|
||||
SET_NETDEV_DEVTYPE(net, &wlan_type);
|
||||
@@ -2212,7 +2208,6 @@ static int __init usbnet_init(void)
|
||||
BUILD_BUG_ON(
|
||||
sizeof_field(struct sk_buff, cb) < sizeof(struct skb_data));
|
||||
|
||||
eth_random_addr(node_id);
|
||||
return 0;
|
||||
}
|
||||
module_init(usbnet_init);
|
||||
|
||||
@@ -1089,6 +1089,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
|
||||
ieee80211_hw_set(hw, AMPDU_AGGREGATION);
|
||||
ieee80211_hw_set(hw, SIGNAL_DBM);
|
||||
ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
|
||||
ieee80211_hw_set(hw, MFP_CAPABLE);
|
||||
|
||||
hw->extra_tx_headroom = brcms_c_get_header_len();
|
||||
hw->queues = N_TX_QUEUES;
|
||||
|
||||
@@ -1301,6 +1301,9 @@ mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
|
||||
|
||||
for (i = 0; i < adapter->priv_num; i++) {
|
||||
if (adapter->priv[i]) {
|
||||
if (adapter->priv[i]->bss_mode == NL80211_IFTYPE_UNSPECIFIED)
|
||||
continue;
|
||||
|
||||
if ((adapter->priv[i]->bss_num == bss_num) &&
|
||||
(adapter->priv[i]->bss_type == bss_type))
|
||||
break;
|
||||
|
||||
@@ -1092,13 +1092,13 @@ void nvmem_device_put(struct nvmem_device *nvmem)
|
||||
EXPORT_SYMBOL_GPL(nvmem_device_put);
|
||||
|
||||
/**
|
||||
* devm_nvmem_device_get() - Get nvmem cell of device form a given id
|
||||
* devm_nvmem_device_get() - Get nvmem device of device form a given id
|
||||
*
|
||||
* @dev: Device that requests the nvmem device.
|
||||
* @id: name id for the requested nvmem device.
|
||||
*
|
||||
* Return: ERR_PTR() on error or a valid pointer to a struct nvmem_cell
|
||||
* on success. The nvmem_cell will be freed by the automatically once the
|
||||
* Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device
|
||||
* on success. The nvmem_device will be freed by the automatically once the
|
||||
* device is freed.
|
||||
*/
|
||||
struct nvmem_device *devm_nvmem_device_get(struct device *dev, const char *id)
|
||||
|
||||
@@ -344,7 +344,8 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
|
||||
struct device_node *p;
|
||||
const __be32 *addr;
|
||||
u32 intsize;
|
||||
int i, res;
|
||||
int i, res, addr_len;
|
||||
__be32 addr_buf[3] = { 0 };
|
||||
|
||||
pr_debug("of_irq_parse_one: dev=%pOF, index=%d\n", device, index);
|
||||
|
||||
@@ -353,13 +354,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
|
||||
return of_irq_parse_oldworld(device, index, out_irq);
|
||||
|
||||
/* Get the reg property (if any) */
|
||||
addr = of_get_property(device, "reg", NULL);
|
||||
addr = of_get_property(device, "reg", &addr_len);
|
||||
|
||||
/* Prevent out-of-bounds read in case of longer interrupt parent address size */
|
||||
if (addr_len > (3 * sizeof(__be32)))
|
||||
addr_len = 3 * sizeof(__be32);
|
||||
if (addr)
|
||||
memcpy(addr_buf, addr, addr_len);
|
||||
|
||||
/* Try the new-style interrupts-extended first */
|
||||
res = of_parse_phandle_with_args(device, "interrupts-extended",
|
||||
"#interrupt-cells", index, out_irq);
|
||||
if (!res)
|
||||
return of_irq_parse_raw(addr, out_irq);
|
||||
return of_irq_parse_raw(addr_buf, out_irq);
|
||||
|
||||
/* Look for the interrupt parent. */
|
||||
p = of_irq_find_parent(device);
|
||||
@@ -389,7 +396,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
|
||||
|
||||
|
||||
/* Check if there are any interrupt-map translations to process */
|
||||
res = of_irq_parse_raw(addr, out_irq);
|
||||
res = of_irq_parse_raw(addr_buf, out_irq);
|
||||
out:
|
||||
of_node_put(p);
|
||||
return res;
|
||||
|
||||
@@ -35,6 +35,11 @@
|
||||
#define PCIE_DEVICEID_SHIFT 16
|
||||
|
||||
/* Application registers */
|
||||
#define PID 0x000
|
||||
#define RTL GENMASK(15, 11)
|
||||
#define RTL_SHIFT 11
|
||||
#define AM6_PCI_PG1_RTL_VER 0x15
|
||||
|
||||
#define CMD_STATUS 0x004
|
||||
#define LTSSM_EN_VAL BIT(0)
|
||||
#define OB_XLAT_EN_VAL BIT(1)
|
||||
@@ -105,6 +110,8 @@
|
||||
|
||||
#define to_keystone_pcie(x) dev_get_drvdata((x)->dev)
|
||||
|
||||
#define PCI_DEVICE_ID_TI_AM654X 0xb00c
|
||||
|
||||
struct ks_pcie_of_data {
|
||||
enum dw_pcie_device_mode mode;
|
||||
const struct dw_pcie_host_ops *host_ops;
|
||||
@@ -519,7 +526,11 @@ static int ks_pcie_start_link(struct dw_pcie *pci)
|
||||
static void ks_pcie_quirk(struct pci_dev *dev)
|
||||
{
|
||||
struct pci_bus *bus = dev->bus;
|
||||
struct keystone_pcie *ks_pcie;
|
||||
struct device *bridge_dev;
|
||||
struct pci_dev *bridge;
|
||||
u32 val;
|
||||
|
||||
static const struct pci_device_id rc_pci_devids[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK),
|
||||
.class = PCI_CLASS_BRIDGE_PCI_NORMAL, .class_mask = ~0, },
|
||||
@@ -531,6 +542,11 @@ static void ks_pcie_quirk(struct pci_dev *dev)
|
||||
.class = PCI_CLASS_BRIDGE_PCI_NORMAL, .class_mask = ~0, },
|
||||
{ 0, },
|
||||
};
|
||||
static const struct pci_device_id am6_pci_devids[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM654X),
|
||||
.class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, },
|
||||
{ 0, },
|
||||
};
|
||||
|
||||
if (pci_is_root_bus(bus))
|
||||
bridge = dev;
|
||||
@@ -552,10 +568,36 @@ static void ks_pcie_quirk(struct pci_dev *dev)
|
||||
*/
|
||||
if (pci_match_id(rc_pci_devids, bridge)) {
|
||||
if (pcie_get_readrq(dev) > 256) {
|
||||
dev_info(&dev->dev, "limiting MRRS to 256\n");
|
||||
dev_info(&dev->dev, "limiting MRRS to 256 bytes\n");
|
||||
pcie_set_readrq(dev, 256);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Memory transactions fail with PCI controller in AM654 PG1.0
|
||||
* when MRRS is set to more than 128 bytes. Force the MRRS to
|
||||
* 128 bytes in all downstream devices.
|
||||
*/
|
||||
if (pci_match_id(am6_pci_devids, bridge)) {
|
||||
bridge_dev = pci_get_host_bridge_device(dev);
|
||||
if (!bridge_dev && !bridge_dev->parent)
|
||||
return;
|
||||
|
||||
ks_pcie = dev_get_drvdata(bridge_dev->parent);
|
||||
if (!ks_pcie)
|
||||
return;
|
||||
|
||||
val = ks_pcie_app_readl(ks_pcie, PID);
|
||||
val &= RTL;
|
||||
val >>= RTL_SHIFT;
|
||||
if (val != AM6_PCI_PG1_RTL_VER)
|
||||
return;
|
||||
|
||||
if (pcie_get_readrq(dev) > 128) {
|
||||
dev_info(&dev->dev, "limiting MRRS to 128 bytes\n");
|
||||
pcie_set_readrq(dev, 128);
|
||||
}
|
||||
}
|
||||
}
|
||||
DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, ks_pcie_quirk);
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
|
||||
bool disable_device)
|
||||
{
|
||||
struct pci_dev *pdev = php_slot->pdev;
|
||||
int irq = php_slot->irq;
|
||||
u16 ctrl;
|
||||
|
||||
if (php_slot->irq > 0) {
|
||||
@@ -58,7 +57,7 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
|
||||
php_slot->wq = NULL;
|
||||
}
|
||||
|
||||
if (disable_device || irq > 0) {
|
||||
if (disable_device) {
|
||||
if (pdev->msix_enabled)
|
||||
pci_disable_msix(pdev);
|
||||
else if (pdev->msi_enabled)
|
||||
|
||||
@@ -5584,10 +5584,12 @@ static void pci_bus_lock(struct pci_bus *bus)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
|
||||
pci_dev_lock(bus->self);
|
||||
list_for_each_entry(dev, &bus->devices, bus_list) {
|
||||
pci_dev_lock(dev);
|
||||
if (dev->subordinate)
|
||||
pci_bus_lock(dev->subordinate);
|
||||
else
|
||||
pci_dev_lock(dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5599,8 +5601,10 @@ static void pci_bus_unlock(struct pci_bus *bus)
|
||||
list_for_each_entry(dev, &bus->devices, bus_list) {
|
||||
if (dev->subordinate)
|
||||
pci_bus_unlock(dev->subordinate);
|
||||
pci_dev_unlock(dev);
|
||||
else
|
||||
pci_dev_unlock(dev);
|
||||
}
|
||||
pci_dev_unlock(bus->self);
|
||||
}
|
||||
|
||||
/* Return 1 on successful lock, 0 on contention */
|
||||
@@ -5608,15 +5612,15 @@ static int pci_bus_trylock(struct pci_bus *bus)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
|
||||
if (!pci_dev_trylock(bus->self))
|
||||
return 0;
|
||||
|
||||
list_for_each_entry(dev, &bus->devices, bus_list) {
|
||||
if (!pci_dev_trylock(dev))
|
||||
goto unlock;
|
||||
if (dev->subordinate) {
|
||||
if (!pci_bus_trylock(dev->subordinate)) {
|
||||
pci_dev_unlock(dev);
|
||||
if (!pci_bus_trylock(dev->subordinate))
|
||||
goto unlock;
|
||||
}
|
||||
}
|
||||
} else if (!pci_dev_trylock(dev))
|
||||
goto unlock;
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -5624,8 +5628,10 @@ unlock:
|
||||
list_for_each_entry_continue_reverse(dev, &bus->devices, bus_list) {
|
||||
if (dev->subordinate)
|
||||
pci_bus_unlock(dev->subordinate);
|
||||
pci_dev_unlock(dev);
|
||||
else
|
||||
pci_dev_unlock(dev);
|
||||
}
|
||||
pci_dev_unlock(bus->self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5657,9 +5663,10 @@ static void pci_slot_lock(struct pci_slot *slot)
|
||||
list_for_each_entry(dev, &slot->bus->devices, bus_list) {
|
||||
if (!dev->slot || dev->slot != slot)
|
||||
continue;
|
||||
pci_dev_lock(dev);
|
||||
if (dev->subordinate)
|
||||
pci_bus_lock(dev->subordinate);
|
||||
else
|
||||
pci_dev_lock(dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5685,14 +5692,13 @@ static int pci_slot_trylock(struct pci_slot *slot)
|
||||
list_for_each_entry(dev, &slot->bus->devices, bus_list) {
|
||||
if (!dev->slot || dev->slot != slot)
|
||||
continue;
|
||||
if (!pci_dev_trylock(dev))
|
||||
goto unlock;
|
||||
if (dev->subordinate) {
|
||||
if (!pci_bus_trylock(dev->subordinate)) {
|
||||
pci_dev_unlock(dev);
|
||||
goto unlock;
|
||||
}
|
||||
}
|
||||
} else if (!pci_dev_trylock(dev))
|
||||
goto unlock;
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -5703,7 +5709,8 @@ unlock:
|
||||
continue;
|
||||
if (dev->subordinate)
|
||||
pci_bus_unlock(dev->subordinate);
|
||||
pci_dev_unlock(dev);
|
||||
else
|
||||
pci_dev_unlock(dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -638,11 +638,11 @@ static int yenta_search_one_res(struct resource *root, struct resource *res,
|
||||
start = PCIBIOS_MIN_CARDBUS_IO;
|
||||
end = ~0U;
|
||||
} else {
|
||||
unsigned long avail = root->end - root->start;
|
||||
unsigned long avail = resource_size(root);
|
||||
int i;
|
||||
size = BRIDGE_MEM_MAX;
|
||||
if (size > avail/8) {
|
||||
size = (avail+1)/8;
|
||||
if (size > (avail - 1) / 8) {
|
||||
size = avail / 8;
|
||||
/* round size down to next power of 2 */
|
||||
i = 0;
|
||||
while ((size /= 2) != 0)
|
||||
|
||||
@@ -847,6 +847,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
|
||||
phy_type = args->args[1];
|
||||
phy_instance = args->args[2];
|
||||
|
||||
guard(mutex)(>r_phy->phy->mutex);
|
||||
ret = xpsgtr_set_lane_type(gtr_phy, phy_type, phy_instance);
|
||||
if (ret < 0) {
|
||||
dev_err(gtr_dev->dev, "Invalid PHY type and/or instance\n");
|
||||
|
||||
@@ -590,7 +590,10 @@ static int __init dell_smbios_init(void)
|
||||
return 0;
|
||||
|
||||
fail_sysfs:
|
||||
free_group(platform_device);
|
||||
if (!wmi)
|
||||
exit_dell_smbios_wmi();
|
||||
if (!smm)
|
||||
exit_dell_smbios_smm();
|
||||
|
||||
fail_create_group:
|
||||
platform_device_del(platform_device);
|
||||
|
||||
@@ -701,3 +701,95 @@ struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev,
|
||||
|
||||
return c_rdev;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if name is a supply name according to the '*-supply' pattern
|
||||
* return 0 if false
|
||||
* return length of supply name without the -supply
|
||||
*/
|
||||
static int is_supply_name(const char *name)
|
||||
{
|
||||
int strs, i;
|
||||
|
||||
strs = strlen(name);
|
||||
/* string need to be at minimum len(x-supply) */
|
||||
if (strs < 8)
|
||||
return 0;
|
||||
for (i = strs - 6; i > 0; i--) {
|
||||
/* find first '-' and check if right part is supply */
|
||||
if (name[i] != '-')
|
||||
continue;
|
||||
if (strcmp(name + i + 1, "supply") != 0)
|
||||
return 0;
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* of_regulator_bulk_get_all - get multiple regulator consumers
|
||||
*
|
||||
* @dev: Device to supply
|
||||
* @np: device node to search for consumers
|
||||
* @consumers: Configuration of consumers; clients are stored here.
|
||||
*
|
||||
* @return number of regulators on success, an errno on failure.
|
||||
*
|
||||
* This helper function allows drivers to get several regulator
|
||||
* consumers in one operation. If any of the regulators cannot be
|
||||
* acquired then any regulators that were allocated will be freed
|
||||
* before returning to the caller.
|
||||
*/
|
||||
int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
|
||||
struct regulator_bulk_data **consumers)
|
||||
{
|
||||
int num_consumers = 0;
|
||||
struct regulator *tmp;
|
||||
struct property *prop;
|
||||
int i, n = 0, ret;
|
||||
char name[64];
|
||||
|
||||
*consumers = NULL;
|
||||
|
||||
/*
|
||||
* first pass: get numbers of xxx-supply
|
||||
* second pass: fill consumers
|
||||
*/
|
||||
restart:
|
||||
for_each_property_of_node(np, prop) {
|
||||
i = is_supply_name(prop->name);
|
||||
if (i == 0)
|
||||
continue;
|
||||
if (!*consumers) {
|
||||
num_consumers++;
|
||||
continue;
|
||||
} else {
|
||||
memcpy(name, prop->name, i);
|
||||
name[i] = '\0';
|
||||
tmp = regulator_get(dev, name);
|
||||
if (!tmp) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
(*consumers)[n].consumer = tmp;
|
||||
n++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (*consumers)
|
||||
return num_consumers;
|
||||
if (num_consumers == 0)
|
||||
return 0;
|
||||
*consumers = kmalloc_array(num_consumers,
|
||||
sizeof(struct regulator_bulk_data),
|
||||
GFP_KERNEL);
|
||||
if (!*consumers)
|
||||
return -ENOMEM;
|
||||
goto restart;
|
||||
|
||||
error:
|
||||
while (--n >= 0)
|
||||
regulator_put(consumers[n]->consumer);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_regulator_bulk_get_all);
|
||||
|
||||
@@ -976,14 +976,16 @@ static int rockchip_spi_suspend(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct spi_controller *ctlr = dev_get_drvdata(dev);
|
||||
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
|
||||
|
||||
ret = spi_controller_suspend(ctlr);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
clk_disable_unprepare(rs->spiclk);
|
||||
clk_disable_unprepare(rs->apb_pclk);
|
||||
ret = pm_runtime_force_suspend(dev);
|
||||
if (ret < 0) {
|
||||
spi_controller_resume(ctlr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pinctrl_pm_select_sleep_state(dev);
|
||||
|
||||
@@ -994,25 +996,14 @@ static int rockchip_spi_resume(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct spi_controller *ctlr = dev_get_drvdata(dev);
|
||||
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
|
||||
|
||||
pinctrl_pm_select_default_state(dev);
|
||||
|
||||
ret = clk_prepare_enable(rs->apb_pclk);
|
||||
ret = pm_runtime_force_resume(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = clk_prepare_enable(rs->spiclk);
|
||||
if (ret < 0)
|
||||
clk_disable_unprepare(rs->apb_pclk);
|
||||
|
||||
ret = spi_controller_resume(ctlr);
|
||||
if (ret < 0) {
|
||||
clk_disable_unprepare(rs->spiclk);
|
||||
clk_disable_unprepare(rs->apb_pclk);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return spi_controller_resume(ctlr);
|
||||
}
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ static int ad9834_write_frequency(struct ad9834_state *st,
|
||||
|
||||
clk_freq = clk_get_rate(st->mclk);
|
||||
|
||||
if (fout > (clk_freq / 2))
|
||||
if (!clk_freq || fout > (clk_freq / 2))
|
||||
return -EINVAL;
|
||||
|
||||
regval = ad9834_calc_freqreg(clk_freq, fout);
|
||||
|
||||
@@ -104,10 +104,11 @@ static void hv_uio_channel_cb(void *context)
|
||||
|
||||
/*
|
||||
* Callback from vmbus_event when channel is rescinded.
|
||||
* It is meant for rescind of primary channels only.
|
||||
*/
|
||||
static void hv_uio_rescind(struct vmbus_channel *channel)
|
||||
{
|
||||
struct hv_device *hv_dev = channel->primary_channel->device_obj;
|
||||
struct hv_device *hv_dev = channel->device_obj;
|
||||
struct hv_uio_private_data *pdata = hv_get_drvdata(hv_dev);
|
||||
|
||||
/*
|
||||
@@ -118,6 +119,14 @@ static void hv_uio_rescind(struct vmbus_channel *channel)
|
||||
|
||||
/* Wake up reader */
|
||||
uio_event_notify(&pdata->info);
|
||||
|
||||
/*
|
||||
* With rescind callback registered, rescind path will not unregister the device
|
||||
* from vmbus when the primary channel is rescinded.
|
||||
* Without it, rescind handling is incomplete and next onoffer msg does not come.
|
||||
* Unregister the device from vmbus here.
|
||||
*/
|
||||
vmbus_device_unregister(channel->device_obj);
|
||||
}
|
||||
|
||||
/* Sysfs API to allow mmap of the ring buffers
|
||||
|
||||
@@ -1200,6 +1200,21 @@ static int dwc3_core_init(struct dwc3 *dwc)
|
||||
dwc3_writel(dwc->regs, DWC3_GUCTL2, reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* STAR 9001285599: This issue affects DWC_usb3 version 3.20a
|
||||
* only. If the PM TIMER ECM is enabled through GUCTL2[19], the
|
||||
* link compliance test (TD7.21) may fail. If the ECN is not
|
||||
* enabled (GUCTL2[19] = 0), the controller will use the old timer
|
||||
* value (5us), which is still acceptable for the link compliance
|
||||
* test. Therefore, do not enable PM TIMER ECM in 3.20a by
|
||||
* setting GUCTL2[19] by default; instead, use GUCTL2[19] = 0.
|
||||
*/
|
||||
if (DWC3_VER_IS(DWC3, 320A)) {
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUCTL2);
|
||||
reg &= ~DWC3_GUCTL2_LC_TIMER;
|
||||
dwc3_writel(dwc->regs, DWC3_GUCTL2, reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* When configured in HOST mode, after issuing U3/L2 exit controller
|
||||
* fails to send proper CRC checksum in CRC5 feild. Because of this
|
||||
|
||||
@@ -405,6 +405,7 @@
|
||||
|
||||
/* Global User Control Register 2 */
|
||||
#define DWC3_GUCTL2_RST_ACTBITLATER BIT(14)
|
||||
#define DWC3_GUCTL2_LC_TIMER BIT(19)
|
||||
|
||||
/* Global User Control Register 3 */
|
||||
#define DWC3_GUCTL3_SPLITDISABLE BIT(14)
|
||||
@@ -1245,6 +1246,7 @@ struct dwc3 {
|
||||
#define DWC3_REVISION_290A 0x5533290a
|
||||
#define DWC3_REVISION_300A 0x5533300a
|
||||
#define DWC3_REVISION_310A 0x5533310a
|
||||
#define DWC3_REVISION_320A 0x5533320a
|
||||
#define DWC3_REVISION_330A 0x5533330a
|
||||
|
||||
#define DWC31_REVISION_ANY 0x0
|
||||
|
||||
@@ -1009,6 +1009,8 @@ static void ast_udc_getstatus(struct ast_udc_dev *udc)
|
||||
break;
|
||||
case USB_RECIP_ENDPOINT:
|
||||
epnum = crq.wIndex & USB_ENDPOINT_NUMBER_MASK;
|
||||
if (epnum >= AST_UDC_NUM_ENDPOINTS)
|
||||
goto stall;
|
||||
status = udc->ep[epnum].stopped;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -422,6 +422,7 @@ static void uas_data_cmplt(struct urb *urb)
|
||||
uas_log_cmd_state(cmnd, "data cmplt err", status);
|
||||
/* error: no data transfered */
|
||||
scsi_set_resid(cmnd, sdb->length);
|
||||
set_host_byte(cmnd, DID_ERROR);
|
||||
} else {
|
||||
scsi_set_resid(cmnd, sdb->length - urb->actual_length);
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,8 @@ out_free_interp:
|
||||
if (elf_read_implies_exec(*elf_ex, executable_stack))
|
||||
current->personality |= READ_IMPLIES_EXEC;
|
||||
|
||||
if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
|
||||
const int snapshot_randomize_va_space = READ_ONCE(randomize_va_space);
|
||||
if (!(current->personality & ADDR_NO_RANDOMIZE) && snapshot_randomize_va_space)
|
||||
current->flags |= PF_RANDOMIZE;
|
||||
|
||||
setup_new_exec(bprm);
|
||||
@@ -1301,7 +1302,7 @@ out_free_interp:
|
||||
mm->end_data = end_data;
|
||||
mm->start_stack = bprm->p;
|
||||
|
||||
if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) {
|
||||
if ((current->flags & PF_RANDOMIZE) && (snapshot_randomize_va_space > 1)) {
|
||||
/*
|
||||
* For architectures with ELF randomization, when executing
|
||||
* a loader directly (i.e. no interpreter listed in ELF
|
||||
|
||||
@@ -324,8 +324,16 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
|
||||
}
|
||||
|
||||
owner = btrfs_header_owner(buf);
|
||||
BUG_ON(owner == BTRFS_TREE_RELOC_OBJECTID &&
|
||||
!(flags & BTRFS_BLOCK_FLAG_FULL_BACKREF));
|
||||
if (unlikely(owner == BTRFS_TREE_RELOC_OBJECTID &&
|
||||
!(flags & BTRFS_BLOCK_FLAG_FULL_BACKREF))) {
|
||||
btrfs_crit(fs_info,
|
||||
"found tree block at bytenr %llu level %d root %llu refs %llu flags %llx without full backref flag set",
|
||||
buf->start, btrfs_header_level(buf),
|
||||
btrfs_root_id(root), refs, flags);
|
||||
ret = -EUCLEAN;
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (refs > 1) {
|
||||
if ((owner == root->root_key.objectid ||
|
||||
|
||||
@@ -5141,7 +5141,15 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,
|
||||
/* We don't care about errors in readahead. */
|
||||
if (ret < 0)
|
||||
continue;
|
||||
BUG_ON(refs == 0);
|
||||
|
||||
/*
|
||||
* This could be racey, it's conceivable that we raced and end
|
||||
* up with a bogus refs count, if that's the case just skip, if
|
||||
* we are actually corrupt we will notice when we look up
|
||||
* everything again with our locks.
|
||||
*/
|
||||
if (refs == 0)
|
||||
continue;
|
||||
|
||||
if (wc->stage == DROP_REFERENCE) {
|
||||
if (refs == 1)
|
||||
@@ -5200,7 +5208,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
|
||||
if (lookup_info &&
|
||||
((wc->stage == DROP_REFERENCE && wc->refs[level] != 1) ||
|
||||
(wc->stage == UPDATE_BACKREF && !(wc->flags[level] & flag)))) {
|
||||
BUG_ON(!path->locks[level]);
|
||||
ASSERT(path->locks[level]);
|
||||
ret = btrfs_lookup_extent_info(trans, fs_info,
|
||||
eb->start, level, 1,
|
||||
&wc->refs[level],
|
||||
@@ -5208,7 +5216,11 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
|
||||
BUG_ON(ret == -ENOMEM);
|
||||
if (ret)
|
||||
return ret;
|
||||
BUG_ON(wc->refs[level] == 0);
|
||||
if (unlikely(wc->refs[level] == 0)) {
|
||||
btrfs_err(fs_info, "bytenr %llu has 0 references, expect > 0",
|
||||
eb->start);
|
||||
return -EUCLEAN;
|
||||
}
|
||||
}
|
||||
|
||||
if (wc->stage == DROP_REFERENCE) {
|
||||
@@ -5224,7 +5236,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
|
||||
|
||||
/* wc->stage == UPDATE_BACKREF */
|
||||
if (!(wc->flags[level] & flag)) {
|
||||
BUG_ON(!path->locks[level]);
|
||||
ASSERT(path->locks[level]);
|
||||
ret = btrfs_inc_ref(trans, root, eb, 1);
|
||||
BUG_ON(ret); /* -ENOMEM */
|
||||
ret = btrfs_dec_ref(trans, root, eb, 0);
|
||||
@@ -5338,8 +5350,9 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
|
||||
goto out_unlock;
|
||||
|
||||
if (unlikely(wc->refs[level - 1] == 0)) {
|
||||
btrfs_err(fs_info, "Missing references.");
|
||||
ret = -EIO;
|
||||
btrfs_err(fs_info, "bytenr %llu has 0 references, expect > 0",
|
||||
bytenr);
|
||||
ret = -EUCLEAN;
|
||||
goto out_unlock;
|
||||
}
|
||||
*lookup_info = 0;
|
||||
@@ -5540,7 +5553,12 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
|
||||
path->locks[level] = 0;
|
||||
return ret;
|
||||
}
|
||||
BUG_ON(wc->refs[level] == 0);
|
||||
if (unlikely(wc->refs[level] == 0)) {
|
||||
btrfs_tree_unlock_rw(eb, path->locks[level]);
|
||||
btrfs_err(fs_info, "bytenr %llu has 0 references, expect > 0",
|
||||
eb->start);
|
||||
return -EUCLEAN;
|
||||
}
|
||||
if (wc->refs[level] == 1) {
|
||||
btrfs_tree_unlock_rw(eb, path->locks[level]);
|
||||
path->locks[level] = 0;
|
||||
|
||||
@@ -5890,7 +5890,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
|
||||
struct inode *inode;
|
||||
struct btrfs_root *root = BTRFS_I(dir)->root;
|
||||
struct btrfs_root *sub_root = root;
|
||||
struct btrfs_key location;
|
||||
struct btrfs_key location = { 0 };
|
||||
u8 di_type = 0;
|
||||
int ret = 0;
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason, handle_t *handl
|
||||
read_unlock(&sbi->s_journal->j_state_lock);
|
||||
}
|
||||
spin_lock(&sbi->s_fc_lock);
|
||||
if (sbi->s_fc_ineligible_tid < tid)
|
||||
if (tid_gt(tid, sbi->s_fc_ineligible_tid))
|
||||
sbi->s_fc_ineligible_tid = tid;
|
||||
spin_unlock(&sbi->s_fc_lock);
|
||||
WARN_ON(reason >= EXT4_FC_REASON_MAX);
|
||||
@@ -1235,7 +1235,7 @@ restart_fc:
|
||||
if (ret == -EALREADY) {
|
||||
/* There was an ongoing commit, check if we need to restart */
|
||||
if (atomic_read(&sbi->s_fc_subtid) <= subtid &&
|
||||
commit_tid > journal->j_commit_sequence)
|
||||
tid_gt(commit_tid, journal->j_commit_sequence))
|
||||
goto restart_fc;
|
||||
ext4_fc_update_stats(sb, EXT4_FC_STATUS_SKIPPED, 0, 0,
|
||||
commit_tid);
|
||||
@@ -1310,7 +1310,7 @@ static void ext4_fc_cleanup(journal_t *journal, int full, tid_t tid)
|
||||
list_del_init(&iter->i_fc_list);
|
||||
ext4_clear_inode_state(&iter->vfs_inode,
|
||||
EXT4_STATE_FC_COMMITTING);
|
||||
if (iter->i_sync_tid <= tid)
|
||||
if (tid_geq(tid, iter->i_sync_tid))
|
||||
ext4_fc_reset_inode(&iter->vfs_inode);
|
||||
/* Make sure EXT4_STATE_FC_COMMITTING bit is clear */
|
||||
smp_mb();
|
||||
@@ -1341,7 +1341,7 @@ static void ext4_fc_cleanup(journal_t *journal, int full, tid_t tid)
|
||||
list_splice_init(&sbi->s_fc_q[FC_Q_STAGING],
|
||||
&sbi->s_fc_q[FC_Q_MAIN]);
|
||||
|
||||
if (tid >= sbi->s_fc_ineligible_tid) {
|
||||
if (tid_geq(tid, sbi->s_fc_ineligible_tid)) {
|
||||
sbi->s_fc_ineligible_tid = 0;
|
||||
ext4_clear_mount_flag(sb, EXT4_MF_FC_INELIGIBLE);
|
||||
}
|
||||
|
||||
@@ -1801,10 +1801,16 @@ __acquires(fi->lock)
|
||||
fuse_writepage_finish(fm, wpa);
|
||||
spin_unlock(&fi->lock);
|
||||
|
||||
/* After fuse_writepage_finish() aux request list is private */
|
||||
/* After rb_erase() aux request list is private */
|
||||
for (aux = wpa->next; aux; aux = next) {
|
||||
struct backing_dev_info *bdi = inode_to_bdi(aux->inode);
|
||||
|
||||
next = aux->next;
|
||||
aux->next = NULL;
|
||||
|
||||
dec_wb_stat(&bdi->wb, WB_WRITEBACK);
|
||||
dec_node_page_state(aux->ia.ap.pages[0], NR_WRITEBACK_TEMP);
|
||||
wb_writeout_inc(&bdi->wb);
|
||||
fuse_writepage_free(aux);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
|
||||
}
|
||||
ret = fuse_simple_request(fm, &args);
|
||||
if (!ret && !size)
|
||||
ret = min_t(ssize_t, outarg.size, XATTR_SIZE_MAX);
|
||||
ret = min_t(size_t, outarg.size, XATTR_SIZE_MAX);
|
||||
if (ret == -ENOSYS) {
|
||||
fm->fc->no_getxattr = 1;
|
||||
ret = -EOPNOTSUPP;
|
||||
@@ -154,7 +154,7 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
|
||||
}
|
||||
ret = fuse_simple_request(fm, &args);
|
||||
if (!ret && !size)
|
||||
ret = min_t(ssize_t, outarg.size, XATTR_LIST_MAX);
|
||||
ret = min_t(size_t, outarg.size, XATTR_LIST_MAX);
|
||||
if (ret > 0 && size)
|
||||
ret = fuse_verify_xattr_list(list, ret);
|
||||
if (ret == -ENOSYS) {
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <linux/vfs.h>
|
||||
#include <linux/inet.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <linux/netdevice.h>
|
||||
@@ -219,6 +220,7 @@ static int __nfs_list_for_each_server(struct list_head *head,
|
||||
ret = fn(server, data);
|
||||
if (ret)
|
||||
goto out;
|
||||
cond_resched();
|
||||
rcu_read_lock();
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
@@ -708,6 +708,33 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,
|
||||
brelse(bh);
|
||||
}
|
||||
|
||||
/**
|
||||
* nilfs_abort_roll_forward - cleaning up after a failed rollforward recovery
|
||||
* @nilfs: nilfs object
|
||||
*/
|
||||
static void nilfs_abort_roll_forward(struct the_nilfs *nilfs)
|
||||
{
|
||||
struct nilfs_inode_info *ii, *n;
|
||||
LIST_HEAD(head);
|
||||
|
||||
/* Abandon inodes that have read recovery data */
|
||||
spin_lock(&nilfs->ns_inode_lock);
|
||||
list_splice_init(&nilfs->ns_dirty_files, &head);
|
||||
spin_unlock(&nilfs->ns_inode_lock);
|
||||
if (list_empty(&head))
|
||||
return;
|
||||
|
||||
set_nilfs_purging(nilfs);
|
||||
list_for_each_entry_safe(ii, n, &head, i_dirty) {
|
||||
spin_lock(&nilfs->ns_inode_lock);
|
||||
list_del_init(&ii->i_dirty);
|
||||
spin_unlock(&nilfs->ns_inode_lock);
|
||||
|
||||
iput(&ii->vfs_inode);
|
||||
}
|
||||
clear_nilfs_purging(nilfs);
|
||||
}
|
||||
|
||||
/**
|
||||
* nilfs_salvage_orphan_logs - salvage logs written after the latest checkpoint
|
||||
* @nilfs: nilfs object
|
||||
@@ -766,15 +793,19 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
|
||||
if (unlikely(err)) {
|
||||
nilfs_err(sb, "error %d writing segment for recovery",
|
||||
err);
|
||||
goto failed;
|
||||
goto put_root;
|
||||
}
|
||||
|
||||
nilfs_finish_roll_forward(nilfs, ri);
|
||||
}
|
||||
|
||||
failed:
|
||||
put_root:
|
||||
nilfs_put_root(root);
|
||||
return err;
|
||||
|
||||
failed:
|
||||
nilfs_abort_roll_forward(nilfs);
|
||||
goto put_root;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1833,6 +1833,9 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
|
||||
nilfs_abort_logs(&logs, ret ? : err);
|
||||
|
||||
list_splice_tail_init(&sci->sc_segbufs, &logs);
|
||||
if (list_empty(&logs))
|
||||
return; /* if the first segment buffer preparation failed */
|
||||
|
||||
nilfs_cancel_segusage(&logs, nilfs->ns_sufile);
|
||||
nilfs_free_incomplete_logs(&logs, nilfs);
|
||||
|
||||
@@ -2077,7 +2080,7 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
|
||||
|
||||
err = nilfs_segctor_begin_construction(sci, nilfs);
|
||||
if (unlikely(err))
|
||||
goto out;
|
||||
goto failed;
|
||||
|
||||
/* Update time stamp */
|
||||
sci->sc_seg_ctime = ktime_get_real_seconds();
|
||||
@@ -2140,10 +2143,9 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
|
||||
return err;
|
||||
|
||||
failed_to_write:
|
||||
if (sci->sc_stage.flags & NILFS_CF_IFILE_STARTED)
|
||||
nilfs_redirty_inodes(&sci->sc_dirty_files);
|
||||
|
||||
failed:
|
||||
if (mode == SC_LSEG_SR && nilfs_sc_cstage_get(sci) >= NILFS_ST_IFILE)
|
||||
nilfs_redirty_inodes(&sci->sc_dirty_files);
|
||||
if (nilfs_doing_gc())
|
||||
nilfs_redirty_inodes(&sci->sc_gc_inodes);
|
||||
nilfs_segctor_abort_construction(sci, nilfs, err);
|
||||
|
||||
@@ -836,9 +836,15 @@ ssize_t nilfs_dev_revision_show(struct nilfs_dev_attr *attr,
|
||||
struct the_nilfs *nilfs,
|
||||
char *buf)
|
||||
{
|
||||
struct nilfs_super_block **sbp = nilfs->ns_sbp;
|
||||
u32 major = le32_to_cpu(sbp[0]->s_rev_level);
|
||||
u16 minor = le16_to_cpu(sbp[0]->s_minor_rev_level);
|
||||
struct nilfs_super_block *raw_sb;
|
||||
u32 major;
|
||||
u16 minor;
|
||||
|
||||
down_read(&nilfs->ns_sem);
|
||||
raw_sb = nilfs->ns_sbp[0];
|
||||
major = le32_to_cpu(raw_sb->s_rev_level);
|
||||
minor = le16_to_cpu(raw_sb->s_minor_rev_level);
|
||||
up_read(&nilfs->ns_sem);
|
||||
|
||||
return sysfs_emit(buf, "%d.%d\n", major, minor);
|
||||
}
|
||||
@@ -856,8 +862,13 @@ ssize_t nilfs_dev_device_size_show(struct nilfs_dev_attr *attr,
|
||||
struct the_nilfs *nilfs,
|
||||
char *buf)
|
||||
{
|
||||
struct nilfs_super_block **sbp = nilfs->ns_sbp;
|
||||
u64 dev_size = le64_to_cpu(sbp[0]->s_dev_size);
|
||||
struct nilfs_super_block *raw_sb;
|
||||
u64 dev_size;
|
||||
|
||||
down_read(&nilfs->ns_sem);
|
||||
raw_sb = nilfs->ns_sbp[0];
|
||||
dev_size = le64_to_cpu(raw_sb->s_dev_size);
|
||||
up_read(&nilfs->ns_sem);
|
||||
|
||||
return sysfs_emit(buf, "%llu\n", dev_size);
|
||||
}
|
||||
@@ -879,9 +890,15 @@ ssize_t nilfs_dev_uuid_show(struct nilfs_dev_attr *attr,
|
||||
struct the_nilfs *nilfs,
|
||||
char *buf)
|
||||
{
|
||||
struct nilfs_super_block **sbp = nilfs->ns_sbp;
|
||||
struct nilfs_super_block *raw_sb;
|
||||
ssize_t len;
|
||||
|
||||
return sysfs_emit(buf, "%pUb\n", sbp[0]->s_uuid);
|
||||
down_read(&nilfs->ns_sem);
|
||||
raw_sb = nilfs->ns_sbp[0];
|
||||
len = sysfs_emit(buf, "%pUb\n", raw_sb->s_uuid);
|
||||
up_read(&nilfs->ns_sem);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -889,10 +906,16 @@ ssize_t nilfs_dev_volume_name_show(struct nilfs_dev_attr *attr,
|
||||
struct the_nilfs *nilfs,
|
||||
char *buf)
|
||||
{
|
||||
struct nilfs_super_block **sbp = nilfs->ns_sbp;
|
||||
struct nilfs_super_block *raw_sb;
|
||||
ssize_t len;
|
||||
|
||||
return scnprintf(buf, sizeof(sbp[0]->s_volume_name), "%s\n",
|
||||
sbp[0]->s_volume_name);
|
||||
down_read(&nilfs->ns_sem);
|
||||
raw_sb = nilfs->ns_sbp[0];
|
||||
len = scnprintf(buf, sizeof(raw_sb->s_volume_name), "%s\n",
|
||||
raw_sb->s_volume_name);
|
||||
up_read(&nilfs->ns_sem);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static const char dev_readme_str[] =
|
||||
|
||||
@@ -272,9 +272,12 @@ out:
|
||||
return err == -ENOENT ? NULL : err ? ERR_PTR(err) : inode;
|
||||
}
|
||||
|
||||
static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
|
||||
const struct NTFS_DE *e, u8 *name,
|
||||
struct dir_context *ctx)
|
||||
/*
|
||||
* returns false if 'ctx' if full
|
||||
*/
|
||||
static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,
|
||||
struct ntfs_inode *ni, const struct NTFS_DE *e,
|
||||
u8 *name, struct dir_context *ctx)
|
||||
{
|
||||
const struct ATTR_FILE_NAME *fname;
|
||||
unsigned long ino;
|
||||
@@ -284,29 +287,29 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
|
||||
fname = Add2Ptr(e, sizeof(struct NTFS_DE));
|
||||
|
||||
if (fname->type == FILE_NAME_DOS)
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
if (!mi_is_ref(&ni->mi, &fname->home))
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
ino = ino_get(&e->ref);
|
||||
|
||||
if (ino == MFT_REC_ROOT)
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
/* Skip meta files. Unless option to show metafiles is set. */
|
||||
if (!sbi->options->showmeta && ntfs_is_meta_file(sbi, ino))
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
if (sbi->options->nohidden && (fname->dup.fa & FILE_ATTRIBUTE_HIDDEN))
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
name_len = ntfs_utf16_to_nls(sbi, fname->name, fname->name_len, name,
|
||||
PATH_MAX);
|
||||
if (name_len <= 0) {
|
||||
ntfs_warn(sbi->sb, "failed to convert name for inode %lx.",
|
||||
ino);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -336,17 +339,20 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
|
||||
}
|
||||
}
|
||||
|
||||
return !dir_emit(ctx, (s8 *)name, name_len, ino, dt_type);
|
||||
return dir_emit(ctx, (s8 *)name, name_len, ino, dt_type);
|
||||
}
|
||||
|
||||
/*
|
||||
* ntfs_read_hdr - Helper function for ntfs_readdir().
|
||||
*
|
||||
* returns 0 if ok.
|
||||
* returns -EINVAL if directory is corrupted.
|
||||
* returns +1 if 'ctx' is full.
|
||||
*/
|
||||
static int ntfs_read_hdr(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
|
||||
const struct INDEX_HDR *hdr, u64 vbo, u64 pos,
|
||||
u8 *name, struct dir_context *ctx)
|
||||
{
|
||||
int err;
|
||||
const struct NTFS_DE *e;
|
||||
u32 e_size;
|
||||
u32 end = le32_to_cpu(hdr->used);
|
||||
@@ -354,12 +360,12 @@ static int ntfs_read_hdr(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
|
||||
|
||||
for (;; off += e_size) {
|
||||
if (off + sizeof(struct NTFS_DE) > end)
|
||||
return -1;
|
||||
return -EINVAL;
|
||||
|
||||
e = Add2Ptr(hdr, off);
|
||||
e_size = le16_to_cpu(e->size);
|
||||
if (e_size < sizeof(struct NTFS_DE) || off + e_size > end)
|
||||
return -1;
|
||||
return -EINVAL;
|
||||
|
||||
if (de_is_last(e))
|
||||
return 0;
|
||||
@@ -369,14 +375,15 @@ static int ntfs_read_hdr(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
|
||||
continue;
|
||||
|
||||
if (le16_to_cpu(e->key_size) < SIZEOF_ATTRIBUTE_FILENAME)
|
||||
return -1;
|
||||
return -EINVAL;
|
||||
|
||||
ctx->pos = vbo + off;
|
||||
|
||||
/* Submit the name to the filldir callback. */
|
||||
err = ntfs_filldir(sbi, ni, e, name, ctx);
|
||||
if (err)
|
||||
return err;
|
||||
if (!ntfs_dir_emit(sbi, ni, e, name, ctx)) {
|
||||
/* ctx is full. */
|
||||
return +1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,8 +482,6 @@ static int ntfs_readdir(struct file *file, struct dir_context *ctx)
|
||||
|
||||
vbo = (u64)bit << index_bits;
|
||||
if (vbo >= i_size) {
|
||||
ntfs_inode_err(dir, "Looks like your dir is corrupt");
|
||||
ctx->pos = eod;
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -499,9 +504,16 @@ out:
|
||||
__putname(name);
|
||||
put_indx_node(node);
|
||||
|
||||
if (err == -ENOENT) {
|
||||
if (err == 1) {
|
||||
/* 'ctx' is full. */
|
||||
err = 0;
|
||||
} else if (err == -ENOENT) {
|
||||
err = 0;
|
||||
ctx->pos = pos;
|
||||
} else if (err < 0) {
|
||||
if (err == -EINVAL)
|
||||
ntfs_inode_err(dir, "directory corrupted");
|
||||
ctx->pos = eod;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
@@ -1601,8 +1601,10 @@ int ni_delete_all(struct ntfs_inode *ni)
|
||||
asize = le32_to_cpu(attr->size);
|
||||
roff = le16_to_cpu(attr->nres.run_off);
|
||||
|
||||
if (roff > asize)
|
||||
if (roff > asize) {
|
||||
_ntfs_bad_inode(&ni->vfs_inode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* run==1 means unpack and deallocate. */
|
||||
run_unpack_ex(RUN_DEALLOCATE, sbi, ni->mi.rno, svcn, evcn, svcn,
|
||||
|
||||
@@ -3443,13 +3443,15 @@ static long smb3_zero_data(struct file *file, struct cifs_tcon *tcon,
|
||||
}
|
||||
|
||||
static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
|
||||
loff_t offset, loff_t len, bool keep_size)
|
||||
unsigned long long offset, unsigned long long len,
|
||||
bool keep_size)
|
||||
{
|
||||
struct cifs_ses *ses = tcon->ses;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct cifsInodeInfo *cifsi = CIFS_I(inode);
|
||||
struct cifsFileInfo *cfile = file->private_data;
|
||||
unsigned long long new_size;
|
||||
struct netfs_inode *ictx = netfs_inode(inode);
|
||||
unsigned long long i_size, new_size, remote_size;
|
||||
long rc;
|
||||
unsigned int xid;
|
||||
__le64 eof;
|
||||
@@ -3462,6 +3464,16 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
|
||||
inode_lock(inode);
|
||||
filemap_invalidate_lock(inode->i_mapping);
|
||||
|
||||
i_size = i_size_read(inode);
|
||||
remote_size = ictx->remote_i_size;
|
||||
if (offset + len >= remote_size && offset < i_size) {
|
||||
unsigned long long top = umin(offset + len, i_size);
|
||||
|
||||
rc = filemap_write_and_wait_range(inode->i_mapping, offset, top - 1);
|
||||
if (rc < 0)
|
||||
goto zero_range_exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* We zero the range through ioctl, so we need remove the page caches
|
||||
* first, otherwise the data may be inconsistent with the server.
|
||||
|
||||
@@ -276,8 +276,13 @@ int squashfs_read_inode(struct inode *inode, long long ino)
|
||||
if (err < 0)
|
||||
goto failed_read;
|
||||
|
||||
set_nlink(inode, le32_to_cpu(sqsh_ino->nlink));
|
||||
inode->i_size = le32_to_cpu(sqsh_ino->symlink_size);
|
||||
if (inode->i_size > PAGE_SIZE) {
|
||||
ERROR("Corrupted symlink\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
set_nlink(inode, le32_to_cpu(sqsh_ino->nlink));
|
||||
inode->i_op = &squashfs_symlink_inode_ops;
|
||||
inode_nohighmem(inode);
|
||||
inode->i_data.a_ops = &squashfs_symlink_aops;
|
||||
|
||||
@@ -1084,12 +1084,19 @@ static int udf_fill_partdesc_info(struct super_block *sb,
|
||||
struct udf_part_map *map;
|
||||
struct udf_sb_info *sbi = UDF_SB(sb);
|
||||
struct partitionHeaderDesc *phd;
|
||||
u32 sum;
|
||||
int err;
|
||||
|
||||
map = &sbi->s_partmaps[p_index];
|
||||
|
||||
map->s_partition_len = le32_to_cpu(p->partitionLength); /* blocks */
|
||||
map->s_partition_root = le32_to_cpu(p->partitionStartingLocation);
|
||||
if (check_add_overflow(map->s_partition_root, map->s_partition_len,
|
||||
&sum)) {
|
||||
udf_err(sb, "Partition %d has invalid location %u + %u\n",
|
||||
p_index, map->s_partition_root, map->s_partition_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_READ_ONLY))
|
||||
map->s_partition_flags |= UDF_PART_FLAG_READ_ONLY;
|
||||
@@ -1145,6 +1152,14 @@ static int udf_fill_partdesc_info(struct super_block *sb,
|
||||
bitmap->s_extPosition = le32_to_cpu(
|
||||
phd->unallocSpaceBitmap.extPosition);
|
||||
map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP;
|
||||
/* Check whether math over bitmap won't overflow. */
|
||||
if (check_add_overflow(map->s_partition_len,
|
||||
sizeof(struct spaceBitmapDesc) << 3,
|
||||
&sum)) {
|
||||
udf_err(sb, "Partition %d is too long (%u)\n", p_index,
|
||||
map->s_partition_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
udf_debug("unallocSpaceBitmap (part %d) @ %u\n",
|
||||
p_index, bitmap->s_extPosition);
|
||||
}
|
||||
|
||||
@@ -244,6 +244,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms);
|
||||
|
||||
int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
|
||||
struct regulator_bulk_data *consumers);
|
||||
int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
|
||||
struct regulator_bulk_data **consumers);
|
||||
int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
|
||||
struct regulator_bulk_data *consumers);
|
||||
void devm_regulator_bulk_put(struct regulator_bulk_data *consumers);
|
||||
@@ -479,6 +481,20 @@ static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
|
||||
struct regulator_bulk_data **consumers)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int devm_regulator_bulk_get_const(
|
||||
struct device *dev, int num_consumers,
|
||||
const struct regulator_bulk_data *in_consumers,
|
||||
struct regulator_bulk_data **out_consumers)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int regulator_bulk_enable(int num_consumers,
|
||||
struct regulator_bulk_data *consumers)
|
||||
{
|
||||
|
||||
@@ -628,7 +628,7 @@ static int io_wqe_worker(void *data)
|
||||
struct io_wqe_acct *acct = io_wqe_get_acct(worker);
|
||||
struct io_wqe *wqe = worker->wqe;
|
||||
struct io_wq *wq = wqe->wq;
|
||||
bool last_timeout = false;
|
||||
bool exit_mask = false, last_timeout = false;
|
||||
char buf[TASK_COMM_LEN];
|
||||
|
||||
worker->flags |= (IO_WORKER_F_UP | IO_WORKER_F_RUNNING);
|
||||
@@ -644,8 +644,11 @@ static int io_wqe_worker(void *data)
|
||||
io_worker_handle_work(worker);
|
||||
|
||||
raw_spin_lock(&wqe->lock);
|
||||
/* timed out, exit unless we're the last worker */
|
||||
if (last_timeout && acct->nr_workers > 1) {
|
||||
/*
|
||||
* Last sleep timed out. Exit if we're not the last worker,
|
||||
* or if someone modified our affinity.
|
||||
*/
|
||||
if (last_timeout && (exit_mask || acct->nr_workers > 1)) {
|
||||
acct->nr_workers--;
|
||||
raw_spin_unlock(&wqe->lock);
|
||||
__set_current_state(TASK_RUNNING);
|
||||
@@ -664,7 +667,11 @@ static int io_wqe_worker(void *data)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
last_timeout = !ret;
|
||||
if (!ret) {
|
||||
last_timeout = true;
|
||||
exit_mask = !cpumask_test_cpu(raw_smp_processor_id(),
|
||||
wqe->cpu_mask);
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(IO_WQ_BIT_EXIT, &wq->state))
|
||||
@@ -716,7 +723,6 @@ static void io_init_new_worker(struct io_wqe *wqe, struct io_worker *worker,
|
||||
tsk->worker_private = worker;
|
||||
worker->task = tsk;
|
||||
set_cpus_allowed_ptr(tsk, wqe->cpu_mask);
|
||||
tsk->flags |= PF_NO_SETAFFINITY;
|
||||
|
||||
raw_spin_lock(&wqe->lock);
|
||||
hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list);
|
||||
|
||||
@@ -239,7 +239,6 @@ static int io_sq_thread(void *data)
|
||||
set_cpus_allowed_ptr(current, cpu_online_mask);
|
||||
sqd->sq_cpu = raw_smp_processor_id();
|
||||
}
|
||||
current->flags |= PF_NO_SETAFFINITY;
|
||||
|
||||
/*
|
||||
* Force audit context to get setup, in case we do prep side async
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user