aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/cec/cec-adap.c49
-rw-r--r--drivers/media/i2c/tc358743.c1
-rw-r--r--drivers/media/pci/intel/ipu3/ipu3-cio2.c6
-rw-r--r--drivers/media/platform/omap3isp/isp.c3
-rw-r--r--drivers/media/platform/vicodec/vicodec-core.c2
-rw-r--r--drivers/media/platform/vim2m.c2
-rw-r--r--drivers/media/v4l2-core/v4l2-ctrls.c5
-rw-r--r--drivers/media/v4l2-core/v4l2-event.c43
-rw-r--r--drivers/media/v4l2-core/v4l2-mem2mem.c4
9 files changed, 75 insertions, 40 deletions
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
index 31d1f4ab915e..65a933a21e68 100644
--- a/drivers/media/cec/cec-adap.c
+++ b/drivers/media/cec/cec-adap.c
@@ -807,7 +807,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
807 } 807 }
808 808
809 if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ) { 809 if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ) {
810 dprintk(1, "%s: transmit queue full\n", __func__); 810 dprintk(2, "%s: transmit queue full\n", __func__);
811 return -EBUSY; 811 return -EBUSY;
812 } 812 }
813 813
@@ -1180,6 +1180,8 @@ static int cec_config_log_addr(struct cec_adapter *adap,
1180{ 1180{
1181 struct cec_log_addrs *las = &adap->log_addrs; 1181 struct cec_log_addrs *las = &adap->log_addrs;
1182 struct cec_msg msg = { }; 1182 struct cec_msg msg = { };
1183 const unsigned int max_retries = 2;
1184 unsigned int i;
1183 int err; 1185 int err;
1184 1186
1185 if (cec_has_log_addr(adap, log_addr)) 1187 if (cec_has_log_addr(adap, log_addr))
@@ -1188,19 +1190,44 @@ static int cec_config_log_addr(struct cec_adapter *adap,
1188 /* Send poll message */ 1190 /* Send poll message */
1189 msg.len = 1; 1191 msg.len = 1;
1190 msg.msg[0] = (log_addr << 4) | log_addr; 1192 msg.msg[0] = (log_addr << 4) | log_addr;
1191 err = cec_transmit_msg_fh(adap, &msg, NULL, true);
1192 1193
1193 /* 1194 for (i = 0; i < max_retries; i++) {
1194 * While trying to poll the physical address was reset 1195 err = cec_transmit_msg_fh(adap, &msg, NULL, true);
1195 * and the adapter was unconfigured, so bail out.
1196 */
1197 if (!adap->is_configuring)
1198 return -EINTR;
1199 1196
1200 if (err) 1197 /*
1201 return err; 1198 * While trying to poll the physical address was reset
1199 * and the adapter was unconfigured, so bail out.
1200 */
1201 if (!adap->is_configuring)
1202 return -EINTR;
1203
1204 if (err)
1205 return err;
1202 1206
1203 if (msg.tx_status & CEC_TX_STATUS_OK) 1207 /*
1208 * The message was aborted due to a disconnect or
1209 * unconfigure, just bail out.
1210 */
1211 if (msg.tx_status & CEC_TX_STATUS_ABORTED)
1212 return -EINTR;
1213 if (msg.tx_status & CEC_TX_STATUS_OK)
1214 return 0;
1215 if (msg.tx_status & CEC_TX_STATUS_NACK)
1216 break;
1217 /*
1218 * Retry up to max_retries times if the message was neither
1219 * OKed or NACKed. This can happen due to e.g. a Lost
1220 * Arbitration condition.
1221 */
1222 }
1223
1224 /*
1225 * If we are unable to get an OK or a NACK after max_retries attempts
1226 * (and note that each attempt already consists of four polls), then
1227 * then we assume that something is really weird and that it is not a
1228 * good idea to try and claim this logical address.
1229 */
1230 if (i == max_retries)
1204 return 0; 1231 return 0;
1205 1232
1206 /* 1233 /*
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index a38e54b8f687..22cafc07de25 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -1918,7 +1918,6 @@ static int tc358743_probe_of(struct tc358743_state *state)
1918 ret = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep), &endpoint); 1918 ret = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep), &endpoint);
1919 if (ret) { 1919 if (ret) {
1920 dev_err(dev, "failed to parse endpoint\n"); 1920 dev_err(dev, "failed to parse endpoint\n");
1921 ret = ret;
1922 goto put_node; 1921 goto put_node;
1923 } 1922 }
1924 1923
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 452eb9b42140..447baaebca44 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1844,14 +1844,12 @@ fail_mutex_destroy:
1844static void cio2_pci_remove(struct pci_dev *pci_dev) 1844static void cio2_pci_remove(struct pci_dev *pci_dev)
1845{ 1845{
1846 struct cio2_device *cio2 = pci_get_drvdata(pci_dev); 1846 struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
1847 unsigned int i;
1848 1847
1848 media_device_unregister(&cio2->media_dev);
1849 cio2_notifier_exit(cio2); 1849 cio2_notifier_exit(cio2);
1850 cio2_queues_exit(cio2);
1850 cio2_fbpt_exit_dummy(cio2); 1851 cio2_fbpt_exit_dummy(cio2);
1851 for (i = 0; i < CIO2_QUEUES; i++)
1852 cio2_queue_exit(cio2, &cio2->queue[i]);
1853 v4l2_device_unregister(&cio2->v4l2_dev); 1852 v4l2_device_unregister(&cio2->v4l2_dev);
1854 media_device_unregister(&cio2->media_dev);
1855 media_device_cleanup(&cio2->media_dev); 1853 media_device_cleanup(&cio2->media_dev);
1856 mutex_destroy(&cio2->lock); 1854 mutex_destroy(&cio2->lock);
1857} 1855}
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 77fb7987b42f..13f2828d880d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1587,6 +1587,8 @@ static void isp_pm_complete(struct device *dev)
1587 1587
1588static void isp_unregister_entities(struct isp_device *isp) 1588static void isp_unregister_entities(struct isp_device *isp)
1589{ 1589{
1590 media_device_unregister(&isp->media_dev);
1591
1590 omap3isp_csi2_unregister_entities(&isp->isp_csi2a); 1592 omap3isp_csi2_unregister_entities(&isp->isp_csi2a);
1591 omap3isp_ccp2_unregister_entities(&isp->isp_ccp2); 1593 omap3isp_ccp2_unregister_entities(&isp->isp_ccp2);
1592 omap3isp_ccdc_unregister_entities(&isp->isp_ccdc); 1594 omap3isp_ccdc_unregister_entities(&isp->isp_ccdc);
@@ -1597,7 +1599,6 @@ static void isp_unregister_entities(struct isp_device *isp)
1597 omap3isp_stat_unregister_entities(&isp->isp_hist); 1599 omap3isp_stat_unregister_entities(&isp->isp_hist);
1598 1600
1599 v4l2_device_unregister(&isp->v4l2_dev); 1601 v4l2_device_unregister(&isp->v4l2_dev);
1600 media_device_unregister(&isp->media_dev);
1601 media_device_cleanup(&isp->media_dev); 1602 media_device_cleanup(&isp->media_dev);
1602} 1603}
1603 1604
diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
index 1eb9132bfc85..b292cff26c86 100644
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -42,7 +42,7 @@ MODULE_PARM_DESC(debug, " activates debug info");
42#define MAX_WIDTH 4096U 42#define MAX_WIDTH 4096U
43#define MIN_WIDTH 640U 43#define MIN_WIDTH 640U
44#define MAX_HEIGHT 2160U 44#define MAX_HEIGHT 2160U
45#define MIN_HEIGHT 480U 45#define MIN_HEIGHT 360U
46 46
47#define dprintk(dev, fmt, arg...) \ 47#define dprintk(dev, fmt, arg...) \
48 v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg) 48 v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index af150a0395df..d82db738f174 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -1009,7 +1009,7 @@ static const struct v4l2_m2m_ops m2m_ops = {
1009 1009
1010static const struct media_device_ops m2m_media_ops = { 1010static const struct media_device_ops m2m_media_ops = {
1011 .req_validate = vb2_request_validate, 1011 .req_validate = vb2_request_validate,
1012 .req_queue = vb2_m2m_request_queue, 1012 .req_queue = v4l2_m2m_request_queue,
1013}; 1013};
1014 1014
1015static int vim2m_probe(struct platform_device *pdev) 1015static int vim2m_probe(struct platform_device *pdev)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 6e37950292cd..5f2b033a7a42 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1664,6 +1664,11 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
1664 p_mpeg2_slice_params->forward_ref_index >= VIDEO_MAX_FRAME) 1664 p_mpeg2_slice_params->forward_ref_index >= VIDEO_MAX_FRAME)
1665 return -EINVAL; 1665 return -EINVAL;
1666 1666
1667 if (p_mpeg2_slice_params->pad ||
1668 p_mpeg2_slice_params->picture.pad ||
1669 p_mpeg2_slice_params->sequence.pad)
1670 return -EINVAL;
1671
1667 return 0; 1672 return 0;
1668 1673
1669 case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: 1674 case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION:
diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
index a3ef1f50a4b3..481e3c65cf97 100644
--- a/drivers/media/v4l2-core/v4l2-event.c
+++ b/drivers/media/v4l2-core/v4l2-event.c
@@ -193,6 +193,22 @@ int v4l2_event_pending(struct v4l2_fh *fh)
193} 193}
194EXPORT_SYMBOL_GPL(v4l2_event_pending); 194EXPORT_SYMBOL_GPL(v4l2_event_pending);
195 195
196static void __v4l2_event_unsubscribe(struct v4l2_subscribed_event *sev)
197{
198 struct v4l2_fh *fh = sev->fh;
199 unsigned int i;
200
201 lockdep_assert_held(&fh->subscribe_lock);
202 assert_spin_locked(&fh->vdev->fh_lock);
203
204 /* Remove any pending events for this subscription */
205 for (i = 0; i < sev->in_use; i++) {
206 list_del(&sev->events[sev_pos(sev, i)].list);
207 fh->navailable--;
208 }
209 list_del(&sev->list);
210}
211
196int v4l2_event_subscribe(struct v4l2_fh *fh, 212int v4l2_event_subscribe(struct v4l2_fh *fh,
197 const struct v4l2_event_subscription *sub, unsigned elems, 213 const struct v4l2_event_subscription *sub, unsigned elems,
198 const struct v4l2_subscribed_event_ops *ops) 214 const struct v4l2_subscribed_event_ops *ops)
@@ -224,27 +240,23 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
224 240
225 spin_lock_irqsave(&fh->vdev->fh_lock, flags); 241 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
226 found_ev = v4l2_event_subscribed(fh, sub->type, sub->id); 242 found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
243 if (!found_ev)
244 list_add(&sev->list, &fh->subscribed);
227 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); 245 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
228 246
229 if (found_ev) { 247 if (found_ev) {
230 /* Already listening */ 248 /* Already listening */
231 kvfree(sev); 249 kvfree(sev);
232 goto out_unlock; 250 } else if (sev->ops && sev->ops->add) {
233 }
234
235 if (sev->ops && sev->ops->add) {
236 ret = sev->ops->add(sev, elems); 251 ret = sev->ops->add(sev, elems);
237 if (ret) { 252 if (ret) {
253 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
254 __v4l2_event_unsubscribe(sev);
255 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
238 kvfree(sev); 256 kvfree(sev);
239 goto out_unlock;
240 } 257 }
241 } 258 }
242 259
243 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
244 list_add(&sev->list, &fh->subscribed);
245 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
246
247out_unlock:
248 mutex_unlock(&fh->subscribe_lock); 260 mutex_unlock(&fh->subscribe_lock);
249 261
250 return ret; 262 return ret;
@@ -279,7 +291,6 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
279{ 291{
280 struct v4l2_subscribed_event *sev; 292 struct v4l2_subscribed_event *sev;
281 unsigned long flags; 293 unsigned long flags;
282 int i;
283 294
284 if (sub->type == V4L2_EVENT_ALL) { 295 if (sub->type == V4L2_EVENT_ALL) {
285 v4l2_event_unsubscribe_all(fh); 296 v4l2_event_unsubscribe_all(fh);
@@ -291,14 +302,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
291 spin_lock_irqsave(&fh->vdev->fh_lock, flags); 302 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
292 303
293 sev = v4l2_event_subscribed(fh, sub->type, sub->id); 304 sev = v4l2_event_subscribed(fh, sub->type, sub->id);
294 if (sev != NULL) { 305 if (sev != NULL)
295 /* Remove any pending events for this subscription */ 306 __v4l2_event_unsubscribe(sev);
296 for (i = 0; i < sev->in_use; i++) {
297 list_del(&sev->events[sev_pos(sev, i)].list);
298 fh->navailable--;
299 }
300 list_del(&sev->list);
301 }
302 307
303 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); 308 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
304 309
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
index d7806db222d8..1ed2465972ac 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -953,7 +953,7 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx,
953} 953}
954EXPORT_SYMBOL_GPL(v4l2_m2m_buf_queue); 954EXPORT_SYMBOL_GPL(v4l2_m2m_buf_queue);
955 955
956void vb2_m2m_request_queue(struct media_request *req) 956void v4l2_m2m_request_queue(struct media_request *req)
957{ 957{
958 struct media_request_object *obj, *obj_safe; 958 struct media_request_object *obj, *obj_safe;
959 struct v4l2_m2m_ctx *m2m_ctx = NULL; 959 struct v4l2_m2m_ctx *m2m_ctx = NULL;
@@ -997,7 +997,7 @@ void vb2_m2m_request_queue(struct media_request *req)
997 if (m2m_ctx) 997 if (m2m_ctx)
998 v4l2_m2m_try_schedule(m2m_ctx); 998 v4l2_m2m_try_schedule(m2m_ctx);
999} 999}
1000EXPORT_SYMBOL_GPL(vb2_m2m_request_queue); 1000EXPORT_SYMBOL_GPL(v4l2_m2m_request_queue);
1001 1001
1002/* Videobuf2 ioctl helpers */ 1002/* Videobuf2 ioctl helpers */
1003 1003