Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp299585pxv; Wed, 21 Jul 2021 23:44:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO78R2GdzyXiG/g710DhuB8TtNUZTmrVz4nFbyifvXBA7rkHCa0fcwNuJFEHbUm39heEb1 X-Received: by 2002:a5e:c311:: with SMTP id a17mr29585477iok.22.1626936295682; Wed, 21 Jul 2021 23:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626936295; cv=none; d=google.com; s=arc-20160816; b=HztPhtXZgJI5w4CwIEBFe6DEHU+AkVMNCEoHHX0XgN5rs9WxNsw9NREO0fdLuAYqRf vaMyn1qpkPdKtUVS10/eDqUkeqJ9CnWXpXojnFpv7TyeVefmQGWX8/7F9wYLGW9kArOP BNKyaZFLDJ9nQy+hKVif/jHG06DcIc5rR74t0dHYGOl9ff+ezSB5c0QiuNe8Ara+43Id 2bIscWzpeQVf1phr+vMPm5Ikdk8GD3dbgbUP8EwDz44MiFtyVGkDQy+IQ/IlI1Iwj4DU 0+2+zjjeVc8ZEZbz4YC6a1nQhKy3B/IFRVJ68I4sdTINWAx+rT6G+ffED2hScxr2ot3P zwCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:in-reply-to:date:sender:references:subject:cc:to:from :dkim-signature:dkim-filter; bh=QBdm2p+QSeNLdiseFpUuaUBT1xNKHEtEcSWQ/raiArw=; b=OOhsD60aAg56Kan/XFPaj+UeASx30BJ+bcAyAL3dIch2prvdHi2c+liaXbBISjpR4R PY6Guj46d/jjcuoswqBP0+PlObh/ljcLDWdg7fFEGzsxvnDK1NuOjchni1n48XNYoM3R ZE6FWsKoevcmiIJxq0M/S+YN5oFyEgNRf2qvc2JfP6l7N4XwZ/jYhhlIRIPywvuC3yhn cPzRrAWfaJFATKE/ickwn8qBStH4QCFYylw3f9BT6xD1/cDMJeZjvnmio44zANuP1dXT nL8YhFRpynkTPhEk6/mIzcHxSH/gHmiarLSSu3MniH/JX0HnhtWADqwGaxac/aVb+rlI HzuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@piap.pl header.s=mail header.b=Pyxf+rDp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=piap.pl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s22si17545248iow.33.2021.07.21.23.44.43; Wed, 21 Jul 2021 23:44:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@piap.pl header.s=mail header.b=Pyxf+rDp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=piap.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbhGVGDC (ORCPT + 99 others); Thu, 22 Jul 2021 02:03:02 -0400 Received: from ni.piap.pl ([195.187.100.5]:60940 "EHLO ni.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbhGVGDA (ORCPT ); Thu, 22 Jul 2021 02:03:00 -0400 Received: from t19.piap.pl (OSB1819.piap.pl [10.0.9.19]) by ni.piap.pl (Postfix) with ESMTPSA id B9440C3F3ECE; Thu, 22 Jul 2021 08:43:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 ni.piap.pl B9440C3F3ECE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=piap.pl; s=mail; t=1626936213; bh=QBdm2p+QSeNLdiseFpUuaUBT1xNKHEtEcSWQ/raiArw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Pyxf+rDpFZqwQ0ptJGNqkE2Mk1syPOIjwIiaYezFnqNr9Q0HtB62zxo2kkOOqPioL l7vkvRUDLvgQ+qnzBJvuo7j92w1t92+ZAWp34YeauqY43nRvnqJz+J7kWHdYBEd1Up fuM0v6im1MBco3V+E0d1jFmmY9ShdYMpq1MnHWLc= From: =?utf-8?Q?Krzysztof_Ha=C5=82asa?= To: Hans Verkuil Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, lkml Subject: Re: [PATCH REPOST] TDA1997x: replace video detection routine References: <68bd6e41-4c32-240f-aa83-fd2b96929d45@xs4all.nl> Sender: khalasa@piap.pl Date: Thu, 22 Jul 2021 08:43:33 +0200 In-Reply-To: ("Krzysztof =?utf-8?Q?Ha=C5=82as?= =?utf-8?Q?a=22's?= message of "Thu, 22 Jul 2021 08:27:27 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 165168 [Jul 22 2021] X-KLMS-AntiSpam-Version: 5.9.20.0 X-KLMS-AntiSpam-Envelope-From: khalasa@piap.pl X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=pass header.d=piap.pl X-KLMS-AntiSpam-Info: LuaCore: 449 449 5db59deca4a4f5e6ea34a93b13bc730e229092f4, {Tracking_Text_ENG_RU_Has_Extended_Latin_Letters, eng}, {Tracking_marketers, three}, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;t19.piap.pl:7.1.1;piap.pl:7.1.1 X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2021/07/22 06:10:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2021/07/22 02:59:00 #16939391 X-KLMS-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Also, I have spotted an interesting loop condition in drivers/media/v4l2-core/v4l2-dv-timings.c (dated 2013, d1c65ad6a44b0ff79d2f0bf726fa6fd9248991f4). It obviously works (unless the table grows to 600+ entries), but I guess I should make it "standard", shouldn't I? The first case is pretty normal: @@ -159,10 +161,10 @@ int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timi= ngs *t, u32 i, idx; =20 memset(t->reserved, 0, sizeof(t->reserved)); - for (i =3D idx =3D 0; i < ARRAY_SIZE(timings); i++) { - if (v4l2_dv_valid_timings(timings + i, cap) && + for (i =3D idx =3D 0; v4l2_dv_timings_presets[i].bt.width; i++) { + if (v4l2_dv_valid_timings(v4l2_dv_timings_presets + i, cap) && idx++ =3D=3D t->index) { - t->timings =3D timings[i]; + t->timings =3D v4l2_dv_timings_presets[i]; return 0; } } This is the interesting part: @@ -179,10 +181,10 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings = *t, if (!v4l2_dv_valid_timings(t, cap)) return false; =20 - for (i =3D 0; i < ARRAY_SIZE(timings); i++) { - if (v4l2_dv_valid_timings(timings + i, cap) && - v4l2_match_dv_timings(t, timings + i, pclock_delta)) { - *t =3D timings[i]; + for (i =3D 0; i < v4l2_dv_timings_presets[i].bt.width; i++) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if (v4l2_dv_valid_timings(v4l2_dv_timings_presets + i, cap) && + v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i, pclock_d= elta)) { + *t =3D v4l2_dv_timings_presets[i]; return true; } } --=20 Krzysztof "Chris" Ha=C5=82asa Sie=C4=87 Badawcza =C5=81ukasiewicz Przemys=C5=82owy Instytut Automatyki i Pomiar=C3=B3w PIAP Al. Jerozolimskie 202, 02-486 Warszawa