History

Merge branch 'akpm' (patches from Andrew)

Pull updates from Andrew Morton: "Most of -mm and quite a number of other subsystems: hotfixes, scripts, ocfs2, misc, lib, binfmt, init, reiserfs, exec, dma-mapping, kcov. MM is fairly quiet this time. Holidays, I assume" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (118 commits) kcov: ignore fault-inject and stacktrace include/linux/io-mapping.h-mapping: use PHYS_PFN() macro in io_mapping_map_atomic_wc() execve: warn if process starts with executable stack reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() init/main.c: fix misleading "This architecture does not have kernel memory protection" message init/main.c: fix quoted value handling in unknown_bootoption init/main.c: remove unnecessary repair_env_string in do_initcall_level init/main.c: log arguments and environment passed to init fs/binfmt_elf.c: coredump: allow process with empty address space to coredump fs/binfmt_elf.c: coredump: delete duplicated overflow check fs/binfmt_elf.c: coredump: allocate core ELF header on stack fs/binfmt_elf.c: make BAD_ADDR() unlikely fs/binfmt_elf.c: better codegen around current->mm fs/binfmt_elf.c: don't copy ELF header around fs/binfmt_elf.c: fix ->start_code calculation fs/binfmt_elf.c: smaller code generation around auxv vector fill lib/find_bit.c: uninline helper _find_next_bit() lib/find_bit.c: join _find_next_bit{_le} uapi: rename ext2_swab() to swab() and share globally in swab.h lib/scatterlist.c: adjust indentation in __sg_alloc_table ...

Linus Torvalds committed 6 years ago

Commit 7eec11d2 parents ddaefe8 43e76af136 files · +2724 −1293Browse files

Showing the changes to drivers (30 of 136 files). Show all

Unified · Split

30 files
  1. drivers/acpi/thermal.c +18 −16
  2. drivers/base/memory.c +3 −22
  3. drivers/block/zram/zram_drv.c +6 −4
  4. drivers/gpu/drm/via/via_dmablit.c +3 −3
  5. drivers/iio/adc/qcom-vadc-common.c +3 −3
  6. drivers/iio/adc/qcom-vadc-common.h +0 −1
  7. drivers/infiniband/core/umem.c +7 −12
  8. drivers/infiniband/core/umem_odp.c +6 −7
  9. drivers/infiniband/hw/hfi1/user_pages.c +2 −2
  10. drivers/infiniband/hw/mthca/mthca_memfree.c +4 −4
  11. drivers/infiniband/hw/qib/qib_user_pages.c +2 −2
  12. drivers/infiniband/hw/qib/qib_user_sdma.c +4 −4
  13. drivers/infiniband/hw/usnic/usnic_uiom.c +2 −2
  14. drivers/infiniband/sw/siw/siw_mem.c +2 −2
  15. drivers/media/v4l2-core/videobuf-dma-sg.c +4 −4
  16. drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0 −1
  17. drivers/net/wireless/intel/iwlegacy/4965-mac.c +2 −1
  18. drivers/net/wireless/intel/iwlegacy/4965.c +9 −8
  19. drivers/net/wireless/intel/iwlegacy/common.h +0 −3
  20. drivers/net/wireless/intel/iwlwifi/dvm/dev.h +0 −5
  21. drivers/net/wireless/intel/iwlwifi/dvm/devices.c +4 −2
  22. drivers/nvdimm/pmem.c +0 −6
  23. drivers/nvme/host/hwmon.c +5 −8
  24. drivers/platform/goldfish/goldfish_pipe.c +12 −23
  25. drivers/platform/x86/asus-wmi.c +3 −4
  26. drivers/platform/x86/intel_menlow.c +6 −3
  27. drivers/thermal/armada_thermal.c +0 −2
  28. drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +4 −3
  29. drivers/thermal/intel/intel_pch_thermal.c +2 −1
  30. drivers/vfio/vfio_iommu_type1.c +7 −28
drivers/acpi/thermal.c+18−16
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/acpi.h>
2828 #include <linux/workqueue.h>
2929 #include <linux/uaccess.h>
30+#include <linux/units.h>
3031
3132 #define PREFIX "ACPI: "
3233
@@ -172,7 +173,7 @@ struct acpi_thermal { · 139 unmodified lines
172173 struct acpi_handle_list devices;
173174 struct thermal_zone_device *thermal_zone;
174175 int tz_enabled;
175− int kelvin_offset;
176+ int kelvin_offset; /* in millidegrees */
176177 struct work_struct thermal_check_work;
177178 };
178179
@@ -297,7 +298,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) · 118 unmodified lines
297298 if (crt == -1) {
298299 tz->trips.critical.flags.valid = 0;
299300 } else if (crt > 0) {
300− unsigned long crt_k = CELSIUS_TO_DECI_KELVIN(crt);
301+ unsigned long crt_k = celsius_to_deci_kelvin(crt);
302+
301303 /*
302304 * Allow override critical threshold
303305 */
@@ -333,7 +335,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) · 29 unmodified lines
333335 if (psv == -1) {
334336 status = AE_SUPPORT;
335337 } else if (psv > 0) {
336− tmp = CELSIUS_TO_DECI_KELVIN(psv);
338+ tmp = celsius_to_deci_kelvin(psv);
337339 status = AE_OK;
338340 } else {
339341 status = acpi_evaluate_integer(tz->device->handle,
@@ -413,7 +415,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) · 73 unmodified lines
413415 break;
414416 if (i == 1)
415417 tz->trips.active[0].temperature =
416− CELSIUS_TO_DECI_KELVIN(act);
418+ celsius_to_deci_kelvin(act);
417419 else
418420 /*
419421 * Don't allow override higher than
@@ -421,9 +423,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) · 1 unmodified line
421423 */
422424 tz->trips.active[i - 1].temperature =
423425 (tz->trips.active[i - 2].temperature <
424− CELSIUS_TO_DECI_KELVIN(act) ?
426+ celsius_to_deci_kelvin(act) ?
425427 tz->trips.active[i - 2].temperature :
426− CELSIUS_TO_DECI_KELVIN(act));
428+ celsius_to_deci_kelvin(act));
427429 break;
428430 } else {
429431 tz->trips.active[i].temperature = tmp;
@@ -519,7 +521,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) · 89 unmodified lines
519521 if (result)
520522 return result;
521523
522− *temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(tz->temperature,
524+ *temp = deci_kelvin_to_millicelsius_with_offset(tz->temperature,
523525 tz->kelvin_offset);
524526 return 0;
525527 }
@@ -624,7 +626,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, · 98 unmodified lines
624626
625627 if (tz->trips.critical.flags.valid) {
626628 if (!trip) {
627− *temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
629+ *temp = deci_kelvin_to_millicelsius_with_offset(
628630 tz->trips.critical.temperature,
629631 tz->kelvin_offset);
630632 return 0;
@@ -634,7 +636,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, · 3 unmodified lines
634636
635637 if (tz->trips.hot.flags.valid) {
636638 if (!trip) {
637− *temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
639+ *temp = deci_kelvin_to_millicelsius_with_offset(
638640 tz->trips.hot.temperature,
639641 tz->kelvin_offset);
640642 return 0;
@@ -644,7 +646,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, · 3 unmodified lines
644646
645647 if (tz->trips.passive.flags.valid) {
646648 if (!trip) {
647− *temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
649+ *temp = deci_kelvin_to_millicelsius_with_offset(
648650 tz->trips.passive.temperature,
649651 tz->kelvin_offset);
650652 return 0;
@@ -655,7 +657,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, · 4 unmodified lines
655657 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
656658 tz->trips.active[i].flags.valid; i++) {
657659 if (!trip) {
658− *temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
660+ *temp = deci_kelvin_to_millicelsius_with_offset(
659661 tz->trips.active[i].temperature,
660662 tz->kelvin_offset);
661663 return 0;
@@ -672,7 +674,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal, · 10 unmodified lines
672674 struct acpi_thermal *tz = thermal->devdata;
673675
674676 if (tz->trips.critical.flags.valid) {
675− *temperature = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
677+ *temperature = deci_kelvin_to_millicelsius_with_offset(
676678 tz->trips.critical.temperature,
677679 tz->kelvin_offset);
678680 return 0;
@@ -692,7 +694,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal, · 13 unmodified lines
692694
693695 if (type == THERMAL_TRIP_ACTIVE) {
694696 int trip_temp;
695− int temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
697+ int temp = deci_kelvin_to_millicelsius_with_offset(
696698 tz->temperature, tz->kelvin_offset);
697699 if (thermal_get_trip_temp(thermal, trip, &trip_temp))
698700 return -EINVAL;
@@ -1043,9 +1045,9 @@ static void acpi_thermal_guess_offset(struct acpi_thermal *tz) · 344 unmodified lines
10431045 {
10441046 if (tz->trips.critical.flags.valid &&
10451047 (tz->trips.critical.temperature % 5) == 1)
1046− tz->kelvin_offset = 2731;
1048+ tz->kelvin_offset = 273100;
10471049 else
1048− tz->kelvin_offset = 2732;
1050+ tz->kelvin_offset = 273200;
10491051 }
10501052
10511053 static void acpi_thermal_check_fn(struct work_struct *work)
@@ -1087,7 +1089,7 @@ static int acpi_thermal_add(struct acpi_device *device) · 35 unmodified lines
10871089 INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
10881090
10891091 pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
1090− acpi_device_bid(device), DECI_KELVIN_TO_CELSIUS(tz->temperature));
1092+ acpi_device_bid(device), deci_kelvin_to_celsius(tz->temperature));
10911093 goto end;
10921094
10931095 free_memory:
drivers/base/memory.c+3−22
@@ -70,20 +70,6 @@ void unregister_memory_notifier(struct notifier_block *nb) · 69 unmodified lines
7070 }
7171 EXPORT_SYMBOL(unregister_memory_notifier);
7272
73−static ATOMIC_NOTIFIER_HEAD(memory_isolate_chain);
74−
75−int register_memory_isolate_notifier(struct notifier_block *nb)
76−{
77− return atomic_notifier_chain_register(&memory_isolate_chain, nb);
78−}
79−EXPORT_SYMBOL(register_memory_isolate_notifier);
80−
81−void unregister_memory_isolate_notifier(struct notifier_block *nb)
82−{
83− atomic_notifier_chain_unregister(&memory_isolate_chain, nb);
84−}
85−EXPORT_SYMBOL(unregister_memory_isolate_notifier);
86−
8773 static void memory_block_release(struct device *dev)
8874 {
8975 struct memory_block *mem = to_memory_block(dev);
@@ -175,11 +161,6 @@ int memory_notify(unsigned long val, void *v) · 85 unmodified lines
175161 return blocking_notifier_call_chain(&memory_chain, val, v);
176162 }
177163
178−int memory_isolate_notify(unsigned long val, void *v)
179−{
180− return atomic_notifier_call_chain(&memory_isolate_chain, val, v);
181−}
182−
183164 /*
184165 * The probe routines leave the pages uninitialized, just as the bootmem code
185166 * does. Make sure we do not access them, but instead use only information from
@@ -225,7 +206,7 @@ static bool pages_correctly_probed(unsigned long start_pfn) · 39 unmodified lines
225206 */
226207 static int
227208 memory_block_action(unsigned long start_section_nr, unsigned long action,
228− int online_type)
209+ int online_type, int nid)
229210 {
230211 unsigned long start_pfn;
231212 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
@@ -238,7 +219,7 @@ memory_block_action(unsigned long start_section_nr, unsigned long action, · 6 unmodified lines
238219 if (!pages_correctly_probed(start_pfn))
239220 return -EBUSY;
240221
241− ret = online_pages(start_pfn, nr_pages, online_type);
222+ ret = online_pages(start_pfn, nr_pages, online_type, nid);
242223 break;
243224 case MEM_OFFLINE:
244225 ret = offline_pages(start_pfn, nr_pages);
@@ -264,7 +245,7 @@ static int memory_block_change_state(struct memory_block *mem, · 19 unmodified lines
264245 mem->state = MEM_GOING_OFFLINE;
265246
266247 ret = memory_block_action(mem->start_section_nr, to_state,
267− mem->online_type);
248+ mem->online_type, mem->nid);
268249
269250 mem->state = ret ? from_state_req : to_state;
270251
drivers/block/zram/zram_drv.c+6−4
@@ -207,14 +207,17 @@ static inline void zram_fill_page(void *ptr, unsigned long len, · 206 unmodified lines
207207
208208 static bool page_same_filled(void *ptr, unsigned long *element)
209209 {
210− unsigned int pos;
211210 unsigned long *page;
212211 unsigned long val;
212+ unsigned int pos, last_pos = PAGE_SIZE / sizeof(*page) - 1;
213213
214214 page = (unsigned long *)ptr;
215215 val = page[0];
216216
217− for (pos = 1; pos < PAGE_SIZE / sizeof(*page); pos++) {
217+ if (val != page[last_pos])
218+ return false;
219+
220+ for (pos = 1; pos < last_pos; pos++) {
218221 if (val != page[pos])
219222 return false;
220223 }
@@ -626,7 +629,7 @@ static ssize_t writeback_store(struct device *dev, · 405 unmodified lines
626629 struct bio bio;
627630 struct bio_vec bio_vec;
628631 struct page *page;
629− ssize_t ret;
632+ ssize_t ret = len;
630633 int mode;
631634 unsigned long blk_idx = 0;
632635
@@ -762,7 +765,6 @@ next: · 129 unmodified lines
762765
763766 if (blk_idx)
764767 free_block_bdev(zram, blk_idx);
765− ret = len;
766768 __free_page(page);
767769 release_init_lock:
768770 up_read(&zram->init_lock);
drivers/gpu/drm/via/via_dmablit.c+3−3
@@ -188,8 +188,8 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg) · 187 unmodified lines
188188 kfree(vsg->desc_pages);
189189 /* fall through */
190190 case dr_via_pages_locked:
191− put_user_pages_dirty_lock(vsg->pages, vsg->num_pages,
192− (vsg->direction == DMA_FROM_DEVICE));
191+ unpin_user_pages_dirty_lock(vsg->pages, vsg->num_pages,
192+ (vsg->direction == DMA_FROM_DEVICE));
193193 /* fall through */
194194 case dr_via_pages_alloc:
195195 vfree(vsg->pages);
@@ -239,7 +239,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) · 43 unmodified lines
239239 vsg->pages = vzalloc(array_size(sizeof(struct page *), vsg->num_pages));
240240 if (NULL == vsg->pages)
241241 return -ENOMEM;
242− ret = get_user_pages_fast((unsigned long)xfer->mem_addr,
242+ ret = pin_user_pages_fast((unsigned long)xfer->mem_addr,
243243 vsg->num_pages,
244244 vsg->direction == DMA_FROM_DEVICE ? FOLL_WRITE : 0,
245245 vsg->pages);
drivers/iio/adc/qcom-vadc-common.c+3−3
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/log2.h>
77 #include <linux/err.h>
88 #include <linux/module.h>
9+#include <linux/units.h>
910
1011 #include "qcom-vadc-common.h"
1112
@@ -236,8 +237,7 @@ static int qcom_vadc_scale_die_temp(const struct vadc_linear_graph *calib_graph, · 224 unmodified lines
236237 voltage = 0;
237238 }
238239
239− voltage -= KELVINMIL_CELSIUSMIL;
240− *result_mdec = voltage;
240+ *result_mdec = milli_kelvin_to_millicelsius(voltage);
241241
242242 return 0;
243243 }
@@ -325,7 +325,7 @@ static int qcom_vadc_scale_hw_calib_die_temp( · 81 unmodified lines
325325 {
326326 *result_mdec = qcom_vadc_scale_code_voltage_factor(adc_code,
327327 prescale, data, 2);
328− *result_mdec -= KELVINMIL_CELSIUSMIL;
328+ *result_mdec = milli_kelvin_to_millicelsius(*result_mdec);
329329
330330 return 0;
331331 }
drivers/iio/adc/qcom-vadc-common.h+0−1
@@ -38,7 +38,6 @@ · 37 unmodified lines
3838 #define VADC_AVG_SAMPLES_MAX 512
3939 #define ADC5_AVG_SAMPLES_MAX 16
4040
41−#define KELVINMIL_CELSIUSMIL 273150
4241 #define PMIC5_CHG_TEMP_SCALE_FACTOR 377500
4342 #define PMIC5_SMB_TEMP_CONSTANT 419400
4443 #define PMIC5_SMB_TEMP_SCALE_FACTOR 356
drivers/infiniband/core/umem.c+7−12
@@ -54,7 +54,7 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d · 53 unmodified lines
5454
5555 for_each_sg_page(umem->sg_head.sgl, &sg_iter, umem->sg_nents, 0) {
5656 page = sg_page_iter_page(&sg_iter);
57− put_user_pages_dirty_lock(&page, 1, umem->writable && dirty);
57+ unpin_user_pages_dirty_lock(&page, 1, umem->writable && dirty);
5858 }
5959
6060 sg_free_table(&umem->sg_head);
@@ -257,16 +257,13 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, · 196 unmodified lines
257257 sg = umem->sg_head.sgl;
258258
259259 while (npages) {
260− down_read(&mm->mmap_sem);
261− ret = get_user_pages(cur_base,
262− min_t(unsigned long, npages,
263− PAGE_SIZE / sizeof (struct page *)),
264− gup_flags | FOLL_LONGTERM,
265− page_list, NULL);
266− if (ret < 0) {
267− up_read(&mm->mmap_sem);
260+ ret = pin_user_pages_fast(cur_base,
261+ min_t(unsigned long, npages,
262+ PAGE_SIZE /
263+ sizeof(struct page *)),
264+ gup_flags | FOLL_LONGTERM, page_list);
265+ if (ret < 0)
268266 goto umem_release;
269− }
270267
271268 cur_base += ret * PAGE_SIZE;
272269 npages -= ret;
@@ -274,8 +271,6 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, · 1 unmodified line
274271 sg = ib_umem_add_sg_table(sg, page_list, ret,
275272 dma_get_max_seg_size(device->dma_device),
276273 &umem->sg_nents);
277−
278− up_read(&mm->mmap_sem);
279274 }
280275
281276 sg_mark_end(sg);
drivers/infiniband/core/umem_odp.c+6−7
@@ -293,9 +293,8 @@ EXPORT_SYMBOL(ib_umem_odp_release); · 292 unmodified lines
293293 * The function returns -EFAULT if the DMA mapping operation fails. It returns
294294 * -EAGAIN if a concurrent invalidation prevents us from updating the page.
295295 *
296− * The page is released via put_user_page even if the operation failed. For
297− * on-demand pinning, the page is released whenever it isn't stored in the
298− * umem.
296+ * The page is released via put_page even if the operation failed. For on-demand
297+ * pinning, the page is released whenever it isn't stored in the umem.
299298 */
300299 static int ib_umem_odp_map_dma_single_page(
301300 struct ib_umem_odp *umem_odp,
@@ -348,7 +347,7 @@ static int ib_umem_odp_map_dma_single_page( · 46 unmodified lines
348347 }
349348
350349 out:
351− put_user_page(page);
350+ put_page(page);
352351 return ret;
353352 }
354353
@@ -458,7 +457,7 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp, u64 user_virt, · 103 unmodified lines
458457 ret = -EFAULT;
459458 break;
460459 }
461− put_user_page(local_page_list[j]);
460+ put_page(local_page_list[j]);
462461 continue;
463462 }
464463
@@ -485,8 +484,8 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp, u64 user_virt, · 20 unmodified lines
485484 * ib_umem_odp_map_dma_single_page().
486485 */
487486 if (npages - (j + 1) > 0)
488− put_user_pages(&local_page_list[j+1],
489− npages - (j + 1));
487+ release_pages(&local_page_list[j+1],
488+ npages - (j + 1));
490489 break;
491490 }
492491 }
drivers/infiniband/hw/hfi1/user_pages.c+2−2
@@ -106,7 +106,7 @@ int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned long vaddr, size_t np · 105 unmodified lines
106106 int ret;
107107 unsigned int gup_flags = FOLL_LONGTERM | (writable ? FOLL_WRITE : 0);
108108
109− ret = get_user_pages_fast(vaddr, npages, gup_flags, pages);
109+ ret = pin_user_pages_fast(vaddr, npages, gup_flags, pages);
110110 if (ret < 0)
111111 return ret;
112112
@@ -118,7 +118,7 @@ int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned long vaddr, size_t np · 5 unmodified lines
118118 void hfi1_release_user_pages(struct mm_struct *mm, struct page **p,
119119 size_t npages, bool dirty)
120120 {
121− put_user_pages_dirty_lock(p, npages, dirty);
121+ unpin_user_pages_dirty_lock(p, npages, dirty);
122122
123123 if (mm) { /* during close after signal, mm can be NULL */
124124 atomic64_sub(npages, &mm->pinned_vm);
drivers/infiniband/hw/mthca/mthca_memfree.c+4−4
@@ -472,7 +472,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, · 471 unmodified lines
472472 goto out;
473473 }
474474
475− ret = get_user_pages_fast(uaddr & PAGE_MASK, 1,
475+ ret = pin_user_pages_fast(uaddr & PAGE_MASK, 1,
476476 FOLL_WRITE | FOLL_LONGTERM, pages);
477477 if (ret < 0)
478478 goto out;
@@ -482,7 +482,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, · 3 unmodified lines
482482
483483 ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
484484 if (ret < 0) {
485− put_user_page(pages[0]);
485+ unpin_user_page(pages[0]);
486486 goto out;
487487 }
488488
@@ -490,7 +490,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, · 1 unmodified line
490490 mthca_uarc_virt(dev, uar, i));
491491 if (ret) {
492492 pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
493− put_user_page(sg_page(&db_tab->page[i].mem));
493+ unpin_user_page(sg_page(&db_tab->page[i].mem));
494494 goto out;
495495 }
496496
@@ -556,7 +556,7 @@ void mthca_cleanup_user_db_tab(struct mthca_dev *dev, struct mthca_uar *uar, · 59 unmodified lines
556556 if (db_tab->page[i].uvirt) {
557557 mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, uar, i), 1);
558558 pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
559− put_user_page(sg_page(&db_tab->page[i].mem));
559+ unpin_user_page(sg_page(&db_tab->page[i].mem));
560560 }
561561 }
562562
drivers/infiniband/hw/qib/qib_user_pages.c+2−2
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 static void __qib_release_user_pages(struct page **p, size_t num_pages,
4141 int dirty)
4242 {
43− put_user_pages_dirty_lock(p, num_pages, dirty);
43+ unpin_user_pages_dirty_lock(p, num_pages, dirty);
4444 }
4545
4646 /**
@@ -108,7 +108,7 @@ int qib_get_user_pages(unsigned long start_page, size_t num_pages, · 61 unmodified lines
108108
109109 down_read(&current->mm->mmap_sem);
110110 for (got = 0; got < num_pages; got += ret) {
111− ret = get_user_pages(start_page + got * PAGE_SIZE,
111+ ret = pin_user_pages(start_page + got * PAGE_SIZE,
112112 num_pages - got,
113113 FOLL_LONGTERM | FOLL_WRITE | FOLL_FORCE,
114114 p + got, NULL);
drivers/infiniband/hw/qib/qib_user_sdma.c+4−4
@@ -317,7 +317,7 @@ static int qib_user_sdma_page_to_frags(const struct qib_devdata *dd, · 316 unmodified lines
317317 * the caller can ignore this page.
318318 */
319319 if (put) {
320− put_user_page(page);
320+ unpin_user_page(page);
321321 } else {
322322 /* coalesce case */
323323 kunmap(page);
@@ -631,7 +631,7 @@ static void qib_user_sdma_free_pkt_frag(struct device *dev, · 307 unmodified lines
631631 kunmap(pkt->addr[i].page);
632632
633633 if (pkt->addr[i].put_page)
634− put_user_page(pkt->addr[i].page);
634+ unpin_user_page(pkt->addr[i].page);
635635 else
636636 __free_page(pkt->addr[i].page);
637637 } else if (pkt->addr[i].kvaddr) {
@@ -670,7 +670,7 @@ static int qib_user_sdma_pin_pages(const struct qib_devdata *dd, · 32 unmodified lines
670670 else
671671 j = npages;
672672
673− ret = get_user_pages_fast(addr, j, FOLL_LONGTERM, pages);
673+ ret = pin_user_pages_fast(addr, j, FOLL_LONGTERM, pages);
674674 if (ret != j) {
675675 i = 0;
676676 j = ret;
@@ -706,7 +706,7 @@ static int qib_user_sdma_pin_pages(const struct qib_devdata *dd, · 29 unmodified lines
706706 /* if error, return all pages not managed by pkt */
707707 free_pages:
708708 while (i < j)
709− put_user_page(pages[i++]);
709+ unpin_user_page(pages[i++]);
710710
711711 done:
712712 return ret;
drivers/infiniband/hw/usnic/usnic_uiom.c+2−2
@@ -75,7 +75,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty) · 74 unmodified lines
7575 for_each_sg(chunk->page_list, sg, chunk->nents, i) {
7676 page = sg_page(sg);
7777 pa = sg_phys(sg);
78− put_user_pages_dirty_lock(&page, 1, dirty);
78+ unpin_user_pages_dirty_lock(&page, 1, dirty);
7979 usnic_dbg("pa: %pa\n", &pa);
8080 }
8181 kfree(chunk);
@@ -141,7 +141,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable, · 59 unmodified lines
141141 ret = 0;
142142
143143 while (npages) {
144− ret = get_user_pages(cur_base,
144+ ret = pin_user_pages(cur_base,
145145 min_t(unsigned long, npages,
146146 PAGE_SIZE / sizeof(struct page *)),
147147 gup_flags | FOLL_LONGTERM,
drivers/infiniband/sw/siw/siw_mem.c+2−2
@@ -63,7 +63,7 @@ struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index) · 62 unmodified lines
6363 static void siw_free_plist(struct siw_page_chunk *chunk, int num_pages,
6464 bool dirty)
6565 {
66− put_user_pages_dirty_lock(chunk->plist, num_pages, dirty);
66+ unpin_user_pages_dirty_lock(chunk->plist, num_pages, dirty);
6767 }
6868
6969 void siw_umem_release(struct siw_umem *umem, bool dirty)
@@ -426,7 +426,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable) · 356 unmodified lines
426426 while (nents) {
427427 struct page **plist = &umem->page_chunk[i].plist[got];
428428
429− rv = get_user_pages(first_page_va, nents,
429+ rv = pin_user_pages(first_page_va, nents,
430430 foll_flags | FOLL_LONGTERM,
431431 plist, NULL);
432432 if (rv < 0)
drivers/media/v4l2-core/videobuf-dma-sg.c+4−4
@@ -183,12 +183,12 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, · 182 unmodified lines
183183 dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n",
184184 data, size, dma->nr_pages);
185185
186− err = get_user_pages(data & PAGE_MASK, dma->nr_pages,
186+ err = pin_user_pages(data & PAGE_MASK, dma->nr_pages,
187187 flags | FOLL_LONGTERM, dma->pages, NULL);
188188
189189 if (err != dma->nr_pages) {
190190 dma->nr_pages = (err >= 0) ? err : 0;
191− dprintk(1, "get_user_pages: err=%d [%d]\n", err,
191+ dprintk(1, "pin_user_pages: err=%d [%d]\n", err,
192192 dma->nr_pages);
193193 return err < 0 ? err : -EINVAL;
194194 }
@@ -349,8 +349,8 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) · 154 unmodified lines
349349 BUG_ON(dma->sglen);
350350
351351 if (dma->pages) {
352− for (i = 0; i < dma->nr_pages; i++)
353− put_page(dma->pages[i]);
352+ unpin_user_pages_dirty_lock(dma->pages, dma->nr_pages,
353+ dma->direction == DMA_FROM_DEVICE);
354354 kfree(dma->pages);
355355 dma->pages = NULL;
356356 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h+0−1
@@ -296,7 +296,6 @@ static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode, · 295 unmodified lines
296296 * possible, the driver should only write the valid vnics into the internal
297297 * ram according to the appropriate port mode.
298298 */
299−#define BITS_TO_BYTES(x) ((x)/8)
300299
301300 /* CMNG constants, as derived from system spec calculations */
302301
drivers/net/wireless/intel/iwlegacy/4965-mac.c+2−1
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/firmware.h>
2828 #include <linux/etherdevice.h>
2929 #include <linux/if_arp.h>
30+#include <linux/units.h>
3031
3132 #include <net/mac80211.h>
3233
@@ -6468,7 +6469,7 @@ il4965_set_hw_params(struct il_priv *il) · 6435 unmodified lines
64686469 il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant;
64696470
64706471 il->hw_params.ct_kill_threshold =
6471− CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY);
6472+ celsius_to_kelvin(CT_KILL_THRESHOLD_LEGACY);
64726473
64736474 il->hw_params.sens = &il4965_sensitivity;
64746475 il->hw_params.beacon_time_tsf_bits = IL4965_EXT_BEACON_TIME_POS;
drivers/net/wireless/intel/iwlegacy/4965.c+9−8
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/sched.h>
1818 #include <linux/skbuff.h>
1919 #include <linux/netdevice.h>
20+#include <linux/units.h>
2021 #include <net/mac80211.h>
2122 #include <linux/etherdevice.h>
2223 #include <asm/unaligned.h>
@@ -1104,7 +1105,7 @@ il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel, u8 is_ht40, · 1081 unmodified lines
11041105 /* get current temperature (Celsius) */
11051106 current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN);
11061107 current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX);
1107− current_temp = KELVIN_TO_CELSIUS(current_temp);
1108+ current_temp = kelvin_to_celsius(current_temp);
11081109
11091110 /* select thermal txpower adjustment params, based on channel group
11101111 * (same frequency group used for mimo txatten adjustment) */
@@ -1610,8 +1611,8 @@ il4965_hw_get_temperature(struct il_priv *il) · 499 unmodified lines
16101611 temperature =
16111612 (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;
16121613
1613− D_TEMP("Calibrated temperature: %dK, %dC\n", temperature,
1614− KELVIN_TO_CELSIUS(temperature));
1614+ D_TEMP("Calibrated temperature: %dK, %ldC\n", temperature,
1615+ kelvin_to_celsius(temperature));
16151616
16161617 return temperature;
16171618 }
@@ -1670,12 +1671,12 @@ il4965_temperature_calib(struct il_priv *il) · 52 unmodified lines
16701671
16711672 if (il->temperature != temp) {
16721673 if (il->temperature)
1673− D_TEMP("Temperature changed " "from %dC to %dC\n",
1674− KELVIN_TO_CELSIUS(il->temperature),
1675− KELVIN_TO_CELSIUS(temp));
1674+ D_TEMP("Temperature changed " "from %ldC to %ldC\n",
1675+ kelvin_to_celsius(il->temperature),
1676+ kelvin_to_celsius(temp));
16761677 else
1677− D_TEMP("Temperature " "initialized to %dC\n",
1678− KELVIN_TO_CELSIUS(temp));
1678+ D_TEMP("Temperature " "initialized to %ldC\n",
1679+ kelvin_to_celsius(temp));
16791680 }
16801681
16811682 il->temperature = temp;
drivers/net/wireless/intel/iwlegacy/common.h+0−3
@@ -779,9 +779,6 @@ struct il_sensitivity_ranges { · 778 unmodified lines
779779 u16 nrg_th_cca;
780780 };
781781
782−#define KELVIN_TO_CELSIUS(x) ((x)-273)
783−#define CELSIUS_TO_KELVIN(x) ((x)+273)
784−
785782 /**
786783 * struct il_hw_params
787784 * @bcast_id: f/w broadcast station ID
drivers/net/wireless/intel/iwlwifi/dvm/dev.h+0−5
@@ -237,11 +237,6 @@ struct iwl_sensitivity_ranges { · 236 unmodified lines
237237 u16 nrg_th_cca;
238238 };
239239
240−
241−#define KELVIN_TO_CELSIUS(x) ((x)-273)
242−#define CELSIUS_TO_KELVIN(x) ((x)+273)
243−
244−
245240 /******************************************************************************
246241 *
247242 * Functions implemented in core module which are forward declared here
drivers/net/wireless/intel/iwlwifi/dvm/devices.c+4−2
@@ -10,6 +10,8 @@ · 9 unmodified lines
1010 *
1111 *****************************************************************************/
1212
13+#include <linux/units.h>
14+
1315 /*
1416 * DVM device-specific data & functions
1517 */
@@ -345,7 +347,7 @@ static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) · 329 unmodified lines
345347 static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
346348 {
347349 const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
348− s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
350+ s32 threshold = (s32)celsius_to_kelvin(CT_KILL_THRESHOLD_LEGACY) -
349351 iwl_temp_calib_to_offset(priv);
350352
351353 priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef;
@@ -381,7 +383,7 @@ static void iwl5150_temperature(struct iwl_priv *priv) · 29 unmodified lines
381383 vt = le32_to_cpu(priv->statistics.common.temperature);
382384 vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
383385 /* now vt hold the temperature in Kelvin */
384− priv->temperature = KELVIN_TO_CELSIUS(vt);
386+ priv->temperature = kelvin_to_celsius(vt);
385387 iwl_tt_handler(priv);
386388 }
387389
drivers/nvdimm/pmem.c+0−6
@@ -337,13 +337,7 @@ static void pmem_release_disk(void *__pmem) · 336 unmodified lines
337337 put_disk(pmem->disk);
338338 }
339339
340−static void pmem_pagemap_page_free(struct page *page)
341−{
342− wake_up_var(&page->_refcount);
343−}
344−
345340 static const struct dev_pagemap_ops fsdax_pagemap_ops = {
346− .page_free = pmem_pagemap_page_free,
347341 .kill = pmem_pagemap_kill,
348342 .cleanup = pmem_pagemap_cleanup,
349343 };
drivers/nvme/host/hwmon.c+5−8
@@ -5,14 +5,11 @@ · 4 unmodified lines
55 */
66
77 #include <linux/hwmon.h>
8+#include <linux/units.h>
89 #include <asm/unaligned.h>
910
1011 #include "nvme.h"
1112
12−/* These macros should be moved to linux/temperature.h */
13−#define MILLICELSIUS_TO_KELVIN(t) DIV_ROUND_CLOSEST((t) + 273150, 1000)
14−#define KELVIN_TO_MILLICELSIUS(t) ((t) * 1000L - 273150)
15−
1613 struct nvme_hwmon_data {
1714 struct nvme_ctrl *ctrl;
1815 struct nvme_smart_log log;
@@ -35,7 +32,7 @@ static int nvme_get_temp_thresh(struct nvme_ctrl *ctrl, int sensor, bool under, · 16 unmodified lines
3532 return -EIO;
3633 if (ret < 0)
3734 return ret;
38− *temp = KELVIN_TO_MILLICELSIUS(status & NVME_TEMP_THRESH_MASK);
35+ *temp = kelvin_to_millicelsius(status & NVME_TEMP_THRESH_MASK);
3936
4037 return 0;
4138 }
@@ -46,7 +43,7 @@ static int nvme_set_temp_thresh(struct nvme_ctrl *ctrl, int sensor, bool under, · 4 unmodified lines
4643 unsigned int threshold = sensor << NVME_TEMP_THRESH_SELECT_SHIFT;
4744 int ret;
4845
49− temp = MILLICELSIUS_TO_KELVIN(temp);
46+ temp = millicelsius_to_kelvin(temp);
5047 threshold |= clamp_val(temp, 0, NVME_TEMP_THRESH_MASK);
5148
5249 if (under)
@@ -88,7 +85,7 @@ static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type, · 35 unmodified lines
8885 case hwmon_temp_min:
8986 return nvme_get_temp_thresh(data->ctrl, channel, true, val);
9087 case hwmon_temp_crit:
91− *val = KELVIN_TO_MILLICELSIUS(data->ctrl->cctemp);
88+ *val = kelvin_to_millicelsius(data->ctrl->cctemp);
9289 return 0;
9390 default:
9491 break;
@@ -105,7 +102,7 @@ static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type, · 10 unmodified lines
105102 temp = get_unaligned_le16(log->temperature);
106103 else
107104 temp = le16_to_cpu(log->temp_sensor[channel - 1]);
108− *val = KELVIN_TO_MILLICELSIUS(temp);
105+ *val = kelvin_to_millicelsius(temp);
109106 break;
110107 case hwmon_temp_alarm:
111108 *val = !!(log->critical_warning & NVME_SMART_CRIT_TEMPERATURE);
drivers/platform/goldfish/goldfish_pipe.c+12−23
@@ -257,12 +257,12 @@ static int goldfish_pipe_error_convert(int status) · 256 unmodified lines
257257 }
258258 }
259259
260−static int pin_user_pages(unsigned long first_page,
261− unsigned long last_page,
262− unsigned int last_page_size,
263− int is_write,
264− struct page *pages[MAX_BUFFERS_PER_COMMAND],
265− unsigned int *iter_last_page_size)
260+static int goldfish_pin_pages(unsigned long first_page,
261+ unsigned long last_page,
262+ unsigned int last_page_size,
263+ int is_write,
264+ struct page *pages[MAX_BUFFERS_PER_COMMAND],
265+ unsigned int *iter_last_page_size)
266266 {
267267 int ret;
268268 int requested_pages = ((last_page - first_page) >> PAGE_SHIFT) + 1;
@@ -274,7 +274,7 @@ static int pin_user_pages(unsigned long first_page, · 5 unmodified lines
274274 *iter_last_page_size = last_page_size;
275275 }
276276
277− ret = get_user_pages_fast(first_page, requested_pages,
277+ ret = pin_user_pages_fast(first_page, requested_pages,
278278 !is_write ? FOLL_WRITE : 0,
279279 pages);
280280 if (ret <= 0)
@@ -285,18 +285,6 @@ static int pin_user_pages(unsigned long first_page, · 4 unmodified lines
285285 return ret;
286286 }
287287
288−static void release_user_pages(struct page **pages, int pages_count,
289− int is_write, s32 consumed_size)
290−{
291− int i;
292−
293− for (i = 0; i < pages_count; i++) {
294− if (!is_write && consumed_size > 0)
295− set_page_dirty(pages[i]);
296− put_page(pages[i]);
297− }
298−}
299−
300288 /* Populate the call parameters, merging adjacent pages together */
301289 static void populate_rw_params(struct page **pages,
302290 int pages_count,
@@ -354,9 +342,9 @@ static int transfer_max_buffers(struct goldfish_pipe *pipe, · 51 unmodified lines
354342 if (mutex_lock_interruptible(&pipe->lock))
355343 return -ERESTARTSYS;
356344
357− pages_count = pin_user_pages(first_page, last_page,
358− last_page_size, is_write,
359− pipe->pages, &iter_last_page_size);
345+ pages_count = goldfish_pin_pages(first_page, last_page,
346+ last_page_size, is_write,
347+ pipe->pages, &iter_last_page_size);
360348 if (pages_count < 0) {
361349 mutex_unlock(&pipe->lock);
362350 return pages_count;
@@ -372,7 +360,8 @@ static int transfer_max_buffers(struct goldfish_pipe *pipe, · 9 unmodified lines
372360
373361 *consumed_size = pipe->command_buffer->rw_params.consumed_size;
374362
375− release_user_pages(pipe->pages, pages_count, is_write, *consumed_size);
363+ unpin_user_pages_dirty_lock(pipe->pages, pages_count,
364+ !is_write && *consumed_size > 0);
376365
377366 mutex_unlock(&pipe->lock);
378367 return 0;
drivers/platform/x86/asus-wmi.c+3−4
@@ -33,9 +33,9 @@ · 32 unmodified lines
3333 #include <linux/seq_file.h>
3434 #include <linux/platform_data/x86/asus-wmi.h>
3535 #include <linux/platform_device.h>
36−#include <linux/thermal.h>
3736 #include <linux/acpi.h>
3837 #include <linux/dmi.h>
38+#include <linux/units.h>
3939
4040 #include <acpi/battery.h>
4141 #include <acpi/video.h>
@@ -1514,9 +1514,8 @@ static ssize_t asus_hwmon_temp1(struct device *dev, · 1472 unmodified lines
15141514 if (err < 0)
15151515 return err;
15161516
1517− value = DECI_KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
1518−
1519− return sprintf(buf, "%d\n", value);
1517+ return sprintf(buf, "%ld\n",
1518+ deci_kelvin_to_millicelsius(value & 0xFFFF));
15201519 }
15211520
15221521 /* Fan1 */
drivers/platform/x86/intel_menlow.c+6−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/slab.h>
2323 #include <linux/thermal.h>
2424 #include <linux/types.h>
25+#include <linux/units.h>
2526
2627 MODULE_AUTHOR("Thomas Sujith");
2728 MODULE_AUTHOR("Zhang Rui");
@@ -302,8 +303,10 @@ static ssize_t aux_show(struct device *dev, struct device_attribute *dev_attr, · 274 unmodified lines
302303 int result;
303304
304305 result = sensor_get_auxtrip(attr->handle, idx, &value);
306+ if (result)
307+ return result;
305308
306− return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
309+ return sprintf(buf, "%lu", deci_kelvin_to_celsius(value));
307310 }
308311
309312 static ssize_t aux0_show(struct device *dev,
@@ -332,8 +335,8 @@ static ssize_t aux_store(struct device *dev, struct device_attribute *dev_attr, · 22 unmodified lines
332335 if (value < 0)
333336 return -EINVAL;
334337
335− result = sensor_set_auxtrip(attr->handle, idx,
336− CELSIUS_TO_DECI_KELVIN(value));
338+ result = sensor_set_auxtrip(attr->handle, idx,
339+ celsius_to_deci_kelvin(value));
337340 return result ? result : count;
338341 }
339342
drivers/thermal/armada_thermal.c+0−2
@@ -21,8 +21,6 @@ · 20 unmodified lines
2121
2222 #include "thermal_core.h"
2323
24−#define TO_MCELSIUS(c) ((c) * 1000)
25−
2624 /* Thermal Manager Control and Status Register */
2725 #define PMU_TDC0_SW_RST_MASK (0x1 << 1)
2826 #define PMU_TM_DISABLE_OFFS 0
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c+4−3
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/init.h>
99 #include <linux/acpi.h>
1010 #include <linux/thermal.h>
11+#include <linux/units.h>
1112 #include "int340x_thermal_zone.h"
1213
1314 static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
@@ -34,7 +35,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, · 20 unmodified lines
3435 *temp = (unsigned long)conv_temp * 10;
3536 } else
3637 /* _TMP returns the temperature in tenths of degrees Kelvin */
37− *temp = DECI_KELVIN_TO_MILLICELSIUS(tmp);
38+ *temp = deci_kelvin_to_millicelsius(tmp);
3839
3940 return 0;
4041 }
@@ -116,7 +117,7 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, · 75 unmodified lines
116117
117118 snprintf(name, sizeof(name), "PAT%d", trip);
118119 status = acpi_execute_simple_method(d->adev->handle, name,
119− MILLICELSIUS_TO_DECI_KELVIN(temp));
120+ millicelsius_to_deci_kelvin(temp));
120121 if (ACPI_FAILURE(status))
121122 return -EIO;
122123
@@ -163,7 +164,7 @@ static int int340x_thermal_get_trip_config(acpi_handle handle, char *name, · 40 unmodified lines
163164 if (ACPI_FAILURE(status))
164165 return -EIO;
165166
166− *temp = DECI_KELVIN_TO_MILLICELSIUS(r);
167+ *temp = deci_kelvin_to_millicelsius(r);
167168
168169 return 0;
169170 }
drivers/thermal/intel/intel_pch_thermal.c+2−1
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/pci.h>
1414 #include <linux/acpi.h>
1515 #include <linux/thermal.h>
16+#include <linux/units.h>
1617 #include <linux/pm.h>
1718
1819 /* Intel PCH thermal Device IDs */
@@ -93,7 +94,7 @@ static void pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, · 74 unmodified lines
9394 if (ACPI_SUCCESS(status)) {
9495 unsigned long trip_temp;
9596
96− trip_temp = DECI_KELVIN_TO_MILLICELSIUS(r);
97+ trip_temp = deci_kelvin_to_millicelsius(r);
9798 if (trip_temp) {
9899 ptd->psv_temp = trip_temp;
99100 ptd->psv_trip_id = *nr_trips;
drivers/vfio/vfio_iommu_type1.c+7−28
@@ -309,9 +309,8 @@ static int put_pfn(unsigned long pfn, int prot) · 308 unmodified lines
309309 {
310310 if (!is_invalid_reserved_pfn(pfn)) {
311311 struct page *page = pfn_to_page(pfn);
312− if (prot & IOMMU_WRITE)
313− SetPageDirty(page);
314− put_page(page);
312+
313+ unpin_user_pages_dirty_lock(&page, 1, prot & IOMMU_WRITE);
315314 return 1;
316315 }
317316 return 0;
@@ -322,7 +321,6 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, · 4 unmodified lines
322321 {
323322 struct page *page[1];
324323 struct vm_area_struct *vma;
325− struct vm_area_struct *vmas[1];
326324 unsigned int flags = 0;
327325 int ret;
328326
@@ -330,33 +328,14 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, · 1 unmodified line
330328 flags |= FOLL_WRITE;
331329
332330 down_read(&mm->mmap_sem);
333− if (mm == current->mm) {
334− ret = get_user_pages(vaddr, 1, flags | FOLL_LONGTERM, page,
335− vmas);
336− } else {
337− ret = get_user_pages_remote(NULL, mm, vaddr, 1, flags, page,
338− vmas, NULL);
339− /*
340− * The lifetime of a vaddr_get_pfn() page pin is
341− * userspace-controlled. In the fs-dax case this could
342− * lead to indefinite stalls in filesystem operations.
343− * Disallow attempts to pin fs-dax pages via this
344− * interface.
345− */
346− if (ret > 0 && vma_is_fsdax(vmas[0])) {
347− ret = -EOPNOTSUPP;
348− put_page(page[0]);
349− }
350− }
351− up_read(&mm->mmap_sem);
352−
331+ ret = pin_user_pages_remote(NULL, mm, vaddr, 1, flags | FOLL_LONGTERM,
332+ page, NULL, NULL);
353333 if (ret == 1) {
354334 *pfn = page_to_pfn(page[0]);
355− return 0;
335+ ret = 0;
336+ goto done;
356337 }
357338
358− down_read(&mm->mmap_sem);
359−
360339 vaddr = untagged_addr(vaddr);
361340
362341 vma = find_vma_intersection(mm, vaddr, vaddr + 1);
@@ -366,7 +345,7 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, · 3 unmodified lines
366345 if (is_invalid_reserved_pfn(*pfn))
367346 ret = 0;
368347 }
369−
348+done:
370349 up_read(&mm->mmap_sem);
371350 return ret;
372351 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t