[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d420f45.1c69fb81.35877.3d86@mx.google.com>
Date: Wed, 31 Jul 2019 14:59:32 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Tri Vo <trong@...roid.com>, gregkh@...uxfoundation.org,
rjw@...ysocki.net, viresh.kumar@...aro.org
Cc: rafael@...nel.org, hridya@...gle.com, sspatil@...gle.com,
kaleshsingh@...gle.com, ravisadineni@...omium.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
kernel-team@...roid.com, Tri Vo <trong@...roid.com>
Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs
Quoting Tri Vo (2019-07-31 14:55:14)
> +/**
> + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs.
> + * @parent: Device given wakeup source is associated with (or NULL if virtual).
> + * @ws: Wakeup source to be added in sysfs.
> + */
> +int wakeup_source_sysfs_add(struct device *parent, struct wakeup_source *ws)
> +{
> + struct device *dev;
> + int id;
> +
> + id = ida_alloc(&wakeup_ida, GFP_KERNEL);
> + if (id < 0)
> + return id;
> + ws->id = id;
> +
> + dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws,
> + wakeup_source_groups, "ws%d",
I thought the name was going to still be 'wakeupN'?
> + ws->id);
> + if (IS_ERR(dev)) {
> + ida_free(&wakeup_ida, ws->id);
> + return PTR_ERR(dev);
> + }
> +
> + ws->dev = dev;
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(wakeup_source_sysfs_add);
> +
> +/**
> + * wakeup_source_sysfs_remove - Remove wakeup_source attributes from sysfs.
> + * @ws: Wakeup source to be removed from sysfs.
> + */
> +void wakeup_source_sysfs_remove(struct wakeup_source *ws)
> +{
> + device_unregister(ws->dev);
> + ida_simple_remove(&wakeup_ida, ws->id);
Should be ida_free()?
> +}
> +EXPORT_SYMBOL_GPL(wakeup_source_sysfs_remove);
> +
> +static int __init wakeup_sources_sysfs_init(void)
> +{
> + wakeup_class = class_create(THIS_MODULE, "wakeup");
> +
> + return PTR_ERR_OR_ZERO(wakeup_class);
> +}
> +
> +postcore_initcall(wakeup_sources_sysfs_init);
Style nitpick: Stick the initcall to the function it calls by dropping
the extra newline between them.
Powered by blists - more mailing lists