This patch series aims to add match data improvements for palmas driver.
This patch series is only compile tested.
v2->v3:
* Patch#1 for removing trailing comma in the terminator entry for OF
table.
* Restored the OF table position and moved near to the user in patch#3.
* Moved OF table near to the user in patch#3.
* Updated commit description for patch#4.
v1->v2:
* Moved the OF table just above its user.
* Removed trailing comma from the terminator entry for the OF table.
Biju Das (4):
mfd: palmas: Remove trailing comma in the terminator entry
mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
mfd: palmas: Move OF table
mfd: palmas: Make similar OF and ID table
drivers/mfd/palmas.c | 60 +++++++++++++++++---------------------------
1 file changed, 23 insertions(+), 37 deletions(-)
--
2.25.1
Constify .data in OF table and {palmas,tps65917}_irq_chip and replace
the variable *features->features in struct palmas_driver_data and
drop the {palmas,tps659038}_features variables and use their values
directly in the named initialization.
Signed-off-by: Biju Das <[email protected]>
---
v2->v3:
* Restored the OF table position and moved near to the user in patch#3.
v1->v2:
* Moved the OF table just above its user.
* Removed trailing comma from the terminator entry for the OF table.
---
drivers/mfd/palmas.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 769538b50903..3c0a3d644834 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -296,7 +296,7 @@ static const struct regmap_irq palmas_irqs[] = {
},
};
-static struct regmap_irq_chip palmas_irq_chip = {
+static const struct regmap_irq_chip palmas_irq_chip = {
.name = "palmas",
.irqs = palmas_irqs,
.num_irqs = ARRAY_SIZE(palmas_irqs),
@@ -309,7 +309,7 @@ static struct regmap_irq_chip palmas_irq_chip = {
PALMAS_INT1_MASK),
};
-static struct regmap_irq_chip tps65917_irq_chip = {
+static const struct regmap_irq_chip tps65917_irq_chip = {
.name = "tps65917",
.irqs = tps65917_irqs,
.num_irqs = ARRAY_SIZE(tps65917_irqs),
@@ -463,26 +463,21 @@ static void palmas_power_off(void)
__func__, ret);
}
-static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST;
-static unsigned int tps659038_features;
-
struct palmas_driver_data {
- unsigned int *features;
- struct regmap_irq_chip *irq_chip;
+ unsigned int features;
+ const struct regmap_irq_chip *irq_chip;
};
-static struct palmas_driver_data palmas_data = {
- .features = &palmas_features,
+static const struct palmas_driver_data palmas_data = {
+ .features = PALMAS_PMIC_FEATURE_SMPS10_BOOST,
.irq_chip = &palmas_irq_chip,
};
-static struct palmas_driver_data tps659038_data = {
- .features = &tps659038_features,
+static const struct palmas_driver_data tps659038_data = {
.irq_chip = &palmas_irq_chip,
};
-static struct palmas_driver_data tps65917_data = {
- .features = &tps659038_features,
+static const struct palmas_driver_data tps65917_data = {
.irq_chip = &tps65917_irq_chip,
};
@@ -507,7 +502,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c)
{
struct palmas *palmas;
struct palmas_platform_data *pdata;
- struct palmas_driver_data *driver_data;
+ const struct palmas_driver_data *driver_data;
struct device_node *node = i2c->dev.of_node;
int ret = 0, i;
unsigned int reg, addr;
@@ -535,8 +530,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c)
palmas->dev = &i2c->dev;
palmas->irq = i2c->irq;
- driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev);
- palmas->features = *driver_data->features;
+ driver_data = device_get_match_data(&i2c->dev);
+ palmas->features = driver_data->features;
for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
if (i == 0)
--
2.25.1
Move OF table near to the user.
While at it, arrange compatible and data in single line.
Signed-off-by: Biju Das <[email protected]>
---
v3:
* New patch.
---
drivers/mfd/palmas.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 3c0a3d644834..3ac9dec2b117 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -481,23 +481,6 @@ static const struct palmas_driver_data tps65917_data = {
.irq_chip = &tps65917_irq_chip,
};
-static const struct of_device_id of_palmas_match_tbl[] = {
- {
- .compatible = "ti,palmas",
- .data = &palmas_data,
- },
- {
- .compatible = "ti,tps659038",
- .data = &tps659038_data,
- },
- {
- .compatible = "ti,tps65917",
- .data = &tps65917_data,
- },
- { }
-};
-MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
-
static int palmas_i2c_probe(struct i2c_client *i2c)
{
struct palmas *palmas;
@@ -707,6 +690,14 @@ static void palmas_i2c_remove(struct i2c_client *i2c)
}
}
+static const struct of_device_id of_palmas_match_tbl[] = {
+ { .compatible = "ti,palmas", .data = &palmas_data },
+ { .compatible = "ti,tps659038", .data = &tps659038_data },
+ { .compatible = "ti,tps65917", .data = &tps65917_data },
+ { }
+};
+MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
+
static const struct i2c_device_id palmas_i2c_id[] = {
{ "palmas", },
{ "twl6035", },
--
2.25.1
On Thu, 31 Aug 2023 19:31:49 +0100, Biju Das wrote:
> This patch series aims to add match data improvements for palmas driver.
>
> This patch series is only compile tested.
>
> v2->v3:
> * Patch#1 for removing trailing comma in the terminator entry for OF
> table.
> * Restored the OF table position and moved near to the user in patch#3.
> * Moved OF table near to the user in patch#3.
> * Updated commit description for patch#4.
> v1->v2:
> * Moved the OF table just above its user.
> * Removed trailing comma from the terminator entry for the OF table.
>
> [...]
Applied, thanks!
[1/4] mfd: palmas: Remove trailing comma in the terminator entry
commit: 00e54d48f88eda223306a38cf6016e7209cd1f00
[2/4] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
commit: e8b286068fc1f53f9784b1e8364bd6630918bbb2
[3/4] mfd: palmas: Move OF table
commit: ce48b597e892a4eb5cb1b0adad4b46c4af737860
[4/4] mfd: palmas: Make similar OF and ID table
commit: 3935ffa5258510e516645a29ae3c4ac582e66ff3
--
Lee Jones [李琼斯]