All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator
@ 2019-04-29 11:35 Axel Lin
  2019-04-29 11:35 ` [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Axel Lin @ 2019-04-29 11:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: Pawel Moll, Sudeep Holla, Lorenzo Pieralisi, Liam Girdwood,
	linux-kernel, Axel Lin

The *regdev and *regmap can be replaced by local variables in probe().
Only desc of struct vexpress_regulator is really need, so just use
struct regulator_desc directly and remove struct vexpress_regulator.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/vexpress-regulator.c | 53 +++++++++++---------------
 1 file changed, 22 insertions(+), 31 deletions(-)

diff --git a/drivers/regulator/vexpress-regulator.c b/drivers/regulator/vexpress-regulator.c
index ca4230fe9e77..a15a1319436a 100644
--- a/drivers/regulator/vexpress-regulator.c
+++ b/drivers/regulator/vexpress-regulator.c
@@ -23,17 +23,10 @@
 #include <linux/regulator/of_regulator.h>
 #include <linux/vexpress.h>
 
-struct vexpress_regulator {
-	struct regulator_desc desc;
-	struct regulator_dev *regdev;
-	struct regmap *regmap;
-};
-
 static int vexpress_regulator_get_voltage(struct regulator_dev *regdev)
 {
-	struct vexpress_regulator *reg = rdev_get_drvdata(regdev);
-	u32 uV;
-	int err = regmap_read(reg->regmap, 0, &uV);
+	unsigned int uV;
+	int err = regmap_read(regdev->regmap, 0, &uV);
 
 	return err ? err : uV;
 }
@@ -41,9 +34,7 @@ static int vexpress_regulator_get_voltage(struct regulator_dev *regdev)
 static int vexpress_regulator_set_voltage(struct regulator_dev *regdev,
 		int min_uV, int max_uV, unsigned *selector)
 {
-	struct vexpress_regulator *reg = rdev_get_drvdata(regdev);
-
-	return regmap_write(reg->regmap, 0, min_uV);
+	return regmap_write(regdev->regmap, 0, min_uV);
 }
 
 static const struct regulator_ops vexpress_regulator_ops_ro = {
@@ -57,44 +48,44 @@ static const struct regulator_ops vexpress_regulator_ops = {
 
 static int vexpress_regulator_probe(struct platform_device *pdev)
 {
-	struct vexpress_regulator *reg;
+	struct regulator_desc *desc;
 	struct regulator_init_data *init_data;
 	struct regulator_config config = { };
+	struct regulator_dev *rdev;
+	struct regmap *regmap;
 
-	reg = devm_kzalloc(&pdev->dev, sizeof(*reg), GFP_KERNEL);
-	if (!reg)
+	desc = devm_kzalloc(&pdev->dev, sizeof(*desc), GFP_KERNEL);
+	if (!desc)
 		return -ENOMEM;
 
-	reg->regmap = devm_regmap_init_vexpress_config(&pdev->dev);
-	if (IS_ERR(reg->regmap))
-		return PTR_ERR(reg->regmap);
+	regmap = devm_regmap_init_vexpress_config(&pdev->dev);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
 
-	reg->desc.name = dev_name(&pdev->dev);
-	reg->desc.type = REGULATOR_VOLTAGE;
-	reg->desc.owner = THIS_MODULE;
-	reg->desc.continuous_voltage_range = true;
+	desc->name = dev_name(&pdev->dev);
+	desc->type = REGULATOR_VOLTAGE;
+	desc->owner = THIS_MODULE;
+	desc->continuous_voltage_range = true;
 
 	init_data = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node,
-					       &reg->desc);
+					       desc);
 	if (!init_data)
 		return -EINVAL;
 
 	init_data->constraints.apply_uV = 0;
 	if (init_data->constraints.min_uV && init_data->constraints.max_uV)
-		reg->desc.ops = &vexpress_regulator_ops;
+		desc->ops = &vexpress_regulator_ops;
 	else
-		reg->desc.ops = &vexpress_regulator_ops_ro;
+		desc->ops = &vexpress_regulator_ops_ro;
 
+	config.regmap = regmap;
 	config.dev = &pdev->dev;
 	config.init_data = init_data;
-	config.driver_data = reg;
 	config.of_node = pdev->dev.of_node;
 
-	reg->regdev = devm_regulator_register(&pdev->dev, &reg->desc, &config);
-	if (IS_ERR(reg->regdev))
-		return PTR_ERR(reg->regdev);
-
-	platform_set_drvdata(pdev, reg);
+	rdev = devm_regulator_register(&pdev->dev, desc, &config);
+	if (IS_ERR(rdev))
+		return PTR_ERR(rdev);
 
 	return 0;
 }
-- 
2.20.1


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

* [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier
  2019-04-29 11:35 [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Axel Lin
@ 2019-04-29 11:35 ` Axel Lin
  2019-04-29 14:17   ` Sudeep Holla
  2019-05-02  2:18   ` Applied "regulator: vexpress: Switch to SPDX identifier" to the regulator tree Mark Brown
  2019-04-29 14:16 ` [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Sudeep Holla
  2019-05-02  2:18 ` Applied "regulator: vexpress: Get rid of struct vexpress_regulator" to the regulator tree Mark Brown
  2 siblings, 2 replies; 6+ messages in thread
From: Axel Lin @ 2019-04-29 11:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: Pawel Moll, Sudeep Holla, Lorenzo Pieralisi, Liam Girdwood,
	linux-kernel, Axel Lin

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/vexpress-regulator.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/regulator/vexpress-regulator.c b/drivers/regulator/vexpress-regulator.c
index a15a1319436a..1235f46e633e 100644
--- a/drivers/regulator/vexpress-regulator.c
+++ b/drivers/regulator/vexpress-regulator.c
@@ -1,15 +1,6 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * Copyright (C) 2012 ARM Limited
- */
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2012 ARM Limited
 
 #define DRVNAME "vexpress-regulator"
 #define pr_fmt(fmt) DRVNAME ": " fmt
-- 
2.20.1


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

* Re: [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator
  2019-04-29 11:35 [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Axel Lin
  2019-04-29 11:35 ` [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier Axel Lin
@ 2019-04-29 14:16 ` Sudeep Holla
  2019-05-02  2:18 ` Applied "regulator: vexpress: Get rid of struct vexpress_regulator" to the regulator tree Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2019-04-29 14:16 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Pawel Moll, Lorenzo Pieralisi, Liam Girdwood,
	linux-kernel, Sudeep Holla

Hi Axel,

On Mon, Apr 29, 2019 at 07:35:41PM +0800, Axel Lin wrote:
> The *regdev and *regmap can be replaced by local variables in probe().
> Only desc of struct vexpress_regulator is really need, so just use
> struct regulator_desc directly and remove struct vexpress_regulator.
>

Looks good, thanks for the clean up.

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep

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

* Re: [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier
  2019-04-29 11:35 ` [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier Axel Lin
@ 2019-04-29 14:17   ` Sudeep Holla
  2019-05-02  2:18   ` Applied "regulator: vexpress: Switch to SPDX identifier" to the regulator tree Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2019-04-29 14:17 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Pawel Moll, Lorenzo Pieralisi, Liam Girdwood,
	linux-kernel, Sudeep Holla

On Mon, Apr 29, 2019 at 07:35:42PM +0800, Axel Lin wrote:

I prefer to have a line of description, worst case repeat the subject,
but don't leave empty.

With that:

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep

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

* Applied "regulator: vexpress: Switch to SPDX identifier" to the regulator tree
  2019-04-29 11:35 ` [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier Axel Lin
  2019-04-29 14:17   ` Sudeep Holla
@ 2019-05-02  2:18   ` Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2019-05-02  2:18 UTC (permalink / raw)
  To: Axel Lin
  Cc: Liam Girdwood, linux-kernel, Lorenzo Pieralisi, Mark Brown,
	Pawel Moll, Sudeep Holla

The patch

   regulator: vexpress: Switch to SPDX identifier

has been applied to the regulator tree at

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

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

From c5e911add161f356aa5adf6cca33d02946006053 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@ingics.com>
Date: Mon, 29 Apr 2019 19:35:42 +0800
Subject: [PATCH] regulator: vexpress: Switch to SPDX identifier

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/vexpress-regulator.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/regulator/vexpress-regulator.c b/drivers/regulator/vexpress-regulator.c
index a15a1319436a..1235f46e633e 100644
--- a/drivers/regulator/vexpress-regulator.c
+++ b/drivers/regulator/vexpress-regulator.c
@@ -1,15 +1,6 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * Copyright (C) 2012 ARM Limited
- */
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2012 ARM Limited
 
 #define DRVNAME "vexpress-regulator"
 #define pr_fmt(fmt) DRVNAME ": " fmt
-- 
2.20.1


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

* Applied "regulator: vexpress: Get rid of struct vexpress_regulator" to the regulator tree
  2019-04-29 11:35 [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Axel Lin
  2019-04-29 11:35 ` [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier Axel Lin
  2019-04-29 14:16 ` [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Sudeep Holla
@ 2019-05-02  2:18 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2019-05-02  2:18 UTC (permalink / raw)
  To: Axel Lin
  Cc: Liam Girdwood, linux-kernel, Lorenzo Pieralisi, Mark Brown,
	Pawel Moll, Sudeep Holla

The patch

   regulator: vexpress: Get rid of struct vexpress_regulator

has been applied to the regulator tree at

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

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

From eeb1b2355a6f06c4995ce282e247afffb946d983 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@ingics.com>
Date: Mon, 29 Apr 2019 19:35:41 +0800
Subject: [PATCH] regulator: vexpress: Get rid of struct vexpress_regulator

The *regdev and *regmap can be replaced by local variables in probe().
Only desc of struct vexpress_regulator is really need, so just use
struct regulator_desc directly and remove struct vexpress_regulator.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/vexpress-regulator.c | 53 +++++++++++---------------
 1 file changed, 22 insertions(+), 31 deletions(-)

diff --git a/drivers/regulator/vexpress-regulator.c b/drivers/regulator/vexpress-regulator.c
index ca4230fe9e77..a15a1319436a 100644
--- a/drivers/regulator/vexpress-regulator.c
+++ b/drivers/regulator/vexpress-regulator.c
@@ -23,17 +23,10 @@
 #include <linux/regulator/of_regulator.h>
 #include <linux/vexpress.h>
 
-struct vexpress_regulator {
-	struct regulator_desc desc;
-	struct regulator_dev *regdev;
-	struct regmap *regmap;
-};
-
 static int vexpress_regulator_get_voltage(struct regulator_dev *regdev)
 {
-	struct vexpress_regulator *reg = rdev_get_drvdata(regdev);
-	u32 uV;
-	int err = regmap_read(reg->regmap, 0, &uV);
+	unsigned int uV;
+	int err = regmap_read(regdev->regmap, 0, &uV);
 
 	return err ? err : uV;
 }
@@ -41,9 +34,7 @@ static int vexpress_regulator_get_voltage(struct regulator_dev *regdev)
 static int vexpress_regulator_set_voltage(struct regulator_dev *regdev,
 		int min_uV, int max_uV, unsigned *selector)
 {
-	struct vexpress_regulator *reg = rdev_get_drvdata(regdev);
-
-	return regmap_write(reg->regmap, 0, min_uV);
+	return regmap_write(regdev->regmap, 0, min_uV);
 }
 
 static const struct regulator_ops vexpress_regulator_ops_ro = {
@@ -57,44 +48,44 @@ static const struct regulator_ops vexpress_regulator_ops = {
 
 static int vexpress_regulator_probe(struct platform_device *pdev)
 {
-	struct vexpress_regulator *reg;
+	struct regulator_desc *desc;
 	struct regulator_init_data *init_data;
 	struct regulator_config config = { };
+	struct regulator_dev *rdev;
+	struct regmap *regmap;
 
-	reg = devm_kzalloc(&pdev->dev, sizeof(*reg), GFP_KERNEL);
-	if (!reg)
+	desc = devm_kzalloc(&pdev->dev, sizeof(*desc), GFP_KERNEL);
+	if (!desc)
 		return -ENOMEM;
 
-	reg->regmap = devm_regmap_init_vexpress_config(&pdev->dev);
-	if (IS_ERR(reg->regmap))
-		return PTR_ERR(reg->regmap);
+	regmap = devm_regmap_init_vexpress_config(&pdev->dev);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
 
-	reg->desc.name = dev_name(&pdev->dev);
-	reg->desc.type = REGULATOR_VOLTAGE;
-	reg->desc.owner = THIS_MODULE;
-	reg->desc.continuous_voltage_range = true;
+	desc->name = dev_name(&pdev->dev);
+	desc->type = REGULATOR_VOLTAGE;
+	desc->owner = THIS_MODULE;
+	desc->continuous_voltage_range = true;
 
 	init_data = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node,
-					       &reg->desc);
+					       desc);
 	if (!init_data)
 		return -EINVAL;
 
 	init_data->constraints.apply_uV = 0;
 	if (init_data->constraints.min_uV && init_data->constraints.max_uV)
-		reg->desc.ops = &vexpress_regulator_ops;
+		desc->ops = &vexpress_regulator_ops;
 	else
-		reg->desc.ops = &vexpress_regulator_ops_ro;
+		desc->ops = &vexpress_regulator_ops_ro;
 
+	config.regmap = regmap;
 	config.dev = &pdev->dev;
 	config.init_data = init_data;
-	config.driver_data = reg;
 	config.of_node = pdev->dev.of_node;
 
-	reg->regdev = devm_regulator_register(&pdev->dev, &reg->desc, &config);
-	if (IS_ERR(reg->regdev))
-		return PTR_ERR(reg->regdev);
-
-	platform_set_drvdata(pdev, reg);
+	rdev = devm_regulator_register(&pdev->dev, desc, &config);
+	if (IS_ERR(rdev))
+		return PTR_ERR(rdev);
 
 	return 0;
 }
-- 
2.20.1


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

end of thread, other threads:[~2019-05-02  2:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 11:35 [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Axel Lin
2019-04-29 11:35 ` [PATCH 2/2] regulator: vexpress: Switch to SPDX identifier Axel Lin
2019-04-29 14:17   ` Sudeep Holla
2019-05-02  2:18   ` Applied "regulator: vexpress: Switch to SPDX identifier" to the regulator tree Mark Brown
2019-04-29 14:16 ` [PATCH 1/2] regulator: vexpress: Get rid of struct vexpress_regulator Sudeep Holla
2019-05-02  2:18 ` Applied "regulator: vexpress: Get rid of struct vexpress_regulator" to the regulator tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.