[PATCH] media: rc: rdev->open or rdev->close can be NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 16, 2013 at 06:00:08PM +0100, Srinivas KANDAGATLA wrote:
> + adding Mauro Chehab
> On 16/08/13 17:51, Hans Petter Selasky wrote:
> > Hi Jurgen,
> > 
> > I think this is something broken at the Linux side or I have sources out of sync.
> > You should just ignore the NULL function pointer, hence the technisat driver does not have these callbacks. 
> 
> I agree, I was under the impression that open/close are mandatory.
> 
> Can you please send a patch to fix this to linux-media@xxxxxxxxxxxxxxx.
> 
> Thanks,
> srini
> 
At least technisat-usb2.c doesn't set these...

Signed-off-by: Juergen Lock <nox@xxxxxxxxxxxxxxxxxx>

--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -707,7 +707,7 @@ int rc_open(struct rc_dev *rdev)
 		return -EINVAL;
 
 	mutex_lock(&rdev->lock);
-	if (!rdev->users++)
+	if (!rdev->users++ && rdev->open != NULL)
 		rval = rdev->open(rdev);
 
 	if (rval)
@@ -731,7 +731,7 @@ void rc_close(struct rc_dev *rdev)
 	if (rdev) {
 		mutex_lock(&rdev->lock);
 
-		 if (!--rdev->users)
+		 if (!--rdev->users && rdev->close != NULL)
 			rdev->close(rdev);
 
 		mutex_unlock(&rdev->lock);
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux