1diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c 2index 297e95be25b3..1e0af19986e9 100644 3--- a/drivers/base/regmap/regmap.c 4+++ b/drivers/base/regmap/regmap.c 5@@ -663,7 +663,9 @@ enum regmap_endian regmap_get_val_endian(struct device *dev, 6 const struct regmap_bus *bus, 7 const struct regmap_config *config) 8 { 9+#if IS_ENABLED(CONFIG_OF) 10 struct fwnode_handle *fwnode = dev ? dev_fwnode(dev) : NULL; 11+#endif 12 enum regmap_endian endian; 13 14 /* Retrieve the endianness specification from the regmap config */ 15@@ -673,6 +675,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev, 16 if (endian != REGMAP_ENDIAN_DEFAULT) 17 return endian; 18 19+#if IS_ENABLED(CONFIG_OF) 20 /* If the firmware node exist try to get endianness from it */ 21 if (fwnode_property_read_bool(fwnode, "big-endian")) 22 endian = REGMAP_ENDIAN_BIG; 23@@ -680,7 +683,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev, 24 endian = REGMAP_ENDIAN_LITTLE; 25 else if (fwnode_property_read_bool(fwnode, "native-endian")) 26 endian = REGMAP_ENDIAN_NATIVE; 27- 28+#endif 29 /* If the endianness was specified in fwnode, use that */ 30 if (endian != REGMAP_ENDIAN_DEFAULT) 31 return endian; 32diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c 33index 2ab22b925941..d5ad67f1b153 100644 34--- a/drivers/hid/hid-asus.c 35+++ b/drivers/hid/hid-asus.c 36@@ -513,12 +513,10 @@ static void asus_kbd_backlight_work(struct work_struct *work) 37 */ 38 static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) 39 { 40+#if IS_ENABLED(CONFIG_ASUS_WMI) 41 u32 value; 42 int ret; 43 44- if (!IS_ENABLED(CONFIG_ASUS_WMI)) 45- return false; 46- 47 ret = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, 48 ASUS_WMI_DEVID_KBD_BACKLIGHT, 0, &value); 49 hid_dbg(hdev, "WMI backlight check: rc %d value %x", ret, value); 50@@ -526,6 +524,9 @@ static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) 51 return false; 52 53 return !!(value & ASUS_WMI_DSTS_PRESENCE_BIT); 54+#else 55+ return false; 56+#endif 57 } 58 59 static int asus_kbd_register_leds(struct hid_device *hdev) 60diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c 61index 0ae9f6df59d1..2c574fa20e33 100644 62--- a/drivers/hid/hid-core.c 63+++ b/drivers/hid/hid-core.c 64@@ -2509,7 +2509,7 @@ void hid_destroy_device(struct hid_device *hdev) 65 } 66 EXPORT_SYMBOL_GPL(hid_destroy_device); 67 68- 69+#if 0 70 static int __hid_bus_reprobe_drivers(struct device *dev, void *data) 71 { 72 struct hid_driver *hdrv = data; 73@@ -2539,6 +2539,7 @@ static int __bus_removed_driver(struct device_driver *drv, void *data) 74 { 75 return bus_rescan_devices(&hid_bus_type); 76 } 77+#endif 78 79 int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, 80 const char *mod_name) 81@@ -2555,9 +2556,11 @@ int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, 82 83 ret = driver_register(&hdrv->driver); 84 85+#if 0 86 if (ret == 0) 87 bus_for_each_drv(&hid_bus_type, NULL, NULL, 88 __hid_bus_driver_added); 89+#endif 90 91 return ret; 92 } 93@@ -2568,7 +2571,9 @@ void hid_unregister_driver(struct hid_driver *hdrv) 94 driver_unregister(&hdrv->driver); 95 hid_free_dynids(hdrv); 96 97+#if 0 98 bus_for_each_drv(&hid_bus_type, NULL, hdrv, __bus_removed_driver); 99+#endif 100 } 101 EXPORT_SYMBOL_GPL(hid_unregister_driver); 102 103diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c 104index 9d9f3e1bd5f4..476e8791edce 100644 105--- a/drivers/hid/hid-multitouch.c 106+++ b/drivers/hid/hid-multitouch.c 107@@ -129,7 +129,7 @@ struct mt_application { 108 */ 109 110 __s32 dev_time; /* the scan time provided by the device */ 111- unsigned long jiffies; /* the frame's jiffies */ 112+ unsigned long jfs; /* the frame's jiffies */ 113 int timestamp; /* the timestamp to be sent */ 114 int prev_scantime; /* scantime reported previously */ 115 116@@ -942,9 +942,9 @@ static void mt_sync_frame(struct mt_device *td, struct mt_application *app, 117 static int mt_compute_timestamp(struct mt_application *app, __s32 value) 118 { 119 long delta = value - app->prev_scantime; 120- unsigned long jdelta = jiffies_to_usecs(jiffies - app->jiffies); 121+ unsigned long jdelta = jiffies_to_usecs(jiffies - app->jfs); 122 123- app->jiffies = jiffies; 124+ app->jfs = jiffies; 125 126 if (delta < 0) 127 delta += app->scantime_logical_max; 128diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h 129index 203d27d198b8..463efcad9c5b 100644 130--- a/drivers/hid/wacom.h 131+++ b/drivers/hid/wacom.h 132@@ -91,6 +91,7 @@ 133 #include <linux/leds.h> 134 #include <linux/usb/input.h> 135 #include <linux/power_supply.h> 136+#include <linux/string.h> 137 #include <asm/unaligned.h> 138 139 /* 140diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c 141index 95f90699d2b1..c0fde2b92bd5 100644 142--- a/drivers/input/evdev.c 143+++ b/drivers/input/evdev.c 144@@ -766,7 +766,7 @@ static int str_to_user(const char *str, unsigned int maxlen, void __user *p) 145 int len; 146 147 if (!str) 148- return -ENOENT; 149+ str = ""; 150 151 len = strlen(str) + 1; 152 if (len > maxlen) 153diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c 154index 8eb8054ef9c6..f616c1068ccc 100644 155--- a/drivers/leds/led-core.c 156+++ b/drivers/leds/led-core.c 157@@ -320,6 +320,7 @@ EXPORT_SYMBOL_GPL(led_update_brightness); 158 159 u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size) 160 { 161+#if IS_ENABLED(CONFIG_OF) 162 struct fwnode_handle *fwnode = led_cdev->dev->fwnode; 163 u32 *pattern; 164 int count; 165@@ -340,6 +341,9 @@ u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size) 166 *size = count; 167 168 return pattern; 169+#else 170+ return NULL; 171+#endif 172 } 173 EXPORT_SYMBOL_GPL(led_get_default_pattern); 174 175@@ -361,6 +365,7 @@ void led_sysfs_enable(struct led_classdev *led_cdev) 176 } 177 EXPORT_SYMBOL_GPL(led_sysfs_enable); 178 179+#if IS_ENABLED(CONFIG_OF) 180 static void led_parse_fwnode_props(struct device *dev, 181 struct fwnode_handle *fwnode, 182 struct led_properties *props) 183@@ -411,12 +416,15 @@ static void led_parse_fwnode_props(struct device *dev, 184 props->func_enum_present = true; 185 } 186 } 187+#endif 188 189 int led_compose_name(struct device *dev, struct led_init_data *init_data, 190 char *led_classdev_name) 191 { 192 struct led_properties props = {}; 193+#if IS_ENABLED(CONFIG_OF) 194 struct fwnode_handle *fwnode = init_data->fwnode; 195+#endif 196 const char *devicename = init_data->devicename; 197 198 /* We want to label LEDs that can produce full range of colors 199@@ -426,7 +434,9 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data, 200 if (!led_classdev_name) 201 return -EINVAL; 202 203+#if IS_ENABLED(CONFIG_OF) 204 led_parse_fwnode_props(dev, fwnode, &props); 205+#endif 206 207 if (props.label) { 208 /* 209@@ -468,9 +478,11 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data, 210 } 211 snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%s:%s", 212 devicename, init_data->default_label); 213+#if IS_ENABLED(CONFIG_OF) 214 } else if (is_of_node(fwnode)) { 215 strscpy(led_classdev_name, to_of_node(fwnode)->name, 216 LED_MAX_NAME_SIZE); 217+#endif 218 } else 219 return -EINVAL; 220 221diff --git a/drivers/media/common/videobuf2/Makefile b/drivers/media/common/videobuf2/Makefile 222index 54306f8d096c..f51ce82ce34e 100644 223--- a/drivers/media/common/videobuf2/Makefile 224+++ b/drivers/media/common/videobuf2/Makefile 225@@ -1,6 +1,6 @@ 226 # SPDX-License-Identifier: GPL-2.0 227 videobuf2-common-objs := videobuf2-core.o 228-videobuf2-common-objs += frame_vector.o 229+# videobuf2-common-objs += frame_vector.o 230 231 ifeq ($(CONFIG_TRACEPOINTS),y) 232 videobuf2-common-objs += vb2-trace.o 233diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c 234index 02281d13505f..4297324951e7 100644 235--- a/drivers/media/common/videobuf2/videobuf2-core.c 236+++ b/drivers/media/common/videobuf2/videobuf2-core.c 237@@ -689,7 +689,7 @@ static int __verify_dmabuf_ops(struct vb2_queue *q) 238 int vb2_verify_memory_type(struct vb2_queue *q, 239 enum vb2_memory memory, unsigned int type) 240 { 241- if (memory != VB2_MEMORY_MMAP && memory != VB2_MEMORY_USERPTR && 242+ if (memory != VB2_MEMORY_MMAP && /* memory != VB2_MEMORY_USERPTR && */ 243 memory != VB2_MEMORY_DMABUF) { 244 dprintk(q, 1, "unsupported memory type\n"); 245 return -EINVAL; 246@@ -708,12 +708,12 @@ int vb2_verify_memory_type(struct vb2_queue *q, 247 dprintk(q, 1, "MMAP for current setup unsupported\n"); 248 return -EINVAL; 249 } 250- 251+#if 0 252 if (memory == VB2_MEMORY_USERPTR && __verify_userptr_ops(q)) { 253 dprintk(q, 1, "USERPTR for current setup unsupported\n"); 254 return -EINVAL; 255 } 256- 257+#endif 258 if (memory == VB2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) { 259 dprintk(q, 1, "DMABUF for current setup unsupported\n"); 260 return -EINVAL; 261@@ -1363,9 +1363,11 @@ static int __buf_prepare(struct vb2_buffer *vb) 262 case VB2_MEMORY_MMAP: 263 ret = __prepare_mmap(vb); 264 break; 265+#if 0 266 case VB2_MEMORY_USERPTR: 267 ret = __prepare_userptr(vb); 268 break; 269+#endif 270 case VB2_MEMORY_DMABUF: 271 ret = __prepare_dmabuf(vb); 272 break; 273diff --git a/drivers/media/common/videobuf2/videobuf2-memops.c b/drivers/media/common/videobuf2/videobuf2-memops.c 274index 9dd6c27162f4..3bbf3dc7d9f9 100644 275--- a/drivers/media/common/videobuf2/videobuf2-memops.c 276+++ b/drivers/media/common/videobuf2/videobuf2-memops.c 277@@ -22,6 +22,7 @@ 278 #include <media/videobuf2-v4l2.h> 279 #include <media/videobuf2-memops.h> 280 281+#if 0 282 /** 283 * vb2_create_framevec() - map virtual addresses to pfns 284 * @start: Virtual user address where we start mapping 285@@ -63,7 +64,9 @@ struct frame_vector *vb2_create_framevec(unsigned long start, 286 return ERR_PTR(ret); 287 } 288 EXPORT_SYMBOL(vb2_create_framevec); 289+#endif 290 291+#if 0 292 /** 293 * vb2_destroy_framevec() - release vector of mapped pfns 294 * @vec: vector of pfns / pages to release 295@@ -77,6 +80,7 @@ void vb2_destroy_framevec(struct frame_vector *vec) 296 frame_vector_destroy(vec); 297 } 298 EXPORT_SYMBOL(vb2_destroy_framevec); 299+#endif 300 301 /** 302 * vb2_common_vm_open() - increase refcount of the vma 303diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c 304index 83f95258ec8c..a8a29d4bdc70 100644 305--- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c 306+++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c 307@@ -71,6 +71,7 @@ static void vb2_vmalloc_put(void *buf_priv) 308 } 309 } 310 311+#if 0 312 static void *vb2_vmalloc_get_userptr(struct device *dev, unsigned long vaddr, 313 unsigned long size, 314 enum dma_data_direction dma_dir) 315@@ -146,6 +147,10 @@ static void vb2_vmalloc_put_userptr(void *buf_priv) 316 vb2_destroy_framevec(buf->vec); 317 kfree(buf); 318 } 319+#else 320+#define vb2_vmalloc_get_userptr NULL 321+#define vb2_vmalloc_put_userptr NULL 322+#endif 323 324 static void *vb2_vmalloc_vaddr(void *buf_priv) 325 { 326diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c 327index a6915582d1a6..49224a61da2b 100644 328--- a/drivers/media/dvb-core/dvb_frontend.c 329+++ b/drivers/media/dvb-core/dvb_frontend.c 330@@ -2067,6 +2067,8 @@ static int dvb_frontend_do_ioctl(struct file *file, unsigned int cmd, 331 * reading from them would interfere with a DVB tune application 332 */ 333 if ((file->f_flags & O_ACCMODE) == O_RDONLY 334+ && (cmd != FE_GET_PROPERTY) 335+ && (cmd != FE_GET_PROPERTY_OLD) 336 && (_IOC_DIR(cmd) != _IOC_READ 337 || cmd == FE_GET_EVENT 338 || cmd == FE_DISEQC_RECV_SLAVE_REPLY)) { 339@@ -2443,6 +2445,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, 340 err = 0; 341 break; 342 } 343+ case FE_GET_PROPERTY_OLD: 344 case FE_GET_PROPERTY: 345 err = dvb_get_property(fe, file, parg); 346 break; 347diff --git a/drivers/media/dvb-frontends/cx24120.c b/drivers/media/dvb-frontends/cx24120.c 348index d8acd582c711..f004d9965d4a 100644 349--- a/drivers/media/dvb-frontends/cx24120.c 350+++ b/drivers/media/dvb-frontends/cx24120.c 351@@ -103,6 +103,8 @@ enum command_message_id { 352 #define CX24120_BER_WINDOW 16 353 #define CX24120_BER_WSIZE ((1 << CX24120_BER_WINDOW) * 208 * 8) 354 355+#undef info 356+#undef err 357 #define info(args...) pr_info("cx24120: " args) 358 #define err(args...) pr_err("cx24120: ### ERROR: " args) 359 360diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c 361index 3d84ee17e54c..4f5efe9dbc5e 100644 362--- a/drivers/media/dvb-frontends/cx24123.c 363+++ b/drivers/media/dvb-frontends/cx24123.c 364@@ -29,6 +29,8 @@ static int debug; 365 module_param(debug, int, 0644); 366 MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); 367 368+#undef info 369+#undef err 370 #define info(args...) do { printk(KERN_INFO "CX24123: " args); } while (0) 371 #define err(args...) do { printk(KERN_ERR "CX24123: " args); } while (0) 372 373diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c 374index b294ba87e934..2145757f642c 100644 375--- a/drivers/media/dvb-frontends/m88rs2000.c 376+++ b/drivers/media/dvb-frontends/m88rs2000.c 377@@ -45,6 +45,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))."); 378 } while (0) 379 380 #define deb_info(args...) dprintk(0x01, args) 381+#undef info 382 #define info(format, arg...) \ 383 printk(KERN_INFO "m88rs2000-fe: " format "\n" , ## arg) 384 385diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c 386index a34834487943..2a7d7e80ca49 100644 387--- a/drivers/media/dvb-frontends/tda18271c2dd.c 388+++ b/drivers/media/dvb-frontends/tda18271c2dd.c 389@@ -1091,7 +1091,7 @@ static int ChannelConfiguration(struct tda_state *state, 390 return status; 391 } 392 393-static int sleep(struct dvb_frontend *fe) 394+static int do_sleep(struct dvb_frontend *fe) 395 { 396 struct tda_state *state = fe->tuner_priv; 397 398@@ -1203,7 +1203,7 @@ static const struct dvb_tuner_ops tuner_ops = { 399 .frequency_step_hz = 62500 400 }, 401 .init = init, 402- .sleep = sleep, 403+ .sleep = do_sleep, 404 .set_params = set_params, 405 .release = release, 406 .get_if_frequency = get_if_frequency, 407diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c 408index 63e94dfcb5d3..667aba0894cd 100644 409--- a/drivers/media/i2c/adv7343.c 410+++ b/drivers/media/i2c/adv7343.c 411@@ -397,6 +397,7 @@ static int adv7343_initialize(struct v4l2_subdev *sd) 412 static struct adv7343_platform_data * 413 adv7343_get_pdata(struct i2c_client *client) 414 { 415+#if IS_ENABLED(CONFIG_OF) 416 struct adv7343_platform_data *pdata; 417 struct device_node *np; 418 419@@ -426,6 +427,9 @@ adv7343_get_pdata(struct i2c_client *client) 420 done: 421 of_node_put(np); 422 return pdata; 423+#else 424+ return client->dev.platform_data; 425+#endif 426 } 427 428 static int adv7343_probe(struct i2c_client *client) 429diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c 430index a7fbe5b400c2..1893aeedc336 100644 431--- a/drivers/media/i2c/tvp514x.c 432+++ b/drivers/media/i2c/tvp514x.c 433@@ -979,6 +979,7 @@ static const struct tvp514x_decoder tvp514x_dev = { 434 static struct tvp514x_platform_data * 435 tvp514x_get_pdata(struct i2c_client *client) 436 { 437+#if IS_ENABLED(CONFIG_OF) 438 struct tvp514x_platform_data *pdata = NULL; 439 struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 }; 440 struct device_node *endpoint; 441@@ -1012,6 +1013,9 @@ tvp514x_get_pdata(struct i2c_client *client) 442 done: 443 of_node_put(endpoint); 444 return pdata; 445+#else 446+ return client->dev.platform_data; 447+#endif 448 } 449 450 /** 451@@ -1206,7 +1210,9 @@ MODULE_DEVICE_TABLE(of, tvp514x_of_match); 452 453 static struct i2c_driver tvp514x_driver = { 454 .driver = { 455+#if IS_ENABLED(CONFIG_OF) 456 .of_match_table = of_match_ptr(tvp514x_of_match), 457+#endif 458 .name = TVP514X_MODULE_NAME, 459 }, 460 .probe = tvp514x_probe, 461diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c 462index e26e3f544054..c86bc1142e2d 100644 463--- a/drivers/media/i2c/tvp5150.c 464+++ b/drivers/media/i2c/tvp5150.c 465@@ -1994,6 +1994,7 @@ static int tvp5150_validate_connectors(struct tvp5150 *decoder) 466 return 0; 467 } 468 469+#if IS_ENABLED(CONFIG_OF) 470 static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) 471 { 472 struct device *dev = decoder->sd.dev; 473@@ -2105,11 +2106,13 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) 474 err_put: 475 of_node_put(ep_np); 476 err_free: 477+#if IS_ENABLED(CONFIG_OF) 478 for (i = 0; i < TVP5150_MAX_CONNECTORS; i++) 479 v4l2_fwnode_connector_free(&decoder->connectors[i].base); 480- 481+#endif 482 return ret; 483 } 484+#endif 485 486 static const char * const tvp5150_test_patterns[2] = { 487 "Disabled", 488@@ -2120,7 +2123,9 @@ static int tvp5150_probe(struct i2c_client *c) 489 { 490 struct tvp5150 *core; 491 struct v4l2_subdev *sd; 492+#if IS_ENABLED(CONFIG_OF) 493 struct device_node *np = c->dev.of_node; 494+#endif 495 struct regmap *map; 496 unsigned int i; 497 int res; 498@@ -2148,7 +2153,8 @@ static int tvp5150_probe(struct i2c_client *c) 499 sd->internal_ops = &tvp5150_internal_ops; 500 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; 501 502- if (IS_ENABLED(CONFIG_OF) && np) { 503+#if IS_ENABLED(CONFIG_OF) 504+ if (np) { 505 res = tvp5150_parse_dt(core, np); 506 if (res) { 507 dev_err(sd->dev, "DT parsing error: %d\n", res); 508@@ -2158,6 +2164,10 @@ static int tvp5150_probe(struct i2c_client *c) 509 /* Default to BT.656 embedded sync */ 510 core->mbus_type = V4L2_MBUS_BT656; 511 } 512+#else 513+ /* Default to BT.656 embedded sync */ 514+ core->mbus_type = V4L2_MBUS_BT656; 515+#endif 516 517 res = tvp5150_mc_init(core); 518 if (res) 519@@ -2213,11 +2223,16 @@ static int tvp5150_probe(struct i2c_client *c) 520 core->irq = c->irq; 521 tvp5150_reset(sd, 0); /* Calls v4l2_ctrl_handler_setup() */ 522 if (c->irq) { 523+#if 0 524 res = devm_request_threaded_irq(&c->dev, c->irq, NULL, 525 tvp5150_isr, IRQF_TRIGGER_HIGH | 526 IRQF_ONESHOT, "tvp5150", core); 527 if (res) 528 goto err; 529+#else 530+ res = -EINVAL; 531+ goto err; 532+#endif 533 } 534 535 res = v4l2_async_register_subdev(sd); 536@@ -2248,12 +2263,16 @@ static int tvp5150_remove(struct i2c_client *c) 537 "tvp5150.c: removing tvp5150 adapter on address 0x%x\n", 538 c->addr << 1); 539 540+#if IS_ENABLED(CONFIG_OF) 541 for (i = 0; i < decoder->connectors_num; i++) 542 v4l2_fwnode_connector_free(&decoder->connectors[i].base); 543+#endif 544+#if defined(CONFIG_MEDIA_CONTROLLER) 545 for (i = 0; i < decoder->connectors_num; i++) { 546 media_device_unregister_entity(&decoder->connectors[i].ent); 547 media_entity_cleanup(&decoder->connectors[i].ent); 548 } 549+#endif 550 v4l2_async_unregister_subdev(sd); 551 v4l2_ctrl_handler_free(&decoder->hdl); 552 pm_runtime_disable(&c->dev); 553diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c 554index ada4ec5ef782..a46d93d8bf39 100644 555--- a/drivers/media/i2c/tvp7002.c 556+++ b/drivers/media/i2c/tvp7002.c 557@@ -882,6 +882,7 @@ static const struct v4l2_subdev_ops tvp7002_ops = { 558 static struct tvp7002_config * 559 tvp7002_get_pdata(struct i2c_client *client) 560 { 561+#if IS_ENABLED(CONFIG_OF) 562 struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 }; 563 struct tvp7002_config *pdata = NULL; 564 struct device_node *endpoint; 565@@ -921,6 +922,9 @@ tvp7002_get_pdata(struct i2c_client *client) 566 done: 567 of_node_put(endpoint); 568 return pdata; 569+#else 570+ return client->dev.platform_data; 571+#endif 572 } 573 574 /* 575@@ -1074,7 +1078,9 @@ MODULE_DEVICE_TABLE(of, tvp7002_of_match); 576 /* I2C driver data */ 577 static struct i2c_driver tvp7002_driver = { 578 .driver = { 579+#if IS_ENABLED(CONFIG_OF) 580 .of_match_table = of_match_ptr(tvp7002_of_match), 581+#endif 582 .name = TVP7002_MODULE_NAME, 583 }, 584 .probe_new = tvp7002_probe, 585diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c 586index 116daf90c858..d78416b2e33d 100644 587--- a/drivers/media/rc/lirc_dev.c 588+++ b/drivers/media/rc/lirc_dev.c 589@@ -823,6 +823,7 @@ void __exit lirc_dev_exit(void) 590 unregister_chrdev_region(lirc_base_dev, RC_DEV_MAX); 591 } 592 593+#if 0 594 struct rc_dev *rc_dev_get_from_fd(int fd) 595 { 596 struct fd f = fdget(fd); 597@@ -845,5 +846,6 @@ struct rc_dev *rc_dev_get_from_fd(int fd) 598 599 return dev; 600 } 601+#endif 602 603 MODULE_ALIAS("lirc_dev"); 604diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c 605index 8e88dc8ea6c5..1d0bfcbe7b73 100644 606--- a/drivers/media/rc/rc-main.c 607+++ b/drivers/media/rc/rc-main.c 608@@ -1887,6 +1887,12 @@ static void rc_free_rx_device(struct rc_dev *dev) 609 ir_free_table(&dev->rc_map); 610 } 611 612+static char *rc_core_default_protocol; 613+module_param_named(default_protocol, rc_core_default_protocol, charp, 0644); 614+MODULE_PARM_DESC(default_protocol, "Select default protocol: " 615+ "jvc, lirc, mce_kbd, nec, none, other, rc-5, rc-5-sz, " 616+ "rc-6, sanyo, sharp, sony, unknown or xmp"); 617+ 618 int rc_register_device(struct rc_dev *dev) 619 { 620 const char *path; 621@@ -1966,6 +1972,15 @@ int rc_register_device(struct rc_dev *dev) 622 dev_dbg(&dev->dev, "Registered rc%u (driver: %s)\n", dev->minor, 623 dev->driver_name ? dev->driver_name : "unknown"); 624 625+ if (rc_core_default_protocol != NULL) { 626+ /* set initial default protocol */ 627+ if (store_protocols(&dev->dev, &dev_attr_protocols, 628+ rc_core_default_protocol, 629+ strlen(rc_core_default_protocol)) < 0) { 630+ printk(KERN_ERR "Could not store protocol '%s'\n", 631+ rc_core_default_protocol); 632+ } 633+ } 634 return 0; 635 636 out_rx: 637diff --git a/drivers/media/usb/as102/as102_drv.h b/drivers/media/usb/as102/as102_drv.h 638index 4342c7ce3407..a790077b44a5 100644 639--- a/drivers/media/usb/as102/as102_drv.h 640+++ b/drivers/media/usb/as102/as102_drv.h 641@@ -23,8 +23,8 @@ extern int elna_enable; 642 643 #define AS102_DEVICE_MAJOR 192 644 645-#define AS102_USB_BUF_SIZE 512 646-#define MAX_STREAM_URB 32 647+#define AS102_USB_BUF_SIZE (1 << 14) 648+#define MAX_STREAM_URB 2 649 650 struct as10x_bus_adapter_t { 651 struct usb_device *usb_dev; 652diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c 653index c6659253c6fb..0ed246b01cca 100644 654--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c 655+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c 656@@ -593,6 +593,7 @@ struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) 657 return dev->muxc->adapter[1]; 658 default: 659 BUG(); 660+ return NULL; 661 } 662 } 663 EXPORT_SYMBOL_GPL(cx231xx_get_i2c_adap); 664diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c 665index 1b6d4e4c52ca..719db9a1c7d2 100644 666--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c 667+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c 668@@ -86,6 +86,7 @@ static int dvb_usb_lme2510_debug; 669 #define deb_info(level, args...) lme_debug(dvb_usb_lme2510_debug, level, args) 670 #define debug_data_snipet(level, name, p) \ 671 deb_info(level, name" (%8phN)", p); 672+#undef info 673 #define info(args...) pr_info(DVB_USB_LOG_PREFIX": "args) 674 675 module_param_named(debug, dvb_usb_lme2510_debug, int, 0644); 676diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c 677index 2ad2ddeaff51..542c01844d13 100644 678--- a/drivers/media/usb/dvb-usb-v2/usb_urb.c 679+++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c 680@@ -250,6 +250,7 @@ static int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num, 681 int usb_urb_reconfig(struct usb_data_stream *stream, 682 struct usb_data_stream_properties *props) 683 { 684+#if 0 685 int buf_size; 686 687 if (!props) 688@@ -299,7 +300,7 @@ int usb_urb_reconfig(struct usb_data_stream *stream, 689 return usb_urb_alloc_bulk_urbs(stream); 690 else if (props->type == USB_ISOC) 691 return usb_urb_alloc_isoc_urbs(stream); 692- 693+#endif 694 return 0; 695 } 696 697@@ -322,6 +323,11 @@ int usb_urb_initv2(struct usb_data_stream *stream, 698 699 switch (stream->props.type) { 700 case USB_BULK: 701+ 702+ /* XXX override driver parameters */ 703+ stream->props.count = 2; 704+ if (stream->props.u.bulk.buffersize < 131072) 705+ stream->props.u.bulk.buffersize = 131072; 706 ret = usb_alloc_stream_buffers(stream, stream->props.count, 707 stream->props.u.bulk.buffersize); 708 if (ret < 0) 709@@ -329,6 +335,19 @@ int usb_urb_initv2(struct usb_data_stream *stream, 710 711 return usb_urb_alloc_bulk_urbs(stream); 712 case USB_ISOC: 713+ 714+ /* XXX override driver parameters */ 715+ switch (stream->udev->speed) { 716+ case USB_SPEED_FULL: 717+ case USB_SPEED_LOW: 718+ stream->props.count = 2; 719+ stream->props.u.isoc.framesperurb = 24; 720+ break; 721+ default: 722+ stream->props.count = 2; 723+ stream->props.u.isoc.framesperurb = 24 * 8; 724+ break; 725+ } 726 ret = usb_alloc_stream_buffers(stream, stream->props.count, 727 stream->props.u.isoc.framesize * 728 stream->props.u.isoc.framesperurb); 729diff --git a/drivers/media/usb/dvb-usb/usb-urb.c b/drivers/media/usb/dvb-usb/usb-urb.c 730index 9771f0954c69..1fe83a6bcf12 100644 731--- a/drivers/media/usb/dvb-usb/usb-urb.c 732+++ b/drivers/media/usb/dvb-usb/usb-urb.c 733@@ -226,8 +226,24 @@ int usb_urb_init(struct usb_data_stream *stream, struct usb_data_stream_properti 734 735 switch (stream->props.type) { 736 case USB_BULK: 737+ /* XXX override driver parameters */ 738+ stream->props.count = 2; 739+ if (stream->props.u.bulk.buffersize < 131072) 740+ stream->props.u.bulk.buffersize = 131072; 741 return usb_bulk_urb_init(stream); 742 case USB_ISOC: 743+ /* XXX override driver parameters */ 744+ switch (stream->udev->speed) { 745+ case USB_SPEED_FULL: 746+ case USB_SPEED_LOW: 747+ stream->props.count = 2; 748+ stream->props.u.isoc.framesperurb = 24; 749+ break; 750+ default: 751+ stream->props.count = 2; 752+ stream->props.u.isoc.framesperurb = 24 * 8; 753+ break; 754+ } 755 return usb_isoc_urb_init(stream); 756 default: 757 err("unknown URB-type for data transfer."); 758diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h 759index ab167cd1f400..c97d1da614d9 100644 760--- a/drivers/media/usb/em28xx/em28xx.h 761+++ b/drivers/media/usb/em28xx/em28xx.h 762@@ -455,6 +455,7 @@ enum em28xx_led_role { 763 EM28XX_LED_DIGITAL_CAPTURING_TS2, 764 EM28XX_LED_ILLUMINATION, 765 EM28XX_NUM_LED_ROLES, /* must be the last */ 766+ EM28XX_LED_DUMMY = -1, /* force enum signed */ 767 }; 768 769 struct em28xx_led { 770diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c 771index 47d8f28bfdfc..deced3e89f5d 100644 772--- a/drivers/media/usb/gspca/gspca.c 773+++ b/drivers/media/usb/gspca/gspca.c 774@@ -37,7 +37,7 @@ 775 #endif 776 777 /* global values */ 778-#define DEF_NURBS 3 /* default number of URBs */ 779+#define DEF_NURBS 2 /* default number of URBs */ 780 #if DEF_NURBS > MAX_NURBS 781 #error "DEF_NURBS too big" 782 #endif 783diff --git a/drivers/media/usb/stkwebcam/stk-webcam.h b/drivers/media/usb/stkwebcam/stk-webcam.h 784index 14519e5308b1..e1ebdc9b4d7a 100644 785--- a/drivers/media/usb/stkwebcam/stk-webcam.h 786+++ b/drivers/media/usb/stkwebcam/stk-webcam.h 787@@ -17,8 +17,8 @@ 788 #define DRIVER_VERSION "v0.0.1" 789 #define DRIVER_VERSION_NUM 0x000001 790 791-#define MAX_ISO_BUFS 3 792-#define ISO_FRAMES_PER_DESC 16 793+#define MAX_ISO_BUFS 2 794+#define ISO_FRAMES_PER_DESC 56 795 #define ISO_MAX_FRAME_SIZE 3 * 1024 796 #define ISO_BUFFER_SIZE (ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE) 797 798diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c 799index 9a791d8ef200..189d45df67b0 100644 800--- a/drivers/media/usb/uvc/uvc_driver.c 801+++ b/drivers/media/usb/uvc/uvc_driver.c 802@@ -2172,8 +2172,6 @@ static void uvc_unregister_video(struct uvc_device *dev) 803 804 video_unregister_device(&stream->vdev); 805 video_unregister_device(&stream->meta.vdev); 806- 807- uvc_debugfs_cleanup_stream(stream); 808 } 809 810 uvc_status_unregister(dev); 811@@ -2270,8 +2268,6 @@ static int uvc_register_video(struct uvc_device *dev, 812 else 813 stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT; 814 815- uvc_debugfs_init_stream(stream); 816- 817 /* Register the device with V4L. */ 818 return uvc_register_video_device(dev, stream, &stream->vdev, 819 &stream->queue, stream->type, 820@@ -3189,11 +3185,8 @@ static int __init uvc_init(void) 821 { 822 int ret; 823 824- uvc_debugfs_init(); 825- 826 ret = usb_register(&uvc_driver.driver); 827 if (ret < 0) { 828- uvc_debugfs_cleanup(); 829 return ret; 830 } 831 832@@ -3203,7 +3196,6 @@ static int __init uvc_init(void) 833 static void __exit uvc_cleanup(void) 834 { 835 usb_deregister(&uvc_driver.driver); 836- uvc_debugfs_cleanup(); 837 } 838 839 module_init(uvc_init); 840diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c 841index a777b389a66e..a198165c4218 100644 842--- a/drivers/media/usb/uvc/uvc_video.c 843+++ b/drivers/media/usb/uvc/uvc_video.c 844@@ -1110,7 +1110,11 @@ static inline enum dma_data_direction uvc_stream_dir( 845 846 static inline struct device *uvc_stream_to_dmadev(struct uvc_streaming *stream) 847 { 848+#ifdef __linux__ 849 return bus_to_hcd(stream->dev->udev->bus)->self.sysdev; 850+#else 851+ return NULL; 852+#endif 853 } 854 855 static int uvc_submit_urb(struct uvc_urb *uvc_urb, gfp_t mem_flags) 856@@ -1659,9 +1663,7 @@ static int uvc_alloc_urb_buffers(struct uvc_streaming *stream, 857 /* Compute the number of packets. Bulk endpoints might transfer UVC 858 * payloads across multiple URBs. 859 */ 860- npackets = DIV_ROUND_UP(size, psize); 861- if (npackets > UVC_MAX_PACKETS) 862- npackets = UVC_MAX_PACKETS; 863+ npackets = size / psize; 864 865 /* Retry allocations until one succeed. */ 866 for (; npackets > 1; npackets /= 2) { 867@@ -1761,7 +1763,23 @@ static int uvc_init_video_isoc(struct uvc_streaming *stream, 868 u32 size; 869 870 psize = uvc_endpoint_max_bpi(stream->dev->udev, ep); 871- size = stream->ctrl.dwMaxVideoFrameSize; 872+ 873+ if (stream->dev->udev->speed == USB_SPEED_FULL) { 874+ /* (8000 >> 3) = 1000 FPS */ 875+ size = (UVC_MAX_PACKETS >> 3) * psize; 876+ } else { 877+ /* 1000 - 8000 FPS, figure out */ 878+ size = ep->desc.bInterval; 879+ if (size > 0) 880+ size --; 881+ if (size > 3) 882+ size = 3; 883+ size = (UVC_MAX_PACKETS >> size) * psize; 884+ } 885+ 886+ /* avoid division by zero */ 887+ if (psize == 0) 888+ return -EINVAL; 889 890 npackets = uvc_alloc_urb_buffers(stream, size, psize, gfp_flags); 891 if (npackets == 0) 892diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h 893index cce5e38133cd..73a75ae17127 100644 894--- a/drivers/media/usb/uvc/uvcvideo.h 895+++ b/drivers/media/usb/uvc/uvcvideo.h 896@@ -183,9 +183,9 @@ 897 #define DRIVER_VERSION "1.1.1" 898 899 /* Number of isochronous URBs. */ 900-#define UVC_URBS 5 901+#define UVC_URBS 2U 902 /* Maximum number of packets per URB. */ 903-#define UVC_MAX_PACKETS 32 904+#define UVC_MAX_PACKETS 128U /* at 8000 FPS */ 905 /* Maximum status buffer size in bytes of interrupt URB. */ 906 #define UVC_MAX_STATUS_SIZE 16 907 908diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c 909index e638aa8aecb7..736c0b26ef4c 100644 910--- a/drivers/media/v4l2-core/v4l2-async.c 911+++ b/drivers/media/v4l2-core/v4l2-async.c 912@@ -69,6 +69,7 @@ static bool match_i2c(struct v4l2_async_notifier *notifier, 913 static bool match_fwnode(struct v4l2_async_notifier *notifier, 914 struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) 915 { 916+#if IS_ENABLED(CONFIG_OF) 917 struct fwnode_handle *other_fwnode; 918 struct fwnode_handle *dev_fwnode; 919 bool asd_fwnode_is_ep; 920@@ -141,6 +142,9 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier, 921 } 922 923 return true; 924+#else 925+ return false; 926+#endif 927 } 928 929 static LIST_HEAD(subdev_list); 930@@ -570,6 +574,7 @@ __v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) 931 list_del(¬ifier->list); 932 } 933 934+#if 0 935 void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) 936 { 937 mutex_lock(&list_lock); 938@@ -579,6 +584,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) 939 mutex_unlock(&list_lock); 940 } 941 EXPORT_SYMBOL(v4l2_async_notifier_unregister); 942+#endif 943 944 static void __v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier) 945 { 946@@ -808,6 +814,7 @@ static void print_waiting_subdev(struct seq_file *s, 947 asd->match.i2c.address); 948 break; 949 case V4L2_ASYNC_MATCH_FWNODE: { 950+#if IS_ENABLED(CONFIG_OF) 951 struct fwnode_handle *devnode, *fwnode = asd->match.fwnode; 952 953 devnode = fwnode_graph_is_endpoint(fwnode) ? 954@@ -819,6 +826,7 @@ static void print_waiting_subdev(struct seq_file *s, 955 fwnode); 956 957 fwnode_handle_put(devnode); 958+#endif 959 break; 960 } 961 } 962diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c 963index 7d0edf3530be..3c1934776078 100644 964--- a/drivers/media/v4l2-core/v4l2-dev.c 965+++ b/drivers/media/v4l2-core/v4l2-dev.c 966@@ -41,6 +41,16 @@ 967 968 static struct dentry *v4l2_debugfs_dir; 969 970+static int v4l_vflip; 971+module_param(v4l_vflip, int, 0644); 972+MODULE_PARM_DESC(v4l_vflip, 973+ "Force all V4L devices to flip the picture vertically."); 974+ 975+static int v4l_hflip; 976+module_param(v4l_hflip, int, 0644); 977+MODULE_PARM_DESC(v4l_hflip, 978+ "Force all V4L devices to flip the picture horizontally."); 979+ 980 /* 981 * sysfs stuff 982 */ 983@@ -367,6 +377,24 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 984 } else 985 ret = -ENOTTY; 986 987+ if (ret == 0 && cmd == VIDIOC_ENUMINPUT) { 988+ 989+ __u32 status; 990+ 991+ if (copy_from_user(&status, (char *)arg + 992+ offsetof(struct v4l2_input, status), sizeof(status))) 993+ ret = -EFAULT; 994+ 995+ if (v4l_vflip) 996+ status ^= V4L2_IN_ST_VFLIP; 997+ if (v4l_hflip) 998+ status ^= V4L2_IN_ST_HFLIP; 999+ 1000+ if (copy_to_user((char *)arg + offsetof(struct v4l2_input, 1001+ status), &status, sizeof(status))) 1002+ ret = -EFAULT; 1003+ } 1004+ 1005 return ret; 1006 } 1007 1008@@ -453,13 +481,17 @@ static int v4l2_release(struct inode *inode, struct file *filp) 1009 * request at the same time. 1010 */ 1011 if (vdev->fops->release) { 1012+#if IS_ENABLED(MEDIA_CONTROLLER) 1013 if (v4l2_device_supports_requests(vdev->v4l2_dev)) { 1014 mutex_lock(&vdev->v4l2_dev->mdev->req_queue_mutex); 1015 ret = vdev->fops->release(filp); 1016 mutex_unlock(&vdev->v4l2_dev->mdev->req_queue_mutex); 1017 } else { 1018+#endif 1019 ret = vdev->fops->release(filp); 1020+#if IS_ENABLED(MEDIA_CONTROLLER) 1021 } 1022+#endif 1023 } 1024 1025 if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) 1026diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c 1027index 2673f51aafa4..738db4e2c1dd 100644 1028--- a/drivers/media/v4l2-core/v4l2-ioctl.c 1029+++ b/drivers/media/v4l2-core/v4l2-ioctl.c 1030@@ -2906,6 +2906,7 @@ static long __video_do_ioctl(struct file *file, 1031 * operation, and that should not be mixed with queueing a new 1032 * request at the same time. 1033 */ 1034+#if IS_ENABLED(MEDIA_CONTROLLER) 1035 if (v4l2_device_supports_requests(vfd->v4l2_dev) && 1036 (cmd == VIDIOC_STREAMON || cmd == VIDIOC_STREAMOFF)) { 1037 req_queue_lock = &vfd->v4l2_dev->mdev->req_queue_mutex; 1038@@ -2913,6 +2914,7 @@ static long __video_do_ioctl(struct file *file, 1039 if (mutex_lock_interruptible(req_queue_lock)) 1040 return -ERESTARTSYS; 1041 } 1042+#endif 1043 1044 lock = v4l2_ioctl_get_lock(vfd, vfh, cmd, arg); 1045 1046diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c 1047index 956dafab43d4..b767b82f90a8 100644 1048--- a/drivers/media/v4l2-core/v4l2-subdev.c 1049+++ b/drivers/media/v4l2-core/v4l2-subdev.c 1050@@ -428,6 +428,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1051 1052 return v4l2_event_dequeue(vfh, arg, file->f_flags & O_NONBLOCK); 1053 1054+#ifdef CONFIG_COMPAT_32BIT_TIME 1055 case VIDIOC_DQEVENT_TIME32: { 1056 struct v4l2_event_time32 *ev32 = arg; 1057 struct v4l2_event ev = { }; 1058@@ -451,7 +452,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1059 1060 return rval; 1061 } 1062- 1063+#endif 1064 case VIDIOC_SUBSCRIBE_EVENT: 1065 return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg); 1066 1067diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h 1068index 8a8977a33ec1..4d999cd44927 100644 1069--- a/include/media/v4l2-device.h 1070+++ b/include/media/v4l2-device.h 1071@@ -246,11 +246,13 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, 1072 * 1073 * @v4l2_dev: pointer to struct v4l2_device 1074 */ 1075+#if IS_ENABLED(MEDIA_CONTROLLER) 1076 static inline bool v4l2_device_supports_requests(struct v4l2_device *v4l2_dev) 1077 { 1078 return v4l2_dev->mdev && v4l2_dev->mdev->ops && 1079 v4l2_dev->mdev->ops->req_queue; 1080 } 1081+#endif 1082 1083 /* Helper macros to iterate over all subdevs. */ 1084 1085diff --git a/include/uapi/asm-generic/ioctl.h b/include/uapi/asm-generic/ioctl.h 1086index a84f4db8a250..6695939fb2d4 100644 1087--- a/include/uapi/asm-generic/ioctl.h 1088+++ b/include/uapi/asm-generic/ioctl.h 1089@@ -83,6 +83,7 @@ 1090 * means userland is reading and kernel is writing. 1091 */ 1092 #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) 1093+#define _IOWINT(type,nr) _IOC(_IOC_NONE,(type),(nr),sizeof(int)) 1094 #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) 1095 #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) 1096 #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) 1097diff --git a/include/uapi/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h 1098index dffa59e95ebb..c4533a16d93e 100644 1099--- a/include/uapi/linux/dvb/ca.h 1100+++ b/include/uapi/linux/dvb/ca.h 1101@@ -134,9 +134,17 @@ struct ca_descr { 1102 1103 #define CA_RESET _IO('o', 128) 1104 #define CA_GET_CAP _IOR('o', 129, struct ca_caps) 1105+/* 1106+ * At least CA_GET_SLOT_INFO and CA_GET_MSG need to be _IOWR not _IOR. 1107+ * This is wrong on Linux too but there the driver doesn't care. 1108+ * 1109 #define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info) 1110 #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info) 1111 #define CA_GET_MSG _IOR('o', 132, struct ca_msg) 1112+*/ 1113+#define CA_GET_SLOT_INFO _IOWR('o', 130, struct ca_slot_info) 1114+#define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info) 1115+#define CA_GET_MSG _IOWR('o', 132, struct ca_msg) 1116 #define CA_SEND_MSG _IOW('o', 133, struct ca_msg) 1117 #define CA_SET_DESCR _IOW('o', 134, struct ca_descr) 1118 1119diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h 1120index 4f9b4551c534..a5e950404072 100644 1121--- a/include/uapi/linux/dvb/frontend.h 1122+++ b/include/uapi/linux/dvb/frontend.h 1123@@ -908,7 +908,8 @@ struct dtv_properties { 1124 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ 1125 1126 #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) 1127-#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) 1128+#define FE_GET_PROPERTY _IOW('o', 83, struct dtv_properties) 1129+#define FE_GET_PROPERTY_OLD _IOR('o', 83, struct dtv_properties) 1130 1131 #if defined(__DVB_CORE__) || !defined(__KERNEL__) 1132 1133diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h 1134index ee3127461ee0..047701d44a8c 100644 1135--- a/include/uapi/linux/input.h 1136+++ b/include/uapi/linux/input.h 1137@@ -131,8 +131,12 @@ struct input_mask { 1138 #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ 1139 #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ 1140 1141-#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ 1142-#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) 1143+/* 1144+ * These two need to be _IOWR not _IOR (they're wrong on Linux too but 1145+ * there the driver doesn't care.) 1146+ */ 1147+#define EVIOCGKEYCODE _IOWR('E', 0x04, unsigned int[2]) /* get keycode */ 1148+#define EVIOCGKEYCODE_V2 _IOWR('E', 0x04, struct input_keymap_entry) 1149 #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ 1150 #define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) 1151 1152@@ -165,7 +169,7 @@ struct input_mask { 1153 * 1154 * If the request code is not an ABS_MT value, -EINVAL is returned. 1155 */ 1156-#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len) 1157+#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ|_IOC_WRITE, 'E', 0x0a, len) 1158 1159 #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 1160 #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 1161@@ -177,11 +181,11 @@ struct input_mask { 1162 #define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */ 1163 1164 #define EVIOCSFF _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */ 1165-#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ 1166+#define EVIOCRMFF _IOWINT('E', 0x81) /* Erase a force effect */ 1167 #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ 1168 1169-#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 1170-#define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */ 1171+#define EVIOCGRAB _IOWINT('E', 0x90) /* Grab/Release device */ 1172+#define EVIOCREVOKE _IOWINT('E', 0x91) /* Revoke device access */ 1173 1174 /** 1175 * EVIOCGMASK - Retrieve current event mask 1176@@ -212,7 +216,7 @@ struct input_mask { 1177 * if the receive-buffer points to invalid memory, or EINVAL if the kernel 1178 * does not implement the ioctl. 1179 */ 1180-#define EVIOCGMASK _IOR('E', 0x92, struct input_mask) /* Get event-masks */ 1181+#define EVIOCGMASK _IOW('E', 0x92, struct input_mask) /* Get event-masks */ 1182 1183 /** 1184 * EVIOCSMASK - Set event mask 1185diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c 1186index 12f2562b0141..a56a8349e8dd 100644 1187--- a/drivers/input/touchscreen/sur40.c 1188+++ b/drivers/input/touchscreen/sur40.c 1189@@ -1121,7 +1121,9 @@ static const struct vb2_queue sur40_queue = { 1190 .io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF, 1191 .buf_struct_size = sizeof(struct sur40_buffer), 1192 .ops = &sur40_queue_ops, 1193+#ifdef __linux__ 1194 .mem_ops = &vb2_dma_sg_memops, 1195+#endif 1196 .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, 1197 .min_buffers_needed = 3, 1198 }; 1199