V4L/DVB (6460): v4l2-i2c-drv: add legacy_probe function pointer
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 14 Sep 2007 07:49:16 +0000 (04:49 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:01:23 +0000 (19:01 -0200)
Some devices do complicated tests whether the device can be probed or not.
Add a legacy_probe function pointer to support that.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
include/media/v4l2-i2c-drv-legacy.h
include/media/v4l2-i2c-drv.h

index c059b32844c156669d1641d3457c28f10430fd64..433c984eefa5fa3110ecf1607b3f3603a837b2a9 100644 (file)
@@ -29,6 +29,7 @@ struct v4l2_i2c_driver_data {
        int (*remove)(struct i2c_client *client);
        int (*suspend)(struct i2c_client *client, pm_message_t state);
        int (*resume)(struct i2c_client *client);
+       int (*legacy_probe)(struct i2c_adapter *adapter);
        int legacy_class;
 };
 
@@ -45,6 +46,11 @@ static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address,
 
 static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)
 {
+       if (v4l2_i2c_data.legacy_probe) {
+               if (v4l2_i2c_data.legacy_probe(adapter))
+                       return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
+               return 0;
+       }
        if (adapter->class & v4l2_i2c_data.legacy_class)
                return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
        return 0;
index 547db60d36409c4376b4349b6107f5785dcc9f1e..bc61ab27779d8843ad2170e6ea1cddf68a50d324 100644 (file)
@@ -29,6 +29,7 @@ struct v4l2_i2c_driver_data {
        int (*remove)(struct i2c_client *client);
        int (*suspend)(struct i2c_client *client, pm_message_t state);
        int (*resume)(struct i2c_client *client);
+       int (*legacy_probe)(struct i2c_adapter *adapter);
        int legacy_class;
 };