From: Gery Kahn <geryk@ti.com>
To: <linux-wireless@vger.kernel.org>
Cc: Luciano Coelho <coelho@ti.com>
Subject: [PATCH 2/2] wl12xx Export chip id to sysfs
Date: Thu, 14 Jul 2011 15:47:53 +0300 [thread overview]
Message-ID: <1310647673-10144-2-git-send-email-geryk@ti.com> (raw)
In-Reply-To: <1310647673-10144-1-git-send-email-geryk@ti.com>
Export the chip id to userspace. This helps to change application behavior
according to architecture of the wl12xx chip.
Signed-off-by: Gery Kahn <geryk@ti.com>
---
drivers/net/wireless/wl12xx/main.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index d65fef6..13a6cfa 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -4437,6 +4437,25 @@ static ssize_t wl1271_sysfs_show_hw_pg_ver(struct device *dev,
static DEVICE_ATTR(hw_pg_ver, S_IRUGO,
wl1271_sysfs_show_hw_pg_ver, NULL);
+static ssize_t wl1271_sysfs_show_chip_id(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct wl1271 *wl = dev_get_drvdata(dev);
+ ssize_t len;
+
+ len = PAGE_SIZE;
+
+ mutex_lock(&wl->mutex);
+ len = snprintf(buf, len, "0x%x\n", wl->chip.id);
+ mutex_unlock(&wl->mutex);
+
+ return len;
+}
+
+static DEVICE_ATTR(chip_id, S_IRUGO,
+ wl1271_sysfs_show_chip_id, NULL);
+
static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
@@ -4803,8 +4822,17 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
goto err_hw_pg_ver;
}
+ ret = device_create_file(&wl->plat_dev->dev, &dev_attr_chip_id);
+ if (ret < 0) {
+ wl1271_error("failed to create sysfs file chip_id");
+ goto err_fwlog_attr;
+ }
+
return hw;
+err_fwlog_attr:
+ device_remove_bin_file(&wl->plat_dev->dev, &fwlog_attr);
+
err_hw_pg_ver:
device_remove_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
@@ -4849,6 +4877,8 @@ int wl1271_free_hw(struct wl1271 *wl)
device_remove_bin_file(&wl->plat_dev->dev, &fwlog_attr);
+ device_remove_file(&wl->plat_dev->dev, &dev_attr_chip_id);
+
device_remove_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
--
1.7.0.4
next prev parent reply other threads:[~2011-07-14 12:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-14 12:47 [PATCH 1/2] wl12xx: Fix for PG version and sysfs files Gery Kahn
2011-07-14 12:47 ` Gery Kahn [this message]
2011-07-15 10:56 ` [PATCH 2/2] wl12xx Export chip id to sysfs Kalle Valo
2011-07-17 8:16 ` Kahn, Gery
2011-07-17 12:51 ` Kahn, Gery
2011-07-17 21:45 ` Kalle Valo
2011-07-18 7:18 ` Kalle Valo
2011-07-18 7:21 ` Kalle Valo
2011-07-18 8:39 ` Kahn, Gery
2011-07-18 8:47 ` Kahn, Gery
2011-07-18 9:36 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310647673-10144-2-git-send-email-geryk@ti.com \
--to=geryk@ti.com \
--cc=coelho@ti.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.