Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1619531rwb; Mon, 7 Nov 2022 03:58:47 -0800 (PST) X-Google-Smtp-Source: AMsMyM4Kl4PC68TnbMWmUV3dF/pIuPXkP38oFVi51Tb/pvitGplW4dDvEIZaARwEMwJsYUf8rvOT X-Received: by 2002:a17:906:9f1b:b0:7ad:c66e:ad7d with SMTP id fy27-20020a1709069f1b00b007adc66ead7dmr41060207ejc.432.1667822326905; Mon, 07 Nov 2022 03:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667822326; cv=none; d=google.com; s=arc-20160816; b=Wsu/YFKTgnOViCibIvWJc8ViTv7YGFRs619BgU9vEjPfZ9I5ICthsVUEYHESFAV011 E+qa5Q+uZ9EhimQ0UyVNbisyjacRM9u38xivrLFHITtYISlR2L8ykivnVoRA9yNQ8LUH KGtKzjYceqUJWvJRYuUosXHssDlSEbLUVs6rCO8PkBkBuuNULWUc1SPs4UDD7uY3Geeq 0Okp3qRY7e04rN9VyEYy/gf0fhwLNifLfp8aPGB9xzAlW7rSLdOR2HmMKWWWe3vUplGG vAOg23hAb/rZg1H3L2uj7BVJIwikd1DyHovOKQ31qyupOO+tZxRehGl2xotyWC0jPBLb 1qFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=B8Qv3G6jlxbDnN0yOE9Mm49TEBfZzJWK2QWKJn/4g/E=; b=hq/hA8mzTAE05gF51C2EBb6/Fl6jgsPWHqhiYZZc5UGuuyurHslGREiBuFaHqTIAb1 98zLaek6QcPm4KQF1bDhpvAT+bMkaH33jQhVUiRFq8pHoiB0dKGxq3pJSURPJ3dxtO04 bLuE1PhHKYiyhARqpQehxVL03DNI9KsB2GBIUMTQtZLSkv/Vxp3Fv61LQWQdiMnDzrba HnQiS2G9yZ8Eap8/JVXB12OhEOdEscqsvPCwCh0b4XxF0VRnve/FLD1FWZ+nVNN4xmlg 2Him9fmmjAKjbzD0MdUg2yvBV2/RHYS8MfULJhHtde6rPGPmgC35NvC10bRemSzjaJq+ snpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tronnes.org header.s=ds202112 header.b="OKmL8xe/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tronnes.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx17-20020a0564020b5100b00461c41bd7b6si7887848edb.209.2022.11.07.03.58.22; Mon, 07 Nov 2022 03:58:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@tronnes.org header.s=ds202112 header.b="OKmL8xe/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tronnes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbiKGL3j (ORCPT + 94 others); Mon, 7 Nov 2022 06:29:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbiKGL3h (ORCPT ); Mon, 7 Nov 2022 06:29:37 -0500 Received: from smtp.domeneshop.no (smtp.domeneshop.no [IPv6:2a01:5b40:0:3005::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7C97648 for ; Mon, 7 Nov 2022 03:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org ; s=ds202112; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B8Qv3G6jlxbDnN0yOE9Mm49TEBfZzJWK2QWKJn/4g/E=; b=OKmL8xe/O0wgRO8t9gtcWKIjpC GoG99sdMaZA0k6TOA6REEMTwdPKVlWt1B62cudm31jh9VIFRkc6bFKr8RL/6LadKyAyo9epZIbSVJ X74Icm4ko/UdbJO6J0VCPf2CGRauort43+cnQpWKVPoy/FfLyxRxNcfmDyaK+mBICHhTgFieMVxGH FUB6ae6NWocOierzkzediJ5Mu0m17KyWqWmlErqxUk2XL7thDcFc/YN8BWiIuJRr9TUaKUg/V8mQ9 wVtwKy2Axt5WAy6G+AiYRlrITea0Iou3CK83pwIBvZZErMEy2mNA4TgL5jIvIU5rvjExMOyO18bjK o5Eq8GAg==; Received: from [2a01:799:95a:cb00:fd97:29ff:d72a:349e] (port=49995) by smtp.domeneshop.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1os0Jp-0006SH-3V; Mon, 07 Nov 2022 12:29:33 +0100 Message-ID: <813ebf68-a7f4-441f-d0d6-f63fd923a479@tronnes.org> Date: Mon, 7 Nov 2022 12:29:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v6 16/23] drm/probe-helper: Provide a TV get_modes helper To: Maxime Ripard Cc: Karol Herbst , Emma Anholt , Ben Skeggs , Chen-Yu Tsai , Rodrigo Vivi , Maarten Lankhorst , Jani Nikula , Daniel Vetter , Thomas Zimmermann , Tvrtko Ursulin , Samuel Holland , Jernej Skrabec , David Airlie , Joonas Lahtinen , Lyude Paul , linux-sunxi@lists.linux.dev, intel-gfx@lists.freedesktop.org, Phil Elwell , linux-arm-kernel@lists.infradead.org, nouveau@lists.freedesktop.org, Hans de Goede , Dom Cobley , Mateusz Kwiatkowski , dri-devel@lists.freedesktop.org, Dave Stevenson , linux-kernel@vger.kernel.org, Geert Uytterhoeven , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= References: <20220728-rpi-analog-tv-properties-v6-0-e7792734108f@cerno.tech> <20220728-rpi-analog-tv-properties-v6-16-e7792734108f@cerno.tech> <842076aa-8d7c-96d6-ba46-d0e66dacd2df@tronnes.org> <20221107102126.klxrvfe34e6uriyx@houat> From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= In-Reply-To: <20221107102126.klxrvfe34e6uriyx@houat> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Den 07.11.2022 11.21, skrev Maxime Ripard: > Hi Noralf, > > I'll leave aside your comments on the code, since we'll use your implementation. > > On Sun, Nov 06, 2022 at 05:33:48PM +0100, Noralf Trønnes wrote: >> Den 26.10.2022 17.33, skrev maxime@cerno.tech: >>> + >>> + if (cmdline->tv_mode_specified) >>> + default_mode = cmdline->tv_mode; >> >> I realised that we don't verify tv_mode coming from the command line, >> not here and not in the reset helper. Should we do that? A driver should >> be programmed defensively to handle an illegal/unsupported value, but it >> doesn't feel right to allow an illegal enum value coming through the >> core/helpers. > > I don't think we can end up with an invalid value here if it's been > specified. > > We parse the command line through drm_mode_parse_tv_mode() (introduced > in patch 13 "drm/modes: Introduce the tv_mode property as a command-line > option") that will pick the tv mode part of the command line, and call > drm_get_tv_mode_from_name() using it. > > drm_get_tv_mode_from_name() will return a EINVAL if it's not a value we > expect, and mode->tv_mode is only set on success. And AFAIK, there's no > other path that will set tv_mode. > I see now that illegal was the wrong word, but if the driver only supports ntsc, the user can still set tv_mode=PAL right? And that's an unsupported value that the driver can't fulfill, so it errors out. But then again maybe that's just how it is, we can also set a display mode that the driver can't handle, so this is no different in that respect. Yeah, my argument lost some of its strength here :) Noralf.