[PATCH 0/4] ASoC: qcom: Minor code cleanups for lpass-cpu
Here's some minor code cleanups for the lpass-cpu driver. I noticed that it casts away const from the driver data from DT. That's not great but fixing it is a little more involved. I'll get to it later. There's also some questionable clk_get() usage that should probably be clk_get_optional(). For now this should help a little.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org
Stephen Boyd (4): ASoC: qcom: Remove useless debug print ASoC: qcom: Add some names to regmap configs ASoC: qcom: Stop casting away __iomem for error pointers ASoC: qcom: Remove duplicate error messages on ioremap
sound/soc/qcom/lpass-cpu.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
This looks like a left over debug print that tells us that HDMI is enabled. Let's remove it as that's definitely not an error to have HDMI enabled.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver") Signed-off-by: Stephen Boyd swboyd@chromium.org --- sound/soc/qcom/lpass-cpu.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index af684fd19ab9..8437ba31a306 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -742,7 +742,6 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev, } if (id == LPASS_DP_RX) { data->hdmi_port_enable = 1; - dev_err(dev, "HDMI Port is enabled: %d\n", id); } else { data->mi2s_playback_sd_mode[id] = of_lpass_cpu_parse_sd_lines(dev, node,
This device can sometimes have multiple regmaps. Let's add a name so that we can differentiate in debugfs more easily.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org Signed-off-by: Stephen Boyd swboyd@chromium.org --- sound/soc/qcom/lpass-cpu.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 8437ba31a306..40126202a4a3 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -474,6 +474,7 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg) }
static struct regmap_config lpass_cpu_regmap_config = { + .name = "lpass_cpu", .reg_bits = 32, .reg_stride = 4, .val_bits = 32, @@ -674,6 +675,7 @@ static bool lpass_hdmi_regmap_volatile(struct device *dev, unsigned int reg) }
static struct regmap_config lpass_hdmi_regmap_config = { + .name = "lpass_hdmi", .reg_bits = 32, .reg_stride = 4, .val_bits = 32,
We don't need to cast away __iomem when testing with IS_ERR() or converting with PTR_ERR(). Modern sparse can handle this just fine. Drop it.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org Signed-off-by: Stephen Boyd swboyd@chromium.org --- sound/soc/qcom/lpass-cpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 40126202a4a3..b267fe8db3fc 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -788,10 +788,10 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
drvdata->lpaif = devm_ioremap_resource(dev, res); - if (IS_ERR((void const __force *)drvdata->lpaif)) { + if (IS_ERR(drvdata->lpaif)) { dev_err(dev, "error mapping reg resource: %ld\n", - PTR_ERR((void const __force *)drvdata->lpaif)); - return PTR_ERR((void const __force *)drvdata->lpaif); + PTR_ERR(drvdata->lpaif)); + return PTR_ERR(drvdata->lpaif); }
lpass_cpu_regmap_config.max_register = LPAIF_WRDMAPER_REG(variant, @@ -810,10 +810,10 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-hdmiif");
drvdata->hdmiif = devm_ioremap_resource(dev, res); - if (IS_ERR((void const __force *)drvdata->hdmiif)) { + if (IS_ERR(drvdata->hdmiif)) { dev_err(dev, "error mapping reg resource: %ld\n", - PTR_ERR((void const __force *)drvdata->hdmiif)); - return PTR_ERR((void const __force *)drvdata->hdmiif); + PTR_ERR(drvdata->hdmiif)); + return PTR_ERR(drvdata->hdmiif); }
lpass_hdmi_regmap_config.max_register = LPAIF_HDMI_RDMAPER_REG(variant,
We don't need to print an error message when these ioremap operations fail. The function that returns an error already prints an error message and properly attributes it to the device. Drop them to save some code.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org Signed-off-by: Stephen Boyd swboyd@chromium.org --- sound/soc/qcom/lpass-cpu.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index b267fe8db3fc..0ca957dcd3fe 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -788,11 +788,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
drvdata->lpaif = devm_ioremap_resource(dev, res); - if (IS_ERR(drvdata->lpaif)) { - dev_err(dev, "error mapping reg resource: %ld\n", - PTR_ERR(drvdata->lpaif)); + if (IS_ERR(drvdata->lpaif)) return PTR_ERR(drvdata->lpaif); - }
lpass_cpu_regmap_config.max_register = LPAIF_WRDMAPER_REG(variant, variant->wrdma_channels + @@ -810,11 +807,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-hdmiif");
drvdata->hdmiif = devm_ioremap_resource(dev, res); - if (IS_ERR(drvdata->hdmiif)) { - dev_err(dev, "error mapping reg resource: %ld\n", - PTR_ERR(drvdata->hdmiif)); + if (IS_ERR(drvdata->hdmiif)) return PTR_ERR(drvdata->hdmiif); - }
lpass_hdmi_regmap_config.max_register = LPAIF_HDMI_RDMAPER_REG(variant, variant->hdmi_rdma_channels);
Thanks Stephen for the cleanup patches.
All of them look good to me!
On 15/01/2021 03:43, Stephen Boyd wrote:
Here's some minor code cleanups for the lpass-cpu driver. I noticed that it casts away const from the driver data from DT. That's not great but fixing it is a little more involved. I'll get to it later. There's also some questionable clk_get() usage that should probably be clk_get_optional(). For now this should help a little.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org
Stephen Boyd (4): ASoC: qcom: Remove useless debug print ASoC: qcom: Add some names to regmap configs ASoC: qcom: Stop casting away __iomem for error pointers ASoC: qcom: Remove duplicate error messages on ioremap
sound/soc/qcom/lpass-cpu.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
Reviewed-by: Srinivas Kandagatla srinivas.kandagatla@linaro.org
On Thu, 14 Jan 2021 19:43:23 -0800, Stephen Boyd wrote:
Here's some minor code cleanups for the lpass-cpu driver. I noticed that it casts away const from the driver data from DT. That's not great but fixing it is a little more involved. I'll get to it later. There's also some questionable clk_get() usage that should probably be clk_get_optional(). For now this should help a little.
Cc: V Sujith Kumar Reddy vsujithk@codeaurora.org Cc: Srinivasa Rao srivasam@codeaurora.org Cc: Srinivas Kandagatla srinivas.kandagatla@linaro.org Cc: Cheng-Yi Chiang cychiang@chromium.org
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: qcom: Remove useless debug print commit: 16117beb16f01a470d40339960ffae1e287c03be [2/4] ASoC: qcom: Add some names to regmap configs commit: 03b49bf9a92b18bbfcc3b5eb206cca8447e9f2cb [3/4] ASoC: qcom: Stop casting away __iomem for error pointers commit: e697df66876c182927899950971c3b4888df3e6e [4/4] ASoC: qcom: Remove duplicate error messages on ioremap commit: 4e15f5060d34dd28591cf3af43d3086a4b76c965
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Mark Brown
-
Srinivas Kandagatla
-
Stephen Boyd