aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-core/dvbdev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 20:16:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 20:16:59 -0400
commitef1c4a6fa91bbbe9b09f770d28eba31a9edf770c (patch)
tree52f5d175031c553160d14890e876ffc5432d2467 /drivers/media/dvb-core/dvbdev.c
parent147a89bc71e7db40f011454a40add7ff2d10f8d8 (diff)
parentf8a695c4b43d02c89b8bba9ba6058fd5db1bc71d (diff)
Merge tag 'media/v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - new CEC pin injection code for testing purposes - DVB frontend cxd2099 promoted from staging - new platform driver for Sony cxd2880 DVB devices - new sensor drivers: mt9t112, ov2685, ov5695, ov772x, tda1997x, tw9910.c - removal of unused cx18 and ivtv alsa mixers - the reneseas-ceu driver doesn't depend on soc_camera anymore and moved from staging - removed the mantis_vp3028 driver, unused since 2009 - s5p-mfc: add support for version 10 of the MSP - added a decoder for imon protocol - atomisp: lots of cleanups - imx074 and mt9t031: don't depend on soc_camera anymore, being promoted from staging - added helper functions to better support DVB I2C binding - lots of driver improvements and cleanups * tag 'media/v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (438 commits) media: v4l2-ioctl: rename a temp var that stores _IOC_SIZE(cmd) media: fimc-capture: get rid of two warnings media: dvb-usb-v2: fix a missing dependency of I2C_MUX media: uvc: to the right check at uvc_ioctl_enum_framesizes() media: cec-core: fix a bug at cec_error_inj_write() media: tda9840: cleanup a warning media: tm6000: avoid casting just to print pointer address media: em28xx-input: improve error handling code media: zr364xx: avoid casting just to print pointer address media: vivid-radio-rx: add a cast to avoid a warning media: saa7134-alsa: don't use casts to print a buffer address media: solo6x10: get rid of an address space warning media: zoran: don't cast pointers to print them media: ir-kbd-i2c: change the if logic to avoid a warning media: ir-kbd-i2c: improve error handling code media: saa7134-input: improve error handling media: s2255drv: fix a casting warning media: ivtvfb: Cleanup some warnings media: videobuf-dma-sg: Fix a weird cast soc_camera: fix a weird cast on printk ...
Diffstat (limited to 'drivers/media/dvb-core/dvbdev.c')
-rw-r--r--drivers/media/dvb-core/dvbdev.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 60e9c2ba26be..787fe06df217 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -24,6 +24,7 @@
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/i2c.h>
27#include <linux/init.h> 28#include <linux/init.h>
28#include <linux/slab.h> 29#include <linux/slab.h>
29#include <linux/device.h> 30#include <linux/device.h>
@@ -941,6 +942,55 @@ out:
941 return err; 942 return err;
942} 943}
943 944
945#if IS_ENABLED(CONFIG_I2C)
946struct i2c_client *dvb_module_probe(const char *module_name,
947 const char *name,
948 struct i2c_adapter *adap,
949 unsigned char addr,
950 void *platform_data)
951{
952 struct i2c_client *client;
953 struct i2c_board_info *board_info;
954
955 board_info = kzalloc(sizeof(*board_info), GFP_KERNEL);
956 if (!board_info)
957 return NULL;
958
959 if (name)
960 strlcpy(board_info->type, name, I2C_NAME_SIZE);
961 else
962 strlcpy(board_info->type, module_name, I2C_NAME_SIZE);
963
964 board_info->addr = addr;
965 board_info->platform_data = platform_data;
966 request_module(module_name);
967 client = i2c_new_device(adap, board_info);
968 if (client == NULL || client->dev.driver == NULL) {
969 kfree(board_info);
970 return NULL;
971 }
972
973 if (!try_module_get(client->dev.driver->owner)) {
974 i2c_unregister_device(client);
975 client = NULL;
976 }
977
978 kfree(board_info);
979 return client;
980}
981EXPORT_SYMBOL_GPL(dvb_module_probe);
982
983void dvb_module_release(struct i2c_client *client)
984{
985 if (!client)
986 return;
987
988 module_put(client->dev.driver->owner);
989 i2c_unregister_device(client);
990}
991EXPORT_SYMBOL_GPL(dvb_module_release);
992#endif
993
944static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env) 994static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
945{ 995{
946 struct dvb_device *dvbdev = dev_get_drvdata(dev); 996 struct dvb_device *dvbdev = dev_get_drvdata(dev);