linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "André Draszik" <andre.draszik@linaro.org>
To: Krzysztof Kozlowski <krzk@kernel.org>, Lee Jones <lee@kernel.org>,
	 Rob Herring <robh@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Sylwester Nawrocki <s.nawrocki@samsung.com>,
	 Chanwoo Choi <cw00.choi@samsung.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	 Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: "Peter Griffin" <peter.griffin@linaro.org>,
	"Tudor Ambarus" <tudor.ambarus@linaro.org>,
	"Will McVicker" <willmcvicker@google.com>,
	kernel-team@android.com, linux-kernel@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rtc@vger.kernel.org,
	"André Draszik" <andre.draszik@linaro.org>
Subject: [PATCH v4 18/32] mfd: sec: Change device_type to int
Date: Wed, 09 Apr 2025 21:37:39 +0100	[thread overview]
Message-ID: <20250409-s2mpg10-v4-18-d66d5f39b6bf@linaro.org> (raw)
In-Reply-To: <20250409-s2mpg10-v4-0-d66d5f39b6bf@linaro.org>

Now that sec-i2c doesn't match device type by pointer casting anymore,
we can switch the device type from unsigned long to int easily.

This saves a few bytes in struct sec_pmic_dev due to member alignment.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 drivers/mfd/sec-common.c         | 9 ++++-----
 drivers/mfd/sec-core.h           | 5 ++---
 drivers/mfd/sec-i2c.c            | 2 +-
 drivers/mfd/sec-irq.c            | 5 ++---
 include/linux/mfd/samsung/core.h | 2 +-
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c
index bb0eb3c2d9a260ddf2fb110cc255f08a0d25230d..4871492548f5efde4248b5b3db74045ec8c9d676 100644
--- a/drivers/mfd/sec-common.c
+++ b/drivers/mfd/sec-common.c
@@ -155,9 +155,8 @@ sec_pmic_parse_dt_pdata(struct device *dev)
 	return pd;
 }
 
-int sec_pmic_probe(struct device *dev, unsigned long device_type,
-		   unsigned int irq, struct regmap *regmap,
-		   struct i2c_client *client)
+int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq,
+		   struct regmap *regmap, struct i2c_client *client)
 {
 	struct sec_platform_data *pdata;
 	const struct mfd_cell *sec_devs;
@@ -232,7 +231,7 @@ int sec_pmic_probe(struct device *dev, unsigned long device_type,
 		break;
 	default:
 		return dev_err_probe(sec_pmic->dev, -EINVAL,
-				     "Unsupported device type %lu\n",
+				     "Unsupported device type %d\n",
 				     sec_pmic->device_type);
 	}
 	ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs,
@@ -266,7 +265,7 @@ void sec_pmic_shutdown(struct device *dev)
 		 * ignore the rest.
 		 */
 		dev_warn(sec_pmic->dev,
-			 "Unsupported device %lu for manual power off\n",
+			 "Unsupported device %d for manual power off\n",
 			 sec_pmic->device_type);
 		return;
 	}
diff --git a/drivers/mfd/sec-core.h b/drivers/mfd/sec-core.h
index a0a3488924d96f69373e7569079cfefd0544ca26..92c7558ab8b0de44a52e028eeb7998e38358cb4c 100644
--- a/drivers/mfd/sec-core.h
+++ b/drivers/mfd/sec-core.h
@@ -14,9 +14,8 @@ struct i2c_client;
 
 extern const struct dev_pm_ops sec_pmic_pm_ops;
 
-int sec_pmic_probe(struct device *dev, unsigned long device_type,
-		   unsigned int irq, struct regmap *regmap,
-		   struct i2c_client *client);
+int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq,
+		   struct regmap *regmap, struct i2c_client *client);
 void sec_pmic_shutdown(struct device *dev);
 
 int sec_irq_init(struct sec_pmic_dev *sec_pmic);
diff --git a/drivers/mfd/sec-i2c.c b/drivers/mfd/sec-i2c.c
index 41b09f5e3c49f410604a5d47e625cbb37d7f5fa2..2ccb494c8c024361c78e92be71ce9c215757dd89 100644
--- a/drivers/mfd/sec-i2c.c
+++ b/drivers/mfd/sec-i2c.c
@@ -27,7 +27,7 @@
 
 struct sec_pmic_i2c_platform_data {
 	const struct regmap_config *regmap_cfg;
-	unsigned long device_type;
+	int device_type;
 };
 
 static bool s2mpa01_volatile(struct device *dev, unsigned int reg)
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index 79b4f74b05a24e413a84ff8c0b16156a828310e5..54c674574c701eec979d8c6a94909b78dcc77065 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -449,10 +449,9 @@ static const struct regmap_irq_chip s5m8767_irq_chip = {
 int sec_irq_init(struct sec_pmic_dev *sec_pmic)
 {
 	int ret = 0;
-	int type = sec_pmic->device_type;
 	const struct regmap_irq_chip *sec_irq_chip;
 
-	switch (type) {
+	switch (sec_pmic->device_type) {
 	case S5M8767X:
 		sec_irq_chip = &s5m8767_irq_chip;
 		break;
@@ -484,7 +483,7 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
 		break;
 	default:
 		return dev_err_probe(sec_pmic->dev, -EINVAL,
-				     "Unsupported device type %lu\n",
+				     "Unsupported device type %d\n",
 				     sec_pmic->device_type);
 	}
 
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index c1102324172a9b6bd6072b5929a4866d6c9653fa..d785e101fe795a5d8f9cccf4ccc4232437e89416 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -67,7 +67,7 @@ struct sec_pmic_dev {
 	struct regmap *regmap_pmic;
 	struct i2c_client *i2c;
 
-	unsigned long device_type;
+	int device_type;
 	int irq;
 	struct regmap_irq_chip_data *irq_data;
 };

-- 
2.49.0.604.gff1f9ca942-goog


  parent reply	other threads:[~2025-04-09 20:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 20:37 [PATCH v4 00/32] Samsung S2MPG10 PMIC MFD-based drivers André Draszik
2025-04-09 20:37 ` [PATCH v4 01/32] dt-bindings: mfd: samsung,s2mps11: add s2mpg10 André Draszik
2025-04-09 20:37 ` [PATCH v4 02/32] dt-bindings: clock: " André Draszik
2025-06-16 11:43   ` André Draszik
2025-06-27 12:15   ` André Draszik
2025-07-10  6:13   ` André Draszik
2025-04-09 20:37 ` [PATCH v4 03/32] dt-bindings: firmware: google,gs101-acpm-ipc: add PMIC child node André Draszik
2025-04-10  6:27   ` (subset) " Krzysztof Kozlowski
2025-04-09 20:37 ` [PATCH v4 04/32] mfd: sec-core: Drop non-existing forward declarations André Draszik
2025-04-09 20:37 ` [PATCH v4 05/32] mfd: sec: Sort includes alphabetically André Draszik
2025-04-09 20:37 ` [PATCH v4 06/32] mfd: sec: Update includes to add missing and remove superfluous ones André Draszik
2025-04-09 20:37 ` [PATCH v4 07/32] mfd: sec: Move private internal API to internal header André Draszik
2025-04-09 20:37 ` [PATCH v4 08/32] mfd: sec: Split into core and transport (i2c) drivers André Draszik
2025-04-09 20:37 ` [PATCH v4 09/32] mfd: sec: Add support for S2MPG10 PMIC André Draszik
2025-04-09 20:37 ` [PATCH v4 10/32] mfd: sec: Merge separate core and irq modules André Draszik
2025-04-09 20:37 ` [PATCH v4 11/32] mfd: sec-common: Fix multiple trivial whitespace issues André Draszik
2025-04-09 20:37 ` [PATCH v4 12/32] mfd: sec-i2c: Sort struct of_device_id entries and the device type switch André Draszik
2025-04-09 20:37 ` [PATCH v4 13/32] mfd: sec: Use dev_err_probe() where appropriate André Draszik
2025-04-09 20:37 ` [PATCH v4 14/32] mfd: sec-i2c: s2dos05/s2mpu05: Use explicit regmap config and drop default André Draszik
2025-04-09 20:37 ` [PATCH v4 15/32] mfd: sec-irq: s2dos05 doesn't support interrupts André Draszik
2025-04-09 20:37 ` [PATCH v4 16/32] mfd: sec-common: Don't ignore errors from sec_irq_init() André Draszik
2025-04-09 20:37 ` [PATCH v4 17/32] mfd: sec-i2c: Rework platform data and regmap instantiating André Draszik
2025-04-09 20:37 ` André Draszik [this message]
2025-04-09 20:37 ` [PATCH v4 19/32] mfd: sec: Don't compare against NULL / 0 for errors, use ! André Draszik
2025-04-09 20:37 ` [PATCH v4 20/32] mfd: sec-common: Use sizeof(*var), not sizeof(struct type_of_var) André Draszik
2025-04-09 20:37 ` [PATCH v4 21/32] mfd: sec-common: Convert to using MFD_CELL macros André Draszik
2025-04-09 20:37 ` [PATCH v4 22/32] mfd: sec-irq: Convert to using REGMAP_IRQ_REG() macros André Draszik
2025-04-09 20:37 ` [PATCH v4 23/32] mfd: sec: Add myself as module author André Draszik
2025-04-09 20:37 ` [PATCH v4 24/32] clk: s2mps11: add support for S2MPG10 PMIC clock André Draszik
2025-07-10  6:13   ` André Draszik
2025-04-09 20:37 ` [PATCH v4 25/32] rtc: s5m: cache device type during probe André Draszik
2025-04-09 20:37 ` [PATCH v4 26/32] rtc: s5m: prepare for external regmap André Draszik
2025-04-09 20:37 ` [PATCH v4 27/32] rtc: s5m: add support for S2MPG10 RTC André Draszik
2025-04-09 20:37 ` [PATCH v4 28/32] rtc: s5m: fix a typo: peding -> pending André Draszik
2025-04-09 20:37 ` [PATCH v4 29/32] rtc: s5m: switch to devm_device_init_wakeup André Draszik
2025-04-09 20:37 ` [PATCH v4 30/32] rtc: s5m: replace regmap_update_bits with regmap_clear/set_bits André Draszik
2025-04-09 20:37 ` [PATCH v4 31/32] rtc: s5m: replace open-coded read/modify/write registers with regmap helpers André Draszik
2025-04-09 20:37 ` [PATCH v4 32/32] MAINTAINERS: add myself as reviewer for Samsung S2M MFD André Draszik
2025-04-10  6:18 ` [PATCH v4 00/32] Samsung S2MPG10 PMIC MFD-based drivers Krzysztof Kozlowski
2025-04-28 18:03   ` André Draszik
2025-04-15 16:02 ` Lee Jones
2025-04-17 15:42   ` Alexandre Belloni
2025-04-28 18:17     ` André Draszik
2025-05-19 14:41       ` André Draszik
2025-06-16 11:33         ` André Draszik
2025-06-23 22:19           ` Alexandre Belloni
2025-06-24  6:38             ` André Draszik
2025-04-24 15:11 ` (subset) " Lee Jones
2025-06-23 22:17 ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250409-s2mpg10-v4-18-d66d5f39b6bf@linaro.org \
    --to=andre.draszik@linaro.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alim.akhtar@samsung.com \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel-team@android.com \
    --cc=krzk@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=peter.griffin@linaro.org \
    --cc=robh@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=tudor.ambarus@linaro.org \
    --cc=will@kernel.org \
    --cc=willmcvicker@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).