[02/21] gspca pac7302/pac7311: separate sd_desc

Message ID 4AECC4A0.7080801@freemail.hu (mailing list archive)
State Superseded, archived
Headers

Commit Message

Németh Márton Oct. 31, 2009, 11:13 p.m. UTC
  From: Márton Németh <nm127@freemail.hu>

Move the sensor specific decision temporary to sd_probe. Create an sd_desc
for PAC7302 and one for PAC7311.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Thomas Kaiser <thomas@kaiser-linux.li>
Cc: Theodore Kilgore <kilgota@auburn.edu>
Cc: Kyle Guinn <elyk03@gmail.com>
---
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff -uprN b/drivers/media/video/gspca/pac7311.c c/drivers/media/video/gspca/pac7311.c
--- b/drivers/media/video/gspca/pac7311.c	2009-10-30 17:09:52.000000000 +0100
+++ c/drivers/media/video/gspca/pac7311.c	2009-10-30 17:05:09.000000000 +0100
@@ -1078,8 +1078,22 @@  static int sd_getvflip(struct gspca_dev
 	return 0;
 }

-/* sub-driver description */
-static struct sd_desc sd_desc = {
+/* sub-driver description for pac7302 */
+static struct sd_desc pac7302_sd_desc = {
+	.name = MODULE_NAME,
+	.ctrls = sd_ctrls,
+	.nctrls = ARRAY_SIZE(sd_ctrls),
+	.config = sd_config,
+	.init = sd_init,
+	.start = sd_start,
+	.stopN = sd_stopN,
+	.stop0 = sd_stop0,
+	.pkt_scan = sd_pkt_scan,
+	.dq_callback = do_autogain,
+};
+
+/* sub-driver description for pac7311 */
+static struct sd_desc pac7311_sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1117,8 +1131,12 @@  MODULE_DEVICE_TABLE(usb, device_table);
 static int sd_probe(struct usb_interface *intf,
 			const struct usb_device_id *id)
 {
-	return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
-				THIS_MODULE);
+	if (id->driver_info == SENSOR_PAC7302)
+		return gspca_dev_probe(intf, id, &pac7302_sd_desc,
+				sizeof(struct sd), THIS_MODULE);
+	else
+		return gspca_dev_probe(intf, id, &pac7311_sd_desc,
+				sizeof(struct sd), THIS_MODULE);
 }

 static struct usb_driver sd_driver = {