Update backport patches up to 5.19.

Drop support for <4.9.
This commit is contained in:
CrazyCat
2023-03-18 23:29:21 +02:00
parent 6fec82c8e8
commit 1995c153cf
39 changed files with 5245 additions and 2872 deletions

View File

@@ -28,6 +28,20 @@ add drx39xxj.patch
add ccs.patch
add rc-cec.patch
[5.19.1023]
add v5.19_class.patch
add v5.19_i2client.patch
add v5.19_pt3.patch
add v5.19_testdrv.patch
add v5.19_timer.patch
add v5.19_v4l2-tpg.patch
add v5.19_videobuf2.patch
[5.18.1023]
add v5.18_rc.patch
add v5.18_rc2.patch
add v5.18_v4l2.patch
[5.17.1023]
add v5.17_spi.patch
add v5.17_iosys.patch
@@ -40,7 +54,6 @@ add v5.15_container_of.patch
add v5.14_bus_void_return.patch
[5.13.1023]
add v5.13_atmel.patch
add v5.13_stk1160.patch
[5.12.1023]
@@ -78,6 +91,9 @@ add v5.5_go7007.patch
add v5.4_revert_spi_transfer.patch
add v5.4_async.patch
[5.3.1023]
add v5.3_dma_resv.patch
[5.1.1023]
add v5.1_vm_map_pages.patch
add v5.1_devm_i2c_new_dummy_device.patch
@@ -94,6 +110,8 @@ add v4.20_access_ok.patch
add v4.18_fwnode_args_args.patch
add v4.18_ccs_bitops.patch
add v4.18_vb2_map_atomic.patch
add v4.18_device_match_fwnode.patch
add v4.18_ida_simple.patch
[4.17.1023]
add v4.17_i2c_check_num_msgs.patch
@@ -136,31 +154,6 @@ add v4.9_probe_new.patch
add v4.9_vivid_ktime.patch
[4.8.1023]
add v4.8_user_pages_flag.patch
add v4.8_em28xx_bitfield.patch
add v4.8_dma_map_resource.patch
add v4.8_drm_crtc.patch
[4.7.1023]
add v4.7_dma_attrs.patch
add v4.7_pci_alloc_irq_vectors.patch
add v4.7_copy_to_user_warning.patch
add v4.7_objtool_warning.patch
[4.6.1023]
add v4.6_i2c_mux.patch
[4.5.1023]
add v4.5_gpiochip_data_pointer.patch
add v4.5_get_user_pages.patch
add v4.5_uvc_super_plus.patch
add v4.5_copy_to_user_warning.patch
add v4.5_vb2_cpu_access.patch
[4.4.1023]
add v4.4_gpio_chip_parent.patch
add v4.4_user_pages_flag.patch
[4.3.1023]
delete v4.4_user_pages_flag.patch
add v4.3_bt87x_const_fix.patch

View File

@@ -1688,30 +1688,6 @@ index 5bcbf0d40147..c99d6b059797 100644
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/input.h>
diff --git a/drivers/media/usb/stkwebcam/stk-sensor.c b/drivers/media/usb/stkwebcam/stk-sensor.c
index 94aa6a27f934..33f08a47a41d 100644
--- a/drivers/media/usb/stkwebcam/stk-sensor.c
+++ b/drivers/media/usb/stkwebcam/stk-sensor.c
@@ -33,6 +33,7 @@
/* It seems the i2c bus is controlled with these registers */
+#undef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "stk-webcam.h"
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 9f445e6ab5fa..871be52e3649 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -9,6 +9,7 @@
* Copyright 2006-2007 Jonathan Corbet
*/
+#undef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
index 9e016b71aa91..3f0c291b9a67 100644
--- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c

View File

@@ -205,18 +205,6 @@ index 049d40b948bb..549c47d59642 100644
#include <linux/delay.h>
#include <linux/videodev2.h>
#include <linux/v4l2-dv-timings.h>
diff --git a/drivers/media/usb/cpia2/cpia2_core.c b/drivers/media/usb/cpia2/cpia2_core.c
index b5a2d06fb356..39e0e301594b 100644
--- a/drivers/media/usb/cpia2/cpia2_core.c
+++ b/drivers/media/usb/cpia2/cpia2_core.c
@@ -23,7 +23,6 @@
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
-#include <linux/sched/signal.h>
#define FIRMWARE "cpia2/stv0672_vp4.bin"
MODULE_FIRMWARE(FIRMWARE);
diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c
index 46ed95483e22..b90be6e31611 100644
--- a/drivers/media/usb/gspca/cpia1.c

View File

@@ -84,16 +84,3 @@ index 5a3cb614a211..c71ddefd2e58 100644
mutex_lock(&dev->i2c_mutex);
addr = msgs[0].addr << 1;
diff --git b/drivers/media/usb/tm6000/tm6000-i2c.c a/drivers/media/usb/tm6000/tm6000-i2c.c
index ccd1adf862b1..659b63febf85 100644
--- b/drivers/media/usb/tm6000/tm6000-i2c.c
+++ a/drivers/media/usb/tm6000/tm6000-i2c.c
@@ -145,6 +145,8 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
struct tm6000_core *dev = i2c_adap->algo_data;
int addr, rc, i, byte;
+ if (num <= 0)
+ return 0;
for (i = 0; i < num; i++) {
addr = (msgs[i].addr << 1) & 0xff;
i2c_dprintk(2, "%s %s addr=0x%x len=%d:",

View File

@@ -50,3 +50,29 @@ index 9dc15a5a9683..b2b6ff5d5e88 100644
#include <linux/string.h>
int cxd2880_convert2s_complement(u32 value, u32 bitlen);
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 11f3d71..1409af2 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -7,7 +7,7 @@
*/
#include <linux/atomic.h>
-#include <linux/bits.h>
+#include <linux/bitops.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/list.h>
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 35453f8..d6eefb1 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -6,7 +6,7 @@
* Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/
-#include <linux/bits.h>
+#include <linux/bitops.h>
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/list.h>

View File

@@ -0,0 +1,26 @@
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index dff1d9b..98463739 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -991,7 +991,7 @@ int v4l2_subdev_get_fwnode_pad_1_to_1(struct media_entity *entity,
fwnode = fwnode_graph_get_port_parent(endpoint->local_fwnode);
fwnode_handle_put(fwnode);
- if (device_match_fwnode(sd->dev, fwnode))
+ if (dev_fwnode(sd->dev) == fwnode)
return endpoint->port;
return -ENXIO;
diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c
index 11dd142..9d46a36 100644
--- a/drivers/staging/media/tegra-video/vi.c
+++ b/drivers/staging/media/tegra-video/vi.c
@@ -1811,7 +1811,7 @@ static int tegra_vi_graph_parse_one(struct tegra_vi_channel *chan,
}
/* skip entities that are already processed */
- if (device_match_fwnode(vi->dev, remote) ||
+ if (remote == dev_fwnode(vi->dev) ||
tegra_vi_graph_find_entity(chan, remote)) {
fwnode_handle_put(remote);
continue;

View File

@@ -0,0 +1,62 @@
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 25ab61d..765375b 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -715,7 +715,7 @@ int lirc_register(struct rc_dev *dev)
const char *rx_type, *tx_type;
int err, minor;
- minor = ida_alloc_max(&lirc_ida, RC_DEV_MAX - 1, GFP_KERNEL);
+ minor = ida_simple_get(&lirc_ida, 0, RC_DEV_MAX, GFP_KERNEL);
if (minor < 0)
return minor;
@@ -760,7 +760,7 @@ int lirc_register(struct rc_dev *dev)
return 0;
out_ida:
- ida_free(&lirc_ida, minor);
+ ida_simple_remove(&lirc_ida, minor);
return err;
}
@@ -778,7 +778,7 @@ void lirc_unregister(struct rc_dev *dev)
spin_unlock_irqrestore(&dev->lirc_fh_lock, flags);
cdev_device_del(&dev->lirc_cdev, &dev->lirc_dev);
- ida_free(&lirc_ida, MINOR(dev->lirc_dev.devt));
+ ida_simple_remove(&lirc_ida, MINOR(dev->lirc_dev.devt));
}
int __init lirc_dev_init(void)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 527d932..c4d36b0 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1898,7 +1898,7 @@ int rc_register_device(struct rc_dev *dev)
if (!dev)
return -EINVAL;
- minor = ida_alloc_max(&rc_ida, RC_DEV_MAX - 1, GFP_KERNEL);
+ minor = ida_simple_get(&rc_ida, 0, RC_DEV_MAX, GFP_KERNEL);
if (minor < 0)
return minor;
@@ -1981,7 +1981,7 @@ int rc_register_device(struct rc_dev *dev)
out_raw:
ir_raw_event_free(dev);
out_minor:
- ida_free(&rc_ida, minor);
+ ida_simple_remove(&rc_ida, minor);
return rc;
}
EXPORT_SYMBOL_GPL(rc_register_device);
@@ -2041,7 +2041,7 @@ void rc_unregister_device(struct rc_dev *dev)
device_del(&dev->dev);
- ida_free(&rc_ida, dev->minor);
+ ida_simple_remove(&rc_ida, dev->minor);
if (!dev->managed_alloc)
rc_free_device(dev);

View File

@@ -1,20 +0,0 @@
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index d8ade87..eb3d306 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -401,13 +401,13 @@ static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runti
static int snd_bt87x_set_analog_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime)
{
- static const struct snd_ratnum analog_clock = {
+ static struct snd_ratnum analog_clock = {
.num = ANALOG_CLOCK,
.den_min = CLOCK_DIV_MIN,
.den_max = CLOCK_DIV_MAX,
.den_step = 1
};
- static const struct snd_pcm_hw_constraint_ratnums constraint_rates = {
+ static struct snd_pcm_hw_constraint_ratnums constraint_rates = {
.nrats = 1,
.rats = &analog_clock
};

View File

@@ -1,13 +0,0 @@
diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c
index 95267c6..7c378de 100644
--- a/drivers/media/dvb-frontends/cxd2820r_core.c
+++ b/drivers/media/dvb-frontends/cxd2820r_core.c
@@ -662,7 +662,7 @@ static int cxd2820r_probe(struct i2c_client *client,
#ifdef CONFIG_GPIOLIB
/* Add GPIOs */
priv->gpio_chip.label = KBUILD_MODNAME;
- priv->gpio_chip.parent = &client->dev;
+ priv->gpio_chip.dev = &client->dev;
priv->gpio_chip.owner = THIS_MODULE;
priv->gpio_chip.direction_output = cxd2820r_gpio_direction_output;
priv->gpio_chip.set = cxd2820r_gpio_set;

View File

@@ -1,65 +0,0 @@
diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c
index 16f4a9364747..b823e0a768d8 100644
--- a/drivers/media/pci/ivtv/ivtv-udma.c
+++ b/drivers/media/pci/ivtv/ivtv-udma.c
@@ -113,7 +113,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
/* Get user pages for DMA Xfer */
err = get_user_pages_unlocked(current, current->mm,
- user_dma.uaddr, user_dma.page_count, 0, 1, dma->map);
+ user_dma.uaddr, user_dma.page_count, dma->map, FOLL_FORCE);
if (user_dma.page_count != err) {
IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c
index 2019ed26472d..f554184395bc 100644
--- a/drivers/media/pci/ivtv/ivtv-yuv.c
+++ b/drivers/media/pci/ivtv/ivtv-yuv.c
@@ -64,13 +64,13 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
/* Get user pages for DMA Xfer */
y_pages = get_user_pages_unlocked(current, current->mm,
- y_dma.uaddr, y_dma.page_count, 0, 1,
- &dma->map[0]);
+ y_dma.uaddr, y_dma.page_count,
+ &dma->map[0], FOLL_FORCE);
uv_pages = 0; /* silence gcc. value is set and consumed only if: */
if (y_pages == y_dma.page_count) {
uv_pages = get_user_pages_unlocked(current, current->mm,
- uv_dma.uaddr, uv_dma.page_count, 0, 1,
- &dma->map[y_pages]);
+ uv_dma.uaddr, uv_dma.page_count,
+ &dma->map[y_pages], FOLL_FORCE);
}
if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 408dc4145815..8abe973c6fa8 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -153,6 +153,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
{
unsigned long first, last;
int err, rw = 0;
+ unsigned int flags = FOLL_FORCE;
dma->direction = direction;
switch (dma->direction) {
@@ -176,13 +177,15 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
if (NULL == dma->pages)
return -ENOMEM;
+ if (rw == READ)
+ flags |= FOLL_WRITE;
+
dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n",
data, size, dma->nr_pages);
err = get_user_pages(current, current->mm,
data & PAGE_MASK, dma->nr_pages,
- rw == READ, 1, /* force */
- dma->pages, NULL);
+ flags, dma->pages, NULL);
if (err != dma->nr_pages) {
dma->nr_pages = (err >= 0) ? err : 0;

View File

@@ -1,13 +0,0 @@
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 5b82e63..272473c 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -344,7 +344,7 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
readbuf[i++] = dev->rdsbuf[dev->rdsout++];
mutex_unlock(&dev->lock);
- if (i && copy_to_user(data, readbuf, i))
+ if (i > sizeof(readbuf) || (i && copy_to_user(data, readbuf, i)))
return -EFAULT;
return i;
}

View File

@@ -1,52 +0,0 @@
diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c
index 4769469fe842..24152accc66c 100644
--- a/drivers/media/pci/ivtv/ivtv-udma.c
+++ b/drivers/media/pci/ivtv/ivtv-udma.c
@@ -124,8 +124,8 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
}
/* Get user pages for DMA Xfer */
- err = get_user_pages_unlocked(user_dma.uaddr, user_dma.page_count, 0,
- 1, dma->map);
+ err = get_user_pages_unlocked(current, current->mm,
+ user_dma.uaddr, user_dma.page_count, 0, 1, dma->map);
if (user_dma.page_count != err) {
IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c
index b094054cda6e..2b8e7b2f2b86 100644
--- a/drivers/media/pci/ivtv/ivtv-yuv.c
+++ b/drivers/media/pci/ivtv/ivtv-yuv.c
@@ -75,12 +75,14 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
ivtv_udma_get_page_info (&uv_dma, (unsigned long)args->uv_source, 360 * uv_decode_height);
/* Get user pages for DMA Xfer */
- y_pages = get_user_pages_unlocked(y_dma.uaddr,
- y_dma.page_count, 0, 1, &dma->map[0]);
+ y_pages = get_user_pages_unlocked(current, current->mm,
+ y_dma.uaddr, y_dma.page_count, 0, 1,
+ &dma->map[0]);
uv_pages = 0; /* silence gcc. value is set and consumed only if: */
if (y_pages == y_dma.page_count) {
- uv_pages = get_user_pages_unlocked(uv_dma.uaddr,
- uv_dma.page_count, 0, 1, &dma->map[y_pages]);
+ uv_pages = get_user_pages_unlocked(current, current->mm,
+ uv_dma.uaddr, uv_dma.page_count, 0, 1,
+ &dma->map[y_pages]);
}
if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index df4c052c6bd6..f669cedca8bd 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -181,7 +181,8 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n",
data, size, dma->nr_pages);
- err = get_user_pages(data & PAGE_MASK, dma->nr_pages,
+ err = get_user_pages(current, current->mm,
+ data & PAGE_MASK, dma->nr_pages,
rw == READ, 1, /* force */
dma->pages, NULL);

View File

@@ -1,43 +0,0 @@
diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c
index 95267c6..d980d6b 100644
--- a/drivers/media/dvb-frontends/cxd2820r_core.c
+++ b/drivers/media/dvb-frontends/cxd2820r_core.c
@@ -434,7 +434,8 @@ static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr,
int val)
{
- struct cxd2820r_priv *priv = gpiochip_get_data(chip);
+ struct cxd2820r_priv *priv =
+ container_of(chip, struct cxd2820r_priv, gpio_chip);
struct i2c_client *client = priv->client[0];
u8 gpio[GPIO_COUNT];
@@ -448,7 +449,8 @@ static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr,
static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val)
{
- struct cxd2820r_priv *priv = gpiochip_get_data(chip);
+ struct cxd2820r_priv *priv =
+ container_of(chip, struct cxd2820r_priv, gpio_chip);
struct i2c_client *client = priv->client[0];
u8 gpio[GPIO_COUNT];
@@ -464,7 +466,8 @@ static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val)
static int cxd2820r_gpio_get(struct gpio_chip *chip, unsigned nr)
{
- struct cxd2820r_priv *priv = gpiochip_get_data(chip);
+ struct cxd2820r_priv *priv =
+ container_of(chip, struct cxd2820r_priv, gpio_chip);
struct i2c_client *client = priv->client[0];
dev_dbg(&client->dev, "nr=%u\n", nr);
@@ -670,7 +673,7 @@ static int cxd2820r_probe(struct i2c_client *client,
priv->gpio_chip.base = -1; /* Dynamic allocation */
priv->gpio_chip.ngpio = GPIO_COUNT;
priv->gpio_chip.can_sleep = 1;
- ret = gpiochip_add_data(&priv->gpio_chip, priv);
+ ret = gpiochip_add(&priv->gpio_chip);
if (ret)
goto err_regmap_1_regmap_exit;

View File

@@ -1,12 +0,0 @@
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index b5589d5..075a0fe 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1470,7 +1470,6 @@ static unsigned int uvc_endpoint_max_bpi(struct usb_device *dev,
switch (dev->speed) {
case USB_SPEED_SUPER:
- case USB_SPEED_SUPER_PLUS:
return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
case USB_SPEED_HIGH:
psize = usb_endpoint_maxp(&ep->desc);

View File

@@ -1,54 +0,0 @@
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index 29d3707b8f27..5656d80be384 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -346,16 +346,17 @@ static void vb2_dc_dmabuf_ops_release(struct dma_buf *dbuf)
static int
vb2_dc_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
+ size_t start, size_t length,
enum dma_data_direction direction)
{
return 0;
}
-static int
+static void
vb2_dc_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
+ size_t start, size_t length,
enum dma_data_direction direction)
{
- return 0;
}
static void *vb2_dc_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum)
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index 5ba5c87a5fe5..7349375bf197 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -489,6 +489,7 @@ static void vb2_dma_sg_dmabuf_ops_release(struct dma_buf *dbuf)
static int
vb2_dma_sg_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
+ size_t start, size_t length,
enum dma_data_direction direction)
{
struct vb2_dma_sg_buf *buf = dbuf->priv;
@@ -498,15 +499,15 @@ vb2_dma_sg_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
return 0;
}
-static int
+static void
vb2_dma_sg_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
+ size_t start, size_t length,
enum dma_data_direction direction)
{
struct vb2_dma_sg_buf *buf = dbuf->priv;
struct sg_table *sgt = buf->dma_sgt;
dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
- return 0;
}
static void *vb2_dma_sg_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum)

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index 97365a8..0330226 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -1494,7 +1494,10 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
fragbuf[0] = connection_id;
fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00;
- status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen);
+ /* to fix a warning for older kernels we need to check fraglen explicitly */
+ status = -1;
+ if (fraglen <= sizeof(fragbuf) - 2)
+ status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen);
if (status) {
status = -EFAULT;
goto exit;

View File

@@ -1,484 +0,0 @@
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index abf1279858d0..d2066b77ddc3 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -28,7 +28,7 @@ struct vb2_dc_buf {
unsigned long size;
void *cookie;
dma_addr_t dma_addr;
- unsigned long attrs;
+ struct dma_attrs attrs;
enum dma_data_direction dma_dir;
struct sg_table *dma_sgt;
struct frame_vector *vec;
@@ -56,10 +56,10 @@ static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
unsigned int i;
unsigned long size = 0;
- for_each_sgtable_dma_sg(sgt, s, i) {
+ for_each_sg(sgt->sgl, s, sgt->nents, i) {
if (sg_dma_address(s) != expected)
break;
- expected += sg_dma_len(s);
+ expected = sg_dma_address(s) + sg_dma_len(s);
size += sg_dma_len(s);
}
return size;
@@ -132,7 +132,8 @@ static void vb2_dc_prepare(void *buf_priv)
flush_kernel_vmap_range(buf->vaddr, buf->size);
/* For both USERPTR and non-coherent MMAP */
- dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
+ dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir);
}
static void vb2_dc_finish(void *buf_priv)
@@ -152,7 +153,7 @@ static void vb2_dc_finish(void *buf_priv)
invalidate_kernel_vmap_range(buf->vaddr, buf->size);
/* For both USERPTR and non-coherent MMAP */
- dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
+ dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir);
}
/*********************************************/
@@ -177,7 +178,7 @@ static void vb2_dc_put(void *buf_priv)
kfree(buf->sgt_base);
}
dma_free_attrs(buf->dev, buf->size, buf->cookie,
- buf->dma_addr, buf->attrs);
+ buf->dma_addr, &buf->attrs);
}
put_device(buf->dev);
kfree(buf);
@@ -191,11 +192,11 @@ static int vb2_dc_alloc_coherent(struct vb2_dc_buf *buf)
buf->size,
&buf->dma_addr,
GFP_KERNEL | q->gfp_flags,
- buf->attrs);
+ &buf->attrs);
if (!buf->cookie)
return -ENOMEM;
- if (q->dma_attrs & DMA_ATTR_NO_KERNEL_MAPPING)
+ if (!dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->attrs))
return 0;
buf->vaddr = buf->cookie;
@@ -210,7 +211,7 @@ static int vb2_dc_alloc_non_coherent(struct vb2_dc_buf *buf)
buf->size,
buf->dma_dir,
GFP_KERNEL | q->gfp_flags,
- buf->attrs);
+ 0);
if (!buf->dma_sgt)
return -ENOMEM;
@@ -237,7 +238,7 @@ static void *vb2_dc_alloc(struct vb2_buffer *vb,
if (!buf)
return ERR_PTR(-ENOMEM);
- buf->attrs = vb->vb2_queue->dma_attrs;
+ buf->attrs = *vb->vb2_queue->dma_attrs;
buf->dma_dir = vb->vb2_queue->dma_dir;
buf->vb = vb;
buf->non_coherent_mem = vb->vb2_queue->non_coherent_mem;
@@ -287,7 +288,7 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
buf->dma_sgt);
else
ret = dma_mmap_attrs(buf->dev, vma, buf->cookie, buf->dma_addr,
- buf->size, buf->attrs);
+ buf->size, &buf->attrs);
if (ret) {
pr_err("Remapping memory failed, error: %d\n", ret);
return ret;
@@ -365,15 +366,19 @@ static void vb2_dc_dmabuf_ops_detach(struct dma_buf *dbuf,
sgt = &attach->sgt;
/* release the scatterlist cache */
- if (attach->dma_dir != DMA_NONE)
+ if (attach->dma_dir != DMA_NONE) {
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
/*
* Cache sync can be skipped here, as the vb2_dc memory is
* allocated from device coherent memory, which means the
* memory locations do not require any explicit cache
* maintenance prior or after being used by the device.
*/
- dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sg_attrs(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ attach->dma_dir, &attrs);
+ }
sg_free_table(sgt);
kfree(attach);
db_attach->priv = NULL;
@@ -386,6 +391,9 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
/* stealing dmabuf mutex to serialize map/unmap operations */
struct mutex *lock = &db_attach->dmabuf->lock;
struct sg_table *sgt;
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
mutex_lock(lock);
@@ -398,8 +406,8 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
/* release any previous cache */
if (attach->dma_dir != DMA_NONE) {
- dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sg_attrs(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ attach->dma_dir, &attrs);
attach->dma_dir = DMA_NONE;
}
@@ -407,8 +415,9 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
* mapping to the client with new direction, no cache sync
* required see comment in vb2_dc_dmabuf_ops_detach()
*/
- if (dma_map_sgtable(db_attach->dev, sgt, dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC)) {
+ sgt->nents = dma_map_sg_attrs(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ dma_dir, &attrs);
+ if (!sgt->nents) {
pr_err("failed to map scatterlist\n");
mutex_unlock(lock);
return ERR_PTR(-EIO);
@@ -502,7 +511,7 @@ static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
}
ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
- buf->size, buf->attrs);
+ buf->size, &buf->attrs);
if (ret < 0) {
dev_err(buf->dev, "failed to get scatterlist from DMA API\n");
kfree(sgt);
@@ -553,12 +562,15 @@ static void vb2_dc_put_userptr(void *buf_priv)
struct page **pages;
if (sgt) {
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
/*
* No need to sync to CPU, it's already synced to the CPU
* since the finish() memop will have been called before this.
*/
- dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir, &attrs);
pages = frame_vector_pages(buf->vec);
/* sgt should exist only if vector contains pages... */
BUG_ON(IS_ERR(pages));
@@ -615,6 +627,9 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev,
struct sg_table *sgt;
unsigned long contig_size;
unsigned long dma_align = dma_get_cache_alignment();
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
/* Only cache aligned DMA transfers are reliable */
if (!IS_ALIGNED(vaddr | size, dma_align)) {
@@ -679,8 +694,9 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev,
* No need to sync to the device, this will happen later when the
* prepare() memop is called.
*/
- if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC)) {
+ sgt->nents = dma_map_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir, &attrs);
+ if (sgt->nents <= 0) {
pr_err("failed to map scatterlist\n");
ret = -EIO;
goto fail_sgt_init;
@@ -704,7 +720,8 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev,
return buf;
fail_map_sg:
- dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir, &attrs);
fail_sgt_init:
sg_free_table(sgt);
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index e8728f26d92a..1a82e5a3dc88 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -104,6 +104,9 @@ static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev,
struct sg_table *sgt;
int ret;
int num_pages;
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
if (WARN_ON(!dev) || WARN_ON(!size))
return ERR_PTR(-EINVAL);
@@ -147,8 +150,9 @@ static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev,
* No need to sync to the device, this will happen later when the
* prepare() memop is called.
*/
- if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC))
+ sgt->nents = dma_map_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir, &attrs);
+ if (!sgt->nents)
goto fail_map;
buf->handler.refcount = &buf->refcount;
@@ -183,10 +187,13 @@ static void vb2_dma_sg_put(void *buf_priv)
int i = buf->num_pages;
if (atomic_dec_and_test(&buf->refcount)) {
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
dprintk(1, "%s: Freeing buffer of %d pages\n", __func__,
buf->num_pages);
- dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir,
+ &attrs);
if (buf->vaddr)
vm_unmap_ram(buf->vaddr, buf->num_pages);
sg_free_table(buf->dma_sgt);
@@ -206,7 +213,8 @@ static void vb2_dma_sg_prepare(void *buf_priv)
if (buf->vb->skip_cache_sync_on_prepare)
return;
- dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
+ dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir);
}
static void vb2_dma_sg_finish(void *buf_priv)
@@ -217,7 +225,7 @@ static void vb2_dma_sg_finish(void *buf_priv)
if (buf->vb->skip_cache_sync_on_finish)
return;
- dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
+ dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir);
}
static void *vb2_dma_sg_get_userptr(struct vb2_buffer *vb, struct device *dev,
@@ -225,11 +233,13 @@ static void *vb2_dma_sg_get_userptr(struct vb2_buffer *vb, struct device *dev,
{
struct vb2_dma_sg_buf *buf;
struct sg_table *sgt;
+ DEFINE_DMA_ATTRS(attrs);
struct frame_vector *vec;
if (WARN_ON(!dev))
return ERR_PTR(-EINVAL);
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
buf = kzalloc(sizeof *buf, GFP_KERNEL);
if (!buf)
return ERR_PTR(-ENOMEM);
@@ -260,8 +270,9 @@ static void *vb2_dma_sg_get_userptr(struct vb2_buffer *vb, struct device *dev,
* No need to sync to the device, this will happen later when the
* prepare() memop is called.
*/
- if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
- DMA_ATTR_SKIP_CPU_SYNC))
+ sgt->nents = dma_map_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
+ buf->dma_dir, &attrs);
+ if (!sgt->nents)
goto userptr_fail_map;
return buf;
@@ -284,10 +295,14 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)
struct vb2_dma_sg_buf *buf = buf_priv;
struct sg_table *sgt = &buf->sg_table;
int i = buf->num_pages;
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
dprintk(1, "%s: Releasing userspace buffer of %d pages\n",
__func__, buf->num_pages);
- dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
+ dma_unmap_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir,
+ &attrs);
if (buf->vaddr)
vm_unmap_ram(buf->vaddr, buf->num_pages);
sg_free_table(buf->dma_sgt);
@@ -421,7 +436,8 @@ static void vb2_dma_sg_dmabuf_ops_detach(struct dma_buf *dbuf,
/* release the scatterlist cache */
if (attach->dma_dir != DMA_NONE)
- dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir, 0);
+ dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ attach->dma_dir);
sg_free_table(sgt);
kfree(attach);
db_attach->priv = NULL;
@@ -446,12 +462,15 @@ static struct sg_table *vb2_dma_sg_dmabuf_ops_map(
/* release any previous cache */
if (attach->dma_dir != DMA_NONE) {
- dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir, 0);
+ dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ attach->dma_dir);
attach->dma_dir = DMA_NONE;
}
/* mapping to the client with new direction */
- if (dma_map_sgtable(db_attach->dev, sgt, dma_dir, 0)) {
+ sgt->nents = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ dma_dir);
+ if (!sgt->nents) {
pr_err("failed to map scatterlist\n");
mutex_unlock(lock);
return ERR_PTR(-EIO);
diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
index b35b169c022a..4e669d43ac13 100644
--- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c
+++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
@@ -227,7 +227,7 @@ static int vb2_vmalloc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *de
kfree(attach);
return ret;
}
- for_each_sgtable_sg(sgt, sg, i) {
+ for_each_sg(sgt->sgl, sg, sgt->nents, i) {
struct page *page = vmalloc_to_page(vaddr);
if (!page) {
@@ -257,7 +257,8 @@ static void vb2_vmalloc_dmabuf_ops_detach(struct dma_buf *dbuf,
/* release the scatterlist cache */
if (attach->dma_dir != DMA_NONE)
- dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir, 0);
+ dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ attach->dma_dir);
sg_free_table(sgt);
kfree(attach);
db_attach->priv = NULL;
@@ -282,12 +283,15 @@ static struct sg_table *vb2_vmalloc_dmabuf_ops_map(
/* release any previous cache */
if (attach->dma_dir != DMA_NONE) {
- dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir, 0);
+ dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ attach->dma_dir);
attach->dma_dir = DMA_NONE;
}
/* mapping to the client with new direction */
- if (dma_map_sgtable(db_attach->dev, sgt, dma_dir, 0)) {
+ sgt->nents = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
+ dma_dir);
+ if (!sgt->nents) {
pr_err("failed to map scatterlist\n");
mutex_unlock(lock);
return ERR_PTR(-EIO);
diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-hw.c b/drivers/media/platform/st/sti/bdisp/bdisp-hw.c
index a74e9fd65238..eafc63307ef7 100644
--- a/drivers/media/platform/st/sti/bdisp/bdisp-hw.c
+++ b/drivers/media/platform/st/sti/bdisp/bdisp-hw.c
@@ -430,11 +430,14 @@ int bdisp_hw_get_and_clear_irq(struct bdisp_dev *bdisp)
*/
void bdisp_hw_free_nodes(struct bdisp_ctx *ctx)
{
- if (ctx && ctx->node[0])
+ if (ctx && ctx->node[0]) {
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
dma_free_attrs(ctx->bdisp_dev->dev,
sizeof(struct bdisp_node) * MAX_NB_NODE,
- ctx->node[0], ctx->node_paddr[0],
- DMA_ATTR_WRITE_COMBINE);
+ ctx->node[0], ctx->node_paddr[0], &attrs);
+ }
}
/**
@@ -452,10 +455,12 @@ int bdisp_hw_alloc_nodes(struct bdisp_ctx *ctx)
unsigned int i, node_size = sizeof(struct bdisp_node);
void *base;
dma_addr_t paddr;
+ DEFINE_DMA_ATTRS(attrs);
/* Allocate all the nodes within a single memory page */
+ dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
base = dma_alloc_attrs(dev, node_size * MAX_NB_NODE, &paddr,
- GFP_KERNEL, DMA_ATTR_WRITE_COMBINE);
+ GFP_KERNEL, &attrs);
if (!base) {
dev_err(dev, "%s no mem\n", __func__);
return -ENOMEM;
@@ -488,9 +493,13 @@ void bdisp_hw_free_filters(struct device *dev)
{
int size = (BDISP_HF_NB * NB_H_FILTER) + (BDISP_VF_NB * NB_V_FILTER);
- if (bdisp_h_filter[0].virt)
+ if (bdisp_h_filter[0].virt) {
+ DEFINE_DMA_ATTRS(attrs);
+
+ dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
dma_free_attrs(dev, size, bdisp_h_filter[0].virt,
- bdisp_h_filter[0].paddr, DMA_ATTR_WRITE_COMBINE);
+ bdisp_h_filter[0].paddr, &attrs);
+ }
}
/**
@@ -507,11 +516,12 @@ int bdisp_hw_alloc_filters(struct device *dev)
unsigned int i, size;
void *base;
dma_addr_t paddr;
+ DEFINE_DMA_ATTRS(attrs);
/* Allocate all the filters within a single memory page */
size = (BDISP_HF_NB * NB_H_FILTER) + (BDISP_VF_NB * NB_V_FILTER);
- base = dma_alloc_attrs(dev, size, &paddr, GFP_KERNEL,
- DMA_ATTR_WRITE_COMBINE);
+ dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+ base = dma_alloc_attrs(dev, size, &paddr, GFP_KERNEL, &attrs);
if (!base)
return -ENOMEM;
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 5468b633b9d2..a12fa6e6f9ab 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -475,7 +475,7 @@ struct vb2_buf_ops {
* @alloc_devs: &struct device memory type/allocator-specific per-plane device
* @dev: device to use for the default allocation context if the driver
* doesn't fill in the @alloc_devs array.
- * @dma_attrs: DMA attributes to use for the DMA.
+ * @dma_attrs: DMA attributes to use for the DMA. May be NULL.
* @bidirectional: when this flag is set the DMA direction for the buffers of
* this queue will be overridden with %DMA_BIDIRECTIONAL direction.
* This is useful in cases where the hardware (firmware) writes to
@@ -574,7 +574,7 @@ struct vb2_queue {
unsigned int type;
unsigned int io_modes;
struct device *dev;
- unsigned long dma_attrs;
+ struct dma_attrs *dma_attrs;
unsigned int bidirectional:1;
unsigned int fileio_read_once:1;
unsigned int fileio_write_immediately:1;
diff --git a/include/media/videobuf2-dma-contig.h b/include/media/videobuf2-dma-contig.h
index 5be313cbf7d7..4f0ae91af337 100644
--- a/include/media/videobuf2-dma-contig.h
+++ b/include/media/videobuf2-dma-contig.h
@@ -16,6 +16,8 @@
#include <media/videobuf2-v4l2.h>
#include <linux/dma-mapping.h>
+struct dma_attrs;
+
static inline dma_addr_t
vb2_dma_contig_plane_dma_addr(struct vb2_buffer *vb, unsigned int plane_no)
{

View File

@@ -1,13 +0,0 @@
diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 44ca66c..c2c7585 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -802,6 +802,8 @@ static void ttusb_dec_process_urb_frame_list(unsigned long data)
kfree(frame);
}
}
+/* to fix a warning for Kernel 4.7 */
+STACK_FRAME_NON_STANDARD(ttusb_dec_process_urb_frame_list);
static void ttusb_dec_process_urb(struct urb *urb)
{

View File

@@ -1,58 +0,0 @@
diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c
index c8b1a62..26b08af 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.c
+++ b/drivers/media/pci/cobalt/cobalt-driver.c
@@ -298,7 +298,9 @@ static void cobalt_pci_iounmap(struct cobalt *cobalt, struct pci_dev *pci_dev)
static void cobalt_free_msi(struct cobalt *cobalt, struct pci_dev *pci_dev)
{
free_irq(pci_dev->irq, (void *)cobalt);
- pci_free_irq_vectors(pci_dev);
+
+ if (cobalt->msi_enabled)
+ pci_disable_msi(pci_dev);
}
static int cobalt_setup_pci(struct cobalt *cobalt, struct pci_dev *pci_dev,
@@ -375,12 +377,14 @@ static int cobalt_setup_pci(struct cobalt *cobalt, struct pci_dev *pci_dev,
from being generated. */
cobalt_set_interrupt(cobalt, false);
- if (pci_alloc_irq_vectors(pci_dev, 1, 1, PCI_IRQ_MSI) < 1) {
+ if (pci_enable_msi_range(pci_dev, 1, 1) < 1) {
cobalt_err("Could not enable MSI\n");
+ cobalt->msi_enabled = false;
ret = -EIO;
goto err_release;
}
msi_config_show(cobalt, pci_dev);
+ cobalt->msi_enabled = true;
/* Register IRQ */
if (request_irq(pci_dev->irq, cobalt_irq_handler, IRQF_SHARED,
diff --git a/drivers/media/pci/cobalt/cobalt-driver.h b/drivers/media/pci/cobalt/cobalt-driver.h
index 429bee4..cc33b3a 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.h
+++ b/drivers/media/pci/cobalt/cobalt-driver.h
@@ -275,6 +275,8 @@ struct cobalt {
u32 irq_none;
u32 irq_full_fifo;
+ bool msi_enabled;
+
/* omnitek dma */
int dma_channels;
int first_fifo_channel;
diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c
index 21cce8c..3db28de 100644
--- a/drivers/media/pci/ddbridge/ddbridge-main.c
+++ b/drivers/media/pci/ddbridge/ddbridge-main.c
@@ -106,8 +106,7 @@ static void ddb_irq_msi(struct ddb *dev, int nr)
int stat;
if (msi && pci_msi_enabled()) {
- stat = pci_alloc_irq_vectors(dev->pdev, 1, nr,
- PCI_IRQ_MSI | PCI_IRQ_MSIX);
+ stat = pci_enable_msi_range(dev->pdev, 1, nr);
if (stat >= 1) {
dev->msi = stat;
dev_info(dev->dev, "using %d MSI interrupt(s)\n",

View File

@@ -1,63 +0,0 @@
diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c
index 5f8883031c9c..8cd24ffe9484 100644
--- a/drivers/media/pci/ivtv/ivtv-udma.c
+++ b/drivers/media/pci/ivtv/ivtv-udma.c
@@ -112,8 +112,8 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
}
/* Get user pages for DMA Xfer */
- err = get_user_pages_unlocked(user_dma.uaddr, user_dma.page_count,
- dma->map, FOLL_FORCE);
+ err = get_user_pages_unlocked(user_dma.uaddr, user_dma.page_count, 0,
+ 1, dma->map);
if (user_dma.page_count != err) {
IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c
index cd2fe2d444c0..d219f1f84032 100644
--- a/drivers/media/pci/ivtv/ivtv-yuv.c
+++ b/drivers/media/pci/ivtv/ivtv-yuv.c
@@ -64,12 +64,11 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
/* Get user pages for DMA Xfer */
y_pages = get_user_pages_unlocked(y_dma.uaddr,
- y_dma.page_count, &dma->map[0], FOLL_FORCE);
+ y_dma.page_count, 0, 1, &dma->map[0]);
uv_pages = 0; /* silence gcc. value is set and consumed only if: */
if (y_pages == y_dma.page_count) {
uv_pages = get_user_pages_unlocked(uv_dma.uaddr,
- uv_dma.page_count, &dma->map[y_pages],
- FOLL_FORCE);
+ uv_dma.page_count, 0, 1, &dma->map[y_pages]);
}
if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 111b311fea4d..54badf2416af 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -153,7 +153,6 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
{
unsigned long first, last;
int err, rw = 0;
- unsigned int flags = FOLL_FORCE;
dma->direction = direction;
switch (dma->direction) {
@@ -177,14 +176,12 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
if (NULL == dma->pages)
return -ENOMEM;
- if (rw == READ)
- flags |= FOLL_WRITE;
-
dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n",
data, size, dma->nr_pages);
err = get_user_pages(data & PAGE_MASK, dma->nr_pages,
- flags | FOLL_LONGTERM, dma->pages, NULL);
+ rw == READ, 1, /* force */
+ dma->pages, NULL);
if (err != dma->nr_pages) {
dma->nr_pages = (err >= 0) ? err : 0;

View File

@@ -1,13 +0,0 @@
diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
index 07fa6dbf8460..eefc40331aa1 100644
--- a/drivers/media/platform/atmel/atmel-isc.h
+++ b/drivers/media/platform/atmel/atmel-isc.h
@@ -11,6 +11,8 @@
#ifndef _ATMEL_ISC_H_
#include <linux/clk-provider.h>
+#include <linux/delay.h>
+#include <linux/irqreturn.h>
#include <linux/platform_device.h>
#include <media/v4l2-ctrls.h>

View File

@@ -1,8 +1,8 @@
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index fea489f03d57..09737b47881f 100644
index 741f9c629c6f..666596b94137 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -13,11 +13,10 @@
@@ -13,12 +13,10 @@
#include <linux/bitmap.h>
#include <linux/bug.h>
@@ -11,6 +11,7 @@ index fea489f03d57..09737b47881f 100644
+#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/media.h>
-#include <linux/minmax.h>
-#include <linux/types.h>
/* Enums used internally at the media controller to represent graphs */

165
backports/v5.18_rc.patch Normal file
View File

@@ -0,0 +1,165 @@
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index fff4dd48eaca..6932817c1697 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -771,7 +771,7 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
/* Set up irq_urb */
pipe = usb_rcvintpipe(udev, ati_remote->endpoint_in->bEndpointAddress);
- maxp = usb_maxpacket(udev, pipe);
+ maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;
usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf,
@@ -782,7 +782,7 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
/* Set up out_urb */
pipe = usb_sndintpipe(udev, ati_remote->endpoint_out->bEndpointAddress);
- maxp = usb_maxpacket(udev, pipe);
+ maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;
usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf,
diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c
index 1464ef9c55bc..a1c4dd28bf60 100644
--- a/drivers/media/rc/igorplugusb.c
+++ b/drivers/media/rc/igorplugusb.c
@@ -38,7 +38,7 @@ struct igorplugusb {
struct timer_list timer;
- u8 *buf_in;
+ uint8_t buf_in[MAX_PACKET];
char phys[64];
};
@@ -176,9 +176,6 @@ static int igorplugusb_probe(struct usb_interface *intf,
if (!ir->urb)
goto fail;
- ir->buf_in = kmalloc(MAX_PACKET, GFP_KERNEL);
- if (!ir->buf_in)
- goto fail;
usb_fill_control_urb(ir->urb, udev,
usb_rcvctrlpipe(udev, 0), (uint8_t *)&ir->request,
ir->buf_in, MAX_PACKET, igorplugusb_callback, ir);
@@ -227,7 +224,6 @@ static int igorplugusb_probe(struct usb_interface *intf,
usb_unpoison_urb(ir->urb);
usb_free_urb(ir->urb);
rc_free_device(ir->rc);
- kfree(ir->buf_in);
return ret;
}
@@ -242,7 +238,6 @@ static void igorplugusb_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL);
usb_unpoison_urb(ir->urb);
usb_free_urb(ir->urb);
- kfree(ir->buf_in);
}
static const struct usb_device_id igorplugusb_table[] = {
diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c
index b02ded52f19e..d41580f6e4c7 100644
--- a/drivers/media/rc/imon_raw.c
+++ b/drivers/media/rc/imon_raw.c
@@ -14,7 +14,7 @@ struct imon {
struct device *dev;
struct urb *ir_urb;
struct rc_dev *rcdev;
- __be64 *ir_buf;
+ __be64 ir_buf;
char phys[64];
};
@@ -29,7 +29,7 @@ struct imon {
static void imon_ir_data(struct imon *imon)
{
struct ir_raw_event rawir = {};
- u64 data = be64_to_cpup(imon->ir_buf);
+ u64 data = be64_to_cpu(imon->ir_buf);
u8 packet_no = data & 0xff;
int offset = 40;
int bit;
@@ -37,7 +37,7 @@ static void imon_ir_data(struct imon *imon)
if (packet_no == 0xff)
return;
- dev_dbg(imon->dev, "data: %*ph", 8, imon->ir_buf);
+ dev_dbg(imon->dev, "data: %*ph", 8, &imon->ir_buf);
/*
* Only the first 5 bytes contain IR data. Right shift so we move
@@ -137,16 +137,10 @@ static int imon_probe(struct usb_interface *intf,
if (!imon->ir_urb)
return -ENOMEM;
- imon->ir_buf = kmalloc(sizeof(__be64), GFP_KERNEL);
- if (!imon->ir_buf) {
- ret = -ENOMEM;
- goto free_urb;
- }
-
imon->dev = &intf->dev;
usb_fill_int_urb(imon->ir_urb, udev,
usb_rcvintpipe(udev, ir_ep->bEndpointAddress),
- imon->ir_buf, sizeof(__be64),
+ &imon->ir_buf, sizeof(imon->ir_buf),
imon_ir_rx, imon, ir_ep->bInterval);
rcdev = devm_rc_allocate_device(&intf->dev, RC_DRIVER_IR_RAW);
@@ -183,7 +177,6 @@ static int imon_probe(struct usb_interface *intf,
free_urb:
usb_free_urb(imon->ir_urb);
- kfree(imon->ir_buf);
return ret;
}
@@ -193,7 +186,6 @@ static void imon_disconnect(struct usb_interface *intf)
usb_kill_urb(imon->ir_urb);
usb_free_urb(imon->ir_urb);
- kfree(imon->ir_buf);
}
static const struct usb_device_id imon_table[] = {
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index c76ba24c1f55..8b9fbbb6e39d 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1721,7 +1721,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
pipe = usb_rcvintpipe(dev, ep_in->bEndpointAddress);
else
pipe = usb_rcvbulkpipe(dev, ep_in->bEndpointAddress);
- maxp = usb_maxpacket(dev, pipe);
+ maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL);
if (!ir)
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index 9b209e687f25..2418bbff3d9e 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -307,7 +307,7 @@ static int streamzap_probe(struct usb_interface *intf,
}
pipe = usb_rcvintpipe(usbdev, endpoint->bEndpointAddress);
- maxp = usb_maxpacket(usbdev, pipe);
+ maxp = usb_maxpacket(usbdev, pipe, usb_pipeout(pipe));
if (maxp == 0) {
dev_err(&intf->dev, "%s: endpoint Max Packet Size is 0!?!\n",
diff --git a/drivers/media/rc/xbox_remote.c b/drivers/media/rc/xbox_remote.c
index a1572381d097..50b3ee47a920 100644
--- a/drivers/media/rc/xbox_remote.c
+++ b/drivers/media/rc/xbox_remote.c
@@ -171,7 +171,7 @@ static void xbox_remote_initialize(struct xbox_remote *xbox_remote,
/* Set up irq_urb */
pipe = usb_rcvintpipe(udev, endpoint_in->bEndpointAddress);
- maxp = usb_maxpacket(udev, pipe);
+ maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;
usb_fill_int_urb(xbox_remote->irq_urb, udev, pipe, xbox_remote->inbuf,

70
backports/v5.18_rc2.patch Normal file
View File

@@ -0,0 +1,70 @@
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 6795e6fcf558..b0dd59dc09eb 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1439,37 +1439,42 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
{
int ret;
struct device *dev = ir->dev;
- char data[USB_CTRL_MSG_SZ];
+ char *data;
+
+ data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL);
+ if (!data) {
+ dev_err(dev, "%s: memory allocation failed!", __func__);
+ return;
+ }
/*
* This is a strange one. Windows issues a set address to the device
* on the receive control pipe and expect a certain value pair back
*/
- ret = usb_control_msg_recv(ir->usbdev, 0, USB_REQ_SET_ADDRESS,
- USB_DIR_IN | USB_TYPE_VENDOR,
- 0, 0, data, USB_CTRL_MSG_SZ, 3000,
- GFP_KERNEL);
+ ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
+ USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0,
+ data, USB_CTRL_MSG_SZ, 3000);
dev_dbg(dev, "set address - ret = %d", ret);
dev_dbg(dev, "set address - data[0] = %d, data[1] = %d",
data[0], data[1]);
/* set feature: bit rate 38400 bps */
- ret = usb_control_msg_send(ir->usbdev, 0,
- USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
- 0xc04e, 0x0000, NULL, 0, 3000, GFP_KERNEL);
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
+ USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
+ 0xc04e, 0x0000, NULL, 0, 3000);
dev_dbg(dev, "set feature - ret = %d", ret);
/* bRequest 4: set char length to 8 bits */
- ret = usb_control_msg_send(ir->usbdev, 0,
- 4, USB_TYPE_VENDOR,
- 0x0808, 0x0000, NULL, 0, 3000, GFP_KERNEL);
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
+ 4, USB_TYPE_VENDOR,
+ 0x0808, 0x0000, NULL, 0, 3000);
dev_dbg(dev, "set char length - retB = %d", ret);
/* bRequest 2: set handshaking to use DTR/DSR */
- ret = usb_control_msg_send(ir->usbdev, 0,
- 2, USB_TYPE_VENDOR,
- 0x0000, 0x0100, NULL, 0, 3000, GFP_KERNEL);
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
+ 2, USB_TYPE_VENDOR,
+ 0x0000, 0x0100, NULL, 0, 3000);
dev_dbg(dev, "set handshake - retC = %d", ret);
/* device resume */
@@ -1477,6 +1482,8 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
/* get hw/sw revision? */
mce_command_out(ir, GET_REVISION, sizeof(GET_REVISION));
+
+ kfree(data);
}
static void mceusb_gen2_init(struct mceusb_dev *ir)

250
backports/v5.18_v4l2.patch Normal file
View File

@@ -0,0 +1,250 @@
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index b26da2650289..09e5ba108a09 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -32,6 +32,12 @@
#include <trace/events/v4l2.h>
+/* Zero out the end of the struct pointed to by p. Everything after, but
+ * not including, the specified field is cleared. */
+#define CLEAR_AFTER_FIELD(p, field) \
+ memset((u8 *)(p) + offsetof(typeof(*(p)), field) + sizeof((p)->field), \
+ 0, sizeof(*(p)) - offsetof(typeof(*(p)), field) - sizeof((p)->field))
+
#define is_valid_ioctl(vfd, cmd) test_bit(_IOC_NR(cmd), (vfd)->valid_ioctls)
struct std_descr {
@@ -1528,7 +1534,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
p->mbus_code = 0;
mbus_code = p->mbus_code;
- memset_after(p, 0, type);
+ CLEAR_AFTER_FIELD(p, type);
p->mbus_code = mbus_code;
switch (p->type) {
@@ -1703,7 +1709,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (unlikely(!ops->vidioc_s_fmt_vid_cap))
break;
- memset_after(p, 0, fmt.pix);
+ CLEAR_AFTER_FIELD(p, fmt.pix);
ret = ops->vidioc_s_fmt_vid_cap(file, fh, arg);
/* just in case the driver zeroed it again */
p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
@@ -1713,30 +1719,30 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane))
break;
- memset_after(p, 0, fmt.pix_mp.xfer_func);
+ CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
- memset_after(&p->fmt.pix_mp.plane_fmt[i],
- 0, bytesperline);
+ CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+ bytesperline);
return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (unlikely(!ops->vidioc_s_fmt_vid_overlay))
break;
- memset_after(p, 0, fmt.win);
+ CLEAR_AFTER_FIELD(p, fmt.win);
return ops->vidioc_s_fmt_vid_overlay(file, fh, arg);
case V4L2_BUF_TYPE_VBI_CAPTURE:
if (unlikely(!ops->vidioc_s_fmt_vbi_cap))
break;
- memset_after(p, 0, fmt.vbi.flags);
+ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
return ops->vidioc_s_fmt_vbi_cap(file, fh, arg);
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_cap))
break;
- memset_after(p, 0, fmt.sliced.io_size);
+ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
return ops->vidioc_s_fmt_sliced_vbi_cap(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
if (unlikely(!ops->vidioc_s_fmt_vid_out))
break;
- memset_after(p, 0, fmt.pix);
+ CLEAR_AFTER_FIELD(p, fmt.pix);
ret = ops->vidioc_s_fmt_vid_out(file, fh, arg);
/* just in case the driver zeroed it again */
p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
@@ -1744,45 +1750,45 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane))
break;
- memset_after(p, 0, fmt.pix_mp.xfer_func);
+ CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
- memset_after(&p->fmt.pix_mp.plane_fmt[i],
- 0, bytesperline);
+ CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+ bytesperline);
return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay))
break;
- memset_after(p, 0, fmt.win);
+ CLEAR_AFTER_FIELD(p, fmt.win);
return ops->vidioc_s_fmt_vid_out_overlay(file, fh, arg);
case V4L2_BUF_TYPE_VBI_OUTPUT:
if (unlikely(!ops->vidioc_s_fmt_vbi_out))
break;
- memset_after(p, 0, fmt.vbi.flags);
+ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
return ops->vidioc_s_fmt_vbi_out(file, fh, arg);
case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_out))
break;
- memset_after(p, 0, fmt.sliced.io_size);
+ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
return ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg);
case V4L2_BUF_TYPE_SDR_CAPTURE:
if (unlikely(!ops->vidioc_s_fmt_sdr_cap))
break;
- memset_after(p, 0, fmt.sdr.buffersize);
+ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
return ops->vidioc_s_fmt_sdr_cap(file, fh, arg);
case V4L2_BUF_TYPE_SDR_OUTPUT:
if (unlikely(!ops->vidioc_s_fmt_sdr_out))
break;
- memset_after(p, 0, fmt.sdr.buffersize);
+ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
return ops->vidioc_s_fmt_sdr_out(file, fh, arg);
case V4L2_BUF_TYPE_META_CAPTURE:
if (unlikely(!ops->vidioc_s_fmt_meta_cap))
break;
- memset_after(p, 0, fmt.meta);
+ CLEAR_AFTER_FIELD(p, fmt.meta);
return ops->vidioc_s_fmt_meta_cap(file, fh, arg);
case V4L2_BUF_TYPE_META_OUTPUT:
if (unlikely(!ops->vidioc_s_fmt_meta_out))
break;
- memset_after(p, 0, fmt.meta);
+ CLEAR_AFTER_FIELD(p, fmt.meta);
return ops->vidioc_s_fmt_meta_out(file, fh, arg);
}
return -EINVAL;
@@ -1805,7 +1811,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (unlikely(!ops->vidioc_try_fmt_vid_cap))
break;
- memset_after(p, 0, fmt.pix);
+ CLEAR_AFTER_FIELD(p, fmt.pix);
ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg);
/* just in case the driver zeroed it again */
p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
@@ -1815,30 +1821,30 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane))
break;
- memset_after(p, 0, fmt.pix_mp.xfer_func);
+ CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
- memset_after(&p->fmt.pix_mp.plane_fmt[i],
- 0, bytesperline);
+ CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+ bytesperline);
return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (unlikely(!ops->vidioc_try_fmt_vid_overlay))
break;
- memset_after(p, 0, fmt.win);
+ CLEAR_AFTER_FIELD(p, fmt.win);
return ops->vidioc_try_fmt_vid_overlay(file, fh, arg);
case V4L2_BUF_TYPE_VBI_CAPTURE:
if (unlikely(!ops->vidioc_try_fmt_vbi_cap))
break;
- memset_after(p, 0, fmt.vbi.flags);
+ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
return ops->vidioc_try_fmt_vbi_cap(file, fh, arg);
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_cap))
break;
- memset_after(p, 0, fmt.sliced.io_size);
+ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
return ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
if (unlikely(!ops->vidioc_try_fmt_vid_out))
break;
- memset_after(p, 0, fmt.pix);
+ CLEAR_AFTER_FIELD(p, fmt.pix);
ret = ops->vidioc_try_fmt_vid_out(file, fh, arg);
/* just in case the driver zeroed it again */
p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
@@ -1846,45 +1852,45 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane))
break;
- memset_after(p, 0, fmt.pix_mp.xfer_func);
+ CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
- memset_after(&p->fmt.pix_mp.plane_fmt[i],
- 0, bytesperline);
+ CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+ bytesperline);
return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay))
break;
- memset_after(p, 0, fmt.win);
+ CLEAR_AFTER_FIELD(p, fmt.win);
return ops->vidioc_try_fmt_vid_out_overlay(file, fh, arg);
case V4L2_BUF_TYPE_VBI_OUTPUT:
if (unlikely(!ops->vidioc_try_fmt_vbi_out))
break;
- memset_after(p, 0, fmt.vbi.flags);
+ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
return ops->vidioc_try_fmt_vbi_out(file, fh, arg);
case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_out))
break;
- memset_after(p, 0, fmt.sliced.io_size);
+ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg);
case V4L2_BUF_TYPE_SDR_CAPTURE:
if (unlikely(!ops->vidioc_try_fmt_sdr_cap))
break;
- memset_after(p, 0, fmt.sdr.buffersize);
+ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
return ops->vidioc_try_fmt_sdr_cap(file, fh, arg);
case V4L2_BUF_TYPE_SDR_OUTPUT:
if (unlikely(!ops->vidioc_try_fmt_sdr_out))
break;
- memset_after(p, 0, fmt.sdr.buffersize);
+ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
return ops->vidioc_try_fmt_sdr_out(file, fh, arg);
case V4L2_BUF_TYPE_META_CAPTURE:
if (unlikely(!ops->vidioc_try_fmt_meta_cap))
break;
- memset_after(p, 0, fmt.meta);
+ CLEAR_AFTER_FIELD(p, fmt.meta);
return ops->vidioc_try_fmt_meta_cap(file, fh, arg);
case V4L2_BUF_TYPE_META_OUTPUT:
if (unlikely(!ops->vidioc_try_fmt_meta_out))
break;
- memset_after(p, 0, fmt.meta);
+ CLEAR_AFTER_FIELD(p, fmt.meta);
return ops->vidioc_try_fmt_meta_out(file, fh, arg);
}
return -EINVAL;
@@ -2083,7 +2089,7 @@ static int v4l_reqbufs(const struct v4l2_ioctl_ops *ops,
if (ret)
return ret;
- memset_after(p, 0, flags);
+ CLEAR_AFTER_FIELD(p, flags);
return ops->vidioc_reqbufs(file, fh, p);
}
@@ -2124,7 +2130,7 @@ static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops,
if (ret)
return ret;
- memset_after(create, 0, flags);
+ CLEAR_AFTER_FIELD(create, flags);
v4l_sanitize_format(&create->format);

View File

@@ -0,0 +1,48 @@
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 0ed087caf7f3..886c54d5c8e0 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -1028,7 +1028,7 @@ void dvb_module_release(struct i2c_client *client)
EXPORT_SYMBOL_GPL(dvb_module_release);
#endif
-static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
+static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
{
const struct dvb_device *dvbdev = dev_get_drvdata(dev);
@@ -1038,7 +1038,7 @@ static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}
-static char *dvb_devnode(const struct device *dev, umode_t *mode)
+static char *dvb_devnode(struct device *dev, umode_t *mode)
{
const struct dvb_device *dvbdev = dev_get_drvdata(dev);
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 527d9324742b..eba0cd30e314 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1017,7 +1017,7 @@ static void ir_close(struct input_dev *idev)
}
/* class for /sys/class/rc */
-static char *rc_devnode(const struct device *dev, umode_t *mode)
+static char *rc_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev));
}
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index ee8087f29b2c..e40ce41ae885 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -2716,7 +2716,7 @@ static const struct file_operations ddb_fops = {
.release = ddb_release,
};
-static char *ddb_devnode(const struct device *device, umode_t *mode)
+static char *ddb_devnode(struct device *device, umode_t *mode)
{
const struct ddb *dev = dev_get_drvdata(device);

File diff suppressed because it is too large Load Diff

15
backports/v5.19_pt3.patch Normal file
View File

@@ -0,0 +1,15 @@
diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c
index 246f73b8a9e7..11f26cac0abc 100644
--- a/drivers/media/pci/pt3/pt3.c
+++ b/drivers/media/pci/pt3/pt3.c
@@ -445,8 +445,8 @@ static int pt3_fetch_thread(void *data)
pt3_proc_dma(adap);
delay = ktime_set(0, PT3_FETCH_DELAY * NSEC_PER_MSEC);
- set_current_state(TASK_UNINTERRUPTIBLE|TASK_FREEZABLE);
- schedule_hrtimeout_range(&delay,
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ freezable_schedule_hrtimeout_range(&delay,
PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
HRTIMER_MODE_REL);
}

View File

@@ -0,0 +1,142 @@
diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.c b/drivers/media/test-drivers/vidtv/vidtv_demod.c
index b878db798686..ddd690420ce0 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_demod.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_demod.c
@@ -188,11 +188,11 @@ static void vidtv_demod_update_stats(struct dvb_frontend *fe)
* Also, usually, signal strength is a negative number in dBm.
*/
c->strength.stat[0].svalue = state->tuner_cnr;
- c->strength.stat[0].svalue -= get_random_u32_below(state->tuner_cnr / 50);
+ c->strength.stat[0].svalue -= prandom_u32_max(state->tuner_cnr / 50);
c->strength.stat[0].svalue -= 68000; /* Adjust to a better range */
c->cnr.stat[0].svalue = state->tuner_cnr;
- c->cnr.stat[0].svalue -= get_random_u32_below(state->tuner_cnr / 50);
+ c->cnr.stat[0].svalue -= prandom_u32_max(state->tuner_cnr / 50);
}
static int vidtv_demod_read_status(struct dvb_frontend *fe,
@@ -213,11 +213,11 @@ static int vidtv_demod_read_status(struct dvb_frontend *fe,
if (snr < cnr2qual->cnr_ok) {
/* eventually lose the TS lock */
- if (get_random_u32_below(100) < config->drop_tslock_prob_on_low_snr)
+ if (prandom_u32_max(100) < config->drop_tslock_prob_on_low_snr)
state->status = 0;
} else {
/* recover if the signal improves */
- if (get_random_u32_below(100) <
+ if (prandom_u32_max(100) <
config->recover_tslock_prob_on_good_snr)
state->status = FE_HAS_SIGNAL |
FE_HAS_CARRIER |
@@ -437,11 +437,12 @@ static int vidtv_demod_i2c_probe(struct i2c_client *client)
return 0;
}
-static void vidtv_demod_i2c_remove(struct i2c_client *client)
+static int vidtv_demod_i2c_remove(struct i2c_client *client)
{
struct vidtv_demod_state *state = i2c_get_clientdata(client);
kfree(state);
+ return 0;
}
static struct i2c_driver vidtv_demod_i2c_driver = {
diff --git a/drivers/media/test-drivers/vidtv/vidtv_tuner.c b/drivers/media/test-drivers/vidtv/vidtv_tuner.c
index 55a4387f3854..3be74d01e182 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_tuner.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_tuner.c
@@ -413,11 +413,12 @@ static int vidtv_tuner_i2c_probe(struct i2c_client *client)
return 0;
}
-static void vidtv_tuner_i2c_remove(struct i2c_client *client)
+static int vidtv_tuner_i2c_remove(struct i2c_client *client)
{
struct vidtv_tuner_dev *tuner_dev = i2c_get_clientdata(client);
kfree(tuner_dev);
+ return 0;
}
static struct i2c_driver vidtv_tuner_i2c_driver = {
diff --git a/drivers/media/test-drivers/vivid/vivid-kthread-cap.c b/drivers/media/test-drivers/vivid/vivid-kthread-cap.c
index ee65d20314d3..690daada7db4 100644
--- a/drivers/media/test-drivers/vivid/vivid-kthread-cap.c
+++ b/drivers/media/test-drivers/vivid/vivid-kthread-cap.c
@@ -693,7 +693,7 @@ static noinline_for_stack void vivid_thread_vid_cap_tick(struct vivid_dev *dev,
/* Drop a certain percentage of buffers. */
if (dev->perc_dropped_buffers &&
- get_random_u32_below(100) < dev->perc_dropped_buffers)
+ prandom_u32_max(100) < dev->perc_dropped_buffers)
goto update_mv;
spin_lock(&dev->slock);
diff --git a/drivers/media/test-drivers/vivid/vivid-kthread-out.c b/drivers/media/test-drivers/vivid/vivid-kthread-out.c
index fac6208b51da..0833e021bb11 100644
--- a/drivers/media/test-drivers/vivid/vivid-kthread-out.c
+++ b/drivers/media/test-drivers/vivid/vivid-kthread-out.c
@@ -51,7 +51,7 @@ static void vivid_thread_vid_out_tick(struct vivid_dev *dev)
/* Drop a certain percentage of buffers. */
if (dev->perc_dropped_buffers &&
- get_random_u32_below(100) < dev->perc_dropped_buffers)
+ prandom_u32_max(100) < dev->perc_dropped_buffers)
return;
spin_lock(&dev->slock);
diff --git a/drivers/media/test-drivers/vivid/vivid-radio-rx.c b/drivers/media/test-drivers/vivid/vivid-radio-rx.c
index 79c1723bd84c..232cab508f48 100644
--- a/drivers/media/test-drivers/vivid/vivid-radio-rx.c
+++ b/drivers/media/test-drivers/vivid/vivid-radio-rx.c
@@ -94,8 +94,8 @@ ssize_t vivid_radio_rx_read(struct file *file, char __user *buf,
if (data_blk == 0 && dev->radio_rds_loop)
vivid_radio_rds_init(dev);
- if (perc && get_random_u32_below(100) < perc) {
- switch (get_random_u32_below(4)) {
+ if (perc && prandom_u32_max(100) < perc) {
+ switch (prandom_u32_max(4)) {
case 0:
rds.block |= V4L2_RDS_BLOCK_CORRECTED;
break;
@@ -104,8 +104,8 @@ ssize_t vivid_radio_rx_read(struct file *file, char __user *buf,
break;
case 2:
rds.block |= V4L2_RDS_BLOCK_ERROR;
- rds.lsb = get_random_u8();
- rds.msb = get_random_u8();
+ rds.lsb = prandom_u32_max(256);
+ rds.msb = prandom_u32_max(256);
break;
case 3: /* Skip block altogether */
if (i)
diff --git a/drivers/media/test-drivers/vivid/vivid-sdr-cap.c b/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
index a81f26b76988..0ae5628b86c9 100644
--- a/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
+++ b/drivers/media/test-drivers/vivid/vivid-sdr-cap.c
@@ -90,7 +90,7 @@ static void vivid_thread_sdr_cap_tick(struct vivid_dev *dev)
/* Drop a certain percentage of buffers. */
if (dev->perc_dropped_buffers &&
- get_random_u32_below(100) < dev->perc_dropped_buffers)
+ prandom_u32_max(100) < dev->perc_dropped_buffers)
return;
spin_lock(&dev->slock);
diff --git a/drivers/media/test-drivers/vivid/vivid-touch-cap.c b/drivers/media/test-drivers/vivid/vivid-touch-cap.c
index c7f6e23df51e..6cc32eb54f9d 100644
--- a/drivers/media/test-drivers/vivid/vivid-touch-cap.c
+++ b/drivers/media/test-drivers/vivid/vivid-touch-cap.c
@@ -221,7 +221,7 @@ static void vivid_fill_buff_noise(__s16 *tch_buf, int size)
static inline int get_random_pressure(void)
{
- return get_random_u32_below(VIVID_PRESSURE_LIMIT);
+ return prandom_u32_max(VIVID_PRESSURE_LIMIT);
}
static void vivid_tch_buf_set(struct v4l2_pix_format *f,

View File

@@ -0,0 +1,69 @@
diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c
index ba503d820e48..f5846c22c799 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
@@ -1425,7 +1425,7 @@ static void ivtv_remove(struct pci_dev *pdev)
/* Interrupts */
ivtv_set_irq_mask(itv, 0xffffffff);
- timer_shutdown_sync(&itv->dma_timer);
+ del_timer_sync(&itv->dma_timer);
/* Kill irq worker */
kthread_flush_worker(&itv->irq_worker);
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 3c2627712fe9..acf18e2251a5 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -1487,7 +1487,7 @@ static void s2255_destroy(struct s2255_dev *dev)
/* board shutdown stops the read pipe if it is running */
s2255_board_shutdown(dev);
/* make sure firmware still not trying to load */
- timer_shutdown_sync(&dev->timer); /* only started in .probe and .open */
+ del_timer_sync(&dev->timer); /* only started in .probe and .open */
if (dev->fw_data->fw_urb) {
usb_kill_urb(dev->fw_data->fw_urb);
usb_free_urb(dev->fw_data->fw_urb);
@@ -2322,7 +2322,7 @@ static int s2255_probe(struct usb_interface *interface,
errorFWDATA2:
usb_free_urb(dev->fw_data->fw_urb);
errorFWURB:
- timer_shutdown_sync(&dev->timer);
+ del_timer_sync(&dev->timer);
errorEP:
usb_put_dev(dev->udev);
errorUDEV:
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index 75c89b07e86a..62ff1fa1c753 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -2605,10 +2605,10 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
return hdw;
fail:
if (hdw) {
- timer_shutdown_sync(&hdw->quiescent_timer);
- timer_shutdown_sync(&hdw->decoder_stabilization_timer);
- timer_shutdown_sync(&hdw->encoder_run_timer);
- timer_shutdown_sync(&hdw->encoder_wait_timer);
+ del_timer_sync(&hdw->quiescent_timer);
+ del_timer_sync(&hdw->decoder_stabilization_timer);
+ del_timer_sync(&hdw->encoder_run_timer);
+ del_timer_sync(&hdw->encoder_wait_timer);
flush_work(&hdw->workpoll);
v4l2_device_unregister(&hdw->v4l2_dev);
usb_free_urb(hdw->ctl_read_urb);
@@ -2668,10 +2668,10 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
if (!hdw) return;
pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_destroy: hdw=%p",hdw);
flush_work(&hdw->workpoll);
- timer_shutdown_sync(&hdw->quiescent_timer);
- timer_shutdown_sync(&hdw->decoder_stabilization_timer);
- timer_shutdown_sync(&hdw->encoder_run_timer);
- timer_shutdown_sync(&hdw->encoder_wait_timer);
+ del_timer_sync(&hdw->quiescent_timer);
+ del_timer_sync(&hdw->decoder_stabilization_timer);
+ del_timer_sync(&hdw->encoder_run_timer);
+ del_timer_sync(&hdw->encoder_wait_timer);
if (hdw->fw_buffer) {
kfree(hdw->fw_buffer);
hdw->fw_buffer = NULL;

View File

@@ -0,0 +1,37 @@
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index a366566f22c3..9b7bcdce6e44 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -870,9 +870,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
g = tpg_colors[col].g;
b = tpg_colors[col].b;
} else if (tpg->pattern == TPG_PAT_NOISE) {
- r = g = b = get_random_u8();
+ r = g = b = prandom_u32_max(256);
} else if (k == TPG_COLOR_RANDOM) {
- r = g = b = tpg->qual_offset + get_random_u32_below(196);
+ r = g = b = tpg->qual_offset + prandom_u32_max(196);
} else if (k >= TPG_COLOR_RAMP) {
r = g = b = k - TPG_COLOR_RAMP;
}
@@ -2286,7 +2286,7 @@ static void tpg_fill_params_extras(const struct tpg_data *tpg,
params->wss_width = tpg->crop.width;
params->wss_width = tpg_hscale_div(tpg, p, params->wss_width);
params->wss_random_offset =
- params->twopixsize * get_random_u32_below(tpg->src_width / 2);
+ params->twopixsize * prandom_u32_max(tpg->src_width / 2);
if (tpg->crop.left < tpg->border.left) {
left_pillar_width = tpg->border.left - tpg->crop.left;
@@ -2495,9 +2495,9 @@ static void tpg_fill_plane_pattern(const struct tpg_data *tpg,
linestart_newer = tpg->black_line[p];
} else if (tpg->pattern == TPG_PAT_NOISE || tpg->qual == TPG_QUAL_NOISE) {
linestart_older = tpg->random_line[p] +
- twopixsize * get_random_u32_below(tpg->src_width / 2);
+ twopixsize * prandom_u32_max(tpg->src_width / 2);
linestart_newer = tpg->random_line[p] +
- twopixsize * get_random_u32_below(tpg->src_width / 2);
+ twopixsize * prandom_u32_max(tpg->src_width / 2);
} else {
unsigned frame_line_old =
(frame_line + mv_vert_old) % tpg->src_height;

View File

@@ -0,0 +1,110 @@
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index 5f1175f8b349..44d8d7b861b1 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -102,7 +102,7 @@ static void *vb2_dc_vaddr(struct vb2_buffer *vb, void *buf_priv)
if (buf->db_attach) {
struct iosys_map map;
- if (!dma_buf_vmap_unlocked(buf->db_attach->dmabuf, &map))
+ if (!dma_buf_vmap(buf->db_attach->dmabuf, &map))
buf->vaddr = map.vaddr;
return buf->vaddr;
@@ -706,7 +706,7 @@ static int vb2_dc_map_dmabuf(void *mem_priv)
}
/* get the associated scatterlist for this buffer */
- sgt = dma_buf_map_attachment_unlocked(buf->db_attach, buf->dma_dir);
+ sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir);
if (IS_ERR(sgt)) {
pr_err("Error getting dmabuf scatterlist\n");
return -EINVAL;
@@ -717,7 +717,7 @@ static int vb2_dc_map_dmabuf(void *mem_priv)
if (contig_size < buf->size) {
pr_err("contiguous chunk is too small %lu/%lu\n",
contig_size, buf->size);
- dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt,
+ dma_buf_unmap_attachment(buf->db_attach, sgt,
buf->dma_dir);
return -EFAULT;
}
@@ -746,10 +746,10 @@ static void vb2_dc_unmap_dmabuf(void *mem_priv)
}
if (buf->vaddr) {
- dma_buf_vunmap_unlocked(buf->db_attach->dmabuf, &map);
+ dma_buf_vunmap(buf->db_attach->dmabuf, &map);
buf->vaddr = NULL;
}
- dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt, buf->dma_dir);
+ dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir);
buf->dma_addr = 0;
buf->dma_sgt = NULL;
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index 183037fb1273..3cf39dc77dfb 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -312,7 +312,7 @@ static void *vb2_dma_sg_vaddr(struct vb2_buffer *vb, void *buf_priv)
if (!buf->vaddr) {
if (buf->db_attach) {
- ret = dma_buf_vmap_unlocked(buf->db_attach->dmabuf, &map);
+ ret = dma_buf_vmap(buf->db_attach->dmabuf, &map);
buf->vaddr = ret ? NULL : map.vaddr;
} else {
buf->vaddr = vm_map_ram(buf->pages, buf->num_pages, -1);
@@ -561,7 +561,7 @@ static int vb2_dma_sg_map_dmabuf(void *mem_priv)
}
/* get the associated scatterlist for this buffer */
- sgt = dma_buf_map_attachment_unlocked(buf->db_attach, buf->dma_dir);
+ sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir);
if (IS_ERR(sgt)) {
pr_err("Error getting dmabuf scatterlist\n");
return -EINVAL;
@@ -590,10 +590,10 @@ static void vb2_dma_sg_unmap_dmabuf(void *mem_priv)
}
if (buf->vaddr) {
- dma_buf_vunmap_unlocked(buf->db_attach->dmabuf, &map);
+ dma_buf_vunmap(buf->db_attach->dmabuf, &map);
buf->vaddr = NULL;
}
- dma_buf_unmap_attachment_unlocked(buf->db_attach, sgt, buf->dma_dir);
+ dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir);
buf->dma_sgt = NULL;
}
diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
index 959b45beb1f3..f1322f92ca1f 100644
--- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c
+++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
@@ -372,7 +372,7 @@ static int vb2_vmalloc_map_dmabuf(void *mem_priv)
struct iosys_map map;
int ret;
- ret = dma_buf_vmap_unlocked(buf->dbuf, &map);
+ ret = dma_buf_vmap(buf->dbuf, &map);
if (ret)
return -EFAULT;
buf->vaddr = map.vaddr;
@@ -385,7 +385,7 @@ static void vb2_vmalloc_unmap_dmabuf(void *mem_priv)
struct vb2_vmalloc_buf *buf = mem_priv;
struct iosys_map map = IOSYS_MAP_INIT_VADDR(buf->vaddr);
- dma_buf_vunmap_unlocked(buf->dbuf, &map);
+ dma_buf_vunmap(buf->dbuf, &map);
buf->vaddr = NULL;
}
@@ -395,7 +395,7 @@ static void vb2_vmalloc_detach_dmabuf(void *mem_priv)
struct iosys_map map = IOSYS_MAP_INIT_VADDR(buf->vaddr);
if (buf->vaddr)
- dma_buf_vunmap_unlocked(buf->dbuf, &map);
+ dma_buf_vunmap(buf->dbuf, &map);
kfree(buf);
}

View File

@@ -0,0 +1,66 @@
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index 5f1175f..14f91a3 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -11,7 +11,7 @@
*/
#include <linux/dma-buf.h>
-#include <linux/dma-resv.h>
+#include <linux/reservation.h>
#include <linux/module.h>
#include <linux/refcount.h>
#include <linux/scatterlist.h>
@@ -456,7 +456,7 @@ static int vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf, struct iosys_map *map)
static int vb2_dc_dmabuf_ops_mmap(struct dma_buf *dbuf,
struct vm_area_struct *vma)
{
- dma_resv_assert_held(dbuf->resv);
+ reservation_object_assert_held(dbuf->resv);
return vb2_dc_mmap(dbuf->priv, vma);
}
diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index 183037f..9832cad 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -10,7 +10,7 @@
* the Free Software Foundation.
*/
-#include <linux/dma-resv.h>
+#include <linux/reservation.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/refcount.h>
@@ -498,7 +498,7 @@ static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf,
static int vb2_dma_sg_dmabuf_ops_mmap(struct dma_buf *dbuf,
struct vm_area_struct *vma)
{
- dma_resv_assert_held(dbuf->resv);
+ reservation_object_assert_held(dbuf->resv);
return vb2_dma_sg_mmap(dbuf->priv, vma);
}
diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
index 959b45b..9841895 100644
--- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c
+++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
@@ -10,7 +10,7 @@
* the Free Software Foundation.
*/
-#include <linux/dma-resv.h>
+#include <linux/reservation.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/mm.h>
@@ -319,7 +319,7 @@ static int vb2_vmalloc_dmabuf_ops_vmap(struct dma_buf *dbuf,
static int vb2_vmalloc_dmabuf_ops_mmap(struct dma_buf *dbuf,
struct vm_area_struct *vma)
{
- dma_resv_assert_held(dbuf->resv);
+ reservation_object_assert_held(dbuf->resv);
return vb2_vmalloc_mmap(dbuf->priv, vma);
}

View File

@@ -830,136 +830,6 @@ index ae27e988e578..b05fa227ffb2 100644
ret = snd_card_register(gosnd->card);
if (ret < 0) {
diff --git b/drivers/media/usb/tm6000/tm6000-alsa.c a/drivers/media/usb/tm6000/tm6000-alsa.c
index c26a0ff60a64..d6c79c13b332 100644
--- b/drivers/media/usb/tm6000/tm6000-alsa.c
+++ a/drivers/media/usb/tm6000/tm6000-alsa.c
@@ -10,6 +10,7 @@
#include <linux/interrupt.h>
#include <linux/usb.h>
#include <linux/slab.h>
+#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <sound/core.h>
@@ -93,6 +94,40 @@ static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip)
return 0;
}
+static void dsp_buffer_free(struct snd_pcm_substream *substream)
+{
+ struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream);
+
+ dprintk(2, "Freeing buffer\n");
+
+ vfree(substream->runtime->dma_area);
+ substream->runtime->dma_area = NULL;
+ substream->runtime->dma_bytes = 0;
+}
+
+static int dsp_buffer_alloc(struct snd_pcm_substream *substream, int size)
+{
+ struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream);
+
+ dprintk(2, "Allocating buffer\n");
+
+ if (substream->runtime->dma_area) {
+ if (substream->runtime->dma_bytes > size)
+ return 0;
+
+ dsp_buffer_free(substream);
+ }
+
+ substream->runtime->dma_area = vmalloc(size);
+ if (!substream->runtime->dma_area)
+ return -ENOMEM;
+
+ substream->runtime->dma_bytes = size;
+
+ return 0;
+}
+
+
/****************************************************************************
ALSA PCM Interface
****************************************************************************/
@@ -233,6 +268,40 @@ static int tm6000_fillbuf(struct tm6000_core *core, char *buf, int size)
return 0;
}
+/*
+ * hw_params callback
+ */
+static int snd_tm6000_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *hw_params)
+{
+ int size, rc;
+
+ size = params_period_bytes(hw_params) * params_periods(hw_params);
+
+ rc = dsp_buffer_alloc(substream, size);
+ if (rc < 0)
+ return rc;
+
+ return 0;
+}
+
+/*
+ * hw free callback
+ */
+static int snd_tm6000_hw_free(struct snd_pcm_substream *substream)
+{
+ struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream);
+ struct tm6000_core *core = chip->core;
+
+ if (atomic_read(&core->stream_started) > 0) {
+ atomic_set(&core->stream_started, 0);
+ schedule_work(&core->wq_trigger);
+ }
+
+ dsp_buffer_free(substream);
+ return 0;
+}
+
/*
* prepare callback
*/
@@ -300,15 +369,27 @@ static snd_pcm_uframes_t snd_tm6000_pointer(struct snd_pcm_substream *substream)
return chip->buf_pos;
}
+static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
+ unsigned long offset)
+{
+ void *pageptr = subs->runtime->dma_area + offset;
+
+ return vmalloc_to_page(pageptr);
+}
+
/*
* operators
*/
static const struct snd_pcm_ops snd_tm6000_pcm_ops = {
.open = snd_tm6000_pcm_open,
.close = snd_tm6000_close,
+ .ioctl = snd_pcm_lib_ioctl,
+ .hw_params = snd_tm6000_hw_params,
+ .hw_free = snd_tm6000_hw_free,
.prepare = snd_tm6000_prepare,
.trigger = snd_tm6000_card_trigger,
.pointer = snd_tm6000_pointer,
+ .page = snd_pcm_get_vmalloc_page,
};
/*
@@ -378,7 +459,6 @@ static int tm6000_audio_init(struct tm6000_core *dev)
strscpy(pcm->name, "Trident TM5600/60x0", sizeof(pcm->name));
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_tm6000_pcm_ops);
- snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
INIT_WORK(&dev->wq_trigger, audio_trigger);
rc = snd_card_register(card);
diff --git b/drivers/media/usb/usbtv/usbtv-audio.c a/drivers/media/usb/usbtv/usbtv-audio.c
index b57e94fb1977..e746c8ddfc49 100644
--- b/drivers/media/usb/usbtv/usbtv-audio.c

View File

@@ -1,14 +1,14 @@
diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 8dd0562de287..111b311fea4d 100644
index 234e9f647c96..91f5d9c3a7b7 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -183,12 +183,12 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
@@ -179,12 +179,12 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n",
data, size, dma->nr_pages);
- err = pin_user_pages(data & PAGE_MASK, dma->nr_pages,
+ err = get_user_pages(data & PAGE_MASK, dma->nr_pages,
flags | FOLL_LONGTERM, dma->pages, NULL);
- err = pin_user_pages(data & PAGE_MASK, dma->nr_pages, gup_flags,
+ err = get_user_pages(data & PAGE_MASK, dma->nr_pages, gup_flags,
dma->pages, NULL);
if (err != dma->nr_pages) {
dma->nr_pages = (err >= 0) ? err : 0;
@@ -17,7 +17,7 @@ index 8dd0562de287..111b311fea4d 100644
dma->nr_pages);
return err < 0 ? err : -EINVAL;
}
@@ -349,8 +349,11 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
@@ -345,8 +345,11 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
BUG_ON(dma->sglen);
if (dma->pages) {

View File

@@ -1,25 +1,3 @@
diff --git a/drivers/media/common/videobuf2/frame_vector.c b/drivers/media/common/videobuf2/frame_vector.c
index 381158320a90..98f86fb44690 100644
--- a/drivers/media/common/videobuf2/frame_vector.c
+++ b/drivers/media/common/videobuf2/frame_vector.c
@@ -57,7 +57,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames,
goto out_unlocked;
}
- mmap_read_lock(mm);
+ down_read(&mm->mmap_sem);
vec->got_ref = false;
vec->is_pfns = true;
ret = 0;
@@ -83,7 +83,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames,
break;
} while (ret < nr_frames);
out:
- mmap_read_unlock(mm);
+ up_read(&mm->mmap_sem);
out_unlocked:
if (!ret)
ret = -EFAULT;
diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
index 78dd35c9b65d..6dc9af18ff2e 100644
--- a/drivers/media/pci/bt8xx/bt878.c
@@ -165,19 +143,3 @@ index 9b2443720ab0..f8bd5a369560 100644
#include <media/videobuf-vmalloc.h>
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
index f13af2329f48..525df72e313a 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
@@ -896,9 +896,9 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
}
mutex_unlock(&bo->mutex);
- mmap_read_lock(current->mm);
+ down_read(&current->mm->mmap_sem);
vma = find_vma(current->mm, (unsigned long)userptr);
- mmap_read_unlock(current->mm);
+ up_read(&current->mm->mmap_sem);
if (!vma) {
dev_err(atomisp_dev, "find_vma failed\n");
kfree(bo->page_obj);

View File

@@ -1,17 +1,17 @@
diff --git a/drivers/media/common/videobuf2/frame_vector.c b/drivers/media/common/videobuf2/frame_vector.c
index 381158320a90..b7986c7f58ea 100644
index 0f430ddc1f67..9ebeff9b094e 100644
--- a/drivers/media/common/videobuf2/frame_vector.c
+++ b/drivers/media/common/videobuf2/frame_vector.c
@@ -48,7 +48,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames,
@@ -50,7 +50,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write,
if (write)
gup_flags |= FOLL_WRITE;
start = untagged_addr(start);
- ret = pin_user_pages_fast(start, nr_frames,
+ ret = get_user_pages_fast(start, nr_frames,
FOLL_FORCE | FOLL_WRITE | FOLL_LONGTERM,
- ret = pin_user_pages_fast(start, nr_frames, gup_flags,
+ ret = get_user_pages_fast(start, nr_frames, gup_flags,
(struct page **)(vec->ptrs));
if (ret > 0) {
@@ -105,6 +105,7 @@ EXPORT_SYMBOL(get_vaddr_frames);
vec->got_ref = true;
vec->is_pfns = false;
@@ -78,6 +78,7 @@ EXPORT_SYMBOL(get_vaddr_frames);
void put_vaddr_frames(struct frame_vector *vec)
{
struct page **pages;
@@ -19,7 +19,7 @@ index 381158320a90..b7986c7f58ea 100644
if (!vec->got_ref)
goto out;
@@ -117,7 +118,8 @@ void put_vaddr_frames(struct frame_vector *vec)
@@ -90,7 +91,8 @@ void put_vaddr_frames(struct frame_vector *vec)
if (WARN_ON(IS_ERR(pages)))
goto out;
@@ -30,10 +30,10 @@ index 381158320a90..b7986c7f58ea 100644
out:
vec->nr_frames = 0;
diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c
index 0d8372cc364a..5f8883031c9c 100644
index 99b9f55ca829..81ad6bd035d9 100644
--- a/drivers/media/pci/ivtv/ivtv-udma.c
+++ b/drivers/media/pci/ivtv/ivtv-udma.c
@@ -92,7 +92,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
@@ -94,7 +94,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
{
struct ivtv_dma_page_info user_dma;
struct ivtv_user_dma *dma = &itv->udma;
@@ -42,7 +42,7 @@ index 0d8372cc364a..5f8883031c9c 100644
IVTV_DEBUG_DMA("ivtv_udma_setup, dst: 0x%08x\n", (unsigned int)ivtv_dest_addr);
@@ -111,15 +111,16 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
@@ -113,15 +113,16 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
return -EINVAL;
}
@@ -50,7 +50,7 @@ index 0d8372cc364a..5f8883031c9c 100644
- err = pin_user_pages_unlocked(user_dma.uaddr, user_dma.page_count,
+ /* Get user pages for DMA Xfer */
+ err = get_user_pages_unlocked(user_dma.uaddr, user_dma.page_count,
dma->map, FOLL_FORCE);
dma->map, 0);
if (user_dma.page_count != err) {
IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
@@ -62,7 +62,7 @@ index 0d8372cc364a..5f8883031c9c 100644
return -EINVAL;
}
return err;
@@ -129,7 +130,9 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
@@ -131,7 +132,9 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
/* Fill SG List with new values */
if (ivtv_udma_fill_sg_list(dma, &user_dma, 0) < 0) {
@@ -73,7 +73,7 @@ index 0d8372cc364a..5f8883031c9c 100644
dma->page_count = 0;
return -ENOMEM;
}
@@ -150,6 +153,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
@@ -153,6 +156,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
void ivtv_udma_unmap(struct ivtv *itv)
{
struct ivtv_user_dma *dma = &itv->udma;
@@ -81,7 +81,7 @@ index 0d8372cc364a..5f8883031c9c 100644
IVTV_DEBUG_INFO("ivtv_unmap_user_dma\n");
@@ -165,7 +169,10 @@ void ivtv_udma_unmap(struct ivtv *itv)
@@ -169,7 +173,10 @@ void ivtv_udma_unmap(struct ivtv *itv)
/* sync DMA */
ivtv_udma_sync_for_cpu(itv);
@@ -94,7 +94,7 @@ index 0d8372cc364a..5f8883031c9c 100644
}
diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c
index 5f7dc9771f8d..cd2fe2d444c0 100644
index 582146f8d70d..2907ebdd1a98 100644
--- a/drivers/media/pci/ivtv/ivtv-yuv.c
+++ b/drivers/media/pci/ivtv/ivtv-yuv.c
@@ -30,6 +30,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
@@ -113,15 +113,15 @@ index 5f7dc9771f8d..cd2fe2d444c0 100644
- y_pages = pin_user_pages_unlocked(y_dma.uaddr,
+ /* Get user pages for DMA Xfer */
+ y_pages = get_user_pages_unlocked(y_dma.uaddr,
y_dma.page_count, &dma->map[0], FOLL_FORCE);
y_dma.page_count, &dma->map[0], 0);
uv_pages = 0; /* silence gcc. value is set and consumed only if: */
if (y_pages == y_dma.page_count) {
- uv_pages = pin_user_pages_unlocked(uv_dma.uaddr,
+ uv_pages = get_user_pages_unlocked(uv_dma.uaddr,
uv_dma.page_count, &dma->map[y_pages],
FOLL_FORCE);
uv_dma.page_count, &dma->map[y_pages], 0);
}
@@ -80,7 +81,8 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
@@ -79,7 +80,8 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
uv_pages, uv_dma.page_count);
if (uv_pages >= 0) {
@@ -131,7 +131,7 @@ index 5f7dc9771f8d..cd2fe2d444c0 100644
rc = -EFAULT;
} else {
rc = uv_pages;
@@ -91,7 +93,8 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
@@ -90,7 +92,8 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
y_pages, y_dma.page_count);
}
if (y_pages >= 0) {
@@ -141,7 +141,7 @@ index 5f7dc9771f8d..cd2fe2d444c0 100644
/*
* Inherit the -EFAULT from rc's
* initialization, but allow it to be
@@ -109,7 +112,9 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
@@ -108,7 +111,9 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
/* Fill & map SG List */
if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, &y_dma, 0)) < 0) {
IVTV_DEBUG_WARN("could not allocate bounce buffers for highmem userspace buffers\n");
@@ -153,7 +153,7 @@ index 5f7dc9771f8d..cd2fe2d444c0 100644
return -ENOMEM;
}
diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index e2d56dca5be4..0c2859844081 100644
index 00ac94d4ab19..4e3962c3f1da 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -281,10 +281,10 @@ static int ivtvfb_prep_dec_dma_to_device(struct ivtv *itv,

View File

@@ -5,12 +5,23 @@ INTEL_ATOMISP
# Needs devm_regmap_init_sccb (select REGMAP_SCCB)
VIDEO_OV772X
VIDEO_OV9650
VIDEO_TC358746
# Adding an entry under kernel [major.minor] means that that
# driver will be enabled from that kernel onwards, and disabled
# for older kernels.
[5.16]
[5.19.0]
VIDEO_DW9768
VIDEO_OV4689
VIDEO_OV5693
VIDEO_OV8858
VIDEO_S5K5BAF
VIDEO_S5C73M3
VIDEO_AR0521
VIDEO_VISL
[5.16.0]
# Needs i2c_driver flags field
VIDEO_IMX319
VIDEO_IMX208
@@ -19,38 +30,38 @@ VIDEO_OV2740
VIDEO_OV5670
VIDEO_OV5675
VIDEO_OV8856
VIDEO_IPU3_CIO2
[5.7]
[5.7.0]
# needs read_poll_timeout
VIDEO_ISL7998X
[5.5]
[5.5.0]
# lots of kAPI changes in 5.6, so disable for older kernels
SND_BT87X
# needs linux/units.h
VIDEO_OV02A10
[5.4]
[5.4.0]
CEC_CROS_EC
[5.3]
[5.3.0]
# sort_r appeared in 5.4
VIDEO_HANTRO
VIDEO_ROCKCHIP_VDEC
V4L2_H264
[5.2]
[5.2.0]
# Needs fwnode_graph_get_endpoint_by_id
VIDEO_IPU3_CIO2
VIDEO_OMAP3
[5.1]
[5.1.0]
# Needs devm_clk_get_optional
VIDEO_IMX274
VIDEO_IMX258
VIDEO_OV7251
[5.0]
[5.0.0]
# DMA mask warnings
VIDEO_MEM2MEM_DEINTERLACE
@@ -108,7 +119,6 @@ VIDEO_OV9734
VIDEO_OV9282
VIDEO_OV8865
VIDEO_OV5648
VIDEO_OV5693
VIDEO_OV13B10
VIDEO_OV08D10
VIDEO_DW9807
@@ -128,7 +138,6 @@ I2C_BCM2048
VIDEO_HI846
VIDEO_HI847
VIDEO_DW9714
VIDEO_DW9768
VIDEO_RDACM20
VIDEO_RDACM21
VIDEO_OG01A1B