lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230113182427.257484-2-u.kleine-koenig@pengutronix.de>
Date:   Fri, 13 Jan 2023 19:24:26 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     Lee Jones <lee@...nel.org>
Cc:     linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: [PATCH 1/2] mfd: Make .disable() callback return void

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@...gutronix.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(-)

diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 4fb7e35eb5ed..b62e1732cfd2 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -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)
diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c
index 0c46b7e64b2d..57fc18e2194f 100644
--- a/drivers/mfd/htc-pasic3.c
+++ b/drivers/mfd/htc-pasic3.c
@@ -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 = {
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 16d1861e9682..b854c4adb527 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -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);
 
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 1d9d1d38d068..fd7dfbe64bf5 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -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)
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index 5392da6ba7b0..848058e7fe41 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -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 = {
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 997bb8b5881d..20521fece1ae 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -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,
 	},
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 0bc7cba798a3..9833d0501d42 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -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);
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ