From ec0feb059c46cc269d297aac0b8d2835340a6fd2 Mon Sep 17 00:00:00 2001 From: Jami Kettunen Date: Wed, 4 Nov 2020 14:00:55 +0200 Subject: [PATCH] tree-wide: Fix compilation after merging up to v4.4.241 Adapt some (vendor) driver and mm modifications to kernel API changes that were introduced since v4.4.146. --- drivers/cpufreq/cpufreq_interactive.c | 4 ++-- drivers/cpufreq/cpufreq_times.c | 12 ++++++------ .../drivers/gpu/arm/midgard/mali_kbase_mem.c | 4 ++-- .../drivers/gpu/arm/midgard/mali_kbase_mem_linux.c | 3 ++- drivers/misc/mediatek/m4u/2.0/m4u.c | 3 ++- drivers/mmc/card/mtk_mmc_block.c | 4 +++- drivers/staging/android/ion/ion.c | 2 +- drivers/usb/gadget/configfs.c | 2 ++ include/linux/mm.h | 2 +- mm/gup.c | 10 ++++++---- mm/vmstat.c | 2 +- 11 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 169a1a215f32..905b0c428da0 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -1071,7 +1071,7 @@ static ssize_t store_io_is_busy(struct cpufreq_interactive_tunables *tunables, */ #define show_gov_pol_sys(file_name) \ static ssize_t show_##file_name##_gov_sys \ -(struct kobject *kobj, struct attribute *attr, char *buf) \ +(struct kobject *kobj, struct kobj_attribute *attr, char *buf) \ { \ return show_##file_name(common_tunables, buf); \ } \ @@ -1084,7 +1084,7 @@ static ssize_t show_##file_name##_gov_pol \ #define store_gov_pol_sys(file_name) \ static ssize_t store_##file_name##_gov_sys \ -(struct kobject *kobj, struct attribute *attr, const char *buf, \ +(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, \ size_t count) \ { \ return store_##file_name(common_tunables, buf, count); \ diff --git a/drivers/cpufreq/cpufreq_times.c b/drivers/cpufreq/cpufreq_times.c index 2917fd3bbfc2..9d6336c291b4 100644 --- a/drivers/cpufreq/cpufreq_times.c +++ b/drivers/cpufreq/cpufreq_times.c @@ -256,13 +256,13 @@ static int concurrent_time_seq_show(struct seq_file *m, void *v, hlist_for_each_entry_rcu(uid_entry, (struct hlist_head *)v, hash) { atomic64_t *times = get_times(uid_entry->concurrent_times); - seq_put_decimal_ull(m, "", (u64)uid_entry->uid); + seq_printf(m, "%llu", (u64)uid_entry->uid); seq_putc(m, ':'); for (i = 0; i < num_possible_cpus; ++i) { u64 time = cputime_to_clock_t(atomic64_read(×[i])); - seq_put_decimal_ull(m, " ", time); + seq_printf(m, " %llu", time); } seq_putc(m, '\n'); } @@ -280,7 +280,7 @@ static inline atomic64_t *get_active_times(struct concurrent_times *times) static int concurrent_active_time_seq_show(struct seq_file *m, void *v) { if (v == uid_hash_table) { - seq_put_decimal_ull(m, "cpus: ", num_possible_cpus()); + seq_printf(m, "cpus: %d", num_possible_cpus()); seq_putc(m, '\n'); } @@ -306,18 +306,18 @@ static int concurrent_policy_time_seq_show(struct seq_file *m, void *v) continue; if (freqs != last_freqs) { if (last_freqs) { - seq_put_decimal_ull(m, ": ", cnt); + seq_printf(m, ": %d", cnt); seq_putc(m, ' '); cnt = 0; } - seq_put_decimal_ull(m, "policy", i); + seq_printf(m, "policy%d", i); last_freqs = freqs; } cnt++; } if (last_freqs) { - seq_put_decimal_ull(m, ": ", cnt); + seq_printf(m, ": %d", cnt); seq_putc(m, '\n'); } } diff --git a/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem.c b/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem.c index 3eff83a4f0ce..8e20083704be 100644 --- a/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem.c +++ b/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem.c @@ -3255,8 +3255,8 @@ static int kbase_jd_user_buf_map(struct kbase_context *kctx, pinned_pages = get_user_pages(NULL, mm, address, alloc->imported.user_buf.nr_pages, - reg->flags & KBASE_REG_GPU_WR, - 0, pages, NULL); + (reg->flags & KBASE_REG_GPU_WR) ? FOLL_WRITE : 0, + pages, NULL); #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) pinned_pages = get_user_pages_remote(NULL, mm, address, diff --git a/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c b/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c index bc95a0fffff2..0bd46c2dccdd 100644 --- a/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c +++ b/drivers/misc/mediatek/gpu/gpu_mali/mali_bifrost/mali-r14p0/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c @@ -1092,7 +1092,8 @@ static struct kbase_va_region *kbase_mem_from_user_buffer( #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) faulted_pages = get_user_pages(current, current->mm, address, *va_pages, - reg->flags & KBASE_REG_GPU_WR, 0, pages, NULL); + (reg->flags & KBASE_REG_GPU_WR) ? FOLL_WRITE : 0, + pages, NULL); #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) faulted_pages = get_user_pages(address, *va_pages, reg->flags & KBASE_REG_GPU_WR, 0, pages, NULL); diff --git a/drivers/misc/mediatek/m4u/2.0/m4u.c b/drivers/misc/mediatek/m4u/2.0/m4u.c index afdd0d04238b..eec767cfd84b 100644 --- a/drivers/misc/mediatek/m4u/2.0/m4u.c +++ b/drivers/misc/mediatek/m4u/2.0/m4u.c @@ -406,7 +406,8 @@ static int m4u_fill_sgtable_user(struct vm_area_struct *vma, unsigned long va, i for (fault_cnt = 0; fault_cnt < 3000; fault_cnt++) { if (has_page) { ret = get_user_pages(current, current->mm, va_tmp, 1, - (vma->vm_flags & VM_WRITE), 0, &pages, NULL); + (vma->vm_flags & VM_WRITE) ? FOLL_WRITE : 0, + &pages, NULL); if (ret == 1) pa = page_to_phys(pages) | (va_tmp & ~PAGE_MASK); diff --git a/drivers/mmc/card/mtk_mmc_block.c b/drivers/mmc/card/mtk_mmc_block.c index 1c2e41f5c235..2b17b1df381c 100644 --- a/drivers/mmc/card/mtk_mmc_block.c +++ b/drivers/mmc/card/mtk_mmc_block.c @@ -128,10 +128,12 @@ static void mt_bio_init_ctx(struct mt_bio_context *ctx, struct task_struct *thre struct request_queue *q) { int i; + char tmp[TASK_COMM_LEN]; ctx->q = q; ctx->pid = task_pid_nr(thread); - get_task_comm(ctx->comm, thread); + get_task_comm(tmp, thread); + snprintf(ctx->comm, TASK_COMM_LEN, "%s", tmp); ctx->qid = get_qid_by_name(ctx->comm); spin_lock_init(&ctx->lock); ctx->id = get_ctxid_by_name(ctx->comm); diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 2518cc83d510..234add359111 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -2010,7 +2010,7 @@ struct ion_handle *ion_drv_get_handle(struct ion_client *client, int user_handle ion_handle_get(handle); mutex_unlock(&client->lock); } else { - handle = ion_handle_get_by_id(client, user_handle); + handle = ion_handle_get_by_id_nolock(client, user_handle); if (!handle) { IONMSG("%s handle invalid, handle_id=%d\n", __func__, user_handle); return ERR_PTR(-EINVAL); diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 220fb74ce170..70707a8f499e 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1579,6 +1579,7 @@ static void configfs_composite_unbind(struct usb_gadget *gadget) spin_unlock_irqrestore(&gi->spinlock, flags); } +#ifndef CONFIG_USB_CONFIGFS_UEVENT static int configfs_composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) { @@ -1625,6 +1626,7 @@ static void configfs_composite_disconnect(struct usb_gadget *gadget) composite_disconnect(gadget); spin_unlock_irqrestore(&gi->spinlock, flags); } +#endif /* CONFIG_USB_CONFIGFS_UEVENT */ static void configfs_composite_suspend(struct usb_gadget *gadget) { diff --git a/include/linux/mm.h b/include/linux/mm.h index 2230d1cf7d55..3698cbb76be6 100755 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1280,7 +1280,7 @@ long get_user_pages(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct **vmas); long get_user_pages_durable(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, - int write, int force, struct page **pages, + unsigned int gup_flags, struct page **pages, struct vm_area_struct **vmas); long get_user_pages_locked(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, diff --git a/mm/gup.c b/mm/gup.c index ca3bad87f892..4a71cd3ae887 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -933,11 +933,13 @@ long get_user_pages(struct task_struct *tsk, struct mm_struct *mm, EXPORT_SYMBOL(get_user_pages); long get_user_pages_durable(struct task_struct *tsk, struct mm_struct *mm, - unsigned long start, unsigned long nr_pages, int write, - int force, struct page **pages, struct vm_area_struct **vmas) + unsigned long start, unsigned long nr_pages, + unsigned int gup_flags, struct page **pages, + struct vm_area_struct **vmas) { - return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force, - pages, vmas, NULL, false, FOLL_TOUCH | FOLL_DURABLE); + return __get_user_pages_locked(tsk, mm, start, nr_pages, + pages, vmas, NULL, false, + gup_flags | FOLL_TOUCH | FOLL_DURABLE); } EXPORT_SYMBOL(get_user_pages_durable); diff --git a/mm/vmstat.c b/mm/vmstat.c index b2a4dcfa192e..bb4f7cb6abc2 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1470,7 +1470,7 @@ void quiet_vmstat(void) * it would be too expensive from this path. * vmstat_shepherd will take care about that for us. */ - refresh_cpu_vm_stats(false); + refresh_cpu_vm_stats(); }