Hello Werner,

I think it's not a good idea to put debuging control flag outside from the 
driver code.
It will be better to add internal debug level or flag by using macro. There are 
lots and
lots of examples in kernel drivers, just grep for "DEBUG" word.

Thank you,
Alexander

On Tue, Jun 14, 2011 at 07:48:48AM -0300, Werner Almesberger wrote:
> The IEEE 802.15.4 protocol stack (net/ieee802154/), the corresponding
> SoftMAC (net/mac802154/), and the driver drivers (drivers/ieee802154/),
> all generate prodigious quantities of debug messages.
> 
> The DEBUG option was hard-coded in the Makefiles. This patch adds
> a config option to each of these subsystems to allow selectively
> disabling the debugging output.
> 
> All three options default to "yes", so existing users should see no
> difference in behaviour.
> 
> Signed-off-by: Werner Almesberger <wer...@almesberger.net>
> 
> ---
>  drivers/ieee802154/Kconfig  |    8 ++++++++
>  drivers/ieee802154/Makefile |    3 ++-
>  net/ieee802154/Kconfig      |    9 +++++++++
>  net/ieee802154/Makefile     |    3 ++-
>  net/mac802154/Kconfig       |    7 +++++++
>  net/mac802154/Makefile      |    3 ++-
>  6 files changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ieee802154/Kconfig b/drivers/ieee802154/Kconfig
> index bd9e81e..99c2ddf 100644
> --- a/drivers/ieee802154/Kconfig
> +++ b/drivers/ieee802154/Kconfig
> @@ -10,6 +10,14 @@ menuconfig IEEE802154_DRIVERS
>         If you say N, all options in this submenu will be skipped and
>         disabled.
>  
> +config IEEE802154_DRIVER_DEBUG
> +     bool "Driver debugging messages"
> +     depends on IEEE802154_DRIVERS
> +     default y
> +     help
> +       Say Y here to make the IEEE 802.15.4 drivers generate extensive
> +       debugging messages.
> +
>  config IEEE802154_FAKEHARD
>       tristate "Fake LR-WPAN driver with several interconnected devices"
>       depends on  IEEE802154_DRIVERS
> diff --git a/drivers/ieee802154/Makefile b/drivers/ieee802154/Makefile
> index cb33815..74338ff 100644
> --- a/drivers/ieee802154/Makefile
> +++ b/drivers/ieee802154/Makefile
> @@ -5,4 +5,5 @@ obj-$(CONFIG_IEEE802154_AT86RF230) += at86rf230.o
>  obj-$(CONFIG_IEEE802154_CC2420) += cc2420.o
>  obj-$(CONFIG_IEEE802154_ADF7242) += adf7242.o
>  
> -EXTRA_CFLAGS += -DDEBUG -DCONFIG_FFD
> +ccflags-$(CONFIG_IEEE802154_DRIVER_DEBUG) += -DDEBUG
> +ccflags-y += -DCONFIG_FFD
> diff --git a/net/ieee802154/Kconfig b/net/ieee802154/Kconfig
> index 1c1de97..5f1a5af 100644
> --- a/net/ieee802154/Kconfig
> +++ b/net/ieee802154/Kconfig
> @@ -10,3 +10,12 @@ config IEEE802154
>  
>         Say Y here to compile LR-WPAN support into the kernel or say M to
>         compile it as modules.
> +
> +config IEEE802154_PROTO_DEBUG
> +     bool "IEEE 802.15.4 protocol stack debugging messages"
> +     depends on IEEE802154
> +     default y
> +     help
> +       Say Y here to make the IEEE 802.15.4 protocol stack generate
> +       extensive debugging messages.
> +
> diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile
> index ce2d335..53f1ec3 100644
> --- a/net/ieee802154/Makefile
> +++ b/net/ieee802154/Makefile
> @@ -2,4 +2,5 @@ obj-$(CONFIG_IEEE802154) +=   ieee802154.o af_802154.o
>  ieee802154-y         := netlink.o nl-mac.o nl-phy.o nl_policy.o wpan-class.o
>  af_802154-y          := af_ieee802154.o raw.o dgram.o
>  
> -ccflags-y += -Wall -DDEBUG
> +ccflags-$(CONFIG_IEEE802154_PROTO_DEBUG) += -DDEBUG
> +ccflags-y += -Wall
> diff --git a/net/mac802154/Kconfig b/net/mac802154/Kconfig
> index 61a3287..32e63bc 100644
> --- a/net/mac802154/Kconfig
> +++ b/net/mac802154/Kconfig
> @@ -15,3 +15,10 @@ config MAC802154
>         say N here. Alternatievly you can say M to compile it as
>         module.
>  
> +config MAC802154_DEBUG
> +     bool "IEEE 802.15.4 SoftMAC debugging messages"
> +     depends on MAC802154
> +     default y
> +     help
> +       Say Y here to make the IEEE 802.15.4 SoftMAC generate extensive
> +       debugging messages.
> diff --git a/net/mac802154/Makefile b/net/mac802154/Makefile
> index 790b97f..d76fabb 100644
> --- a/net/mac802154/Makefile
> +++ b/net/mac802154/Makefile
> @@ -2,4 +2,5 @@ obj-$(CONFIG_MAC802154) +=    mac802154.o
>  mac802154-objs               := rx.o tx.o main.o monitor.o wpan.o mac_cmd.o 
> scan.o mib.o \
>                       beacon.o beacon_hash.o smac.o
>  
> -EXTRA_CFLAGS += -Wall -DDEBUG
> +ccflags-$(CONFIG_MAC802154_DEBUG) += -DDEBUG
> +ccflags-y += -Wall
> -- 
> 1.7.0.4
> 
> 
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Linux-zigbee-devel mailing list
> Linux-zigbee-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to