[libcamera-devel,v2,2/3] libcamera: raspberrypi: dmaheaps: Add isValid()

Message ID 20200828155136.541696-2-jacopo@jmondi.org
State Accepted
Headers show
Series
  • [libcamera-devel,v2,1/3] libcamera: raspberrypi: dmaheaps: Improve device open
Related show

Commit Message

Jacopo Mondi Aug. 28, 2020, 3:51 p.m. UTC
Add isValid() method to verify the allocator device has been open
correctly.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/raspberrypi/dma_heaps.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Jacopo Mondi Aug. 28, 2020, 4 p.m. UTC | #1
On Fri, Aug 28, 2020 at 05:51:35PM +0200, Jacopo Mondi wrote:
> Add isValid() method to verify the allocator device has been open
> correctly.
>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/libcamera/pipeline/raspberrypi/dma_heaps.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
> index ae6be1135f17..119abd26ed31 100644
> --- a/src/libcamera/pipeline/raspberrypi/dma_heaps.h
> +++ b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
> @@ -18,6 +18,7 @@ class DmaHeap
>  public:
>  	DmaHeap();
>  	~DmaHeap();
> +	int isValid() const { return dmaHeapHandle_ > -1; }

Maybe bool ?

>  	FileDescriptor alloc(const char *name, std::size_t size);
>
>  private:
> --
> 2.28.0
>
Kieran Bingham Aug. 28, 2020, 4:03 p.m. UTC | #2
Hi Jacopo,

On 28/08/2020 17:00, Jacopo Mondi wrote:
> On Fri, Aug 28, 2020 at 05:51:35PM +0200, Jacopo Mondi wrote:
>> Add isValid() method to verify the allocator device has been open
>> correctly.
>>
>> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
>> ---
>>  src/libcamera/pipeline/raspberrypi/dma_heaps.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
>> index ae6be1135f17..119abd26ed31 100644
>> --- a/src/libcamera/pipeline/raspberrypi/dma_heaps.h
>> +++ b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
>> @@ -18,6 +18,7 @@ class DmaHeap
>>  public:
>>  	DmaHeap();
>>  	~DmaHeap();
>> +	int isValid() const { return dmaHeapHandle_ > -1; }
> 
> Maybe bool ?
> 

With that changed,

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>>  	FileDescriptor alloc(const char *name, std::size_t size);
>>
>>  private:
>> --
>> 2.28.0
>>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
Laurent Pinchart Aug. 28, 2020, 4:07 p.m. UTC | #3
On Fri, Aug 28, 2020 at 05:03:07PM +0100, Kieran Bingham wrote:
> Hi Jacopo,
> 
> On 28/08/2020 17:00, Jacopo Mondi wrote:
> > On Fri, Aug 28, 2020 at 05:51:35PM +0200, Jacopo Mondi wrote:
> >> Add isValid() method to verify the allocator device has been open
> >> correctly.
> >>
> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> >> ---
> >>  src/libcamera/pipeline/raspberrypi/dma_heaps.h | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
> >> index ae6be1135f17..119abd26ed31 100644
> >> --- a/src/libcamera/pipeline/raspberrypi/dma_heaps.h
> >> +++ b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
> >> @@ -18,6 +18,7 @@ class DmaHeap
> >>  public:
> >>  	DmaHeap();
> >>  	~DmaHeap();
> >> +	int isValid() const { return dmaHeapHandle_ > -1; }
> > 
> > Maybe bool ?
> > 
> 
> With that changed,
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Likewise,

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

> >>  	FileDescriptor alloc(const char *name, std::size_t size);
> >>
> >>  private:

Patch

diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
index ae6be1135f17..119abd26ed31 100644
--- a/src/libcamera/pipeline/raspberrypi/dma_heaps.h
+++ b/src/libcamera/pipeline/raspberrypi/dma_heaps.h
@@ -18,6 +18,7 @@  class DmaHeap
 public:
 	DmaHeap();
 	~DmaHeap();
+	int isValid() const { return dmaHeapHandle_ > -1; }
 	FileDescriptor alloc(const char *name, std::size_t size);
 
 private: