[PATCH 2/6] ipa: rpi: Add erase()/eraseLocked() to RPiController::Metadata

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sun Dec 15 16:35:29 CET 2024


On Fri, Dec 13, 2024 at 10:05:05AM +0000, David Plowman wrote:
> Hi Naush
> 
> Thanks for the patch.
> 
> On Fri, 13 Dec 2024 at 09:46, Naushir Patuck <naush at raspberrypi.com> wrote:
> >
> > These function erases a key/value pair from the metadata object.
> 
> At the risk of nit-picking horribly...
> s/These function erases/These functions erase/
> 
> But otherwise
> 
> Reviewed-by: David Plowman <david.plowman at raspberrypi.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> >
> > Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> > ---
> >  src/ipa/rpi/controller/metadata.h | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h
> > index eda4b59bca9a..62e54051f8f4 100644
> > --- a/src/ipa/rpi/controller/metadata.h
> > +++ b/src/ipa/rpi/controller/metadata.h
> > @@ -90,6 +90,12 @@ public:
> >                 data_.insert(other.data_.begin(), other.data_.end());
> >         }
> >
> > +       void erase(std::string const &tag)
> > +       {
> > +               std::scoped_lock lock(mutex_);
> > +               eraseLocked(tag);
> > +       }
> > +
> >         template<typename T>
> >         T *getLocked(std::string const &tag)
> >         {
> > @@ -110,6 +116,14 @@ public:
> >                 data_[tag] = std::forward<T>(value);
> >         }
> >
> > +       void eraseLocked(std::string const &tag)
> > +       {
> > +               auto it = data_.find(tag);
> > +               if (it == data_.end())
> > +                       return;
> > +               data_.erase(it);
> > +       }
> > +
> >         /*
> >          * Note: use of (lowercase) lock and unlock means you can create scoped
> >          * locks with the standard lock classes.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list