mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
eb83b8e3e6
It's the only user. This also garbage collects the CONFIG_FRAME_VECTOR symbol from all over the tree (well just one place, somehow omap media driver still had this in its Kconfig, despite not using it). Reviewed-by: John Hubbard <jhubbard@nvidia.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Acked-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Pawel Osciak <pawel@osciak.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Tomasz Figa <tfiga@chromium.org> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Jérôme Glisse <jglisse@redhat.com> Cc: Jan Kara <jack@suse.cz> Cc: Dan Williams <dan.j.williams@intel.com> Cc: linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-media@vger.kernel.org Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20201127164131.2244124-7-daniel.vetter@ffwll.ch
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef _MEDIA_FRAME_VECTOR_H
|
|
#define _MEDIA_FRAME_VECTOR_H
|
|
|
|
/* Container for pinned pfns / pages in frame_vector.c */
|
|
struct frame_vector {
|
|
unsigned int nr_allocated; /* Number of frames we have space for */
|
|
unsigned int nr_frames; /* Number of frames stored in ptrs array */
|
|
bool got_ref; /* Did we pin pages by getting page ref? */
|
|
bool is_pfns; /* Does array contain pages or pfns? */
|
|
void *ptrs[]; /* Array of pinned pfns / pages. Use
|
|
* pfns_vector_pages() or pfns_vector_pfns()
|
|
* for access */
|
|
};
|
|
|
|
struct frame_vector *frame_vector_create(unsigned int nr_frames);
|
|
void frame_vector_destroy(struct frame_vector *vec);
|
|
int get_vaddr_frames(unsigned long start, unsigned int nr_pfns,
|
|
struct frame_vector *vec);
|
|
void put_vaddr_frames(struct frame_vector *vec);
|
|
int frame_vector_to_pages(struct frame_vector *vec);
|
|
void frame_vector_to_pfns(struct frame_vector *vec);
|
|
|
|
static inline unsigned int frame_vector_count(struct frame_vector *vec)
|
|
{
|
|
return vec->nr_frames;
|
|
}
|
|
|
|
static inline struct page **frame_vector_pages(struct frame_vector *vec)
|
|
{
|
|
if (vec->is_pfns) {
|
|
int err = frame_vector_to_pages(vec);
|
|
|
|
if (err)
|
|
return ERR_PTR(err);
|
|
}
|
|
return (struct page **)(vec->ptrs);
|
|
}
|
|
|
|
static inline unsigned long *frame_vector_pfns(struct frame_vector *vec)
|
|
{
|
|
if (!vec->is_pfns)
|
|
frame_vector_to_pfns(vec);
|
|
return (unsigned long *)(vec->ptrs);
|
|
}
|
|
|
|
#endif /* _MEDIA_FRAME_VECTOR_H */
|