Commit 906e0c5b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'media/v4.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

 - some build dependency issues at CEC core with randconfigs

 - fix an off by one error at vb2

 - a race fix at cec core

 - driver fixes at tc358743, sir_ir and rainshadow-cec

* tag 'media/v4.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] media/cec.h: use IS_REACHABLE instead of IS_ENABLED
  [media] cec: race fix: don't return -ENONET in cec_receive()
  [media] sir_ir: infinite loop in interrupt handler
  [media] cec-notifier.h: handle unreachable CONFIG_CEC_CORE
  [media] cec: improve MEDIA_CEC_RC dependencies
  [media] vb2: Fix an off by one error in 'vb2_plane_vaddr'
  [media] rainshadow-cec: Fix missing spin_lock_init()
  [media] tc358743: fix register i2c_rd/wr function fix
parents 63f700aa f9f314f3
config MEDIA_CEC_RC config MEDIA_CEC_RC
bool "HDMI CEC RC integration" bool "HDMI CEC RC integration"
depends on CEC_CORE && RC_CORE depends on CEC_CORE && RC_CORE
depends on CEC_CORE=m || RC_CORE=y
---help--- ---help---
Pass on CEC remote control messages to the RC framework. Pass on CEC remote control messages to the RC framework.
...@@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, ...@@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh,
bool block, struct cec_msg __user *parg) bool block, struct cec_msg __user *parg)
{ {
struct cec_msg msg = {}; struct cec_msg msg = {};
long err = 0; long err;
if (copy_from_user(&msg, parg, sizeof(msg))) if (copy_from_user(&msg, parg, sizeof(msg)))
return -EFAULT; return -EFAULT;
mutex_lock(&adap->lock);
if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR)
err = -ENONET;
mutex_unlock(&adap->lock);
if (err)
return err;
err = cec_receive_msg(fh, &msg, block); err = cec_receive_msg(fh, &msg, block);
if (err) if (err)
......
...@@ -223,7 +223,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val) ...@@ -223,7 +223,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val)
static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg, static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
u8 mask, u8 val) u8 mask, u8 val)
{ {
i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2); i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1);
} }
static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg) static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
......
...@@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) ...@@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
static unsigned long delt; static unsigned long delt;
unsigned long deltintr; unsigned long deltintr;
unsigned long flags; unsigned long flags;
int counter = 0;
int iir, lsr; int iir, lsr;
while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) { while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) {
if (++counter > 256) {
dev_err(&sir_ir_dev->dev, "Trapped in interrupt");
break;
}
switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */ switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */
case UART_IIR_MSI: case UART_IIR_MSI:
(void)inb(io + UART_MSR); (void)inb(io + UART_MSR);
......
...@@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv) ...@@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv)
serio_set_drvdata(serio, rain); serio_set_drvdata(serio, rain);
INIT_WORK(&rain->work, rain_irq_work_handler); INIT_WORK(&rain->work, rain_irq_work_handler);
mutex_init(&rain->write_lock); mutex_init(&rain->write_lock);
spin_lock_init(&rain->buf_lock);
err = serio_open(serio, drv); err = serio_open(serio, drv);
if (err) if (err)
......
...@@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs); ...@@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs);
void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no) void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no)
{ {
if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)
return NULL; return NULL;
return call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv); return call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv);
......
...@@ -106,6 +106,16 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, ...@@ -106,6 +106,16 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n,
{ {
} }
static inline void cec_notifier_register(struct cec_notifier *n,
struct cec_adapter *adap,
void (*callback)(struct cec_adapter *adap, u16 pa))
{
}
static inline void cec_notifier_unregister(struct cec_notifier *n)
{
}
#endif #endif
#endif #endif
...@@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap) ...@@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
#define cec_phys_addr_exp(pa) \ #define cec_phys_addr_exp(pa) \
((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
#if IS_ENABLED(CONFIG_CEC_CORE) #if IS_REACHABLE(CONFIG_CEC_CORE)
struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
void *priv, const char *name, u32 caps, u8 available_las); void *priv, const char *name, u32 caps, u8 available_las);
int cec_register_adapter(struct cec_adapter *adap, struct device *parent); int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment