Skip to content

Commit

Permalink
Merge tag 'media/v4.12-3' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/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
  • Loading branch information
Linus Torvalds committed Jun 15, 2017
2 parents 63f700a + f9f314f commit 906e0c5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
1 change: 1 addition & 0 deletions drivers/media/cec/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config MEDIA_CEC_RC
bool "HDMI CEC RC integration"
depends on CEC_CORE && RC_CORE
depends on CEC_CORE=m || RC_CORE=y
---help---
Pass on CEC remote control messages to the RC framework.
8 changes: 1 addition & 7 deletions drivers/media/cec/cec-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh,
bool block, struct cec_msg __user *parg)
{
struct cec_msg msg = {};
long err = 0;
long err;

if (copy_from_user(&msg, parg, sizeof(msg)))
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);
if (err)
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/i2c/tc358743.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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)
Expand Down
6 changes: 6 additions & 0 deletions drivers/media/rc/sir_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
static unsigned long delt;
unsigned long deltintr;
unsigned long flags;
int counter = 0;
int iir, lsr;

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 */
case UART_IIR_MSI:
(void)inb(io + UART_MSR);
Expand Down
1 change: 1 addition & 0 deletions drivers/media/usb/rainshadow-cec/rainshadow-cec.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv)
serio_set_drvdata(serio, rain);
INIT_WORK(&rain->work, rain_irq_work_handler);
mutex_init(&rain->write_lock);
spin_lock_init(&rain->buf_lock);

err = serio_open(serio, drv);
if (err)
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/v4l2-core/videobuf2-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs);

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 call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv);
Expand Down
10 changes: 10 additions & 0 deletions include/media/cec-notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion include/media/cec.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
#define cec_phys_addr_exp(pa) \
((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,
void *priv, const char *name, u32 caps, u8 available_las);
int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
Expand Down

0 comments on commit 906e0c5

Please sign in to comment.