Skip to content

Commit

Permalink
wlcore/wl18xx/wl12xx: add version and timestamp strings (INTERNAL)
Browse files Browse the repository at this point in the history
In order to allow better version control, add version
and timestamp strings into the wl12xx module.

These strings will be printed on driver load, and when
reading the driver_state.

(this is not going to work well in compat, because it
copies all the files instead of compiling them in the
original tree, so the version of the compat tree will
appear as the driver version. we can workaround it
with the additional makefile hacks...)

NOTE: I couldn't find how to make one module recompile
when the .h file of another module was changed, so i
just duplicated it for now.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
elp authored and Luciano Coelho committed Jul 18, 2012
1 parent 97a2314 commit c6acf8d
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1 deletion.
9 changes: 9 additions & 0 deletions drivers/net/wireless/ti/wl12xx/Makefile
@@ -1,3 +1,12 @@
wl12xx-objs = main.o cmd.o acx.o debugfs.o

define filechk_version.h
(echo 'static const char *wl12xx_git_head = "$(shell git describe)";')
endef

$(obj)/version.h: .git/HEAD .git/index
@$(call filechk,version.h)

$(obj)/main.c: $(src)/version.h

obj-$(CONFIG_WL12XX) += wl12xx.o
3 changes: 2 additions & 1 deletion drivers/net/wireless/ti/wl12xx/main.c
Expand Up @@ -40,6 +40,7 @@
#include "cmd.h"
#include "acx.h"
#include "debugfs.h"
#include "version.h"

static char *fref_param;
static char *tcxo_param;
Expand Down Expand Up @@ -1694,7 +1695,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
else
wl1271_error("Invalid tcxo parameter %s", tcxo_param);
}

wl1271_info("wl12xx driver version: %s", wl12xx_git_head);
return wlcore_probe(wl, pdev);
}

Expand Down
9 changes: 9 additions & 0 deletions drivers/net/wireless/ti/wl18xx/Makefile
@@ -1,3 +1,12 @@
wl18xx-objs = main.o acx.o tx.o io.o debugfs.o

define filechk_version.h
(echo 'static const char *wl18xx_git_head = "$(shell git describe)";')
endef

$(obj)/version.h: .git/HEAD .git/index
@$(call filechk,version.h)

$(obj)/main.c: $(src)/version.h

obj-$(CONFIG_WL18XX) += wl18xx.o
2 changes: 2 additions & 0 deletions drivers/net/wireless/ti/wl18xx/main.c
Expand Up @@ -40,6 +40,7 @@
#include "wl18xx.h"
#include "io.h"
#include "debugfs.h"
#include "version.h"

#define WL18XX_RX_CHECKSUM_MASK 0x40

Expand Down Expand Up @@ -1526,6 +1527,7 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)

wl->enable_11a = enable_11a_param;

wl1271_info("wl18xx driver version: %s", wl18xx_git_head);
return wlcore_probe(wl, pdev);

out_free:
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/wireless/ti/wlcore/Makefile
@@ -1,6 +1,16 @@
wlcore-objs = main.o cmd.o io.o event.o tx.o rx.o ps.o acx.o \
boot.o init.o debugfs.o scan.o

define filechk_version.h
(echo 'static const char *wlcore_timestamp = "$(shell date)";'; \
echo 'static const char *wlcore_git_head = "$(shell git describe)";')
endef

$(obj)/version.h: .git/HEAD .git/index
@$(call filechk,version.h)

$(obj)/main.c: $(src)/version.h

wlcore_spi-objs = spi.o
wlcore_sdio-objs = sdio.o

Expand Down
8 changes: 8 additions & 0 deletions drivers/net/wireless/ti/wlcore/debugfs.c
Expand Up @@ -34,6 +34,7 @@
#include "io.h"
#include "tx.h"
#include "hw_ops.h"
#include "version.h"

/* ms */
#define WL1271_DEBUGFS_STATS_LIFETIME 1000
Expand Down Expand Up @@ -447,12 +448,19 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
(res += scnprintf(buf + res, DRIVER_STATE_BUF_LEN - res,\
#x " = " fmt "\n", wl->x))

#define DRIVER_STATE_PRINT_GENERIC(x, fmt, args...) \
(res += scnprintf(buf + res, DRIVER_STATE_BUF_LEN - res,\
#x " = " fmt "\n", args))

#define DRIVER_STATE_PRINT_LONG(x) DRIVER_STATE_PRINT(x, "%ld")
#define DRIVER_STATE_PRINT_INT(x) DRIVER_STATE_PRINT(x, "%d")
#define DRIVER_STATE_PRINT_STR(x) DRIVER_STATE_PRINT(x, "%s")
#define DRIVER_STATE_PRINT_LHEX(x) DRIVER_STATE_PRINT(x, "0x%lx")
#define DRIVER_STATE_PRINT_HEX(x) DRIVER_STATE_PRINT(x, "0x%x")

DRIVER_STATE_PRINT_GENERIC(version, "%s", wlcore_git_head);
DRIVER_STATE_PRINT_GENERIC(timestamp, "%s", wlcore_timestamp);

DRIVER_STATE_PRINT_INT(tx_blocks_available);
DRIVER_STATE_PRINT_INT(tx_allocated_blocks);
DRIVER_STATE_PRINT_INT(tx_allocated_pkts[0]);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/ti/wlcore/main.c
Expand Up @@ -50,6 +50,7 @@
#include "testmode.h"
#include "scan.h"
#include "hw_ops.h"
#include "version.h"

#define WL1271_BOOT_RETRIES 3

Expand Down Expand Up @@ -5656,6 +5657,8 @@ int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev)
goto out_hw_pg_ver;
}

wl1271_info("driver version: %s", wlcore_git_head);
wl1271_info("compilation time: %s", wlcore_timestamp);
goto out;

out_hw_pg_ver:
Expand Down

0 comments on commit c6acf8d

Please sign in to comment.