[PATCH 1/5] slimbus: stream: add checks for invalid unprepare/disable usage
slim_disable_stream() and slim_stream_unprepare() are exported, so add sanity checks preventing unmatched/invalid calls.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- drivers/slimbus/stream.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c index 75f87b3d8b95..7bb073ca6006 100644 --- a/drivers/slimbus/stream.c +++ b/drivers/slimbus/stream.c @@ -407,6 +407,9 @@ int slim_stream_disable(struct slim_stream_runtime *stream) struct slim_controller *ctrl = stream->dev->ctrl; int ret, i;
+ if (!stream->ports || !stream->num_ports) + return -EINVAL; + if (ctrl->disable_stream) ctrl->disable_stream(stream);
@@ -438,6 +441,9 @@ int slim_stream_unprepare(struct slim_stream_runtime *stream) { int i;
+ if (!stream->ports || !stream->num_ports) + return -EINVAL; + for (i = 0; i < stream->num_ports; i++) slim_disconnect_port(stream, &stream->ports[i]);
Bindings require usage of fallback "qcom,slim" compatible, so "qcom,apq8064-slim" is redundant.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- drivers/slimbus/qcom-ctrl.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index c0c4f895d76e..bb106eab8ae2 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -718,7 +718,6 @@ static const struct dev_pm_ops qcom_slim_dev_pm_ops = {
static const struct of_device_id qcom_slim_dt_match[] = { { .compatible = "qcom,slim", }, - { .compatible = "qcom,apq8064-slim", }, {} };
On 23/09/2022 17:57, Krzysztof Kozlowski wrote:
Bindings require usage of fallback "qcom,slim" compatible, so "qcom,apq8064-slim" is redundant.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
drivers/slimbus/qcom-ctrl.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index c0c4f895d76e..bb106eab8ae2 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -718,7 +718,6 @@ static const struct dev_pm_ops qcom_slim_dev_pm_ops = {
static const struct of_device_id qcom_slim_dt_match[] = { { .compatible = "qcom,slim", },
- { .compatible = "qcom,apq8064-slim", }, {} };
Reviewed-by: Neil Armstrong neil.armstrong@linaro.org
Simplify the code with devm_platform_ioremap_resource_byname().
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- drivers/slimbus/qcom-ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index bb106eab8ae2..400b7b385a44 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -488,7 +488,6 @@ static int qcom_slim_probe(struct platform_device *pdev) { struct qcom_slim_ctrl *ctrl; struct slim_controller *sctrl; - struct resource *slim_mem; int ret, ver;
ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); @@ -519,8 +518,7 @@ static int qcom_slim_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ctrl); dev_set_drvdata(ctrl->dev, ctrl);
- slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); - ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem); + ctrl->base = devm_platform_ioremap_resource_byname(pdev, "ctrl"); if (IS_ERR(ctrl->base)) return PTR_ERR(ctrl->base);
On 23/09/2022 17:57, Krzysztof Kozlowski wrote:
Simplify the code with devm_platform_ioremap_resource_byname().
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
drivers/slimbus/qcom-ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c index bb106eab8ae2..400b7b385a44 100644 --- a/drivers/slimbus/qcom-ctrl.c +++ b/drivers/slimbus/qcom-ctrl.c @@ -488,7 +488,6 @@ static int qcom_slim_probe(struct platform_device *pdev) { struct qcom_slim_ctrl *ctrl; struct slim_controller *sctrl;
struct resource *slim_mem; int ret, ver;
ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL);
@@ -519,8 +518,7 @@ static int qcom_slim_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ctrl); dev_set_drvdata(ctrl->dev, ctrl);
- slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl");
- ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem);
- ctrl->base = devm_platform_ioremap_resource_byname(pdev, "ctrl"); if (IS_ERR(ctrl->base)) return PTR_ERR(ctrl->base);
Reviewed-by: Neil Armstrong neil.armstrong@linaro.org
Simplify the code with devm_platform_get_and_ioremap_resource().
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- drivers/slimbus/qcom-ngd-ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index cec11aa106bf..548dd7661334 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1522,7 +1522,6 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct qcom_slim_ngd_ctrl *ctrl; - struct resource *res; int ret; struct pdr_service *pds;
@@ -1532,8 +1531,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
dev_set_drvdata(dev, ctrl);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - ctrl->base = devm_ioremap_resource(dev, res); + ctrl->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(ctrl->base)) return PTR_ERR(ctrl->base);
On 23/09/2022 17:57, Krzysztof Kozlowski wrote:
Simplify the code with devm_platform_get_and_ioremap_resource().
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
drivers/slimbus/qcom-ngd-ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index cec11aa106bf..548dd7661334 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1522,7 +1522,6 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct qcom_slim_ngd_ctrl *ctrl;
- struct resource *res; int ret; struct pdr_service *pds;
@@ -1532,8 +1531,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
dev_set_drvdata(dev, ctrl);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ctrl->base = devm_ioremap_resource(dev, res);
- ctrl->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(ctrl->base)) return PTR_ERR(ctrl->base);
Reviewed-by: Neil Armstrong neil.armstrong@linaro.org
Reinitialize the reconf completion flag when ngd registers are not retainied or when enumeration is lost for ngd.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org --- drivers/slimbus/qcom-ngd-ctrl.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 548dd7661334..e8ebfcd0655c 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1136,6 +1136,12 @@ static int qcom_slim_ngd_power_up(struct qcom_slim_ngd_ctrl *ctrl) return 0; }
+ /* + * Reinitialize only when registers are not retained or when enumeration + * is lost for ngd. + */ + reinit_completion(&ctrl->reconf); + writel_relaxed(DEF_NGD_INT_MASK, ngd->base + NGD_INT_EN); rx_msgq = readl_relaxed(ngd->base + NGD_RX_MSGQ_CFG);
On 23/09/2022 11:57, Krzysztof Kozlowski wrote:
slim_disable_stream() and slim_stream_unprepare() are exported, so add sanity checks preventing unmatched/invalid calls.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
drivers/slimbus/stream.c | 6 ++++++
Hi Srini,
Any comments on these patches? Can they be picked up?
Best regards, Krzysztof
On 23/09/2022 11:57, Krzysztof Kozlowski wrote:
slim_disable_stream() and slim_stream_unprepare() are exported, so add sanity checks preventing unmatched/invalid calls.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
Hi Srini,
This patchset is also waiting for a month without comments.
Best regards, Krzysztof
On 23/09/2022 16:57, Krzysztof Kozlowski wrote:
slim_disable_stream() and slim_stream_unprepare() are exported, so add sanity checks preventing unmatched/invalid calls.
Signed-off-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org
Applied all. thanks, --srini
drivers/slimbus/stream.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c index 75f87b3d8b95..7bb073ca6006 100644 --- a/drivers/slimbus/stream.c +++ b/drivers/slimbus/stream.c @@ -407,6 +407,9 @@ int slim_stream_disable(struct slim_stream_runtime *stream) struct slim_controller *ctrl = stream->dev->ctrl; int ret, i;
- if (!stream->ports || !stream->num_ports)
return -EINVAL;
- if (ctrl->disable_stream) ctrl->disable_stream(stream);
@@ -438,6 +441,9 @@ int slim_stream_unprepare(struct slim_stream_runtime *stream) { int i;
- if (!stream->ports || !stream->num_ports)
return -EINVAL;
- for (i = 0; i < stream->num_ports; i++) slim_disconnect_port(stream, &stream->ports[i]);
participants (3)
-
Krzysztof Kozlowski
-
Neil Armstrong
-
Srinivas Kandagatla