Re: [PATCH wpan-next v4 02/11] ieee802154: Internal PAN management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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





[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux