Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: sec: Change device_type to int

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>
Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-18-d66d5f39b6bf@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

André Draszik and committed by
Lee Jones
adf91d9e aaaeae7e

+10 -13
+4 -5
drivers/mfd/sec-common.c
··· 155 155 return pd; 156 156 } 157 157 158 - int sec_pmic_probe(struct device *dev, unsigned long device_type, 159 - unsigned int irq, struct regmap *regmap, 160 - struct i2c_client *client) 158 + int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq, 159 + struct regmap *regmap, struct i2c_client *client) 161 160 { 162 161 struct sec_platform_data *pdata; 163 162 const struct mfd_cell *sec_devs; ··· 231 232 break; 232 233 default: 233 234 return dev_err_probe(sec_pmic->dev, -EINVAL, 234 - "Unsupported device type %lu\n", 235 + "Unsupported device type %d\n", 235 236 sec_pmic->device_type); 236 237 } 237 238 ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs, ··· 265 266 * ignore the rest. 266 267 */ 267 268 dev_warn(sec_pmic->dev, 268 - "Unsupported device %lu for manual power off\n", 269 + "Unsupported device %d for manual power off\n", 269 270 sec_pmic->device_type); 270 271 return; 271 272 }
+2 -3
drivers/mfd/sec-core.h
··· 14 14 15 15 extern const struct dev_pm_ops sec_pmic_pm_ops; 16 16 17 - int sec_pmic_probe(struct device *dev, unsigned long device_type, 18 - unsigned int irq, struct regmap *regmap, 19 - struct i2c_client *client); 17 + int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq, 18 + struct regmap *regmap, struct i2c_client *client); 20 19 void sec_pmic_shutdown(struct device *dev); 21 20 22 21 int sec_irq_init(struct sec_pmic_dev *sec_pmic);
+1 -1
drivers/mfd/sec-i2c.c
··· 27 27 28 28 struct sec_pmic_i2c_platform_data { 29 29 const struct regmap_config *regmap_cfg; 30 - unsigned long device_type; 30 + int device_type; 31 31 }; 32 32 33 33 static bool s2mpa01_volatile(struct device *dev, unsigned int reg)
+2 -3
drivers/mfd/sec-irq.c
··· 449 449 int sec_irq_init(struct sec_pmic_dev *sec_pmic) 450 450 { 451 451 int ret = 0; 452 - int type = sec_pmic->device_type; 453 452 const struct regmap_irq_chip *sec_irq_chip; 454 453 455 - switch (type) { 454 + switch (sec_pmic->device_type) { 456 455 case S5M8767X: 457 456 sec_irq_chip = &s5m8767_irq_chip; 458 457 break; ··· 483 484 break; 484 485 default: 485 486 return dev_err_probe(sec_pmic->dev, -EINVAL, 486 - "Unsupported device type %lu\n", 487 + "Unsupported device type %d\n", 487 488 sec_pmic->device_type); 488 489 } 489 490
+1 -1
include/linux/mfd/samsung/core.h
··· 67 67 struct regmap *regmap_pmic; 68 68 struct i2c_client *i2c; 69 69 70 - unsigned long device_type; 70 + int device_type; 71 71 int irq; 72 72 struct regmap_irq_chip_data *irq_data; 73 73 };