Commit 1a28ef62 authored by Mathis MARION's avatar Mathis MARION Committed by Federico Vaga

Kernel 5.10 compatibility for table allocation

The signature for `__sg_alloc_table_from_pages` changed in
kernel 5.10 and onwards.
Two agruments are added which can be passed as NULL and 0
for the same behavior as before, except for error checking,
which was addressed in this patch.
Signed-off-by: 's avatarGwenhael GOAVEC <gwenhael.goavec@femto-st.fr>
Signed-off-by: 's avatarMathis MARION <mathis.marion@grenoble-inp.org>
parent ab2e2c31
...@@ -37,6 +37,28 @@ static const int zfad_hw_range[] = { ...@@ -37,6 +37,28 @@ static const int zfad_hw_range[] = {
struct workqueue_struct *fa_workqueue; struct workqueue_struct *fa_workqueue;
static int fa_sg_alloc_table_from_pages(struct sg_table *sgt,
struct page **pages,
unsigned int n_pages,
unsigned int offset,
unsigned long size,
unsigned int max_segment,
gfp_t gfp_mask)
{
#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
struct scatterlist *sg;
sg = __sg_alloc_table_from_pages(sgt, pages, n_pages, offset, size,
max_segment, NULL, 0, gfp_mask);
if (IS_ERR(sg))
return PTR_ERR(sg);
else
return 0;
#else
return __sg_alloc_table_from_pages(sgt, pages, n_pages, offset, size,
max_segment, gfp_mask);
#endif
}
/** /**
* Enable/Disable Data Output Randomizer * Enable/Disable Data Output Randomizer
* @fa: the adc descriptor * @fa: the adc descriptor
...@@ -646,7 +668,7 @@ static void fa_sg_alloc_table_init(struct fa_dev *fa) ...@@ -646,7 +668,7 @@ static void fa_sg_alloc_table_init(struct fa_dev *fa)
if (fa_is_flag_set(fa, FMC_ADC_NOSQUASH_SCATTERLIST)) if (fa_is_flag_set(fa, FMC_ADC_NOSQUASH_SCATTERLIST))
fa->sg_alloc_table_from_pages = sg_alloc_table_from_pages_no_squash; fa->sg_alloc_table_from_pages = sg_alloc_table_from_pages_no_squash;
else else
fa->sg_alloc_table_from_pages = __sg_alloc_table_from_pages; fa->sg_alloc_table_from_pages = fa_sg_alloc_table_from_pages;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment