Skip to content

Commit

Permalink
media: i2c: ov02c10/ov2740: add a debug print for module name
Browse files Browse the repository at this point in the history
This should come in handy when debugging module-specific issues.

Signed-off-by: Juhyung Park <[email protected]>
Signed-off-by: Hao Yao <[email protected]>
  • Loading branch information
arter97 authored and hao-yao committed Jun 5, 2024
1 parent e2b3546 commit d1494a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/media/i2c/ov02c10.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,9 +1597,9 @@ static int ov02c10_read_module_name(struct ov02c10 *ov02c10)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov02c10->sd);
struct device *dev = &client->dev;
int i = 0;
union acpi_object *obj;
struct acpi_device *adev = ACPI_COMPANION(dev);
int i;

ov02c10->module_name_index = 0;
if (!adev)
Expand All @@ -1608,13 +1608,14 @@ static int ov02c10_read_module_name(struct ov02c10 *ov02c10)
obj = acpi_evaluate_dsm_typed(adev->handle,
&cio2_sensor_module_guid, 0x00,
0x01, NULL, ACPI_TYPE_STRING);
if (!obj)
return 0;

if (obj && obj->string.type == ACPI_TYPE_STRING) {
for (i = 1; i < ARRAY_SIZE(ov02c10_module_names); i++) {
if (!strcmp(ov02c10_module_names[i], obj->string.pointer)) {
ov02c10->module_name_index = i;
break;
}
dev_dbg(dev, "module name: %s", obj->string.pointer);
for (i = 1; i < ARRAY_SIZE(ov02c10_module_names); i++) {
if (!strcmp(ov02c10_module_names[i], obj->string.pointer)) {
ov02c10->module_name_index = i;
break;
}
}
ACPI_FREE(obj);
Expand Down
1 change: 1 addition & 0 deletions drivers/media/i2c/ov2740.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@ static int ov2740_read_module_name(struct ov2740 *ov2740)
0x01, NULL, ACPI_TYPE_STRING);

if (obj && obj->string.type == ACPI_TYPE_STRING) {
dev_dbg(dev, "module name: %s", obj->string.pointer);
for (i = 1; i < ARRAY_SIZE(ov2740_module_names); i++) {
if (!strcmp(ov2740_module_names[i], obj->string.pointer)) {
ov2740->module_name_index = i;
Expand Down

0 comments on commit d1494a2

Please sign in to comment.