* [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling
@ 2017-01-30 11:41 Philipp Zabel
2017-01-30 11:41 ` [PATCH 02/14] i2c: mv64xxx: " Philipp Zabel
` (12 more replies)
0 siblings, 13 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/crypto/sunxi-ss/sun4i-ss-core.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
index 3ac6c6c4ad18e..e310e311d23ea 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-core.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
@@ -258,10 +258,11 @@ static int sun4i_ss_probe(struct platform_device *pdev)
ss->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
if (IS_ERR(ss->reset)) {
- if (PTR_ERR(ss->reset) == -EPROBE_DEFER)
- return PTR_ERR(ss->reset);
- dev_info(&pdev->dev, "no reset control found\n");
- ss->reset = NULL;
+ err = PTR_ERR(ss->reset);
+ if (err == -EPROBE_DEFER)
+ return err;
+ dev_err(&pdev->dev, "Cannot get reset control err=%d\n", err);
+ return err;
}
/* Enable both clocks */
@@ -287,12 +288,10 @@ static int sun4i_ss_probe(struct platform_device *pdev)
}
/* Deassert reset if we have a reset control */
- if (ss->reset) {
- err = reset_control_deassert(ss->reset);
- if (err) {
- dev_err(&pdev->dev, "Cannot deassert reset control\n");
- goto error_clk;
- }
+ err = reset_control_deassert(ss->reset);
+ if (err) {
+ dev_err(&pdev->dev, "Cannot deassert reset control\n");
+ goto error_clk;
}
/*
@@ -372,8 +371,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
break;
}
}
- if (ss->reset)
- reset_control_assert(ss->reset);
+ reset_control_assert(ss->reset);
error_clk:
clk_disable_unprepare(ss->ssclk);
error_ssclk:
@@ -398,8 +396,7 @@ static int sun4i_ss_remove(struct platform_device *pdev)
}
writel(0, ss->base + SS_CTL);
- if (ss->reset)
- reset_control_assert(ss->reset);
+ reset_control_assert(ss->reset);
clk_disable_unprepare(ss->busclk);
clk_disable_unprepare(ss->ssclk);
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 02/14] i2c: mv64xxx: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 03/14] [media] coda: " Philipp Zabel
` (11 subsequent siblings)
12 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
---
drivers/i2c/busses/i2c-mv64xxx.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index b4dec0841bc27..1e3f2db3ebd5a 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -823,13 +823,10 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
drv_data->rstc = devm_reset_control_get_optional(dev, NULL);
if (IS_ERR(drv_data->rstc)) {
- if (PTR_ERR(drv_data->rstc) == -EPROBE_DEFER) {
- rc = -EPROBE_DEFER;
- goto out;
- }
- } else {
- reset_control_deassert(drv_data->rstc);
+ rc = PTR_ERR(drv_data->rstc);
+ goto out;
}
+ reset_control_deassert(drv_data->rstc);
/* Its not yet defined how timeouts will be specified in device tree.
* So hard code the value to 1 second.
@@ -951,8 +948,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
exit_free_irq:
free_irq(drv_data->irq, drv_data);
exit_reset:
- if (!IS_ERR_OR_NULL(drv_data->rstc))
- reset_control_assert(drv_data->rstc);
+ reset_control_assert(drv_data->rstc);
exit_clk:
/* Not all platforms have a clk */
if (!IS_ERR(drv_data->clk))
@@ -968,8 +964,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
i2c_del_adapter(&drv_data->adapter);
free_irq(drv_data->irq, drv_data);
- if (!IS_ERR_OR_NULL(drv_data->rstc))
- reset_control_assert(drv_data->rstc);
+ reset_control_assert(drv_data->rstc);
/* Not all platforms have a clk */
if (!IS_ERR(drv_data->clk))
clk_disable_unprepare(drv_data->clk);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 03/14] [media] coda: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
2017-01-30 11:41 ` [PATCH 02/14] i2c: mv64xxx: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 04/14] [media] st_rc: " Philipp Zabel
` (10 subsequent siblings)
12 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to
describe optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional
without special cases and to call reset_control_reset unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
drivers/media/platform/coda/coda-common.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 9e6bdafa16f58..a8482c44b82d2 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1840,8 +1840,7 @@ static int coda_hw_init(struct coda_dev *dev)
if (ret)
goto err_clk_ahb;
- if (dev->rstc)
- reset_control_reset(dev->rstc);
+ reset_control_reset(dev->rstc);
/*
* Copy the first CODA_ISRAM_SIZE in the internal SRAM.
@@ -2216,13 +2215,8 @@ static int coda_probe(struct platform_device *pdev)
dev->rstc = devm_reset_control_get_optional(&pdev->dev, NULL);
if (IS_ERR(dev->rstc)) {
ret = PTR_ERR(dev->rstc);
- if (ret == -ENOENT || ret == -ENOTSUPP) {
- dev->rstc = NULL;
- } else {
- dev_err(&pdev->dev, "failed get reset control: %d\n",
- ret);
- return ret;
- }
+ dev_err(&pdev->dev, "failed get reset control: %d\n", ret);
+ return ret;
}
/* Get IRAM pool from device tree or platform data */
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 04/14] [media] st_rc: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
2017-01-30 11:41 ` [PATCH 02/14] i2c: mv64xxx: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 03/14] [media] coda: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 12:33 ` Patrice CHOTARD
2017-01-30 11:41 ` [PATCH 05/14] [media] rc: sunxi-cir: " Philipp Zabel
` (9 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from reset_control_get_optional and to call
reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
drivers/media/rc/st_rc.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 1fa0c9d1c5083..04e694b707b45 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -165,8 +165,7 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
unsigned int rx_sampling_freq_div;
/* Enable the IP */
- if (dev->rstc)
- reset_control_deassert(dev->rstc);
+ reset_control_deassert(dev->rstc);
clk_prepare_enable(dev->sys_clock);
baseclock = clk_get_rate(dev->sys_clock);
@@ -281,10 +280,11 @@ static int st_rc_probe(struct platform_device *pdev)
else
rc_dev->rx_base = rc_dev->base;
-
rc_dev->rstc = reset_control_get_optional(dev, NULL);
- if (IS_ERR(rc_dev->rstc))
- rc_dev->rstc = NULL;
+ if (IS_ERR(rc_dev->rstc)) {
+ ret = PTR_ERR(rc_dev->rstc);
+ goto err;
+ }
rc_dev->dev = dev;
platform_set_drvdata(pdev, rc_dev);
@@ -353,8 +353,7 @@ static int st_rc_suspend(struct device *dev)
writel(0x00, rc_dev->rx_base + IRB_RX_EN);
writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN);
clk_disable_unprepare(rc_dev->sys_clock);
- if (rc_dev->rstc)
- reset_control_assert(rc_dev->rstc);
+ reset_control_assert(rc_dev->rstc);
}
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 05/14] [media] rc: sunxi-cir: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (2 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 04/14] [media] st_rc: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 06/14] mmc: dw_mmc: " Philipp Zabel
` (8 subsequent siblings)
12 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/media/rc/sunxi-cir.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
index eaadc081760ae..b1e22bd47985e 100644
--- a/drivers/media/rc/sunxi-cir.c
+++ b/drivers/media/rc/sunxi-cir.c
@@ -174,16 +174,11 @@ static int sunxi_ir_probe(struct platform_device *pdev)
/* Reset (optional) */
ir->rst = devm_reset_control_get_optional(dev, NULL);
- if (IS_ERR(ir->rst)) {
- ret = PTR_ERR(ir->rst);
- if (ret == -EPROBE_DEFER)
- return ret;
- ir->rst = NULL;
- } else {
- ret = reset_control_deassert(ir->rst);
- if (ret)
- return ret;
- }
+ if (IS_ERR(ir->rst))
+ return PTR_ERR(ir->rst);
+ ret = reset_control_deassert(ir->rst);
+ if (ret)
+ return ret;
ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK);
if (ret) {
@@ -292,8 +287,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
exit_clkdisable_apb_clk:
clk_disable_unprepare(ir->apb_clk);
exit_reset_assert:
- if (ir->rst)
- reset_control_assert(ir->rst);
+ reset_control_assert(ir->rst);
return ret;
}
@@ -305,8 +299,7 @@ static int sunxi_ir_remove(struct platform_device *pdev)
clk_disable_unprepare(ir->clk);
clk_disable_unprepare(ir->apb_clk);
- if (ir->rst)
- reset_control_assert(ir->rst);
+ reset_control_assert(ir->rst);
spin_lock_irqsave(&ir->ir_lock, flags);
/* disable IR IRQ */
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 06/14] mmc: dw_mmc: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (3 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 05/14] [media] rc: sunxi-cir: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-31 11:52 ` Ulf Hansson
2017-01-30 11:41 ` [PATCH 07/14] mmc: sdhci-st: " Philipp Zabel
` (7 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/dw_mmc.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index b44306b886cb6..9039e8f81ff12 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2963,10 +2963,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
/* find reset controller when exist */
pdata->rstc = devm_reset_control_get_optional(dev, "reset");
- if (IS_ERR(pdata->rstc)) {
- if (PTR_ERR(pdata->rstc) == -EPROBE_DEFER)
- return ERR_PTR(-EPROBE_DEFER);
- }
+ if (IS_ERR(pdata->rstc))
+ return ERR_CAST(pdata->rstc);
/* find out number of slots supported */
of_property_read_u32(np, "num-slots", &pdata->num_slots);
@@ -3090,7 +3088,7 @@ int dw_mci_probe(struct dw_mci *host)
}
}
- if (!IS_ERR(host->pdata->rstc)) {
+ if (host->pdata->rstc) {
reset_control_assert(host->pdata->rstc);
usleep_range(10, 50);
reset_control_deassert(host->pdata->rstc);
@@ -3245,8 +3243,7 @@ int dw_mci_probe(struct dw_mci *host)
if (host->use_dma && host->dma_ops->exit)
host->dma_ops->exit(host);
- if (!IS_ERR(host->pdata->rstc))
- reset_control_assert(host->pdata->rstc);
+ reset_control_assert(host->pdata->rstc);
err_clk_ciu:
clk_disable_unprepare(host->ciu_clk);
@@ -3278,8 +3275,7 @@ void dw_mci_remove(struct dw_mci *host)
if (host->use_dma && host->dma_ops->exit)
host->dma_ops->exit(host);
- if (!IS_ERR(host->pdata->rstc))
- reset_control_assert(host->pdata->rstc);
+ reset_control_assert(host->pdata->rstc);
clk_disable_unprepare(host->ciu_clk);
clk_disable_unprepare(host->biu_clk);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 07/14] mmc: sdhci-st: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (4 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 06/14] mmc: dw_mmc: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 08/14] mmc: sunxi: " Philipp Zabel
` (6 subsequent siblings)
12 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/sdhci-st.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index ed92ce729dde1..5a782b9bae381 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -371,11 +371,10 @@ static int sdhci_st_probe(struct platform_device *pdev)
if (IS_ERR(icnclk))
icnclk = NULL;
- rstc = devm_reset_control_get(&pdev->dev, NULL);
+ rstc = devm_reset_control_get_optional(&pdev->dev, NULL);
if (IS_ERR(rstc))
- rstc = NULL;
- else
- reset_control_deassert(rstc);
+ return PTR_ERR(rstc);
+ reset_control_deassert(rstc);
host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, sizeof(*pdata));
if (IS_ERR(host)) {
@@ -435,8 +434,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
err_of:
sdhci_pltfm_free(pdev);
err_pltfm_init:
- if (rstc)
- reset_control_assert(rstc);
+ reset_control_assert(rstc);
return ret;
}
@@ -453,8 +451,7 @@ static int sdhci_st_remove(struct platform_device *pdev)
clk_disable_unprepare(pdata->icnclk);
- if (rstc)
- reset_control_assert(rstc);
+ reset_control_assert(rstc);
return ret;
}
@@ -470,8 +467,7 @@ static int sdhci_st_suspend(struct device *dev)
if (ret)
goto out;
- if (pdata->rstc)
- reset_control_assert(pdata->rstc);
+ reset_control_assert(pdata->rstc);
clk_disable_unprepare(pdata->icnclk);
clk_disable_unprepare(pltfm_host->clk);
@@ -489,8 +485,7 @@ static int sdhci_st_resume(struct device *dev)
clk_prepare_enable(pltfm_host->clk);
clk_prepare_enable(pdata->icnclk);
- if (pdata->rstc)
- reset_control_deassert(pdata->rstc);
+ reset_control_deassert(pdata->rstc);
st_mmcss_cconfig(np, host);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 08/14] mmc: sunxi: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (5 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 07/14] mmc: sdhci-st: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-31 3:50 ` Chen-Yu Tsai
2017-01-30 11:41 ` [PATCH 09/14] mtd: nand: " Philipp Zabel
` (5 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/sunxi-mmc.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index b1d1303389a71..cd59a5df6cc86 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1149,7 +1149,7 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
}
host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
- if (PTR_ERR(host->reset) == -EPROBE_DEFER)
+ if (IS_ERR(host->reset))
return PTR_ERR(host->reset);
ret = clk_prepare_enable(host->clk_ahb);
@@ -1176,12 +1176,10 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
goto error_disable_clk_output;
}
- if (!IS_ERR(host->reset)) {
- ret = reset_control_deassert(host->reset);
- if (ret) {
- dev_err(&pdev->dev, "reset err %d\n", ret);
- goto error_disable_clk_sample;
- }
+ ret = reset_control_deassert(host->reset);
+ if (ret) {
+ dev_err(&pdev->dev, "reset err %d\n", ret);
+ goto error_disable_clk_sample;
}
/*
@@ -1197,8 +1195,7 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
sunxi_mmc_handle_manual_stop, 0, "sunxi-mmc", host);
error_assert_reset:
- if (!IS_ERR(host->reset))
- reset_control_assert(host->reset);
+ reset_control_assert(host->reset);
error_disable_clk_sample:
clk_disable_unprepare(host->clk_sample);
error_disable_clk_output:
@@ -1281,8 +1278,7 @@ static int sunxi_mmc_remove(struct platform_device *pdev)
disable_irq(host->irq);
sunxi_mmc_reset_host(host);
- if (!IS_ERR(host->reset))
- reset_control_assert(host->reset);
+ reset_control_assert(host->reset);
clk_disable_unprepare(host->clk_sample);
clk_disable_unprepare(host->clk_output);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 09/14] mtd: nand: sunxi: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (6 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 08/14] mmc: sunxi: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 12:44 ` Boris Brezillon
2017-01-30 11:41 ` [PATCH 10/14] phy: meson8b-usb2: " Philipp Zabel
` (4 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Icenowy Zheng <icenowy@aosc.xyz>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/mtd/nand/sunxi_nand.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index e40482a65de66..c6769b52c666a 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -2196,16 +2196,15 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
goto out_ahb_clk_unprepare;
nfc->reset = devm_reset_control_get_optional(dev, "ahb");
- if (!IS_ERR(nfc->reset)) {
- ret = reset_control_deassert(nfc->reset);
- if (ret) {
- dev_err(dev, "reset err %d\n", ret);
- goto out_mod_clk_unprepare;
- }
- } else if (PTR_ERR(nfc->reset) != -ENOENT) {
+ if (IS_ERR(nfc->reset)) {
ret = PTR_ERR(nfc->reset);
goto out_mod_clk_unprepare;
}
+ ret = reset_control_deassert(nfc->reset);
+ if (ret) {
+ dev_err(dev, "reset err %d\n", ret);
+ goto out_mod_clk_unprepare;
+ }
ret = sunxi_nfc_rst(nfc);
if (ret)
@@ -2246,8 +2245,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
if (nfc->dmac)
dma_release_channel(nfc->dmac);
out_ahb_reset_reassert:
- if (!IS_ERR(nfc->reset))
- reset_control_assert(nfc->reset);
+ reset_control_assert(nfc->reset);
out_mod_clk_unprepare:
clk_disable_unprepare(nfc->mod_clk);
out_ahb_clk_unprepare:
@@ -2262,8 +2260,7 @@ static int sunxi_nfc_remove(struct platform_device *pdev)
sunxi_nand_chips_cleanup(nfc);
- if (!IS_ERR(nfc->reset))
- reset_control_assert(nfc->reset);
+ reset_control_assert(nfc->reset);
if (nfc->dmac)
dma_release_channel(nfc->dmac);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 10/14] phy: meson8b-usb2: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (7 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 09/14] mtd: nand: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-02-14 23:36 ` Martin Blumenstingl
2017-01-30 11:41 ` [PATCH 11/14] serial: 8250_dw: " Philipp Zabel
` (3 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional_shared
and to call reset_control_reset unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Carlo Caione <carlo@caione.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-meson8b-usb2.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/phy/phy-meson8b-usb2.c b/drivers/phy/phy-meson8b-usb2.c
index 33c9f4ba157d1..87168f1fe3af6 100644
--- a/drivers/phy/phy-meson8b-usb2.c
+++ b/drivers/phy/phy-meson8b-usb2.c
@@ -141,12 +141,10 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
int ret;
- if (!IS_ERR_OR_NULL(priv->reset)) {
- ret = reset_control_reset(priv->reset);
- if (ret) {
- dev_err(&phy->dev, "Failed to trigger USB reset\n");
- return ret;
- }
+ ret = reset_control_reset(priv->reset);
+ if (ret) {
+ dev_err(&phy->dev, "Failed to trigger USB reset\n");
+ return ret;
}
ret = clk_prepare_enable(priv->clk_usb_general);
@@ -241,7 +239,7 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev)
return PTR_ERR(priv->clk_usb);
priv->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
- if (PTR_ERR(priv->reset) == -EPROBE_DEFER)
+ if (PTR_ERR(priv->reset))
return PTR_ERR(priv->reset);
priv->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 11/14] serial: 8250_dw: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (8 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 10/14] phy: meson8b-usb2: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-02-02 22:21 ` Andy Shevchenko
2017-01-30 11:41 ` [PATCH 12/14] usb: dwc2: " Philipp Zabel
` (2 subsequent siblings)
12 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/8250/8250_dw.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index c89fafc972b69..b8b911adff471 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -503,12 +503,11 @@ static int dw8250_probe(struct platform_device *pdev)
}
data->rst = devm_reset_control_get_optional(dev, NULL);
- if (IS_ERR(data->rst) && PTR_ERR(data->rst) == -EPROBE_DEFER) {
- err = -EPROBE_DEFER;
+ if (IS_ERR(data->rst)) {
+ err = PTR_ERR(data->rst);
goto err_pclk;
}
- if (!IS_ERR(data->rst))
- reset_control_deassert(data->rst);
+ reset_control_deassert(data->rst);
dw8250_quirks(p, data);
@@ -540,8 +539,7 @@ static int dw8250_probe(struct platform_device *pdev)
return 0;
err_reset:
- if (!IS_ERR(data->rst))
- reset_control_assert(data->rst);
+ reset_control_assert(data->rst);
err_pclk:
if (!IS_ERR(data->pclk))
@@ -562,8 +560,7 @@ static int dw8250_remove(struct platform_device *pdev)
serial8250_unregister_port(data->line);
- if (!IS_ERR(data->rst))
- reset_control_assert(data->rst);
+ reset_control_assert(data->rst);
if (!IS_ERR(data->pclk))
clk_disable_unprepare(data->pclk);
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 12/14] usb: dwc2: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (9 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 11/14] serial: 8250_dw: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-31 0:28 ` John Youn
2017-04-10 10:21 ` Felipe Balbi
2017-01-30 11:41 ` [PATCH 13/14] usb: host: ehci-st: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 14/14] ASoC: sunxi: " Philipp Zabel
12 siblings, 2 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc2/platform.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 4fc8c603afb8b..c6aa2710cecfe 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -214,20 +214,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
if (IS_ERR(hsotg->reset)) {
ret = PTR_ERR(hsotg->reset);
- switch (ret) {
- case -ENOENT:
- case -ENOTSUPP:
- hsotg->reset = NULL;
- break;
- default:
- dev_err(hsotg->dev, "error getting reset control %d\n",
- ret);
- return ret;
- }
+ dev_err(hsotg->dev, "error getting reset control %d\n", ret);
+ return ret;
}
- if (hsotg->reset)
- reset_control_deassert(hsotg->reset);
+ reset_control_deassert(hsotg->reset);
/* Set default UTMI width */
hsotg->phyif = GUSBCFG_PHYIF16;
@@ -326,8 +317,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
if (hsotg->ll_hw_enabled)
dwc2_lowlevel_hw_disable(hsotg);
- if (hsotg->reset)
- reset_control_assert(hsotg->reset);
+ reset_control_assert(hsotg->reset);
return 0;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 13/14] usb: host: ehci-st: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (10 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 12/14] usb: dwc2: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 14/14] ASoC: sunxi: " Philipp Zabel
12 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional_shared
unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/host/ehci-st.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
index be4a2788fc582..12e803d2c98df 100644
--- a/drivers/usb/host/ehci-st.c
+++ b/drivers/usb/host/ehci-st.c
@@ -210,18 +210,14 @@ static int st_ehci_platform_probe(struct platform_device *dev)
devm_reset_control_get_optional_shared(&dev->dev, "power");
if (IS_ERR(priv->pwr)) {
err = PTR_ERR(priv->pwr);
- if (err == -EPROBE_DEFER)
- goto err_put_clks;
- priv->pwr = NULL;
+ goto err_put_clks;
}
priv->rst =
devm_reset_control_get_optional_shared(&dev->dev, "softreset");
if (IS_ERR(priv->rst)) {
err = PTR_ERR(priv->rst);
- if (err == -EPROBE_DEFER)
- goto err_put_clks;
- priv->rst = NULL;
+ goto err_put_clks;
}
if (pdata->power_on) {
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 14/14] ASoC: sunxi: simplify optional reset handling
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
` (11 preceding siblings ...)
2017-01-30 11:41 ` [PATCH 13/14] usb: host: ehci-st: " Philipp Zabel
@ 2017-01-30 11:41 ` Philipp Zabel
2017-01-30 12:30 ` Mark Brown
` (2 more replies)
12 siblings, 3 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 11:41 UTC (permalink / raw)
To: linux-arm-kernel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.
This allows to return errors from devm_reset_control_get_optional and to
call reset_control_deassert unconditionally.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Marcus Cooper <codekipper@gmail.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Mark Brown <broonie@kernel.org>
---
sound/soc/sunxi/sun4i-spdif.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
index 88fbb3a1e6601..d02d91b168243 100644
--- a/sound/soc/sunxi/sun4i-spdif.c
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -493,13 +493,12 @@ static int sun4i_spdif_probe(struct platform_device *pdev)
if (of_device_is_compatible(pdev->dev.of_node,
"allwinner,sun6i-a31-spdif")) {
host->rst = devm_reset_control_get_optional(&pdev->dev, NULL);
- if (IS_ERR(host->rst) && PTR_ERR(host->rst) == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
+ if (IS_ERR(host->rst)) {
+ ret = PTR_ERR(host->rst);
dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
goto err_disable_apb_clk;
}
- if (!IS_ERR(host->rst))
- reset_control_deassert(host->rst);
+ reset_control_deassert(host->rst);
}
ret = devm_snd_soc_register_component(&pdev->dev,
--
2.11.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 14/14] ASoC: sunxi: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 14/14] ASoC: sunxi: " Philipp Zabel
@ 2017-01-30 12:30 ` Mark Brown
2017-01-30 13:45 ` Philipp Zabel
2017-01-31 3:49 ` Chen-Yu Tsai
2017-01-31 21:00 ` Mark Brown
2 siblings, 1 reply; 36+ messages in thread
From: Mark Brown @ 2017-01-30 12:30 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 30, 2017 at 12:41:16PM +0100, Philipp Zabel wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
I've only got this patch from the series, what's the story with
dependencies and so on?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170130/63f3a19e/attachment.sig>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 04/14] [media] st_rc: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 04/14] [media] st_rc: " Philipp Zabel
@ 2017-01-30 12:33 ` Patrice CHOTARD
0 siblings, 0 replies; 36+ messages in thread
From: Patrice CHOTARD @ 2017-01-30 12:33 UTC (permalink / raw)
To: linux-arm-kernel
On 01/30/2017 12:41 PM, Philipp Zabel wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from reset_control_get_optional and to call
> reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> drivers/media/rc/st_rc.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
> index 1fa0c9d1c5083..04e694b707b45 100644
> --- a/drivers/media/rc/st_rc.c
> +++ b/drivers/media/rc/st_rc.c
> @@ -165,8 +165,7 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
> unsigned int rx_sampling_freq_div;
>
> /* Enable the IP */
> - if (dev->rstc)
> - reset_control_deassert(dev->rstc);
> + reset_control_deassert(dev->rstc);
>
> clk_prepare_enable(dev->sys_clock);
> baseclock = clk_get_rate(dev->sys_clock);
> @@ -281,10 +280,11 @@ static int st_rc_probe(struct platform_device *pdev)
> else
> rc_dev->rx_base = rc_dev->base;
>
> -
> rc_dev->rstc = reset_control_get_optional(dev, NULL);
> - if (IS_ERR(rc_dev->rstc))
> - rc_dev->rstc = NULL;
> + if (IS_ERR(rc_dev->rstc)) {
> + ret = PTR_ERR(rc_dev->rstc);
> + goto err;
> + }
>
> rc_dev->dev = dev;
> platform_set_drvdata(pdev, rc_dev);
> @@ -353,8 +353,7 @@ static int st_rc_suspend(struct device *dev)
> writel(0x00, rc_dev->rx_base + IRB_RX_EN);
> writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN);
> clk_disable_unprepare(rc_dev->sys_clock);
> - if (rc_dev->rstc)
> - reset_control_assert(rc_dev->rstc);
> + reset_control_assert(rc_dev->rstc);
> }
>
> return 0;
>
Hi Philipp
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Thanks
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 09/14] mtd: nand: sunxi: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 09/14] mtd: nand: " Philipp Zabel
@ 2017-01-30 12:44 ` Boris Brezillon
2017-01-31 17:20 ` Philipp Zabel
2017-01-31 17:21 ` Philipp Zabel
0 siblings, 2 replies; 36+ messages in thread
From: Boris Brezillon @ 2017-01-30 12:44 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp,
On Mon, 30 Jan 2017 12:41:11 +0100
Philipp Zabel <p.zabel@pengutronix.de> wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Icenowy Zheng <icenowy@aosc.xyz>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
I didn't find commit bb475230b8e5 in mainline, so I guess you plan to
take this patch in your own tree. Let me know if this is not the case.
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
> drivers/mtd/nand/sunxi_nand.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
> index e40482a65de66..c6769b52c666a 100644
> --- a/drivers/mtd/nand/sunxi_nand.c
> +++ b/drivers/mtd/nand/sunxi_nand.c
> @@ -2196,16 +2196,15 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
> goto out_ahb_clk_unprepare;
>
> nfc->reset = devm_reset_control_get_optional(dev, "ahb");
> - if (!IS_ERR(nfc->reset)) {
> - ret = reset_control_deassert(nfc->reset);
> - if (ret) {
> - dev_err(dev, "reset err %d\n", ret);
> - goto out_mod_clk_unprepare;
> - }
> - } else if (PTR_ERR(nfc->reset) != -ENOENT) {
> + if (IS_ERR(nfc->reset)) {
> ret = PTR_ERR(nfc->reset);
> goto out_mod_clk_unprepare;
> }
> + ret = reset_control_deassert(nfc->reset);
> + if (ret) {
> + dev_err(dev, "reset err %d\n", ret);
> + goto out_mod_clk_unprepare;
> + }
>
> ret = sunxi_nfc_rst(nfc);
> if (ret)
> @@ -2246,8 +2245,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
> if (nfc->dmac)
> dma_release_channel(nfc->dmac);
> out_ahb_reset_reassert:
> - if (!IS_ERR(nfc->reset))
> - reset_control_assert(nfc->reset);
> + reset_control_assert(nfc->reset);
> out_mod_clk_unprepare:
> clk_disable_unprepare(nfc->mod_clk);
> out_ahb_clk_unprepare:
> @@ -2262,8 +2260,7 @@ static int sunxi_nfc_remove(struct platform_device *pdev)
>
> sunxi_nand_chips_cleanup(nfc);
>
> - if (!IS_ERR(nfc->reset))
> - reset_control_assert(nfc->reset);
> + reset_control_assert(nfc->reset);
>
> if (nfc->dmac)
> dma_release_channel(nfc->dmac);
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 14/14] ASoC: sunxi: simplify optional reset handling
2017-01-30 12:30 ` Mark Brown
@ 2017-01-30 13:45 ` Philipp Zabel
0 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-30 13:45 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2017-01-30 at 12:30 +0000, Mark Brown wrote:
> On Mon, Jan 30, 2017 at 12:41:16PM +0100, Philipp Zabel wrote:
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
>
> I've only got this patch from the series, what's the story with
> dependencies and so on?
This is a cleanup series across subsystems. The referenced commit is the
only dependency, it only just got merged into the arm-soc tree. There
are no dependencies between patches of this series.
I could merge this through the reset tree with your acks or resend it
individually once the above commit hits mainline, whichever you prefer.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 12/14] usb: dwc2: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 12/14] usb: dwc2: " Philipp Zabel
@ 2017-01-31 0:28 ` John Youn
2017-01-31 0:39 ` John Youn
2017-04-10 10:21 ` Felipe Balbi
1 sibling, 1 reply; 36+ messages in thread
From: John Youn @ 2017-01-31 0:28 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp,
On 1/30/2017 3:42 AM, Philipp Zabel wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
Where can I find this? It's not in mainline.
John
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: John Youn <johnyoun@synopsys.com>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/usb/dwc2/platform.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 4fc8c603afb8b..c6aa2710cecfe 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -214,20 +214,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
> hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
> if (IS_ERR(hsotg->reset)) {
> ret = PTR_ERR(hsotg->reset);
> - switch (ret) {
> - case -ENOENT:
> - case -ENOTSUPP:
> - hsotg->reset = NULL;
> - break;
> - default:
> - dev_err(hsotg->dev, "error getting reset control %d\n",
> - ret);
> - return ret;
> - }
> + dev_err(hsotg->dev, "error getting reset control %d\n", ret);
> + return ret;
> }
>
> - if (hsotg->reset)
> - reset_control_deassert(hsotg->reset);
> + reset_control_deassert(hsotg->reset);
>
> /* Set default UTMI width */
> hsotg->phyif = GUSBCFG_PHYIF16;
> @@ -326,8 +317,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
> if (hsotg->ll_hw_enabled)
> dwc2_lowlevel_hw_disable(hsotg);
>
> - if (hsotg->reset)
> - reset_control_assert(hsotg->reset);
> + reset_control_assert(hsotg->reset);
>
> return 0;
> }
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 12/14] usb: dwc2: simplify optional reset handling
2017-01-31 0:28 ` John Youn
@ 2017-01-31 0:39 ` John Youn
0 siblings, 0 replies; 36+ messages in thread
From: John Youn @ 2017-01-31 0:39 UTC (permalink / raw)
To: linux-arm-kernel
On 1/30/2017 4:28 PM, John Youn wrote:
> Hi Philipp,
>
> On 1/30/2017 3:42 AM, Philipp Zabel wrote:
>> As of commit bb475230b8e5 ("reset: make optional functions really
>
> Where can I find this? It's not in mainline.
>
Never mind. I found on arm-soc per your reply elsewhere.
Acked-by: John Youn <johnyoun@synopsys.com>
Regards,
John
>
>
>> optional"), the reset framework API calls use NULL pointers to describe
>> optional, non-present reset controls.
>>
>> This allows to return errors from devm_reset_control_get_optional and to
>> call reset_control_(de)assert unconditionally.
>>
>> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
>> Cc: John Youn <johnyoun@synopsys.com>
>> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>> drivers/usb/dwc2/platform.c | 18 ++++--------------
>> 1 file changed, 4 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
>> index 4fc8c603afb8b..c6aa2710cecfe 100644
>> --- a/drivers/usb/dwc2/platform.c
>> +++ b/drivers/usb/dwc2/platform.c
>> @@ -214,20 +214,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>> hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
>> if (IS_ERR(hsotg->reset)) {
>> ret = PTR_ERR(hsotg->reset);
>> - switch (ret) {
>> - case -ENOENT:
>> - case -ENOTSUPP:
>> - hsotg->reset = NULL;
>> - break;
>> - default:
>> - dev_err(hsotg->dev, "error getting reset control %d\n",
>> - ret);
>> - return ret;
>> - }
>> + dev_err(hsotg->dev, "error getting reset control %d\n", ret);
>> + return ret;
>> }
>>
>> - if (hsotg->reset)
>> - reset_control_deassert(hsotg->reset);
>> + reset_control_deassert(hsotg->reset);
>>
>> /* Set default UTMI width */
>> hsotg->phyif = GUSBCFG_PHYIF16;
>> @@ -326,8 +317,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
>> if (hsotg->ll_hw_enabled)
>> dwc2_lowlevel_hw_disable(hsotg);
>>
>> - if (hsotg->reset)
>> - reset_control_assert(hsotg->reset);
>> + reset_control_assert(hsotg->reset);
>>
>> return 0;
>> }
>>
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 14/14] ASoC: sunxi: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 14/14] ASoC: sunxi: " Philipp Zabel
2017-01-30 12:30 ` Mark Brown
@ 2017-01-31 3:49 ` Chen-Yu Tsai
2017-01-31 21:00 ` Mark Brown
2 siblings, 0 replies; 36+ messages in thread
From: Chen-Yu Tsai @ 2017-01-31 3:49 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 30, 2017 at 7:41 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_deassert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Marcus Cooper <codekipper@gmail.com>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Mark Brown <broonie@kernel.org>
FWIW,
Acked-by: Chen-Yu Tsai <wens@csie.org>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 08/14] mmc: sunxi: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 08/14] mmc: sunxi: " Philipp Zabel
@ 2017-01-31 3:50 ` Chen-Yu Tsai
0 siblings, 0 replies; 36+ messages in thread
From: Chen-Yu Tsai @ 2017-01-31 3:50 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 30, 2017 at 7:41 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
FWIW,
Acked-by: Chen-Yu Tsai <wens@csie.org>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 06/14] mmc: dw_mmc: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 06/14] mmc: dw_mmc: " Philipp Zabel
@ 2017-01-31 11:52 ` Ulf Hansson
2017-01-31 17:21 ` Philipp Zabel
0 siblings, 1 reply; 36+ messages in thread
From: Ulf Hansson @ 2017-01-31 11:52 UTC (permalink / raw)
To: linux-arm-kernel
On 30 January 2017 at 12:41, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Guodong Xu <guodong.xu@linaro.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
Philipp, I have looked at patch 6,7,8 in this series - they look good to me.
However, could you please re-post to linux-mmc and make sure to
include the proper driver maintainers for each change. For example,
Jaehoon Chung maintains dw_mmc.
Moreover, I assume you want me to pick the mmc changes or is there is
dependency to another tree here?
Kind regards
Uffe
> ---
> drivers/mmc/host/dw_mmc.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index b44306b886cb6..9039e8f81ff12 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2963,10 +2963,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
>
> /* find reset controller when exist */
> pdata->rstc = devm_reset_control_get_optional(dev, "reset");
> - if (IS_ERR(pdata->rstc)) {
> - if (PTR_ERR(pdata->rstc) == -EPROBE_DEFER)
> - return ERR_PTR(-EPROBE_DEFER);
> - }
> + if (IS_ERR(pdata->rstc))
> + return ERR_CAST(pdata->rstc);
>
> /* find out number of slots supported */
> of_property_read_u32(np, "num-slots", &pdata->num_slots);
> @@ -3090,7 +3088,7 @@ int dw_mci_probe(struct dw_mci *host)
> }
> }
>
> - if (!IS_ERR(host->pdata->rstc)) {
> + if (host->pdata->rstc) {
> reset_control_assert(host->pdata->rstc);
> usleep_range(10, 50);
> reset_control_deassert(host->pdata->rstc);
> @@ -3245,8 +3243,7 @@ int dw_mci_probe(struct dw_mci *host)
> if (host->use_dma && host->dma_ops->exit)
> host->dma_ops->exit(host);
>
> - if (!IS_ERR(host->pdata->rstc))
> - reset_control_assert(host->pdata->rstc);
> + reset_control_assert(host->pdata->rstc);
>
> err_clk_ciu:
> clk_disable_unprepare(host->ciu_clk);
> @@ -3278,8 +3275,7 @@ void dw_mci_remove(struct dw_mci *host)
> if (host->use_dma && host->dma_ops->exit)
> host->dma_ops->exit(host);
>
> - if (!IS_ERR(host->pdata->rstc))
> - reset_control_assert(host->pdata->rstc);
> + reset_control_assert(host->pdata->rstc);
>
> clk_disable_unprepare(host->ciu_clk);
> clk_disable_unprepare(host->biu_clk);
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 09/14] mtd: nand: sunxi: simplify optional reset handling
2017-01-30 12:44 ` Boris Brezillon
@ 2017-01-31 17:20 ` Philipp Zabel
2017-01-31 17:21 ` Philipp Zabel
1 sibling, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-31 17:20 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2017-01-30 at 13:44 +0100, Boris Brezillon wrote:
> Hi Philipp,
>
> On Mon, 30 Jan 2017 12:41:11 +0100
> Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
> >
> > This allows to return errors from devm_reset_control_get_optional and to
> > call reset_control_(de)assert unconditionally.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > Cc: Icenowy Zheng <icenowy@aosc.xyz>
> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> > Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> I didn't find commit bb475230b8e5 in mainline, so I guess you plan to
> take this patch in your own tree. Let me know if this is not the case.
>
> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Thanks, I think I'll resend this once bb475230b8e5 hits mainline for you
to merge.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 06/14] mmc: dw_mmc: simplify optional reset handling
2017-01-31 11:52 ` Ulf Hansson
@ 2017-01-31 17:21 ` Philipp Zabel
0 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-31 17:21 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 2017-01-31 at 12:52 +0100, Ulf Hansson wrote:
> On 30 January 2017 at 12:41, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
> >
> > This allows to return errors from devm_reset_control_get_optional and to
> > call reset_control_(de)assert unconditionally.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > Cc: Guodong Xu <guodong.xu@linaro.org>
> > Cc: Ulf Hansson <ulf.hansson@linaro.org>
>
> Philipp, I have looked at patch 6,7,8 in this series - they look good to me.
Thank you.
> However, could you please re-post to linux-mmc and make sure to
> include the proper driver maintainers for each change. For example,
> Jaehoon Chung maintains dw_mmc.
My mistake, I tried to be clever and include the people responsible for
the reset code, manually, and managed to forget a few maintainers
instead.
> Moreover, I assume you want me to pick the mmc changes or is there is
> dependency to another tree here?
arm-soc, currently. I think the easiest will be if I just resend this
after bb475230b8e5 is merged into mainline.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 09/14] mtd: nand: sunxi: simplify optional reset handling
2017-01-30 12:44 ` Boris Brezillon
2017-01-31 17:20 ` Philipp Zabel
@ 2017-01-31 17:21 ` Philipp Zabel
1 sibling, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-01-31 17:21 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2017-01-30 at 13:44 +0100, Boris Brezillon wrote:
> Hi Philipp,
>
> On Mon, 30 Jan 2017 12:41:11 +0100
> Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
> >
> > This allows to return errors from devm_reset_control_get_optional and to
> > call reset_control_(de)assert unconditionally.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > Cc: Icenowy Zheng <icenowy@aosc.xyz>
> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> > Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> I didn't find commit bb475230b8e5 in mainline, so I guess you plan to
> take this patch in your own tree. Let me know if this is not the case.
>
> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Thanks, I plan to resend this once bb475230b8e5 hits mainline, for you
to merge.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 14/14] ASoC: sunxi: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 14/14] ASoC: sunxi: " Philipp Zabel
2017-01-30 12:30 ` Mark Brown
2017-01-31 3:49 ` Chen-Yu Tsai
@ 2017-01-31 21:00 ` Mark Brown
2 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2017-01-31 21:00 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 30, 2017 at 12:41:16PM +0100, Philipp Zabel wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
Acked-by: Mark Brown <broonie@kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170131/2beb9e9a/attachment.sig>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 11/14] serial: 8250_dw: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 11/14] serial: 8250_dw: " Philipp Zabel
@ 2017-02-02 22:21 ` Andy Shevchenko
2017-02-07 16:48 ` Philipp Zabel
2017-02-07 16:48 ` Philipp Zabel
0 siblings, 2 replies; 36+ messages in thread
From: Andy Shevchenko @ 2017-02-02 22:21 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 30, 2017 at 1:41 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
Eventually!
FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/tty/serial/8250/8250_dw.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index c89fafc972b69..b8b911adff471 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -503,12 +503,11 @@ static int dw8250_probe(struct platform_device *pdev)
> }
>
> data->rst = devm_reset_control_get_optional(dev, NULL);
> - if (IS_ERR(data->rst) && PTR_ERR(data->rst) == -EPROBE_DEFER) {
> - err = -EPROBE_DEFER;
> + if (IS_ERR(data->rst)) {
> + err = PTR_ERR(data->rst);
> goto err_pclk;
> }
> - if (!IS_ERR(data->rst))
> - reset_control_deassert(data->rst);
> + reset_control_deassert(data->rst);
>
> dw8250_quirks(p, data);
>
> @@ -540,8 +539,7 @@ static int dw8250_probe(struct platform_device *pdev)
> return 0;
>
> err_reset:
> - if (!IS_ERR(data->rst))
> - reset_control_assert(data->rst);
> + reset_control_assert(data->rst);
>
> err_pclk:
> if (!IS_ERR(data->pclk))
> @@ -562,8 +560,7 @@ static int dw8250_remove(struct platform_device *pdev)
>
> serial8250_unregister_port(data->line);
>
> - if (!IS_ERR(data->rst))
> - reset_control_assert(data->rst);
> + reset_control_assert(data->rst);
>
> if (!IS_ERR(data->pclk))
> clk_disable_unprepare(data->pclk);
> --
> 2.11.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 11/14] serial: 8250_dw: simplify optional reset handling
2017-02-02 22:21 ` Andy Shevchenko
@ 2017-02-07 16:48 ` Philipp Zabel
2017-02-07 16:48 ` Philipp Zabel
1 sibling, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-02-07 16:48 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 2017-02-03 at 00:21 +0200, Andy Shevchenko wrote:
> On Mon, Jan 30, 2017 at 1:41 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
>
> Eventually!
That's fine, I'm going to wait for the above patch to hit mainline
before resending these patches anyway.
> FWIW:
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Thanks!
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 11/14] serial: 8250_dw: simplify optional reset handling
2017-02-02 22:21 ` Andy Shevchenko
2017-02-07 16:48 ` Philipp Zabel
@ 2017-02-07 16:48 ` Philipp Zabel
1 sibling, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-02-07 16:48 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 2017-02-03 at 00:21 +0200, Andy Shevchenko wrote:
> On Mon, Jan 30, 2017 at 1:41 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
>
> Eventually!
>
> FWIW:
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Thanks.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 10/14] phy: meson8b-usb2: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 10/14] phy: meson8b-usb2: " Philipp Zabel
@ 2017-02-14 23:36 ` Martin Blumenstingl
2017-02-15 16:43 ` Jerome Brunet
0 siblings, 1 reply; 36+ messages in thread
From: Martin Blumenstingl @ 2017-02-14 23:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi Philipp,
sorry for the late reply.
unfortunately my GXBB board (which is supported by the driver below) is dead.
I CC'ed Jerome Brunet - maybe he can give it a go on one of his (GXBB) boards.
On Mon, Jan 30, 2017 at 12:41 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional_shared
> and to call reset_control_reset unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
(based on reading the code along with the highly appreciated changes
from bb475230b8e5)
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: Carlo Caione <carlo@caione.org>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> drivers/phy/phy-meson8b-usb2.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/phy/phy-meson8b-usb2.c b/drivers/phy/phy-meson8b-usb2.c
> index 33c9f4ba157d1..87168f1fe3af6 100644
> --- a/drivers/phy/phy-meson8b-usb2.c
> +++ b/drivers/phy/phy-meson8b-usb2.c
> @@ -141,12 +141,10 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
> struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> int ret;
>
> - if (!IS_ERR_OR_NULL(priv->reset)) {
> - ret = reset_control_reset(priv->reset);
> - if (ret) {
> - dev_err(&phy->dev, "Failed to trigger USB reset\n");
> - return ret;
> - }
> + ret = reset_control_reset(priv->reset);
> + if (ret) {
> + dev_err(&phy->dev, "Failed to trigger USB reset\n");
> + return ret;
> }
>
> ret = clk_prepare_enable(priv->clk_usb_general);
> @@ -241,7 +239,7 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev)
> return PTR_ERR(priv->clk_usb);
>
> priv->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
> - if (PTR_ERR(priv->reset) == -EPROBE_DEFER)
> + if (PTR_ERR(priv->reset))
> return PTR_ERR(priv->reset);
>
> priv->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1);
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 10/14] phy: meson8b-usb2: simplify optional reset handling
2017-02-14 23:36 ` Martin Blumenstingl
@ 2017-02-15 16:43 ` Jerome Brunet
2017-02-15 16:52 ` Philipp Zabel
0 siblings, 1 reply; 36+ messages in thread
From: Jerome Brunet @ 2017-02-15 16:43 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 2017-02-15 at 00:36 +0100, Martin Blumenstingl wrote:
> Hi Philipp,
>
> sorry for the late reply.
> unfortunately my GXBB board (which is supported by the driver below)
> is dead.
> I CC'ed Jerome Brunet - maybe he can give it a go on one of his
> (GXBB) boards.
>
> On Mon, Jan 30, 2017 at 12:41 PM, Philipp Zabel <p.zabel@pengutronix.
> de> wrote:
> >
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to
> > describe
> > optional, non-present reset controls.
> >
> > This allows to return errors from
> > devm_reset_control_get_optional_shared
> > and to call reset_control_reset unconditionally.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>
> (based on reading the code along with the highly appreciated changes
> from bb475230b8e5)
>
> >
> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Cc: Kevin Hilman <khilman@baylibre.com>
> > Cc: Carlo Caione <carlo@caione.org>
> > Cc: Kishon Vijay Abraham I <kishon@ti.com>
> > ---
> > ?drivers/phy/phy-meson8b-usb2.c | 12 +++++-------
> > ?1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/phy/phy-meson8b-usb2.c b/drivers/phy/phy-
> > meson8b-usb2.c
> > index 33c9f4ba157d1..87168f1fe3af6 100644
> > --- a/drivers/phy/phy-meson8b-usb2.c
> > +++ b/drivers/phy/phy-meson8b-usb2.c
> > @@ -141,12 +141,10 @@ static int phy_meson8b_usb2_power_on(struct
> > phy *phy)
> > ????????struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> > ????????int ret;
> >
> > -???????if (!IS_ERR_OR_NULL(priv->reset)) {
> > -???????????????ret = reset_control_reset(priv->reset);
> > -???????????????if (ret) {
> > -???????????????????????dev_err(&phy->dev, "Failed to trigger USB
> > reset\n");
> > -???????????????????????return ret;
> > -???????????????}
> > +???????ret = reset_control_reset(priv->reset);
> > +???????if (ret) {
> > +???????????????dev_err(&phy->dev, "Failed to trigger USB
> > reset\n");
> > +???????????????return ret;
> > ????????}
> >
> > ????????ret = clk_prepare_enable(priv->clk_usb_general);
> > @@ -241,7 +239,7 @@ static int phy_meson8b_usb2_probe(struct
> > platform_device *pdev)
> > ????????????????return PTR_ERR(priv->clk_usb);
> >
> > ????????priv->reset = devm_reset_control_get_optional_shared(&pdev-
> > >dev, NULL);
> > -???????if (PTR_ERR(priv->reset) == -EPROBE_DEFER)
> > +???????if (PTR_ERR(priv->reset))
This is wrong and will always exit on error. It should be "IS_ERR".
Clearly the bug was there before your patch, but since you are changing
the faulty line, would you mind using IS_ERR instead ?
With this changed:
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
> > ????????????????return PTR_ERR(priv->reset);
> >
> > ????????priv->dr_mode = of_usb_get_dr_mode_by_phy(pdev-
> > >dev.of_node, -1);
> > --
> > 2.11.0
> >
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 10/14] phy: meson8b-usb2: simplify optional reset handling
2017-02-15 16:43 ` Jerome Brunet
@ 2017-02-15 16:52 ` Philipp Zabel
0 siblings, 0 replies; 36+ messages in thread
From: Philipp Zabel @ 2017-02-15 16:52 UTC (permalink / raw)
To: linux-arm-kernel
Hi Jerome,
On Wed, 2017-02-15 at 17:43 +0100, Jerome Brunet wrote:
[...]
> > > @@ -241,7 +239,7 @@ static int phy_meson8b_usb2_probe(struct
> > > platform_device *pdev)
> > > return PTR_ERR(priv->clk_usb);
> > >
> > > priv->reset = devm_reset_control_get_optional_shared(&pdev-
> > > >dev, NULL);
> > > - if (PTR_ERR(priv->reset) == -EPROBE_DEFER)
> > > + if (PTR_ERR(priv->reset))
>
> This is wrong and will always exit on error. It should be "IS_ERR".
> Clearly the bug was there before your patch, but since you are changing
> the faulty line, would you mind using IS_ERR instead ?
>
> With this changed:
> Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Thanks for catching this, I should have changed this to IS_ERR when
removing the error value comparison.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 12/14] usb: dwc2: simplify optional reset handling
2017-01-30 11:41 ` [PATCH 12/14] usb: dwc2: " Philipp Zabel
2017-01-31 0:28 ` John Youn
@ 2017-04-10 10:21 ` Felipe Balbi
2017-04-10 10:36 ` Philipp Zabel
1 sibling, 1 reply; 36+ messages in thread
From: Felipe Balbi @ 2017-04-10 10:21 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Philipp Zabel <p.zabel@pengutronix.de> writes:
> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.
>
> This allows to return errors from devm_reset_control_get_optional and to
> call reset_control_(de)assert unconditionally.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: John Youn <johnyoun@synopsys.com>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
doesn't apply to testing/next. Care to rebase and resend? Also, please
Cc linux-usb ;-)
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170410/3b9a66ef/attachment.sig>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 12/14] usb: dwc2: simplify optional reset handling
2017-04-10 10:21 ` Felipe Balbi
@ 2017-04-10 10:36 ` Philipp Zabel
2017-04-10 11:23 ` Felipe Balbi
0 siblings, 1 reply; 36+ messages in thread
From: Philipp Zabel @ 2017-04-10 10:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi Felipe,
On Mon, 2017-04-10 at 13:21 +0300, Felipe Balbi wrote:
> Hi,
>
> Philipp Zabel <p.zabel@pengutronix.de> writes:
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
> >
> > This allows to return errors from devm_reset_control_get_optional and to
> > call reset_control_(de)assert unconditionally.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> > Cc: John Youn <johnyoun@synopsys.com>
> > Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> doesn't apply to testing/next. Care to rebase and resend?
v2 is already applied as commit 5a6e4f46abd5 ("usb: dwc2: simplify
optional reset handling"), as far as I can tell.
> Also, please Cc linux-usb ;-)
I messed up the Cc: list on the first submission, but v2 should have
made it to linux-usb.
regards
Philipp
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 12/14] usb: dwc2: simplify optional reset handling
2017-04-10 10:36 ` Philipp Zabel
@ 2017-04-10 11:23 ` Felipe Balbi
0 siblings, 0 replies; 36+ messages in thread
From: Felipe Balbi @ 2017-04-10 11:23 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Philipp Zabel <p.zabel@pengutronix.de> writes:
>> Philipp Zabel <p.zabel@pengutronix.de> writes:
>> > As of commit bb475230b8e5 ("reset: make optional functions really
>> > optional"), the reset framework API calls use NULL pointers to describe
>> > optional, non-present reset controls.
>> >
>> > This allows to return errors from devm_reset_control_get_optional and to
>> > call reset_control_(de)assert unconditionally.
>> >
>> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>> > Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
>> > Cc: John Youn <johnyoun@synopsys.com>
>> > Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
>> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>
>> doesn't apply to testing/next. Care to rebase and resend?
>
> v2 is already applied as commit 5a6e4f46abd5 ("usb: dwc2: simplify
> optional reset handling"), as far as I can tell.
indeed, heh :-)
>> Also, please Cc linux-usb ;-)
>
> I messed up the Cc: list on the first submission, but v2 should have
> made it to linux-usb.
cool, thanks
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170410/f4024ef7/attachment.sig>
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2017-04-10 11:23 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-30 11:41 [PATCH 01/14] crypto: sun4i-ss - simplify optional reset handling Philipp Zabel
2017-01-30 11:41 ` [PATCH 02/14] i2c: mv64xxx: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 03/14] [media] coda: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 04/14] [media] st_rc: " Philipp Zabel
2017-01-30 12:33 ` Patrice CHOTARD
2017-01-30 11:41 ` [PATCH 05/14] [media] rc: sunxi-cir: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 06/14] mmc: dw_mmc: " Philipp Zabel
2017-01-31 11:52 ` Ulf Hansson
2017-01-31 17:21 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 07/14] mmc: sdhci-st: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 08/14] mmc: sunxi: " Philipp Zabel
2017-01-31 3:50 ` Chen-Yu Tsai
2017-01-30 11:41 ` [PATCH 09/14] mtd: nand: " Philipp Zabel
2017-01-30 12:44 ` Boris Brezillon
2017-01-31 17:20 ` Philipp Zabel
2017-01-31 17:21 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 10/14] phy: meson8b-usb2: " Philipp Zabel
2017-02-14 23:36 ` Martin Blumenstingl
2017-02-15 16:43 ` Jerome Brunet
2017-02-15 16:52 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 11/14] serial: 8250_dw: " Philipp Zabel
2017-02-02 22:21 ` Andy Shevchenko
2017-02-07 16:48 ` Philipp Zabel
2017-02-07 16:48 ` Philipp Zabel
2017-01-30 11:41 ` [PATCH 12/14] usb: dwc2: " Philipp Zabel
2017-01-31 0:28 ` John Youn
2017-01-31 0:39 ` John Youn
2017-04-10 10:21 ` Felipe Balbi
2017-04-10 10:36 ` Philipp Zabel
2017-04-10 11:23 ` Felipe Balbi
2017-01-30 11:41 ` [PATCH 13/14] usb: host: ehci-st: " Philipp Zabel
2017-01-30 11:41 ` [PATCH 14/14] ASoC: sunxi: " Philipp Zabel
2017-01-30 12:30 ` Mark Brown
2017-01-30 13:45 ` Philipp Zabel
2017-01-31 3:49 ` Chen-Yu Tsai
2017-01-31 21:00 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).