Commit 0fdf68c7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull media fixes from Mauro Carvalho Chehab:

 - a compilation fix issue with ti-vpe on arm 32 bits

 - two Kconfig fixes for imx214 and max9286 drivers

 - a kernel information leak at v4l2-core on time32 compat ioctls

 - some fixes at rc core unbind logic

 - a fix at mceusb driver for it to not use GFP_ATOMIC

 - fixes at cedrus and vicodec drivers at the control handling logic

 - a fix at gpio-ir-tx to avoid disabling interruts on a spinlock

* tag 'media/v5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: mceusb: Avoid GFP_ATOMIC where it is not needed
  media: gpio-ir-tx: spinlock is not needed to disable interrupts
  media: rc: do not access device via sysfs after rc_unregister_device()
  media: rc: uevent sysfs file races with rc_unregister_device()
  media: max9286: Depend on OF_GPIO
  media: i2c: imx214: select V4L2_FWNODE
  media: cedrus: Add missing v4l2_ctrl_request_hdl_put()
  media: vicodec: add missing v4l2_ctrl_request_hdl_put()
  media: media/v4l2-core: Fix kernel-infoleak in video_put_user()
  media: ti-vpe: cal: Fix compilation on 32-bit ARM
parents fc3abb53 ddecfc76
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -467,7 +467,7 @@ config VIDEO_VPX3220
config VIDEO_MAX9286
	tristate "Maxim MAX9286 GMSL deserializer support"
	depends on I2C && I2C_MUX
	depends on OF
	depends on OF_GPIO
	select V4L2_FWNODE
	select VIDEO_V4L2_SUBDEV_API
	select MEDIA_CONTROLLER
@@ -741,7 +741,7 @@ config VIDEO_HI556
config VIDEO_IMX214
	tristate "Sony IMX214 sensor support"
	depends on GPIOLIB && I2C && VIDEO_V4L2
	depends on V4L2_FWNODE
	select V4L2_FWNODE
	select MEDIA_CONTROLLER
	select VIDEO_V4L2_SUBDEV_API
	select REGMAP_I2C
+1 −1
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ static inline void cal_write_field(struct cal_dev *cal, u32 offset, u32 value,
	u32 val = cal_read(cal, offset);

	val &= ~mask;
	val |= FIELD_PREP(mask, value);
	val |= (value << __ffs(mask)) & mask;
	cal_write(cal, offset, val);
}

+5 −11
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ struct gpio_ir {
	struct gpio_desc *gpio;
	unsigned int carrier;
	unsigned int duty_cycle;
	/* we need a spinlock to hold the cpu while transmitting */
	spinlock_t lock;
};

static const struct of_device_id gpio_ir_tx_of_match[] = {
@@ -53,12 +51,11 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier)
static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf,
				   uint count)
{
	unsigned long flags;
	ktime_t edge;
	s32 delta;
	int i;

	spin_lock_irqsave(&gpio_ir->lock, flags);
	local_irq_disable();

	edge = ktime_get();

@@ -72,14 +69,11 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf,
	}

	gpiod_set_value(gpio_ir->gpio, 0);

	spin_unlock_irqrestore(&gpio_ir->lock, flags);
}

static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
				 uint count)
{
	unsigned long flags;
	ktime_t edge;
	/*
	 * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on
@@ -95,7 +89,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
	space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) *
				  (NSEC_PER_SEC / 100), gpio_ir->carrier);

	spin_lock_irqsave(&gpio_ir->lock, flags);
	local_irq_disable();

	edge = ktime_get();

@@ -128,19 +122,20 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
			edge = last;
		}
	}

	spin_unlock_irqrestore(&gpio_ir->lock, flags);
}

static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
		      unsigned int count)
{
	struct gpio_ir *gpio_ir = dev->priv;
	unsigned long flags;

	local_irq_save(flags);
	if (gpio_ir->carrier)
		gpio_ir_tx_modulated(gpio_ir, txbuf, count);
	else
		gpio_ir_tx_unmodulated(gpio_ir, txbuf, count);
	local_irq_restore(flags);

	return count;
}
@@ -176,7 +171,6 @@ static int gpio_ir_tx_probe(struct platform_device *pdev)

	gpio_ir->carrier = 38000;
	gpio_ir->duty_cycle = 50;
	spin_lock_init(&gpio_ir->lock);

	rc = devm_rc_register_device(&pdev->dev, rcdev);
	if (rc < 0)
+1 −1
Original line number Diff line number Diff line
@@ -1726,7 +1726,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
		goto mem_alloc_fail;

	ir->pipe_in = pipe;
	ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_ATOMIC, &ir->dma_in);
	ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_KERNEL, &ir->dma_in);
	if (!ir->buf_in)
		goto buf_in_alloc_fail;

+28 −16
Original line number Diff line number Diff line
@@ -1292,6 +1292,10 @@ static ssize_t store_protocols(struct device *device,
	}

	mutex_lock(&dev->lock);
	if (!dev->registered) {
		mutex_unlock(&dev->lock);
		return -ENODEV;
	}

	old_protocols = *current_protocols;
	new_protocols = old_protocols;
@@ -1430,6 +1434,10 @@ static ssize_t store_filter(struct device *device,
		return -EINVAL;

	mutex_lock(&dev->lock);
	if (!dev->registered) {
		mutex_unlock(&dev->lock);
		return -ENODEV;
	}

	new_filter = *filter;
	if (fattr->mask)
@@ -1544,6 +1552,10 @@ static ssize_t store_wakeup_protocols(struct device *device,
	int i;

	mutex_lock(&dev->lock);
	if (!dev->registered) {
		mutex_unlock(&dev->lock);
		return -ENODEV;
	}

	allowed = dev->allowed_wakeup_protocols;

@@ -1601,25 +1613,25 @@ static void rc_dev_release(struct device *device)
	kfree(dev);
}

#define ADD_HOTPLUG_VAR(fmt, val...)					\
	do {								\
		int err = add_uevent_var(env, fmt, val);		\
		if (err)						\
			return err;					\
	} while (0)

static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env)
{
	struct rc_dev *dev = to_rc_dev(device);
	int ret = 0;

	if (dev->rc_map.name)
		ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name);
	if (dev->driver_name)
		ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name);
	if (dev->device_name)
		ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name);
	mutex_lock(&dev->lock);

	return 0;
	if (!dev->registered)
		ret = -ENODEV;
	if (ret == 0 && dev->rc_map.name)
		ret = add_uevent_var(env, "NAME=%s", dev->rc_map.name);
	if (ret == 0 && dev->driver_name)
		ret = add_uevent_var(env, "DRV_NAME=%s", dev->driver_name);
	if (ret == 0 && dev->device_name)
		ret = add_uevent_var(env, "DEV_NAME=%s", dev->device_name);

	mutex_unlock(&dev->lock);

	return ret;
}

/*
@@ -2011,14 +2023,14 @@ void rc_unregister_device(struct rc_dev *dev)
	del_timer_sync(&dev->timer_keyup);
	del_timer_sync(&dev->timer_repeat);

	rc_free_rx_device(dev);

	mutex_lock(&dev->lock);
	if (dev->users && dev->close)
		dev->close(dev);
	dev->registered = false;
	mutex_unlock(&dev->lock);

	rc_free_rx_device(dev);

	/*
	 * lirc device should be freed with dev->registered = false, so
	 * that userspace polling will get notified.
Loading