From: Ingo Oeser <netdev@axxeo.de>
To: Samuel Ortiz <samuel@sortiz.org>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, irda-users@lists.sourceforge.net,
Jean Tourrilhes <jt@hpl.hp.com>
Subject: Re: [PATCH 3/6] IrDA: IrLAP raw mode
Date: Fri, 16 Mar 2007 11:02:04 +0100 [thread overview]
Message-ID: <200703161102.06417.netdev@axxeo.de> (raw)
In-Reply-To: <20070314192331.GD3397@sortiz.org>
Hi Samuel,
Samuel Ortiz wrote:
> This patch allows us to bypass the IrDA stack down to the IrLAP level.
> Sending and receiving frames is done through a character device.
> This is useful for e.g. doing real IrDA sniffing, testing external IrDA
> stacks and for Lirc (once I will add the framing disabling switch).
Nice!
> --- /dev/null
> +++ b/include/net/irda/irlap_raw.h
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2007 Samuel Ortiz (samuel@sortiz.org)
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation, version 2.
> + *
> + */
> +
> +#ifndef _IRLAP_RAW_H
> +#define _IRLAP_RAW_H
> +
> +#ifdef CONFIG_IRDA_RAW
> +
> +int irlap_raw_recv_frame(struct sk_buff *skb, struct net_device *dev);
> +int irlap_raw_register_device(struct net_device * dev);
> +int irlap_raw_unregister_device(struct net_device * dev);
> +
> +#else
> +
> +#define irlap_raw_recv_frame(skbuff, netdev)
> +#define irlap_raw_register_device(netdev)
> +#define irlap_raw_unregister_device(netdev)
This stuff is usually done this way (functions, which just check arguments and do nothing):
static inline int irlap_raw_recv_frame(struct sk_buff *skb, struct net_device *dev)
{
if (skb == NULL)
return -EINVAL;
if (dev->atalk_ptr == NULL)
return -ENODEV;
return 0;
}
static inline int irlap_raw_register_device(struct net_device * dev)
{
if (dev == NULL)
return -ENODEV;
return 0;
}
statice inline int irlap_raw_unregister_device(struct net_device * dev)
{
if (dev == NULL)
return -ENODEV;
return 0;
}
> --- a/net/irda/irlap_event.c
> +++ b/net/irda/irlap_event.c
> @@ -241,6 +241,11 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
> if (!self || self->magic != LAP_MAGIC)
> return;
>
> + if (self->raw_mode)
> + return;
> +#endif
> +
I would suggest a small helper function here, which compiles into a constant,
if raw_mode is not compiled in.
like
#ifdef CONFIG_IRDA_RAW
static inline int irlap_raw_mod(struct irlap_cb *self)
{
return self->raw_mode;
}
#else
static inline int irlap_raw_mod(struct irlap_cb *self)
{
return 0;
}
#endif
Best Regards
Ingo Oeser
next prev parent reply other threads:[~2007-03-16 10:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-14 19:23 [PATCH 3/6] IrDA: IrLAP raw mode Samuel Ortiz
2007-03-16 10:02 ` Ingo Oeser [this message]
[not found] ` <200703161102.06417.netdev-BkyiQQGWkgE@public.gmane.org>
2007-03-16 20:06 ` Samuel Ortiz
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=200703161102.06417.netdev@axxeo.de \
--to=netdev@axxeo.de \
--cc=davem@davemloft.net \
--cc=irda-users@lists.sourceforge.net \
--cc=jt@hpl.hp.com \
--cc=netdev@vger.kernel.org \
--cc=samuel@sortiz.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.