ASoC: wm8974: Correct boost mixer inputs
Subsystems (8)
Sasha Levin
maintainerPATCH 1/19 ASoC: wm8974: Correct boost mixer inputs
From: Charles Keepax <[email protected]>
[ Upstream commit 37e6fd0cebf0b9f71afb38fd95b10408799d1f0b ]
Bit 6 of INPPGA (INPPGAMUTE) does not control the Aux path, it controls the input PGA path, as can been seen from Figure 8 Input Boost Stage in the datasheet. Update the naming of things in the driver to match this and update the routing to also reflect this.
--- sound/soc/codecs/wm8974.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8974.c +3 -3
@@ -186,7 +186,7 @@ SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_MONOMIX, 0, 1, 0),/* Boost mixer */ static const struct snd_kcontrol_new wm8974_boost_mixer[] = { -SOC_DAPM_SINGLE ("Aux Switch" ,WM8974_INPPGA ,6 ,1 ,1 ), +SOC_DAPM_SINGLE ("PGA Switch" ,WM8974_INPPGA ,6 ,1 ,1 ), };/* Input PGA */
@@ -246,8 +246,8 @@ static const struct snd_soc_dapm_route wm8974_dapm_routes[] = {/* Boost Mixer */ {"ADC", NULL, "Boost Mixer"}, - {"Boost Mixer", "Aux Switch", "Aux Input"}, - {"Boost Mixer", NULL, "Input PGA"}, + {"Boost Mixer", NULL, "Aux Input"}, + {"Boost Mixer", "PGA Switch", "Input PGA"}, {"Boost Mixer", NULL, "MICP"}, /* Input PGA */
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 2/19 ASoC: Intel: Skylake: Fix mem leak in few functions
From: Kamil Duljas <[email protected]>
[ Upstream commit d5c65be34df73fa01ed05611aafb73b440d89e29 ]
The resources should be freed when function return error.
--- sound/soc/intel/skylake/skl-pcm.c | 4 +++- sound/soc/intel/skylake/skl-sst-ipc.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +3 -1
@@ -251,8 +251,10 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,snd_pcm_set_sync (substream); mconfig =skl_tplg_fe_get_cpr_module (dai, substream->stream); -if (!mconfig) +if (!mconfig) { +kfree (dma_params);return -EINVAL ; + }skl_tplg_d0i3_get (skl, mconfig->d0i3_caps);
sound/soc/intel/skylake/skl-sst-ipc.c +3 -1
@@ -1003,8 +1003,10 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc, reply.size = (reply.header >>32 ) &IPC_DATA_OFFSET_SZ_MASK ; buf =krealloc (reply.data, reply.size,GFP_KERNEL ); -if (!buf) +if (!buf) { +kfree (reply.data);return -ENOMEM ; + } *payload = buf; *bytes = reply.size;
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 3/19 ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16
In reply to Sasha LevinFrom: David Lin <[email protected]>
[ Upstream commit c1501f2597dd08601acd42256a4b0a0fc36bf302 ]
This issue is reproduced when W=1 build in compiler gcc-12. The following are sparse warnings:
sound/soc/codecs/nau8822.c:199:25: sparse: sparse: incorrect type in assignment sound/soc/codecs/nau8822.c:199:25: sparse: expected unsigned short sound/soc/codecs/nau8822.c:199:25: sparse: got restricted __be16 sound/soc/codecs/nau8822.c:235:25: sparse: sparse: cast to restricted __be16 sound/soc/codecs/nau8822.c:235:25: sparse: sparse: cast to restricted __be16 sound/soc/codecs/nau8822.c:235:25: sparse: sparse: cast to restricted __be16 sound/soc/codecs/nau8822.c:235:25: sparse: sparse: cast to restricted __be16
--- sound/soc/codecs/nau8822.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/codecs/nau8822.c +6 -3
@@ -184,6 +184,7 @@ static int nau8822_eq_get(struct snd_kcontrol *kcontrol,struct soc_bytes_ext *params = (void *)kcontrol->private_value;int i, reg;u16 reg_val, *val; +__be16 tmp; val = (u16 *)ucontrol->value.bytes.data; reg =NAU8822_REG_EQ1 ;
@@ -192,8 +193,8 @@ static int nau8822_eq_get(struct snd_kcontrol *kcontrol,/* conversion of 16-bit integers between native CPU format * and big endian format */ - reg_val =cpu_to_be16 (reg_val); -memcpy (val + i, ®_val,sizeof (reg_val)); + tmp =cpu_to_be16 (reg_val); +memcpy (val + i, &tmp,sizeof (tmp)); }return 0 ;
@@ -216,6 +217,7 @@ static int nau8822_eq_put(struct snd_kcontrol *kcontrol,void *data;u16 *val, value;int i, reg, ret; +__be16 *tmp; data =kmemdup (ucontrol->value.bytes.data, params->max,GFP_KERNEL |GFP_DMA );
@@ -228,7 +230,8 @@ static int nau8822_eq_put(struct snd_kcontrol *kcontrol,/* conversion of 16-bit integers between native CPU format * and big endian format */ - value =be16_to_cpu (*(val + i)); + tmp = (__be16 *)(val + i); + value =be16_to_cpup (tmp); ret =snd_soc_component_write (component, reg + i, value);if (ret) { dev_err(component->dev,
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 4/19 ASoC: Intel: Skylake: mem leak in skl register function
In reply to Sasha LevinFrom: Kamil Duljas <[email protected]>
[ Upstream commit f8ba14b780273fd290ddf7ee0d7d7decb44cc365 ]
skl_platform_register() uses krealloc. When krealloc is fail, then previous memory is not freed. The leak is also when soc component registration failed.
--- sound/soc/intel/skylake/skl-pcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-pcm.c +4 -1
@@ -1467,6 +1467,7 @@ int skl_platform_register(struct device *dev) dais =krealloc (skl->dais,sizeof (skl_fe_dai) +sizeof (skl_platform_dai),GFP_KERNEL );if (!dais) { +kfree (skl->dais); ret = -ENOMEM ; goto err; }
@@ -1479,8 +1480,10 @@ int skl_platform_register(struct device *dev) ret =devm_snd_soc_register_component (dev, &skl_component, skl->dais, num_dais); -if (ret) +if (ret) { +kfree (skl->dais);dev_err (dev,"soc component registration failed %d\n" , ret); + } err:return ret; }
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 5/19 ASoC: cs43130: Fix the position of const qualifier
In reply to Sasha LevinFrom: Maciej Strozek <[email protected]>
[ Upstream commit e7f289a59e76a5890a57bc27b198f69f175f75d9 ]
--- sound/soc/codecs/cs43130.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs43130.c +2 -2
@@ -1684,7 +1684,7 @@ static ssize_t hpload_dc_r_show(struct device *dev,return cs43130_show_dc (dev, buf,HP_RIGHT ); } -static u16 const cs43130_ac_freq[CS43130_AC_FREQ ] = { +static const u16 cs43130_ac_freq[CS43130_AC_FREQ ] = {24 ,43 ,93 ,
@@ -2365,7 +2365,7 @@ static const struct regmap_config cs43130_regmap = { .use_single_write = true, }; -static u16 const cs43130_dc_threshold[CS43130_DC_THRESHOLD ] = { +static const u16 cs43130_dc_threshold[CS43130_DC_THRESHOLD ] = {50 ,120 , };
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 6/19 ASoC: cs43130: Fix incorrect frame delay configuration
In reply to Sasha LevinFrom: Maciej Strozek <[email protected]>
[ Upstream commit aa7e8e5e4011571022dc06e4d7a2f108feb53d1a ]
--- sound/soc/codecs/cs43130.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs43130.c +1 -1
@@ -579,7 +579,7 @@ static int cs43130_set_sp_fmt(int dai_id, unsigned int bitwidth_sclk,break ;case SND_SOC_DAIFMT_LEFT_J : hi_size = bitwidth_sclk; - frm_delay =2 ; + frm_delay =0 ; frm_phase =1 ;break ;case SND_SOC_DAIFMT_DSP_A :
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 7/19 ASoC: rt5650: add mutex to avoid the jack detection failure
In reply to Sasha LevinFrom: Shuming Fan <[email protected]>
[ Upstream commit cdba4301adda7c60a2064bf808e48fccd352aaa9 ]
This patch adds the jd_mutex to protect the jack detection control flow. And only the headset type could check the button status.
--- sound/soc/codecs/rt5645.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5645.c +9 -1
@@ -448,6 +448,7 @@ struct rt5645_priv {struct regulator_bulk_data supplies[ARRAY_SIZE (rt5645_supply_names)];struct rt5645_eq_param_s *eq_param;struct timer_list btn_check_timer; +struct mutex jd_mutex;int codec_type;int sysclk;
@@ -3189,6 +3190,8 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insert5645_enable_push_button_irq (component, true); } }else { +if (rt5645->en_button_func) +rt5645_enable_push_button_irq (component, false);snd_soc_dapm_disable_pin (dapm,"Mic Det Power" );snd_soc_dapm_sync (dapm); rt5645->jack_type =SND_JACK_HEADPHONE ;
@@ -3269,6 +3272,8 @@ static void rt5645_jack_detect_work(struct work_struct *work)if (!rt5645->component)return ; +mutex_lock (&rt5645->jd_mutex); +switch (rt5645->pdata.jd_mode) {case 0 :/* Not using rt5645 JD */ if (rt5645->gpiod_hp_det) {
@@ -3295,7 +3300,7 @@ static void rt5645_jack_detect_work(struct work_struct *work)if (!val && (rt5645->jack_type ==0 )) {/* jack in */ report =rt5645_jack_detect (rt5645->component,1 ); - }else if (!val && rt5645->jack_type !=0 ) { + }else if (!val && rt5645->jack_type ==SND_JACK_HEADSET ) {/* for push button and jack out */ btn_type =0 ;if (snd_soc_component_read (rt5645->component,RT5645_INT_IRQ_ST ) &0x4 ) {
@@ -3351,6 +3356,8 @@ static void rt5645_jack_detect_work(struct work_struct *work)rt5645_jack_detect (rt5645->component,0 ); } +mutex_unlock (&rt5645->jd_mutex); +snd_soc_jack_report (rt5645->hp_jack, report,SND_JACK_HEADPHONE );snd_soc_jack_report (rt5645->mic_jack, report,SND_JACK_MICROPHONE );if (rt5645->en_button_func)
@@ -4121,6 +4128,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, }timer_setup (&rt5645->btn_check_timer, rt5645_btn_check_callback,0 ); +mutex_init (&rt5645->jd_mutex);INIT_DELAYED_WORK (&rt5645->jack_detect_work, rt5645_jack_detect_work);INIT_DELAYED_WORK (&rt5645->rcclock_work, rt5645_rcclock_work);
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 8/19 ASoC: Intel: skl_hda_dsp_generic: Drop HDMI routes when HDMI is not available
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 3d1dc8b1030df8ca0fdfd4905c88ee10db943bf8 ]
When the HDMI is not present due to disabled display support we will use dummy codec and the HDMI routes will refer to non existent DAPM widgets.
Trim the route list from the HDMI routes to be able to probe the card even if the HDMI dais are not registered.
--- sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/intel/boards/skl_hda_dsp_generic.c +2 -0
@@ -157,6 +157,8 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params) card->dapm_widgets = skl_hda_widgets; card->num_dapm_widgets =ARRAY_SIZE (skl_hda_widgets);if (!ctx->idisp_codec) { + card->dapm_routes = &skl_hda_map[IDISP_ROUTE_COUNT ]; + num_route -=IDISP_ROUTE_COUNT ;for (i =0 ; i <IDISP_DAI_COUNT ; i++) { skl_hda_be_dai_links[i].codecs = dummy_codec; skl_hda_be_dai_links[i].num_codecs =
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 9/19 nouveau/tu102: flush all pdbs on vmm flush
In reply to Sasha LevinFrom: Dave Airlie <[email protected]>
[ Upstream commit cb9c919364653eeafb49e7ff5cd32f1ad64063ac ]
This is a hack around a bug exposed with the GSP code, I'm not sure what is happening exactly, but it appears some of our flushes don't result in proper tlb invalidation for out BAR2 and we get a BAR2 fault from GSP and it all dies.
--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmtu102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmtu102.c +1 -1
@@ -31,7 +31,7 @@ tu102_vmm_flush(struct nvkm_vmm *vmm, int depth) type |=0x00000001 ;/* PAGE_ALL */ if (atomic_read (&vmm->engref[NVKM_SUBDEV_BAR ])) - type |=0x00000004 ;/* HUB_ONLY */ + type |=0x00000006 ;/* HUB_ONLY | ALL PDB (hack) */ mutex_lock (&vmm->mmu->mutex);
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 10/19 ASoC: hdac_hda: Conditionally register dais for HDMI and Analog
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit a0575b4add21a243cc3257e75ad913cd5377d5f2 ]
The current driver is registering the same dais for each hdev found in the
system which results duplicated widgets to be registered and the kernel
log contains similar prints:snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi3 overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi2 overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi1 overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Codec Output Pin1 overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Codec Input Pin1 overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Analog Codec Playback overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Digital Codec Playback overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Alt Analog Codec Playback overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Analog Codec Capture overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Digital Codec Capture overwritten skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Alt Analog Codec Capture overwritten
To avoid such issue, split the dai array into HDMI and non HDMI array and register them conditionally:
for HDMI hdev only register the dais needed for HDMI
for non HDMI hdev do not register the HDMI dais.
Depends-on: 3d1dc8b1030d ("ASoC: Intel: skl_hda_dsp_generic: Drop HDMI routes when HDMI is not available")
--- sound/soc/codecs/hdac_hda.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
sound/soc/codecs/hdac_hda.c +20 -3
@@ -124,6 +124,9 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = { .sig_bits = 24, }, }, +}; + +static struct snd_soc_dai_driver hdac_hda_hdmi_dais[] = { { .id =HDAC_HDMI_0_DAI_ID , .name ="intel-hdmi-hifi1" ,
@@ -575,8 +578,16 @@ static const struct snd_soc_component_driver hdac_hda_codec = { .num_dapm_routes = ARRAY_SIZE(hdac_hda_dapm_routes), }; +static const struct snd_soc_component_driver hdac_hda_hdmi_codec = { + .probe = hdac_hda_codec_probe, + .remove = hdac_hda_codec_remove, + .idle_bias_on = false, + .endianness =1 , +}; +static int hdac_hda_dev_probe (struct hdac_device *hdev) { +struct hdac_hda_priv *hda_pvt =dev_get_drvdata (&hdev->dev);struct hdac_ext_link *hlink;struct hdac_hda_priv *hda_pvt;int ret;
@@ -594,9 +605,15 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)return -ENOMEM ;/* ASoC specific initialization */ - ret =devm_snd_soc_register_component (&hdev->dev, - &hdac_hda_codec, hdac_hda_dais, -ARRAY_SIZE (hdac_hda_dais)); +if (hda_pvt->need_display_power) + ret =devm_snd_soc_register_component (&hdev->dev, + &hdac_hda_hdmi_codec, hdac_hda_hdmi_dais, +ARRAY_SIZE (hdac_hda_hdmi_dais)); +else + ret =devm_snd_soc_register_component (&hdev->dev, + &hdac_hda_codec, hdac_hda_dais, +ARRAY_SIZE (hdac_hda_dais)); +if (ret <0 ) {dev_err (&hdev->dev,"failed to register HDA codec %d\n" , ret);return ret;
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 11/19 net/tg3: fix race condition in tg3_reset_task()
In reply to Sasha LevinFrom: Thinh Tran <[email protected]>
[ Upstream commit 16b55b1f2269962fb6b5154b8bf43f37c9a96637 ]
When an EEH error is encountered by a PCI adapter, the EEH driver modifies the PCI channel's state as shown below:
enum {
/* I/O channel is in normal state */ pci_channel_io_normal = (__force pci_channel_state_t) 1,
/* I/O to channel is blocked */ pci_channel_io_frozen = (__force pci_channel_state_t) 2,
/* PCI card is dead */
pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
};
If the same EEH error then causes the tg3 driver's transmit timeout logic to execute, the tg3_tx_timeout() function schedules a reset task via tg3_reset_task_schedule(), which may cause a race condition between the tg3 and EEH driver as both attempt to recover the HW via a reset action.
EEH driver gets error event
--> eeh_set_channel_state()
and set device to one of
error state above scheduler: tg3_reset_task() get
returned error from tg3_init_hw()
--> dev_close() shuts down the interfacetg3_io_slot_reset() andtg3_io_resume() fail to
reset/resume the device
To resolve this issue, we avoid the race condition by checking the PCI channel state in the tg3_reset_task() function and skip the tg3 driver initiated reset when the PCI channel is not in the normal state. (The driver has no access to tg3 device registers at this point and cannot even complete the reset task successfully without external assistance.) We'll leave the reset procedure to be managed by the EEH driver which calls the tg3_io_error_detected(), tg3_io_slot_reset() and tg3_io_resume() functions as appropriate.
Adding the same checking in tg3_dump_state() to avoid dumping all device registers when the PCI channel is not in the normal state.
--- drivers/net/ethernet/broadcom/tg3.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +10 -1
@@ -6448,6 +6448,14 @@ static void tg3_dump_state(struct tg3 *tp)int i;u32 *regs; +/* If it is a PCI error, all registers will be 0xffff, +* we don't dump them out, just report the error and return +*/ +if (tp->pdev->error_state != pci_channel_io_normal) { +netdev_err (tp->dev,"PCI channel ERROR!\n" ); +return ; + } + regs =kzalloc (TG3_REG_BLK_SIZE ,GFP_ATOMIC );if (!regs)return ;
@@ -11177,7 +11185,8 @@ static void tg3_reset_task(struct work_struct *work)rtnl_lock ();tg3_full_lock (tp,0 ); -if (tp->pcierr_recovery || !netif_running (tp->dev)) { +if (tp->pcierr_recovery || !netif_running (tp->dev) || + tp->pdev->error_state != pci_channel_io_normal) {tg3_flag_clear (tp,RESET_TASK_PENDING );tg3_full_unlock (tp);rtnl_unlock ();
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 12/19 ASoC: da7219: Support low DC impedance headset
In reply to Sasha LevinFrom: David Rau <[email protected]>
[ Upstream commit 5f44de697383fcc9a9a1a78f99e09d1838704b90 ]
Change the default MIC detection impedance threshold to 200ohm to support low mic DC impedance headset.
--- sound/soc/codecs/da7219-aad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/da7219-aad.c +1 -1
@@ -654,7 +654,7 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev) aad_pdata->mic_det_thr =da7219_aad_fw_mic_det_thr (dev, fw_val32); else - aad_pdata->mic_det_thr = DA7219_AAD_MIC_DET_THR_500_OHMS; + aad_pdata->mic_det_thr = DA7219_AAD_MIC_DET_THR_200_OHMS;if (fwnode_property_read_u32 (aad_np,"dlg,jack-ins-deb" , &fw_val32) >=0 ) aad_pdata->jack_ins_deb =
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 13/19 ASoC: ops: add correct range check for limiting volume
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit fb9ad24485087e0f00d84bee7a5914640b2b9024 ]
Volume can have ranges that start with negative values, ex: -84dB to +40dB. Apply correct range check in snd_soc_limit_volume before setting the platform_max. Without this patch, for example setting a 0dB limit on a volume range of -84dB to +40dB would fail.
--- sound/soc/soc-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-ops.c +1 -1
@@ -644,7 +644,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, kctl =snd_soc_card_get_kcontrol (card, name);if (kctl) {struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value; -if (max <= mc->max) { +if (max <= mc->max - mc->min) { mc->platform_max = max; ret =0 ; }
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 14/19 nvme: introduce helper function to get ctrl state
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit 5c687c287c46fadb14644091823298875a5216aa ]
The controller state is typically written by another CPU, so reading it should ensure no optimizations are taken. This is a repeated pattern in the driver, so start with adding a convenience function that returns the controller state with READ_ONCE().
--- drivers/nvme/host/nvme.h | 5 +++++ 1 file changed, 5 insertions(+)
drivers/nvme/host/nvme.h +5 -0
@@ -360,6 +360,11 @@ struct nvme_ctrl {struct nvme_fault_inject fault_inject; }; +static inline enum nvme_ctrl_state nvme_ctrl_state (struct nvme_ctrl *ctrl) +{ +return READ_ONCE (ctrl->state); +} +enum nvme_iopolicy {NVME_IOPOLICY_NUMA ,NVME_IOPOLICY_RR ,
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 15/19 mips/smp: Call rcutree_report_cpu_starting() earlier
In reply to Sasha LevinFrom: Stefan Wiehler <[email protected]>
[ Upstream commit 55702ec9603ebeffb15e6f7b113623fe1d8872f4 ]
rcutree_report_cpu_starting() must be called before clockevents_register_device() to avoid the following lockdep splat triggered by calling list_add() when CONFIG_PROVE_RCU_LIST=y:
WARNING: suspicious RCU usage
...
-----------------------------
kernel/locking/lockdep.c:3680 RCU-list traversed in non-reader section!!
other info that might help us debug this:
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
no locks held by swapper/1/0.
...
Call Trace: [<ffffffff8012a434>] show_stack+0x64/0x158 [<ffffffff80a93d98>] dump_stack_lvl+0x90/0xc4 [<ffffffff801c9e9c>] __lock_acquire+0x1404/0x2940 [<ffffffff801cbf3c>] lock_acquire+0x14c/0x448 [<ffffffff80aa4260>] _raw_spin_lock_irqsave+0x50/0x88 [<ffffffff8021e0c8>] clockevents_register_device+0x60/0x1e8 [<ffffffff80130ff0>] r4k_clockevent_init+0x220/0x3a0 [<ffffffff801339d0>] start_secondary+0x50/0x3b8
raw_smp_processor_id() is required in order to avoid calling into lockdep before RCU has declared the CPU to be watched for readers.
See also commit 29368e093921 ("x86/smpboot: Move rcu_cpu_starting() earlier"), commit de5d9dae150c ("s390/smp: move rcu_cpu_starting() earlier") and commit 99f070b62322 ("powerpc/smp: Call rcu_cpu_starting() earlier").
--- arch/mips/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/smp.c +2 -2
@@ -333,10 +333,11 @@ early_initcall(mips_smp_ipi_init);*/ asmlinkage void start_secondary(void) { -unsigned int cpu; +unsigned int cpu =raw_smp_processor_id ();cpu_probe ();per_cpu_trap_init (false); +rcutree_report_cpu_starting (cpu);mips_clockevent_init (); mp_ops->init_secondary ();cpu_report ();
@@ -348,7 +349,6 @@ asmlinkage void start_secondary(void)*/ calibrate_delay (); - cpu =smp_processor_id (); cpu_data[cpu].udelay_val = loops_per_jiffy;set_cpu_sibling_map (cpu);
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 16/19 drm/amdgpu: Add NULL checks for function pointers
In reply to Sasha LevinFrom: Lijo Lazar <[email protected]>
[ Upstream commit 81577503efb49f4ad76af22f9941d72900ef4aab ]
Check if function is implemented before making the call.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +8 -4
@@ -1615,9 +1615,11 @@ static void soc15_common_get_clockgating_state(void *handle, u32 *flags)if (amdgpu_sriov_vf (adev)) *flags =0 ; - adev->nbio.funcs->get_clockgating_state (adev, flags); +if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state) + adev->nbio.funcs->get_clockgating_state (adev, flags); - adev->hdp.funcs->get_clock_gating_state (adev, flags); +if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state) + adev->hdp.funcs->get_clock_gating_state (adev, flags);if (adev->asic_type !=CHIP_ALDEBARAN ) {
@@ -1633,9 +1635,11 @@ static void soc15_common_get_clockgating_state(void *handle, u32 *flags) }/* AMD_CG_SUPPORT_ROM_MGCG */ - adev->smuio.funcs->get_clock_gating_state (adev, flags); +if (adev->smuio.funcs && adev->smuio.funcs->get_clock_gating_state) + adev->smuio.funcs->get_clock_gating_state (adev, flags); - adev->df.funcs->get_clockgating_state (adev, flags); +if (adev->df.funcs && adev->df.funcs->get_clockgating_state) + adev->df.funcs->get_clockgating_state (adev, flags); } static int soc15_common_set_powergating_state(void *handle,
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 17/19 drm/exynos: fix a potential error pointer dereference
In reply to Sasha LevinFrom: Xiang Yang <[email protected]>
[ Upstream commit 73bf1c9ae6c054c53b8e84452c5e46f86dd28246 ]
Smatch reports the warning below:drivers/gpu/drm/exynos/exynos_hdmi.c:1864 hdmi_bind()
error: 'crtc' dereferencing possible ERR_PTR()
The return value of exynos_drm_crtc_get_by_type maybe ERR_PTR(-ENODEV), which can not be used directly. Fix this by checking the return value before using it.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -0
@@ -1861,6 +1861,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)return ret; crtc =exynos_drm_crtc_get_by_type (drm_dev,EXYNOS_DISPLAY_TYPE_HDMI ); +if (IS_ERR (crtc)) +return PTR_ERR (crtc); crtc->pipe_clk = &hdata->phy_clk; ret =hdmi_create_connector (encoder);
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 18/19 drm/exynos: fix a wrong error checking
In reply to Sasha LevinFrom: Inki Dae <[email protected]>
[ Upstream commit 8d1b7809684c688005706125b804e1f9792d2b1b ]
Fix a wrong error checking in exynos_drm_dma.c module.
In the exynos_drm_register_dma function, both arm_iommu_create_mapping() and iommu_get_domain_for_dev() functions are expected to return NULL as an error.
However, the error checking is performed using the statement if(IS_ERR(mapping)), which doesn't provide a suitable error value. So check if 'mapping' is NULL, and if it is, return -ENODEV.
This issue[1] was reported by Dan.
Changelog v1:
- fix build warning.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/gpu/drm/exynos/exynos_drm_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_dma.c +3 -5
@@ -108,18 +108,16 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,return 0 ;if (!priv->mapping) { -void *mapping; +void *mapping =NULL ;if (IS_ENABLED (CONFIG_ARM_DMA_USE_IOMMU )) mapping =arm_iommu_create_mapping (&platform_bus_type,EXYNOS_DEV_ADDR_START ,EXYNOS_DEV_ADDR_SIZE );else if (IS_ENABLED (CONFIG_IOMMU_DMA )) mapping =iommu_get_domain_for_dev (priv->dma_dev); -else - mapping =ERR_PTR (-ENODEV ); -if (IS_ERR (mapping)) -return PTR_ERR (mapping); +if (!mapping) +return -ENODEV ; priv->mapping = mapping; }
Signature · 1 line
2.42.0
Sasha Levin
maintainerPATCH 19/19 hwmon: (corsair-psu) Fix probe when built-in
In reply to Sasha LevinFrom: Armin Wolf <[email protected]>
[ Upstream commit 307004e8b254ad28e150b63f299ab9caa4bc7c3e ]
It seems that when the driver is built-in, the HID bus is initialized after the driver is loaded, which whould cause module_hid_driver() to fail.
Fix this by registering the driver after the HID bus using late_initcall() in accordance with other hwmon HID drivers.
[groeck: Dropped "compile tested" comment; the patch has been tested
but the tester did not provide a Tested-by: tag]
--- drivers/hwmon/corsair-psu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/hwmon/corsair-psu.c +17 -1
@@ -808,7 +808,23 @@ static struct hid_driver corsairpsu_driver = { .reset_resume = corsairpsu_resume,#endif }; -module_hid_driver (corsairpsu_driver); + +static int __init corsair_init (void ) +{ +return hid_register_driver (&corsairpsu_driver); +} + +static void __exit corsair_exit(void) +{ +hid_unregister_driver (&corsairpsu_driver); +} + +/* +* With module_init() the driver would load before the HID bus when +* built-in, so use late_initcall() instead. +*/ +late_initcall (corsair_init); +module_exit (corsair_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Wilken Gottwalt <[email protected]>" );
Signature · 1 line
2.42.0