[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-wpan
Subject:    Re: [PATCH wpan-next v4 02/11] ieee802154: Internal PAN management
From:       Alexander Aring <aahringo () redhat ! com>
Date:       2023-09-29 0:22:04
Message-ID: CAK-6q+iWit1KoHfz-sQOLD3MiONcaHXAJHbL02V3srLx4C7X2Q () mail ! gmail ! com
[Download RAW message or body]

Hi,

On Wed, Sep 27, 2023 at 12:10 PM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> 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.
>

I see, it makes sense to me.

>
> > > +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.
>

ok. Was a nitpick.

Thanks.

- Alex

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic