[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230927175635.2404e28a@xps-13>
Date: Wed, 27 Sep 2023 18:10:05 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Alexander Aring <aahringo@...hat.com>
Cc: Alexander Aring <alex.aring@...il.com>, Stefan Schmidt
<stefan@...enfreihafen.org>, linux-wpan@...r.kernel.org, "David S. Miller"
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>,
netdev@...r.kernel.org, David Girault <david.girault@...vo.com>, Romuald
Despres <romuald.despres@...vo.com>, Frederic Blain
<frederic.blain@...vo.com>, Nicolas Schodet <nico@...fr.eu.org>, Guilhem
Imberton <guilhem.imberton@...vo.com>, Thomas Petazzoni
<thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH wpan-next v4 02/11] ieee802154: Internal PAN management
Hi Alexander,
> > +
> > +#include <linux/kernel.h>
> > +#include <net/cfg802154.h>
> > +#include <net/af_ieee802154.h>
> > +
> > +/* Checks whether a device address matches one from the PAN list.
> > + * This helper is meant to be used only during PAN management, when we expect
> > + * extended addresses to be used.
> > + */
> > +static bool cfg802154_device_in_pan(struct ieee802154_pan_device *pan_dev,
> > + struct ieee802154_addr *ext_dev)
> > +{
> > + if (!pan_dev || !ext_dev)
> > + return false;
> > +
> > + if (ext_dev->mode == IEEE802154_ADDR_SHORT)
> > + return false;
> > +
> > + switch (ext_dev->mode) {
> > + case IEEE802154_ADDR_SHORT:
> > + return pan_dev->short_addr == ext_dev->short_addr;
>
> This is dead code now, it will never be reached, it's checked above
> (Or I don't see it)? I want to help you here. What exactly do you try
> to reach here again?
It's a left over. All association/disassociation operation so far which
need these checks are operated using extended addressing (from the
spec). I will simplify further this helper.
> > +bool cfg802154_device_is_parent(struct wpan_dev *wpan_dev,
> > + struct ieee802154_addr *target)
> > +{
> > + lockdep_assert_held(&wpan_dev->association_lock);
> > +
> > + if (cfg802154_device_in_pan(wpan_dev->parent, target))
> > + return true;
> > +
> > + return false;
>
> return cfg802154_device_in_pan(...); Why isn't checkpatch warning about that?
checkpatch does not care I guess, but I can definitely simplify this
return path as well, you're right.
Thanks,
Miquèl
Powered by blists - more mailing lists