aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/debugfs.c
diff options
context:
space:
mode:
authorTony Breeds <tony@bakeyournoodle.com>2007-03-08 21:11:46 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:00 -0400
commitd2f11e0991e3794f11d851b7ee0d98e064b10333 (patch)
treecfb44a82f7a8eea65fa98a22803928ccc8592604 /drivers/net/wireless/libertas/debugfs.c
parentaf5b5c9aa92ced95fca509e775aec90933f8959d (diff)
[PATCH] libertas: use standard kernel macros
Cleanup drivers/net/wireless/libertas/debugfs.c to use standard kernel macros and functions. Signed-off-by: Tony Breeds <tony@bakeyournoodle.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r--drivers/net/wireless/libertas/debugfs.c41
1 files changed, 4 insertions, 37 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 3ad1e0339ed0..51dfd202f558 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -1772,8 +1772,8 @@ void libertas_debugfs_remove_one(wlan_private *priv)
1772 1772
1773/* debug entry */ 1773/* debug entry */
1774 1774
1775#define item_size(n) (sizeof ((wlan_adapter *)0)->n) 1775#define item_size(n) (FIELD_SIZEOF(wlan_adapter, n))
1776#define item_addr(n) ((u32) &((wlan_adapter *)0)->n) 1776#define item_addr(n) (offsetof(wlan_adapter, n))
1777 1777
1778struct debug_data { 1778struct debug_data {
1779 char name[32]; 1779 char name[32];
@@ -1789,40 +1789,7 @@ static struct debug_data items[] = {
1789 {"psstate", item_size(psstate), item_addr(psstate)}, 1789 {"psstate", item_size(psstate), item_addr(psstate)},
1790}; 1790};
1791 1791
1792static int num_of_items = sizeof(items) / sizeof(items[0]); 1792static int num_of_items = ARRAY_SIZE(items);
1793
1794/**
1795 * @brief convert string to number
1796 *
1797 * @param s pointer to numbered string
1798 * @return converted number from string s
1799 */
1800static int string_to_number(char *s)
1801{
1802 int r = 0;
1803 int base = 0;
1804
1805 if ((strncmp(s, "0x", 2) == 0) || (strncmp(s, "0X", 2) == 0))
1806 base = 16;
1807 else
1808 base = 10;
1809
1810 if (base == 16)
1811 s += 2;
1812
1813 for (s = s; *s != 0; s++) {
1814 if ((*s >= 48) && (*s <= 57))
1815 r = (r * base) + (*s - 48);
1816 else if ((*s >= 65) && (*s <= 70))
1817 r = (r * base) + (*s - 55);
1818 else if ((*s >= 97) && (*s <= 102))
1819 r = (r * base) + (*s - 87);
1820 else
1821 break;
1822 }
1823
1824 return r;
1825}
1826 1793
1827/** 1794/**
1828 * @brief proc read function 1795 * @brief proc read function
@@ -1912,7 +1879,7 @@ static int wlan_debugfs_write(struct file *f, const char __user *buf,
1912 if (!p2) 1879 if (!p2)
1913 break; 1880 break;
1914 p2++; 1881 p2++;
1915 r = string_to_number(p2); 1882 r = simple_strtoul(p2, NULL, 0);
1916 if (d[i].size == 1) 1883 if (d[i].size == 1)
1917 *((u8 *) d[i].addr) = (u8) r; 1884 *((u8 *) d[i].addr) = (u8) r;
1918 else if (d[i].size == 2) 1885 else if (d[i].size == 2)