lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue,  7 Oct 2014 01:16:28 +0900
From:	"Буди Романто, AreMa Inc" 
	<info@....ma>
To:	linux-media@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, crope@....fi, m.chehab@...sung.com,
	mchehab@....samsung.com, hdegoede@...hat.com,
	laurent.pinchart@...asonboard.com, mkrufky@...uxtv.org,
	sylvester.nawrocki@...il.com, g.liakhovetski@....de,
	peter.senna@...il.com
Subject: [PATCH 1/1] dvbdev: add dvb_register_subdev() & dvb_unregister_subdev()

Taken from https://github.com/knight-rider/ptx/tree/master/pt3_dvb,
these routines simplify I2C binding of subdevices.

Applicable at least to the followings:
drivers/media/pci/bt8xx/bttv-input.c
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885-i2c.c
drivers/media/pci/cx23885/cx23885.h
drivers/media/pci/cx25821/cx25821-i2c.c
drivers/media/pci/cx25821/cx25821.h
drivers/media/pci/cx88/cx88-input.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/pci/pt3/pt3.c
drivers/media/pci/saa7134/saa7134-i2c.c
drivers/media/pci/saa7134/saa7134-input.c
drivers/media/pci/saa7134/saa7134.h
drivers/media/pci/saa7164/saa7164-i2c.c
drivers/media/pci/saa7164/saa7164.h
drivers/media/usb/au0828/au0828-i2c.c
drivers/media/usb/au0828/au0828.h
drivers/media/usb/cx231xx/cx231xx-dvb.c
drivers/media/usb/cx231xx/cx231xx-i2c.c
drivers/media/usb/cx231xx/cx231xx-input.c
drivers/media/usb/cx231xx/cx231xx.h
drivers/media/usb/dvb-usb-v2/af9035.c
drivers/media/usb/dvb-usb-v2/anysee.c
drivers/media/usb/dvb-usb-v2/dvbsky.c
drivers/media/usb/dvb-usb-v2/rtl28xxu.c
drivers/media/usb/dvb-usb/cxusb.c
drivers/media/usb/em28xx/em28xx-cards.c
drivers/media/usb/em28xx/em28xx-dvb.c
drivers/media/usb/em28xx/em28xx-i2c.c
drivers/media/usb/em28xx/em28xx.h
drivers/media/usb/go7007/s2250-board.c
drivers/media/usb/hdpvr/hdpvr-i2c.c
drivers/media/usb/stk1160/stk1160-i2c.c
drivers/media/usb/stk1160/stk1160.h
drivers/media/usb/tm6000/tm6000-cards.c
drivers/media/usb/tm6000/tm6000-i2c.c
drivers/media/usb/tm6000/tm6000.h
drivers/media/usb/usbvision/usbvision-i2c.c
drivers/media/usb/usbvision/usbvision-video.c
drivers/media/usb/usbvision/usbvision.h

Signed-off-by: Буди Романто, AreMa Inc <knightrider@....ma>
---
 drivers/media/dvb-core/dvbdev.c | 24 ++++++++++++++++++++++++
 drivers/media/dvb-core/dvbdev.h |  3 +++
 2 files changed, 27 insertions(+)

diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 983db75..f449543 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -284,6 +284,30 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
 }
 EXPORT_SYMBOL(dvb_unregister_device);
 
+struct i2c_client *dvb_register_subdev(struct i2c_adapter *adap, struct i2c_board_info const *info)
+{
+	struct i2c_client *clt;
+
+	request_module("%s", info->type);
+	clt = i2c_new_device(adap, info);
+	if (clt && clt->dev.driver)
+		if (!try_module_get(clt->dev.driver->owner)) {
+			i2c_unregister_device(clt);
+			clt = NULL;
+		}
+	return clt;
+}
+EXPORT_SYMBOL(dvb_register_subdev);
+
+void dvb_unregister_subdev(struct i2c_client *clt)
+{
+	if (clt) {
+		module_put(clt->dev.driver->owner);
+		i2c_unregister_device(clt);
+	}
+}
+EXPORT_SYMBOL(dvb_unregister_subdev);
+
 static int dvbdev_check_free_adapter_num(int num)
 {
 	struct list_head *entry;
diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h
index f96b28e..cff2296 100644
--- a/drivers/media/dvb-core/dvbdev.h
+++ b/drivers/media/dvb-core/dvbdev.h
@@ -109,6 +109,9 @@ extern int dvb_register_device (struct dvb_adapter *adap,
 
 extern void dvb_unregister_device (struct dvb_device *dvbdev);
 
+extern struct i2c_client *dvb_register_subdev(struct i2c_adapter *adap, struct i2c_board_info const *info);
+extern void dvb_unregister_subdev(struct i2c_client *clt);
+
 extern int dvb_generic_open (struct inode *inode, struct file *file);
 extern int dvb_generic_release (struct inode *inode, struct file *file);
 extern long dvb_generic_ioctl (struct file *file,
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists