1. 11 Jan, 2012 7 commits
    • Mauro Carvalho Chehab's avatar
      [media] cx231xx: fix device disconnect checks · 990862a2
      Mauro Carvalho Chehab authored
      The driver were using DEV_MISCONFIGURED on some places, and
      DEV_DISCONNECTED on others. In a matter of fact, DEV_MISCONFIGURED
      were set only during the usb disconnect callback, with
      was confusing.
      
      Also, the alsa driver never checks if the device is present,
      before doing some dangerous things.
      
      Remove DEV_MISCONFIGURED, replacing it by DEV_DISCONNECTED.
      
      Also, fixes the other usecases for DEV_DISCONNECTED.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      990862a2
    • Mauro Carvalho Chehab's avatar
      [media] cx231xx: cx231xx_devused is racy · db702a7a
      Mauro Carvalho Chehab authored
      cx231xx_devused is racy. Re-implement it in a proper way,
      to remove the risk of mangling it.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      db702a7a
    • Mauro Carvalho Chehab's avatar
      [media] cx231xx: Fix unregister logic · 7528cd27
      Mauro Carvalho Chehab authored
      There are several weirdness at the unregister logic.
      
      First of all, IR has a poll thread. This thread needs to be
      removed, as it uses some resources associated to the main driver.
      So, the driver needs to explicitly unregister the I2C client for
      ir-kbd-i2c.
      
      If, for some reason, the driver needs to wait for a close()
      to happen, not all memories will be freed, because the free
      logic were in the wrong place.
      
      Also, v4l2_device_unregister() seems to be called too early,
      as devices are still using it.
      
      Finally, even with the device disconnected, there is one
      USB function call that will still try to talk with it.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      7528cd27
    • Mauro Carvalho Chehab's avatar
      [media] mb86a20s: implement get_frontend() · 959a119f
      Mauro Carvalho Chehab authored
      Reports the auto-detected parameters to userspace.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      959a119f
    • Mauro Carvalho Chehab's avatar
      [media] cx231xx-input: stop polling if the device got removed. · 90bf3aab
      Mauro Carvalho Chehab authored
      If the device got removed, stops polling it. Also, un-registers
      it at input/evdev, as it won't work anymore. We can't free the
      IR structure yet, as the ir_remove method will be called later.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      90bf3aab
    • Thomas Petazzoni's avatar
      [media] cx231xx: remove useless 'lif' variable in cx231xx_usb_probe() · c53a8e95
      Thomas Petazzoni authored
      Now that we set the intfdata on the right interface, the 'lif'
      variable is useless.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      c53a8e95
    • Thomas Petazzoni's avatar
      [media] cx231xx: fix crash after load/unload/load of module · a116a05c
      Thomas Petazzoni authored
      The following sequence of commands was triggering a kernel crash in
      cdev_get():
      
       modprobe cx231xx
       rmmod cx231xx
       modprobe cx231xx
       v4l2grab -n 1
      
      The problem was that cx231xx_usb_disconnect() was not doing anything
      because the test:
      
      	if (!dev->udev)
      		return;
      
      was reached (i.e, dev->udev was NULL).
      
      This is due to the fact that the 'dev' pointer placed as intfdata into
      the usb_interface structure had the wrong value, because
      cx231xx_probe() was doing the usb_set_intfdata() on the wrong
      usb_interface structure. For some reason, cx231xx_probe() was doing
      the following:
      
      static int cx231xx_usb_probe(struct usb_interface *interface,
      			     const struct usb_device_id *id)
      {
              struct usb_interface *lif = NULL;
      	[...]
              /* store the current interface */
              lif = interface;
      	[...]
              /* store the interface 0 back */
              lif = udev->actconfig->interface[0];
      	[...]
      	usb_set_intfdata(lif, dev);
      	[...]
      	retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
      	[...]
      }
      
      So, the usb_set_intfdata() was done on udev->actconfig->interface[0]
      and not on the 'interface' passed as argument to the ->probe() and
      ->disconnect() hooks. Later on, v4l2_device_register() was
      initializing the intfdata of the correct usb_interface structure as a
      pointer to the v4l2_device structure.
      
      Upon unregistration, the ->disconnect() hook was getting the intfdata
      of the usb_interface passed as argument... and casted it to a 'struct
      cx231xx *' while it was in fact a 'struct v4l2_device *'.
      
      The correct fix seems to just be to set the intfdata on the proper
      interface from the beginning. Now, loading/unloading/reloading the
      driver allows to use the device properly.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      a116a05c
  2. 10 Jan, 2012 1 commit
    • Mauro Carvalho Chehab's avatar
      [media] dvb_ca_en50221: fix compilation breakage · 624f0c18
      Mauro Carvalho Chehab authored
      As reported by Toralf:
      
      the build failed with :
        CC [M]  drivers/media/dvb/dvb-core/dvb_ca_en50221.o
      In file included from arch/x86/include/asm/uaccess.h:573:0,
                       from include/linux/poll.h:14,
                       from drivers/media/dvb/dvb-core/dvbdev.h:27,
                       from drivers/media/dvb/dvb-core/dvb_ca_en50221.h:27,
                       from drivers/media/dvb/dvb-core/dvb_ca_en50221.c:41:
      In function "copy_from_user", inlined from "dvb_ca_en50221_io_write" at drivers/media/dvb/dvb-core/dvb_ca_en50221.c:1314:26: arch/x86/include/asm/uaccess_32.h:211:26: error: call to "copy_from_user_overflow" declared with attribute error: copy_from_user() buffer size is not provably correct
      Reported-by: default avatarToralf Foerster <toralf.foerster@gmx.de>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      624f0c18
  3. 07 Jan, 2012 11 commits
  4. 06 Jan, 2012 21 commits