* [PATCH net-next] net: wwan: core: Add WWAN device index sysfs attribute
@ 2021-05-25 16:31 Loic Poulain
2021-05-25 23:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2021-05-25 16:31 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, m.chetan.kumar, Loic Poulain
Add index sysfs attribute for WWAN devices. This index is used to
uniquely indentify and reference a WWAN device. 'index' is the
attribute name that other device classes use (wireless, v4l2-dev,
rfkill, etc...).
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
drivers/net/wwan/wwan_core.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 92a8a6f..6e8f19c 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -63,6 +63,20 @@ struct wwan_port {
wait_queue_head_t waitqueue;
};
+static ssize_t index_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct wwan_device *wwan = to_wwan_dev(dev);
+
+ return sprintf(buf, "%d\n", wwan->id);
+}
+static DEVICE_ATTR_RO(index);
+
+static struct attribute *wwan_dev_attrs[] = {
+ &dev_attr_index.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(wwan_dev);
+
static void wwan_dev_destroy(struct device *dev)
{
struct wwan_device *wwandev = to_wwan_dev(dev);
@@ -74,6 +88,7 @@ static void wwan_dev_destroy(struct device *dev)
static const struct device_type wwan_dev_type = {
.name = "wwan_dev",
.release = wwan_dev_destroy,
+ .groups = wwan_dev_groups,
};
static int wwan_dev_parent_match(struct device *dev, const void *parent)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: wwan: core: Add WWAN device index sysfs attribute
2021-05-25 16:31 [PATCH net-next] net: wwan: core: Add WWAN device index sysfs attribute Loic Poulain
@ 2021-05-25 23:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-25 23:00 UTC (permalink / raw)
To: Loic Poulain; +Cc: davem, kuba, netdev, m.chetan.kumar
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Tue, 25 May 2021 18:31:18 +0200 you wrote:
> Add index sysfs attribute for WWAN devices. This index is used to
> uniquely indentify and reference a WWAN device. 'index' is the
> attribute name that other device classes use (wireless, v4l2-dev,
> rfkill, etc...).
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
>
> [...]
Here is the summary with links:
- [net-next] net: wwan: core: Add WWAN device index sysfs attribute
https://git.kernel.org/netdev/net-next/c/e4e92ee78702
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-25 23:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 16:31 [PATCH net-next] net: wwan: core: Add WWAN device index sysfs attribute Loic Poulain
2021-05-25 23:00 ` patchwork-bot+netdevbpf
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.