From patchwork Thu Apr 3 08:59:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 878107 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AEB5245006 for ; Thu, 3 Apr 2025 08:59:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743670763; cv=none; b=hh+55QmLHEzwzh3aE4dCoIjlESbC4BT1uC7dG8ysLj0yhuoXh0WJ7Dh1YAjR/NLF2+czWienDnSwxbW++7rrPGn+BoW4sYZRrileHgCCesutBzt0wbbw44OArUPgYf9MIACtRgvYEWdWBO9LGf34O9OcQmhAfs+RcEC2jvmYUVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743670763; c=relaxed/simple; bh=bllvwGesgocAPfPa0BvtiRJ2XbMS7FrEApqy00ZsPPo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XMncxukMYviTiNYX/F9TNAumrnWNogTCevv2TBPoDzsXRNeEWxG0GvIiZGt88BzH33MLQi31+HQGNCkiPNRzHK6X0jTuT72RymsoOAzR8Wh5wUYIiqz/W2Y7iGm+QX5fUz2syeDRZZAHvKT17vUzFg32BXvZkIxpgaDyfcr+CfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PWR6o2sH; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PWR6o2sH" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5e5b6f3025dso1030149a12.1 for ; Thu, 03 Apr 2025 01:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743670751; x=1744275551; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KZ+pWW3wwfoO36sbVjoQMpP7epgDk59E8mIno/3xwfk=; b=PWR6o2sHqfKlE52pGxQ6nvDwYPz3CPIsHrOarlJ9HgaRtlTIHnf62vxvWsYJOiVFcU Vi8Bi/Y2DFThyRjtR6vNiggomRAYOpD4dSymCjJSfALCB672k6brKMjtIwS7RVC7AGdw 0aCsIDqRblRmEhIao5bUaf+NuTnfnp6kDDZK4WRdZvW1L2beo6Xt5CJ/67Adp3YzzkX2 jTkIz0/X3BFIfgrtVGPdg/TPs9zEG/5Iwpg59HEGmLwhv4lqlrxwwVAT5Xn8a52hXJa0 HZWAd+sbuhVcSAZdkVMmidglSaN9kNa8h/y9OZXW4tnnGXhhvpkXB0Pmhm/ZOzOOGCkB uHtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743670751; x=1744275551; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KZ+pWW3wwfoO36sbVjoQMpP7epgDk59E8mIno/3xwfk=; b=iFPFynbHKdTdSiqTSU9/v2Ci4PhgxGqAd7u2WlrxyeR+k/Cuby2IjyneL8utDhWYR6 9B/JWWwbn4JqpJ7GQ3LI7aV7qxIWATg0MGSibWc02+ngpylBcfJldIKJMwoAfPlo+VOX PEGQPXpLM3HA6DYU4aFyEkDKzgU8DFCpxCFtVn5L54rZWKXs106aUJ1/X08K2LnVux3D +FrLxgiaKvj/80tJ+8a4nHwcSrV54CK9VNL/KXV58nGXZwyuy66kmi6p4TARJyggHTBK /k+9VCddOwI47m0G7BlXaPCS3Q1o7O41d67ZVJNYoStLV5HunYAfrNqwwLaAeB0P7Om2 o4mw== X-Forwarded-Encrypted: i=1; AJvYcCXBapi8ge4340f7XqZYxy9usz25CIdeEm5LPDxDZyvMokYGXkwl4gMst2wLyN5RKp3HvSeLHR6K2G42PfRzNUkH+A==@vger.kernel.org X-Gm-Message-State: AOJu0YzM5S9sxYu2a+MzXUY5nfGVtcBrvlwlE1oLTUsd04Ho6Gss1Klg o3/J5e/7/xC8v6zYdMNykuzzzF448v5nZnW7pjnEDgF+9GZcjvM9M/86zIIfyc8= X-Gm-Gg: ASbGncvVZUJ+qwJHYPlKMEaAvs2JQPr0eGvp3+H6uRDZmU1WJubRS3I6JRXyT3EpzXL z/9nt6gCIJh4/9/dypomhJhz1W+wkIE0sG+poN4TWp0QG0HjjtejI33zbsd7x0S9vsalFrSvgxE TsxiDEhESG04OXv7eS04woWLlb1SgBFIy6lwmRoOFx27sQ91O2E5FWkPThdOpH7gQkeUYZ9pxvI tUdy7nnvYWa31Ghs0UThPSGWMpaApKWebL16nb6o3Ffd11lJx15Of1cQ3jAuUkCeHfzz+zA2Yk5 5wdXmJS0ttRUpzIv24y00SFMKv1S8tL1KueMxz7dipHUI+hm8nL0yhOi65sLOiCZP5+hov5BzG2 7Ie416O35nNprCTqZ2/6T4GLrebX+ X-Google-Smtp-Source: AGHT+IEDq89x3CpslTyM0zp7dklQdXkDh51EcU1TCoWVePJqp1R3stB2nQM7HgpHJAOZguo5Gm2LWg== X-Received: by 2002:a05:6402:3204:b0:5f0:82cd:500b with SMTP id 4fb4d7f45d1cf-5f082cd5216mr2774791a12.19.1743670751382; Thu, 03 Apr 2025 01:59:11 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5f0880a535fsm637614a12.80.2025.04.03.01.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Apr 2025 01:59:11 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 03 Apr 2025 09:59:10 +0100 Subject: [PATCH v3 18/32] mfd: sec: change device_type to int Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250403-s2mpg10-v3-18-b542b3505e68@linaro.org> References: <20250403-s2mpg10-v3-0-b542b3505e68@linaro.org> In-Reply-To: <20250403-s2mpg10-v3-0-b542b3505e68@linaro.org> To: Krzysztof Kozlowski , Lee Jones , Rob Herring , Conor Dooley , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , Russell King , Catalin Marinas , Will Deacon , Alexandre Belloni Cc: Peter Griffin , Tudor Ambarus , Will McVicker , 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, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 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 --- 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 79a3b33441fa5ab48b4b233eb8d89b4c20c142ed..c4db58813059f07372679223ec570ed07f52cd73 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; };