mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: userspace-consumer: Drop event support for this cycle
@ 2023-08-24 22:48 Mark Brown
  2023-08-25  9:13 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2023-08-24 22:48 UTC (permalink / raw)
  To: Liam Girdwood, Naresh Solanki, Zev Weiss; +Cc: linux-kernel, Mark Brown

Drop commit 22475bcc2083 ("regulator: userspace-consumer: Add regulator
event support") since Zev Weiss points out that it leaks the constants
we use for notifications out as ABI which isn't ideal, we should have
something more abstracted there.  There's a definite need for this
feature but it needs some more work on the interface.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/userspace-consumer.c | 52 +---------------------------------
 1 file changed, 1 insertion(+), 51 deletions(-)

diff --git a/drivers/regulator/userspace-consumer.c b/drivers/regulator/userspace-consumer.c
index a0b980022993..97f075ed68c9 100644
--- a/drivers/regulator/userspace-consumer.c
+++ b/drivers/regulator/userspace-consumer.c
@@ -29,10 +29,6 @@ struct userspace_consumer_data {
 
 	int num_supplies;
 	struct regulator_bulk_data *supplies;
-
-	struct kobject *kobj;
-	struct notifier_block nb;
-	unsigned long events;
 };
 
 static ssize_t name_show(struct device *dev,
@@ -93,30 +89,12 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEFINE_MUTEX(events_lock);
-
-static ssize_t events_show(struct device *dev,
-			   struct device_attribute *attr, char *buf)
-{
-	struct userspace_consumer_data *data = dev_get_drvdata(dev);
-	unsigned long e;
-
-	mutex_lock(&events_lock);
-	e = data->events;
-	data->events = 0;
-	mutex_unlock(&events_lock);
-
-	return sprintf(buf, "0x%lx\n", e);
-}
-
 static DEVICE_ATTR_RO(name);
 static DEVICE_ATTR_RW(state);
-static DEVICE_ATTR_RO(events);
 
 static struct attribute *attributes[] = {
 	&dev_attr_name.attr,
 	&dev_attr_state.attr,
-	&dev_attr_events.attr,
 	NULL,
 };
 
@@ -137,28 +115,12 @@ static const struct attribute_group attr_group = {
 	.is_visible =  attr_visible,
 };
 
-static int regulator_userspace_notify(struct notifier_block *nb,
-				      unsigned long event,
-				      void *ignored)
-{
-	struct userspace_consumer_data *data =
-		container_of(nb, struct userspace_consumer_data, nb);
-
-	mutex_lock(&events_lock);
-	data->events |= event;
-	mutex_unlock(&events_lock);
-
-	sysfs_notify(data->kobj, NULL, dev_attr_events.attr.name);
-
-	return NOTIFY_OK;
-}
-
 static int regulator_userspace_consumer_probe(struct platform_device *pdev)
 {
 	struct regulator_userspace_consumer_data tmpdata;
 	struct regulator_userspace_consumer_data *pdata;
 	struct userspace_consumer_data *drvdata;
-	int i, ret;
+	int ret;
 
 	pdata = dev_get_platdata(&pdev->dev);
 	if (!pdata) {
@@ -191,7 +153,6 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev)
 	drvdata->num_supplies = pdata->num_supplies;
 	drvdata->supplies = pdata->supplies;
 	drvdata->no_autoswitch = pdata->no_autoswitch;
-	drvdata->kobj = &pdev->dev.kobj;
 
 	mutex_init(&drvdata->lock);
 
@@ -225,13 +186,6 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev)
 	}
 	drvdata->enabled = !!ret;
 
-	drvdata->nb.notifier_call = regulator_userspace_notify;
-	for (i = 0; i < drvdata->num_supplies; i++) {
-		ret = devm_regulator_register_notifier(drvdata->supplies[i].consumer, &drvdata->nb);
-		if (ret)
-			goto err_enable;
-	}
-
 	return 0;
 
 err_enable:
@@ -243,10 +197,6 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev)
 static int regulator_userspace_consumer_remove(struct platform_device *pdev)
 {
 	struct userspace_consumer_data *data = platform_get_drvdata(pdev);
-	int i;
-
-	for (i = 0; i < data->num_supplies; i++)
-		devm_regulator_unregister_notifier(data->supplies[i].consumer, &data->nb);
 
 	sysfs_remove_group(&pdev->dev.kobj, &attr_group);
 

---
base-commit: 21cc7f816c670423a9dae06ad7de5fbc40da97c7
change-id: 20230824-regulator-remove-status-sysfs-e27d4618cd6a

Best regards,
-- 
Mark Brown <broonie@kernel.org>


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

* Re: [PATCH] regulator: userspace-consumer: Drop event support for this cycle
  2023-08-24 22:48 [PATCH] regulator: userspace-consumer: Drop event support for this cycle Mark Brown
@ 2023-08-25  9:13 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-08-25  9:13 UTC (permalink / raw)
  To: Liam Girdwood, Naresh Solanki, Zev Weiss, Mark Brown; +Cc: linux-kernel

On Thu, 24 Aug 2023 23:48:22 +0100, Mark Brown wrote:
> Drop commit 22475bcc2083 ("regulator: userspace-consumer: Add regulator
> event support") since Zev Weiss points out that it leaks the constants
> we use for notifications out as ABI which isn't ideal, we should have
> something more abstracted there.  There's a definite need for this
> feature but it needs some more work on the interface.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] regulator: userspace-consumer: Drop event support for this cycle
      commit: b96c22476ff4bc3459933f87ba52cbb7910ffc6b

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] 2+ messages in thread

end of thread, other threads:[~2023-08-25  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-24 22:48 [PATCH] regulator: userspace-consumer: Drop event support for this cycle Mark Brown
2023-08-25  9:13 ` 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®