[1/2] mfd: Make .disable() callback return void
Commit Message
All implementations return 0 unconditionally, so change the prototype to
return void. This allows to get rid of error handling in callers that
isn't actually used.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/mfd/asic3.c | 17 +++++++++--------
drivers/mfd/htc-pasic3.c | 3 +--
drivers/mfd/mfd-core.c | 4 +++-
drivers/mfd/t7l66xb.c | 4 +---
drivers/mfd/tc6387xb.c | 4 +---
drivers/mfd/tc6393xb.c | 16 ++++++++++------
include/linux/mfd/core.h | 2 +-
7 files changed, 26 insertions(+), 24 deletions(-)
Comments
On Fri, 13 Jan 2023, Uwe Kleine-König wrote:
> All implementations return 0 unconditionally, so change the prototype to
> return void. This allows to get rid of error handling in callers that
> isn't actually used.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/mfd/asic3.c | 17 +++++++++--------
> drivers/mfd/htc-pasic3.c | 3 +--
> drivers/mfd/mfd-core.c | 4 +++-
> drivers/mfd/t7l66xb.c | 4 +---
> drivers/mfd/tc6387xb.c | 4 +---
> drivers/mfd/tc6393xb.c | 16 ++++++++++------
> include/linux/mfd/core.h | 2 +-
> 7 files changed, 26 insertions(+), 24 deletions(-)
Doesn't apply to the MFD tree.
Please rebase and I'll merge it.
Hello,
On Thu, Jan 26, 2023 at 01:34:16PM +0000, Lee Jones wrote:
> On Fri, 13 Jan 2023, Uwe Kleine-König wrote:
>
> > All implementations return 0 unconditionally, so change the prototype to
> > return void. This allows to get rid of error handling in callers that
> > isn't actually used.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> > drivers/mfd/asic3.c | 17 +++++++++--------
> > drivers/mfd/htc-pasic3.c | 3 +--
> > drivers/mfd/mfd-core.c | 4 +++-
> > drivers/mfd/t7l66xb.c | 4 +---
> > drivers/mfd/tc6387xb.c | 4 +---
> > drivers/mfd/tc6393xb.c | 16 ++++++++++------
> > include/linux/mfd/core.h | 2 +-
> > 7 files changed, 26 insertions(+), 24 deletions(-)
>
> Doesn't apply to the MFD tree.
>
> Please rebase and I'll merge it.
Oh, all the drivers that still provided the .enable() and .disable()
callbacks are gone now. So my patch series is superseeded by
http://lore.kernel.org/lkml/20230126152429.580539-1-u.kleine-koenig@pengutronix.de
Best regards
Uwe
@@ -676,7 +676,7 @@ static int ds1wm_enable(struct platform_device *pdev)
return 0;
}
-static int ds1wm_disable(struct platform_device *pdev)
+static void ds1wm_disable(struct platform_device *pdev)
{
struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
@@ -686,8 +686,6 @@ static int ds1wm_disable(struct platform_device *pdev)
asic3_clk_disable(asic, &asic->clocks[ASIC3_CLOCK_OWM]);
asic3_clk_disable(asic, &asic->clocks[ASIC3_CLOCK_EX0]);
asic3_clk_disable(asic, &asic->clocks[ASIC3_CLOCK_EX1]);
-
- return 0;
}
static const struct mfd_cell asic3_cell_ds1wm = {
@@ -769,7 +767,7 @@ static int asic3_mmc_enable(struct platform_device *pdev)
return 0;
}
-static int asic3_mmc_disable(struct platform_device *pdev)
+static void asic3_mmc_disable(struct platform_device *pdev)
{
struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
@@ -782,6 +780,11 @@ static int asic3_mmc_disable(struct platform_device *pdev)
asic3_clk_disable(asic, &asic->clocks[ASIC3_CLOCK_SD_BUS]);
asic3_clk_disable(asic, &asic->clocks[ASIC3_CLOCK_EX0]);
asic3_clk_disable(asic, &asic->clocks[ASIC3_CLOCK_EX1]);
+}
+
+static int asic3_mmc_suspend(struct platform_device *pdev)
+{
+ asic3_mmc_disable(pdev);
return 0;
}
@@ -789,7 +792,7 @@ static const struct mfd_cell asic3_cell_mmc = {
.name = "tmio-mmc",
.enable = asic3_mmc_enable,
.disable = asic3_mmc_disable,
- .suspend = asic3_mmc_disable,
+ .suspend = asic3_mmc_suspend,
.resume = asic3_mmc_enable,
.platform_data = &asic3_mmc_data,
.pdata_size = sizeof(asic3_mmc_data),
@@ -813,14 +816,12 @@ static int asic3_leds_enable(struct platform_device *pdev)
return 0;
}
-static int asic3_leds_disable(struct platform_device *pdev)
+static void asic3_leds_disable(struct platform_device *pdev)
{
const struct mfd_cell *cell = mfd_get_cell(pdev);
struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
asic3_clk_disable(asic, &asic->clocks[clock_ledn[cell->id]]);
-
- return 0;
}
static int asic3_leds_suspend(struct platform_device *pdev)
@@ -82,7 +82,7 @@ static int ds1wm_enable(struct platform_device *pdev)
return 0;
}
-static int ds1wm_disable(struct platform_device *pdev)
+static void ds1wm_disable(struct platform_device *pdev)
{
struct device *dev = pdev->dev.parent;
int c;
@@ -91,7 +91,6 @@ static int ds1wm_disable(struct platform_device *pdev)
pasic3_write_register(dev, 0x28, c | 0x80);
dev_dbg(dev, "DS1WM OWM_EN high (inactive) %02x\n", c | 0x80);
- return 0;
}
static struct ds1wm_driver_data ds1wm_pdata = {
@@ -55,7 +55,9 @@ int mfd_cell_disable(struct platform_device *pdev)
return 0;
}
- return cell->disable(pdev);
+ cell->disable(pdev);
+
+ return 0;
}
EXPORT_SYMBOL(mfd_cell_disable);
@@ -94,7 +94,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
return 0;
}
-static int t7l66xb_mmc_disable(struct platform_device *mmc)
+static void t7l66xb_mmc_disable(struct platform_device *mmc)
{
struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
unsigned long flags;
@@ -109,8 +109,6 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
raw_spin_unlock_irqrestore(&t7l66xb->lock, flags);
clk_disable_unprepare(t7l66xb->clk32k);
-
- return 0;
}
static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
@@ -96,13 +96,11 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
return 0;
}
-static int tc6387xb_mmc_disable(struct platform_device *mmc)
+static void tc6387xb_mmc_disable(struct platform_device *mmc)
{
struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
clk_disable_unprepare(tc6387xb->clk32k);
-
- return 0;
}
static struct tmio_mmc_data tc6387xb_mmc_data = {
@@ -241,7 +241,7 @@ static int tc6393xb_ohci_enable(struct platform_device *dev)
return 0;
}
-static int tc6393xb_ohci_disable(struct platform_device *dev)
+static void tc6393xb_ohci_disable(struct platform_device *dev)
{
struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
unsigned long flags;
@@ -259,8 +259,6 @@ static int tc6393xb_ohci_disable(struct platform_device *dev)
tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
-
- return 0;
}
static int tc6393xb_ohci_suspend(struct platform_device *dev)
@@ -271,7 +269,9 @@ static int tc6393xb_ohci_suspend(struct platform_device *dev)
if (tcpd->resume_restore)
return -EBUSY;
- return tc6393xb_ohci_disable(dev);
+ tc6393xb_ohci_disable(dev);
+
+ return 0;
}
static int tc6393xb_fb_enable(struct platform_device *dev)
@@ -292,7 +292,7 @@ static int tc6393xb_fb_enable(struct platform_device *dev)
return 0;
}
-static int tc6393xb_fb_disable(struct platform_device *dev)
+static void tc6393xb_fb_disable(struct platform_device *dev)
{
struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
unsigned long flags;
@@ -306,7 +306,11 @@ static int tc6393xb_fb_disable(struct platform_device *dev)
tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR);
raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
+}
+static int tc6393xb_fb_suspend(struct platform_device *dev)
+{
+ tc6393xb_fb_disable(dev);
return 0;
}
@@ -417,7 +421,7 @@ static struct mfd_cell tc6393xb_cells[] = {
.num_resources = ARRAY_SIZE(tc6393xb_fb_resources),
.resources = tc6393xb_fb_resources,
.enable = tc6393xb_fb_enable,
- .suspend = tc6393xb_fb_disable,
+ .suspend = tc6393xb_fb_suspend,
.resume = tc6393xb_fb_enable,
.disable = tc6393xb_fb_disable,
},
@@ -69,7 +69,7 @@ struct mfd_cell {
int level;
int (*enable)(struct platform_device *dev);
- int (*disable)(struct platform_device *dev);
+ void (*disable)(struct platform_device *dev);
int (*suspend)(struct platform_device *dev);
int (*resume)(struct platform_device *dev);