V4L/DVB (6460): v4l2-i2c-drv: add legacy_probe function pointer
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>
This commit is contained in:
parent
1a39275a3f
commit
88307eb3c6
|
@ -29,6 +29,7 @@ struct v4l2_i2c_driver_data {
|
||||||
int (*remove)(struct i2c_client *client);
|
int (*remove)(struct i2c_client *client);
|
||||||
int (*suspend)(struct i2c_client *client, pm_message_t state);
|
int (*suspend)(struct i2c_client *client, pm_message_t state);
|
||||||
int (*resume)(struct i2c_client *client);
|
int (*resume)(struct i2c_client *client);
|
||||||
|
int (*legacy_probe)(struct i2c_adapter *adapter);
|
||||||
int legacy_class;
|
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)
|
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)
|
if (adapter->class & v4l2_i2c_data.legacy_class)
|
||||||
return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
|
return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct v4l2_i2c_driver_data {
|
||||||
int (*remove)(struct i2c_client *client);
|
int (*remove)(struct i2c_client *client);
|
||||||
int (*suspend)(struct i2c_client *client, pm_message_t state);
|
int (*suspend)(struct i2c_client *client, pm_message_t state);
|
||||||
int (*resume)(struct i2c_client *client);
|
int (*resume)(struct i2c_client *client);
|
||||||
|
int (*legacy_probe)(struct i2c_adapter *adapter);
|
||||||
int legacy_class;
|
int legacy_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue