mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series
@ 2024-12-17 20:45 Shree Ramamoorthy
  2024-12-17 20:45 ` [PATCH v1 1/4] regulator: tps65219: Use dev_err_probe() instead of dev_err() Shree Ramamoorthy
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Shree Ramamoorthy @ 2024-12-17 20:45 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	broonie, linux-omap, linux-kernel
  Cc: m-leonard, praneeth

This series is in preparation to add 2 PMIC devices to the TPS65219 driver.

The changes involve using dev_err_probe() for instances that have a chance 
of returning -EPORBE_DEFER, remove redundant code, and follow other PMIC 
regulator driver naming conventions. The intention is to remove unnecessary
noise from the new PMIC device patches added to this driver.

Shree Ramamoorthy (4):
  regulator: tps65219: Use dev_err_probe() instead of dev_err()
  regulator: tps65219: Update driver name
  regulator: tps65219: Remove MODULE_ALIAS
  regulator: tps65219: Remove debugging helper function

 drivers/regulator/tps65219-regulator.c | 39 ++++----------------------
 1 file changed, 5 insertions(+), 34 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v1 1/4] regulator: tps65219: Use dev_err_probe() instead of dev_err()
  2024-12-17 20:45 [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Shree Ramamoorthy
@ 2024-12-17 20:45 ` Shree Ramamoorthy
  2024-12-17 20:45 ` [PATCH v1 2/4] regulator: tps65219: Update driver name Shree Ramamoorthy
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Shree Ramamoorthy @ 2024-12-17 20:45 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	broonie, linux-omap, linux-kernel
  Cc: m-leonard, praneeth

Make the error message format unified by switching from dev_err() to
dev_err_probe() where there is a chance of -EPROBE_DEFER returned. This
helps simplify the error code where possible.

Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
---
 drivers/regulator/tps65219-regulator.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index b4065356392f..14d843a99d0f 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -322,11 +322,11 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
 		dev_dbg(tps->dev, "%s regul i= %d START", __func__, i);
 		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
 					       &config);
-		if (IS_ERR(rdev)) {
-			dev_err(tps->dev, "failed to register %s regulator\n",
-				regulators[i].name);
-			return PTR_ERR(rdev);
-		}
+		if (IS_ERR(rdev))
+			return dev_err_probe(tps->dev, PTR_ERR(rdev),
+					"Failed to register %s regulator\n",
+					regulators[i].name);
+
 		rdevtbl[i] = rdev;
 		dev_dbg(tps->dev, "%s regul i= %d COMPLETED", __func__, i);
 	}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v1 2/4] regulator: tps65219: Update driver name
  2024-12-17 20:45 [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Shree Ramamoorthy
  2024-12-17 20:45 ` [PATCH v1 1/4] regulator: tps65219: Use dev_err_probe() instead of dev_err() Shree Ramamoorthy
@ 2024-12-17 20:45 ` Shree Ramamoorthy
  2024-12-17 21:01   ` Mark Brown
  2024-12-17 20:45 ` [PATCH v1 3/4] regulator: tps65219: Remove MODULE_ALIAS Shree Ramamoorthy
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Shree Ramamoorthy @ 2024-12-17 20:45 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	broonie, linux-omap, linux-kernel
  Cc: m-leonard, praneeth

Follow the same naming convention in tps6594-regulator.c with
tpsxxx-regulator instead of tpsxxx-pmic.

Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
---
 drivers/regulator/tps65219-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index 14d843a99d0f..5decf69f327a 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -379,7 +379,7 @@ MODULE_DEVICE_TABLE(platform, tps65219_regulator_id_table);
 
 static struct platform_driver tps65219_regulator_driver = {
 	.driver = {
-		.name = "tps65219-pmic",
+		.name = "tps65219-regulator",
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe = tps65219_regulator_probe,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v1 3/4] regulator: tps65219: Remove MODULE_ALIAS
  2024-12-17 20:45 [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Shree Ramamoorthy
  2024-12-17 20:45 ` [PATCH v1 1/4] regulator: tps65219: Use dev_err_probe() instead of dev_err() Shree Ramamoorthy
  2024-12-17 20:45 ` [PATCH v1 2/4] regulator: tps65219: Update driver name Shree Ramamoorthy
@ 2024-12-17 20:45 ` Shree Ramamoorthy
  2024-12-17 20:45 ` [PATCH v1 4/4] regulator: tps65219: Remove debugging helper function Shree Ramamoorthy
  2024-12-18 14:20 ` [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Mark Brown
  4 siblings, 0 replies; 9+ messages in thread
From: Shree Ramamoorthy @ 2024-12-17 20:45 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	broonie, linux-omap, linux-kernel
  Cc: m-leonard, praneeth

Remove MODULE_ALIAS because the same module alias is already generated by
MODULE_DEVICE_TABLE.

Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
---
 drivers/regulator/tps65219-regulator.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index 5decf69f327a..f57a046f9dea 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -390,5 +390,4 @@ module_platform_driver(tps65219_regulator_driver);
 
 MODULE_AUTHOR("Jerome Neanne <j-neanne@baylibre.com>");
 MODULE_DESCRIPTION("TPS65219 voltage regulator driver");
-MODULE_ALIAS("platform:tps65219-pmic");
 MODULE_LICENSE("GPL");
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v1 4/4] regulator: tps65219: Remove debugging helper function
  2024-12-17 20:45 [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Shree Ramamoorthy
                   ` (2 preceding siblings ...)
  2024-12-17 20:45 ` [PATCH v1 3/4] regulator: tps65219: Remove MODULE_ALIAS Shree Ramamoorthy
@ 2024-12-17 20:45 ` Shree Ramamoorthy
  2024-12-18 14:20 ` [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Mark Brown
  4 siblings, 0 replies; 9+ messages in thread
From: Shree Ramamoorthy @ 2024-12-17 20:45 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	broonie, linux-omap, linux-kernel
  Cc: m-leonard, praneeth

This helper function is primarily used by developers for debugging & is
not a standard feature included in other PMIC drivers. The purpose of
debugging function is to check if rdev is determine if the regulator has
been registered prior to requesting a threaded irq. This case is already
handled with the ISERR(rdev) check because the error code is returned.

Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
---
 drivers/regulator/tps65219-regulator.c | 28 --------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index f57a046f9dea..aa65077f9d41 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -287,21 +287,6 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static int tps65219_get_rdev_by_name(const char *regulator_name,
-				     struct regulator_dev *rdevtbl[7],
-				     struct regulator_dev **dev)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
-		if (strcmp(regulator_name, regulators[i].name) == 0) {
-			*dev = rdevtbl[i];
-			return 0;
-		}
-	}
-	return -EINVAL;
-}
-
 static int tps65219_regulator_probe(struct platform_device *pdev)
 {
 	struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
@@ -312,23 +297,18 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
 	int irq;
 	struct tps65219_regulator_irq_data *irq_data;
 	struct tps65219_regulator_irq_type *irq_type;
-	struct regulator_dev *rdevtbl[7];
 
 	config.dev = tps->dev;
 	config.driver_data = tps;
 	config.regmap = tps->regmap;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
-		dev_dbg(tps->dev, "%s regul i= %d START", __func__, i);
 		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
 					       &config);
 		if (IS_ERR(rdev))
 			return dev_err_probe(tps->dev, PTR_ERR(rdev),
 					"Failed to register %s regulator\n",
 					regulators[i].name);
-
-		rdevtbl[i] = rdev;
-		dev_dbg(tps->dev, "%s regul i= %d COMPLETED", __func__, i);
 	}
 
 	irq_data = devm_kmalloc(tps->dev,
@@ -348,14 +328,6 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
 		irq_data[i].dev = tps->dev;
 		irq_data[i].type = irq_type;
 
-		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, &rdev);
-		if (IS_ERR(rdev)) {
-			dev_err(tps->dev, "Failed to get rdev for %s\n",
-				irq_type->regulator_name);
-			return -EINVAL;
-		}
-		irq_data[i].rdev = rdev;
-
 		error = devm_request_threaded_irq(tps->dev, irq, NULL,
 						  tps65219_regulator_irq_handler,
 						  IRQF_ONESHOT,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 2/4] regulator: tps65219: Update driver name
  2024-12-17 20:45 ` [PATCH v1 2/4] regulator: tps65219: Update driver name Shree Ramamoorthy
@ 2024-12-17 21:01   ` Mark Brown
  2024-12-17 21:16     ` Andrew Davis
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2024-12-17 21:01 UTC (permalink / raw)
  To: Shree Ramamoorthy
  Cc: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	linux-omap, linux-kernel, m-leonard, praneeth

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

On Tue, Dec 17, 2024 at 02:45:24PM -0600, Shree Ramamoorthy wrote:

> Follow the same naming convention in tps6594-regulator.c with
> tpsxxx-regulator instead of tpsxxx-pmic.

>  static struct platform_driver tps65219_regulator_driver = {
>  	.driver = {
> -		.name = "tps65219-pmic",
> +		.name = "tps65219-regulator",
>  		.probe_type = PROBE_PREFER_ASYNCHRONOUS,

This isn't just a naming convention thing AFACIT, the MFD registers the
new name so the driver wouldn't previously have loaded.  How did this
ever work?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 2/4] regulator: tps65219: Update driver name
  2024-12-17 21:01   ` Mark Brown
@ 2024-12-17 21:16     ` Andrew Davis
  2024-12-17 21:19       ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Davis @ 2024-12-17 21:16 UTC (permalink / raw)
  To: Mark Brown, Shree Ramamoorthy
  Cc: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	linux-omap, linux-kernel, m-leonard, praneeth

On 12/17/24 3:01 PM, Mark Brown wrote:
> On Tue, Dec 17, 2024 at 02:45:24PM -0600, Shree Ramamoorthy wrote:
> 
>> Follow the same naming convention in tps6594-regulator.c with
>> tpsxxx-regulator instead of tpsxxx-pmic.
> 
>>   static struct platform_driver tps65219_regulator_driver = {
>>   	.driver = {
>> -		.name = "tps65219-pmic",
>> +		.name = "tps65219-regulator",
>>   		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
> 
> This isn't just a naming convention thing AFACIT, the MFD registers the
> new name so the driver wouldn't previously have loaded.  How did this
> ever work?

It matches based on the platform device .id_table[0] which does have
"tps65219-regulator" listed, the driver .name itself is only used
as a last fallback when there is no .id_table.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/platform.c#n1352

Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 2/4] regulator: tps65219: Update driver name
  2024-12-17 21:16     ` Andrew Davis
@ 2024-12-17 21:19       ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2024-12-17 21:19 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Shree Ramamoorthy, aaro.koskinen, andreas, khilman, rogerq, tony,
	lgirdwood, linux-omap, linux-kernel, m-leonard, praneeth

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

On Tue, Dec 17, 2024 at 03:16:44PM -0600, Andrew Davis wrote:
> On 12/17/24 3:01 PM, Mark Brown wrote:

> > This isn't just a naming convention thing AFACIT, the MFD registers the
> > new name so the driver wouldn't previously have loaded.  How did this
> > ever work?

> It matches based on the platform device .id_table[0] which does have
> "tps65219-regulator" listed, the driver .name itself is only used
> as a last fallback when there is no .id_table.

Ah, there's not enough context in the diff to show the ID table.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series
  2024-12-17 20:45 [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Shree Ramamoorthy
                   ` (3 preceding siblings ...)
  2024-12-17 20:45 ` [PATCH v1 4/4] regulator: tps65219: Remove debugging helper function Shree Ramamoorthy
@ 2024-12-18 14:20 ` Mark Brown
  4 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2024-12-18 14:20 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, lgirdwood,
	linux-omap, linux-kernel, Shree Ramamoorthy
  Cc: m-leonard, praneeth

On Tue, 17 Dec 2024 14:45:22 -0600, Shree Ramamoorthy wrote:
> This series is in preparation to add 2 PMIC devices to the TPS65219 driver.
> 
> The changes involve using dev_err_probe() for instances that have a chance
> of returning -EPORBE_DEFER, remove redundant code, and follow other PMIC
> regulator driver naming conventions. The intention is to remove unnecessary
> noise from the new PMIC device patches added to this driver.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/4] regulator: tps65219: Use dev_err_probe() instead of dev_err()
      commit: e7ce0437709552a5f5e577c29f3dfde620153913
[2/4] regulator: tps65219: Update driver name
      commit: 2ef8310c464cac41a024fc6fd2910e51f10a38e7
[3/4] regulator: tps65219: Remove MODULE_ALIAS
      commit: ca321ef98b80eb282a4dcdd5231f666c610b0575
[4/4] regulator: tps65219: Remove debugging helper function
      commit: 64a6b577490c1c71f1a3bbdb3844717815214621

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-12-18 14:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-17 20:45 [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Shree Ramamoorthy
2024-12-17 20:45 ` [PATCH v1 1/4] regulator: tps65219: Use dev_err_probe() instead of dev_err() Shree Ramamoorthy
2024-12-17 20:45 ` [PATCH v1 2/4] regulator: tps65219: Update driver name Shree Ramamoorthy
2024-12-17 21:01   ` Mark Brown
2024-12-17 21:16     ` Andrew Davis
2024-12-17 21:19       ` Mark Brown
2024-12-17 20:45 ` [PATCH v1 3/4] regulator: tps65219: Remove MODULE_ALIAS Shree Ramamoorthy
2024-12-17 20:45 ` [PATCH v1 4/4] regulator: tps65219: Remove debugging helper function Shree Ramamoorthy
2024-12-18 14:20 ` [PATCH v1 0/4] TPS65219 Regulator Driver Cleanup Series Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®