[PATCH] libertas: make mesh code configurable

Holger Schurig hs4233 at mail.mn-solutions.de
Fri Jun 20 03:06:59 EDT 2008


> Especially for the mesh_dev thing, you should probably have a
> static inline that returns priv->mesh_dev (mesh case) and NULL
> (non-mesh case) and rely on the compiler to elide as much code
> as possible.
>
> E.g. this:
> > +#ifdef CONFIG_LIBERTAS_MESH
> >  	if (priv->mesh_dev && (priv->mesh_connect_status ==
> > LBS_CONNECTED)) netif_wake_queue(priv->mesh_dev);
> > +#endif
>
> wouldn't then need an ifdef.

Ah, I thought that the compiler would barf about the
priv->mesh_connect_status, because this is no longer in
struct lbs_private.

So I tried your suggestion and, yes, the compiler barfs:

static inline struct net_device *lbs_mesh_dev(struct lbs_private *priv)
{
#ifdef CONFIG_LIBERTAS_MESH
        return priv->mesh_dev;
#else
        return NULL;
#endif
}

        if (lbs_mesh_dev(priv) && dev == lbs_mesh_dev(priv)) {
                priv->mesh_open = 1;
                priv->mesh_connect_status = LBS_CONNECTED;
                netif_carrier_on(dev);
        } else {
                priv->infra_open = 1;

                if (priv->connect_status == LBS_CONNECTED)
                        netif_carrier_on(dev);
                else
                        netif_carrier_off(dev);
        }

drivers/net/wireless/libertas/main.c: In function 'lbs_dev_open':
drivers/net/wireless/libertas/main.c:414: error: 'struct lbs_private' has no member named 'mesh_open'
drivers/net/wireless/libertas/main.c:415: error: 'struct lbs_private' has no member named 'mesh_connect_status'



More information about the libertas-dev mailing list